home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Joystick Magazine 2003 November
/
CD1_JOY_153.iso
/
demos
/
NHL2004Demo.exe
/
fe
/
COMMON
/
js
/
System.js
< prev
next >
Wrap
Text File
|
2003-08-20
|
7KB
|
218 lines
function SystemClass() { this.handleErrorTimerID = 0; };
SystemClass.prototype.libraryClasses = [
"Remote_Request",
"JAX_Object",
"JAX_Cookie",
"User_Profile",
"User_Stats_Base",
"NHL_Stats_Base",
"Tournament"
];
SystemClass.prototype.handleError = function(msg, line, url, dontNav)
{
var bCont = true;
if (System.GUI.loadingDialog) { System.GUI.loadingDialog.hide(); };
if (msg.match(/(?:\:\:\d+\:\:|\:\:\-\d+\:\:)/g)) {
var errorCode = "";
var errorMsg = "";
errorCode = msg.match(/(?:\:\:\d+\:\:|\:\:\-\d+\:\:)/g).toString();
errorMsg = msg.substr(errorCode.lastIndexOf("::") +2);
errorCode = errorCode.substr(2);
errorCode = errorCode.substr(0, errorCode.lastIndexOf("::"));
gblRRManager.doCancel();
if (System.GUI.dialog) {
var bShowServerErrorMsg = false;
errorCode = parseInt(errorCode);
if (errorCode == 10 || (errorCode >=102 && errorCode <=122) ) {
bShowServerErrorMsg = true;
} else if (errorCode == 97 || errorCode == 99) {
bShowServerErorrMsg = false;
} else if (errorCode >= 130 && errorCode <= 139) {
errorMsg = "Your Account has been Suspended";
} else if (errorCode >= 400 && errorCode <= 432) {
bShowServerErrorMsg = true;
} else {
if (System.localEnums.sc["SC_ERROR_" + errorCode]) {
errorMsg = scMsg("SC_ERROR_" + errorCode);
bShowServerErrorMsg = true;
} else {
bShowServerErrorMsg = false;
};
};
if (bShowServerErrorMsg) {
System.GUI.dialog.innerHTML = errorMsg;
} else {
System.GUI.dialog.innerHTML = scMsg("SC_REGERROR_99");
};
System.GUI.dialog.setSize(380, 157);
System.GUI.dialog.addButton("btn1", "OK");
System.GUI.dialog.show();
};
bCont = msg = line = url = null;
} else {
//window.external.GameInterface.Quit();
bCont = msg = line = url = bDontNav = null;
};
return true;
};
SystemClass.prototype.localEnums = new locArray();
SystemClass.prototype.writeLocaleString = function(str, win)
{
win.document.write(this.getLocaleStr(str));
win = str = null;
};
SystemClass.prototype.Session = new Session();
SystemClass.prototype.GUI = new GUI_FrameWork();
SystemClass.prototype.ScratchPad = new JAX_Object();
SystemClass.prototype.getHostURL = function() { return EASOProps.get("host_url"); };
SystemClass.prototype.getInstallFolder = function(prependProtocall)
{
if (!this._installFolderPre) {
var split = top.location.href.split(/\b\/fe\/\w/gi, 2);
this._installFolderPre = (split) ? split[0] : "";
split = null;
};
if (!prependProtocall) {
this._installFolder = this._installFolderPre.substring(8) + "/";
} else {
this._installFolder = this._installFolderPre + "/";
};
this._installFolder = unescape(this._installFolder);
prependProtocol = null;
return this._installFolder;
};
SystemClass.prototype.getEASODataDir = function( )
{
if (this._dataDir ) {return this._dataDir ;};
if ( "GetUserDirectory" in window.external.GameInterface )
this._dataDir = unescape( window.external.GameInterface.GetUserDirectory() ) + "\EASO";
else {
this._dataDir = "c:\temp"
}
return this._dataDir;
}
var showId = false;
SystemClass.prototype.showLabel = function(bShow)
{
showId = bShow;
}
SystemClass.prototype.getLocaleString = function(str, dict, uppercase)
{
if (!showId)
{
dict = (!dict) ? 0 : dict;
var msgID = System.localEnums.lookup(dict, str);
if (msgID) {
try {
if (uppercase)
return window.external.GameInterface.GetLocalizedText(dict, msgID, false).toUpperCase();
else
return window.external.GameInterface.GetLocalizedText(dict, msgID, false);
} catch (e) { };
};
}
var ret = str.replace(/^SC_/,"");
str = dict = uppercase = msgID = null;
if (uppercase)
return ret.toUpperCase();
else
return ret;
};
SystemClass.prototype.loadLibrary = function(win)
{
win.offscreenBuffering = true;
win.confirm = function() { return false; };
//win.alert = function() { return false; };
win.prompt = function() { return false; };
win.open = function() { return false; };
win.close = function() { return false; };
win.document.onselectstart = function()
{
if (this.parentWindow.event) {
this.parentWindow.event.cancelBubble = true;
if ( (this.parentWindow.event.srcElement.tagName != "INPUT") && (this.parentWindow.event.srcElement.tagName != "TEXTAREA")) {
return false;
};
};
return true;
};
win.document.onmousewheel = function()
{
if (this.parentWindow.event) {
if (this.parentWindow.event.shiftKey) { return false; };
};
};
win.document.ondragstart = function() { return false; };
win.onerror = function(message, line, url) { return System.handleError(message, line, url); };
var idx = 0;
var end = this.libraryClasses.length;
while (idx < end)
{
win[this.libraryClasses[idx]] = top[this.libraryClasses[idx]];
idx++;
};
win.nhlMsg = function(msg, isUpper) { return System.getLocaleString(msg, 0, isUpper); };
win.writeNHLMsg = function(msg, isUpper) { this.document.write(this.nhlMsg(msg, isUpper)); };
win.scMsg = function(msg, isUpper) { return System.getLocaleString(msg, 1, isUpper); };
win.writeSCMsg = function(msg, isUpper) { this.document.write(this.scMsg(msg, isUpper)); };
win.ContextMenu = ContextMenu;
win.isNHL = function ()
{
if ( ("GameInterface" in window.external) && ("AudioInterface" in window.external.GameInterface) )
return true;
else
return false;
};
win = idx = end = null;
};
SystemClass.prototype._init = function()
{
window.offscreenBuffering = true;
window.confirm = function() { return false; };
//win.alert = function() { return false; };
window.prompt = function() { return false; };
window.open = function() { return false; };
window.close = function() { return false; };
document.onselectstart = function()
{
if (event) {
event.cancelBubble = true;
if ( (event.srcElement.tagName != "INPUT") && (event.srcElement.tagName != "TEXTAREA")) {return false; };
};
return true;
};
document.onmousewheel = function() { if (event) { if (event.shiftKey) { return false; }; };};
document.ondragstart = function() { return false; };
if (!window.external.GameInterface.IsDebug())
{
window.onerror = function(message, line, url) { return System.handleError(message, line, url); };
}
window.nhlMsg = function(msg, isUpper) { return System.getLocaleString(msg, 0, isUpper); };
window.writeNHLMsg = function(msg, isUpper) { document.write(nhlMsg(msg, isUpper)); };
window.scMsg = function(msg, isUpper) { return System.getLocaleString(msg, 1, isUpper); };
window.writeSCMsg = function(msg, isUpper) { document.write(scMsg(msg, isUpper)); };
window.isNHL = function ()
{
if ( ("GameInterface" in window.external) && ("AudioInterface" in window.external.GameInterface) ) {
return true;
} else {
return false;
};
};
};
var System = new SystemClass();