From 2c84722b45db36d62c424462a0b9406f1c4c1c3d Mon Sep 17 00:00:00 2001 From: Stefano Balietti Date: Wed, 20 Oct 2021 10:39:47 +0200 Subject: [PATCH 1/9] changelog --- CHANGELOG | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 3f86fc5..df75ac5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,11 @@ # nodegame-window change log +## 7.0.0 +- Improved error messages for setInnerHTML +- Frame loading waits for the callback to be executed. +- WaitScreen texts are all paramterers (thanks jjensenius3). + + ## 6.2.0 - InfoPanel scrolls into view when opened. - W.createInfoPanel creates toggle button by default. From bf2e0b4fa0f8a3f1158079f98458797ebd0f706a Mon Sep 17 00:00:00 2001 From: Stefano Balietti Date: Wed, 20 Oct 2021 11:04:09 +0200 Subject: [PATCH 2/9] 7.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a852567..a557c1a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nodegame-window", "description": "Provides a handy API to interface nodeGame with the browser window.", - "version": "6.2.0", + "version": "7.0.0", "keywords": [ "nodegame", "window", "browser", "frame", "behavioral", "multiplayer", "games", "ui" ], "author": "Stefano Balietti ", "license": "MIT", From c16fcb346ed919775ea563c898010470fb01739e Mon Sep 17 00:00:00 2001 From: Stefano Balietti Date: Tue, 8 Mar 2022 10:31:40 +0100 Subject: [PATCH 3/9] loadingDot does not change in size --- build/nodegame-window.js | 27 ++++++++++++++++----------- build/nodegame-window.min.js | 2 +- lib/modules/extra.js | 15 ++++++++------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/build/nodegame-window.js b/build/nodegame-window.js index 8a522ad..2c0f3a6 100644 --- a/build/nodegame-window.js +++ b/build/nodegame-window.js @@ -4337,24 +4337,25 @@ * and a method stop, that clears the interval */ GameWindow.prototype.getLoadingDots = function(len, id) { - var spanDots, i, limit, intervalId; + var spanDots, counter, intervalId; if (len & len < 0) { throw new Error('GameWindow.getLoadingDots: len cannot be < 0. ' + 'Found: ' + len); } - len = len || 5; spanDots = document.createElement('span'); spanDots.id = id || 'span_dots'; - limit = ''; - for (i = 0; i < len; i++) { - limit = limit + '.'; - } // Refreshing the dots... + counter = 0; + len = len || 5; + // So the height does not change. + spanDots.innerHTML = ' '; intervalId = setInterval(function() { - if (spanDots.innerHTML !== limit) { + if (counter < len) { + counter++; spanDots.innerHTML = spanDots.innerHTML + '.'; } else { + counter = 0; spanDots.innerHTML = '.'; } }, 1000); @@ -4559,13 +4560,15 @@ // Only process strings or numbers. if ('string' !== typeof search && 'number' !== typeof search) { throw new TypeError('GameWindow.setInnerHTML: search must be ' + - 'string or number. Found: ' + search); + 'string or number. Found: ' + search + + " (replace = " + replace + ")"); } // Only process strings or numbers. if ('string' !== typeof replace && 'number' !== typeof replace) { throw new TypeError('GameWindow.setInnerHTML: replace must be ' + - 'string or number. Found: ' + replace); + 'string or number. Found: ' + replace + + " (search = " + search + ")"); } if ('undefined' === typeof mod) { @@ -4574,12 +4577,14 @@ else if ('string' === typeof mod) { if (mod !== 'g' && mod !== 'id' && mod !== 'className') { throw new Error('GameWindow.setInnerHTML: invalid ' + - 'mod value: ' + mod); + 'mod value: ' + mod + + " (search = " + search + ")"); } } else { throw new TypeError('GameWindow.setInnerHTML: mod must be ' + - 'string or undefined. Found: ' + mod); + 'string or undefined. Found: ' + mod + + " (search = " + search + ")"); } if (mod === 'id' || mod === 'g') { diff --git a/build/nodegame-window.min.js b/build/nodegame-window.min.js index fb75330..a34afb8 100644 --- a/build/nodegame-window.min.js +++ b/build/nodegame-window.min.js @@ -15,4 +15,4 @@ * * Depends on JSUS and nodegame-client. */ -(function(e,t){"use strict";function a(e,t){function r(){e.removeEventListener("load",r,!1),n.removeEventListener("load",r,!1),t&&setTimeout(function(){t()},120)}var n;n=e.contentWindow,e.addEventListener("load",r,!1),n.addEventListener("load",r,!1)}function f(e,t){function r(i){var s;s=J.getIFrameDocument(e);if(i.type==="load"||s.readyState==="complete")e.detachEvent("onreadystatechange",r),n.detachEvent("onload",r),t&&setTimeout(function(){t()},120)}var n;n=e.contentWindow,e.attachEvent("onreadystatechange",r),n.attachEvent("onload",r)}function l(e,t){W.isIE?f(e,t):a(e,t)}function c(){this.setStateLevel("UNINITIALIZED");if("undefined"==typeof e)throw new Error("GameWindow: no window found. Are you in a browser?");if("undefined"==typeof t)throw new Error("GameWindow: nodeGame not found");t.silly("node-window: loading..."),this.frameName=null,this.frameElement=null,this.frameWindow=null,this.frameDocument=null,this.frameRoot=null,this.headerElement=null,this.headerName=null,this.headerRoot=null,this.headerPosition=null,this.defaultHeaderPosition="top",this.conf={},this.uriChannel=null,this.areLoading=0,this.cacheSupported=null,this.directFrameDocumentAccess=null,this.cache={},this.currentURIs={},this.unprocessedUri=null,this.globalLibs=[],this.frameLibs={},this.uriPrefix=null,this.stateLevel=null,this.waitScreen=null,this.listenersAdded=null,this.screenState=t.constants.screenLevels.ACTIVE,this.styleElement=null,this.isIE=!!document.createElement("span").attachEvent,this.headerOffset=0,this.willResizeFrame=!1,this.addDefaultSetups(),this.addDefaultListeners(),setTimeout(function(){(function(e){e.length>=1&&(e[0].style.display="none")})(document.getElementsByTagName("noscript"))},1e3),this.init(c.defaults),t.silly("node-window: created.")}function h(e,t,n,r,i,s,o){var u,a;n=W.getElementById(r),u=W.getIFrameDocument(n).documentElement,i&&(u.innerHTML=e.cache[t].contents),r===e.frameName&&(e.frameWindow=n.contentWindow,e.frameDocument=e.getIFrameDocument(n),e.conf.rightClickDisabled&&J.disableRightClick(e.frameDocument),e.conf.noEscape&&(e.frameDocument.onkeydown=document.onkeydown)),e.styleElement=null,p(n),a=function(){v(n,e.globalLibs.concat(e.frameLibs.hasOwnProperty(t)?e.frameLibs[t]:[])),s&&(e.cache[t].contents=u.innerHTML),o(),b()},i?d(n,a):a()}function p(e){var t,n,r,i;n=W.getIFrameDocument(e),r=W.getElementsByClassName(n,"injectedlib","script");for(t=0;t=n.length&&r&&r()})}(o,a),e.frames[f].location.replace(o)},c.prototype.clearCache=function(){this.cache={}},c.prototype.getElementById=c.prototype.gid=function(e){var t,n;return n=this.getFrameDocument(),t=null,n&&n.getElementById&&(t=n.getElementById(e)),t||(t=document.getElementById(e)),t},c.prototype.getElementsByTagName=function(e){var t;return t=this.getFrameDocument(),t?t.getElementsByTagName(e):document.getElementsByTagName(e)},c.prototype.getElementsByClassName=function(e,t){var n;return n=this.getFrameDocument()||document,J.getElementsByClassName(n,e,t)},c.prototype.loadFrame=function(e,n,r){var i,s,o,u,a,f,p,d,v,g,b,w,E,S,x;if("string"!=typeof e)throw new TypeError("GameWindow.loadFrame: uri must be string. Found: "+e);if(n&&"function"!=typeof n)throw new TypeError("GameWindow.loadFrame: func must be function or undefined. Found: "+n);if(r&&"object"!=typeof r)throw new TypeError("GameWindow.loadFrame: opts must be object or undefined. Found: "+r);r=r||{},v=this.getFrame(),g=this.frameName;if(!v)throw new Error("GameWindow.loadFrame: no frame found");if(!g)throw new Error("GameWindow.loadFrame: frame has no name");this.setStateLevel("LOADING"),i=this,w=v.contentWindow,b=W.getIFrameDocument(v),S=b.readyState,S=S==="complete",s=c.defaults.cacheDefaults.loadCache,o=c.defaults.cacheDefaults.storeCacheNow,u=c.defaults.cacheDefaults.storeCacheLater;if(r.cache){if(r.cache.loadMode)if(r.cache.loadMode==="reload")s=!1;else{if(r.cache.loadMode!=="cache")throw new Error("GameWindow.loadFrame: unkown cache load mode: "+r.cache.loadMode);s=!0}if(r.cache.storeMode)if(r.cache.storeMode==="off")o=!1,u=!1;else if(r.cache.storeMode==="onLoad")o=!0,u=!1;else{if(r.cache.storeMode!=="onClose")throw new Error("GameWindow.loadFrame: unkown cache store mode: "+r.cache.storeMode);o=!1,u=!0}}if("undefined"!=typeof r.autoParse){if("object"!=typeof r.autoParse)throw new TypeError("GameWindow.loadFrame: opts.autoParse must be object or undefined. Found: "+r.autoParse);if("undefined"!=typeof r.autoParsePrefix){if("string"!=typeof r.autoParsePrefix)throw new TypeError("GameWindow.loadFrame: opts.autoParsePrefix must be string or undefined. Found: "+r.autoParsePrefix);p=r.autoParsePrefix}if("undefined"!=typeof r.autoParseMod){if("string"!=typeof r.autoParseMod)throw new TypeError("GameWindow.loadFrame: opts.autoParseMod must be string or undefined. Found: "+r.autoParseMod);d=r.autoParseMod}f=r.autoParse}a="undefined"==typeof r.scrollUp?!0:r.scrollUp,this.unprocessedUri=e;if(this.cacheSupported===null){this.preCacheTest(function(){i.loadFrame(e,n,r)});return}e=this.processUri(e),this.cacheSupported===!1?(o=!1,u=!1,s=!1):(x=this.currentURIs[g],this.cache.hasOwnProperty(x)&&this.cache[x].cacheOnClose&&(E=b.documentElement,this.cache[x].contents=E.innerHTML),this.cache.hasOwnProperty(e)||(this.cache[e]={contents:null,cacheOnClose:!1}),this.cache[e].cacheOnClose=u,this.cache[e].contents===null&&(s=!1)),this.currentURIs[g]=e,m(this,1),v.style.visibility="hidden",(!s||!S)&&l(v,function(){i.directFrameDocumentAccess===null&&y(i),h(i,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)})}),s?S&&h(this,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)}):w.location.replace(e),w.node=t},c.prototype.processUri=function(e){return e.charAt(0)!=="/"&&e.substr(0,7)!=="http://"&&(this.uriPrefix&&(e=this.uriPrefix+e),this.uriChannel&&(e=this.uriChannel+e)),e},c.prototype.updateLoadFrameState=function(n,r,i,s,u){var a,f;a=m(this,-1),a&&this.setStateLevel("LOADED"),n&&n.call(t.game),r&&this.searchReplace(r,i,s),u&&e.scrollTo&&e.scrollTo(0,0),t.events.ee.game.emit("FRAME_LOADED"),t.events.ee.stage.emit("FRAME_LOADED"),t.events.ee.step.emit("FRAME_LOADED"),a?(f=t.game.getStageLevel(),f===o&&t.emit("LOADED")):t.silly("game-window: "+this.areLoading+" frames "+"still loading.")},c.prototype.clearPageBody=function(){this.reset(),document.body.innerHTML=""},c.prototype.clearPage=function(){this.reset();try{document.documentElement.innerHTML=""}catch(e){this.removeChildrenFromNode(document.documentElement)}},c.prototype.setUriPrefix=function(e){if(e!==null&&"string"!=typeof e)throw new TypeError("GameWindow.setUriPrefix: uriPrefix must be string or null. Found: "+e);this.conf.uriPrefix=this.uriPrefix=e},c.prototype.setUriChannel=function(e){if("string"==typeof e)e.charAt(0)!=="/"&&(e="/"+e),e.charAt(e.length-1)!=="/"&&(e+="/");else if(e!==null)throw new TypeError("GameWindow.uriChannel: uriChannel must be string or null. Found: "+e);this.uriChannel=e},c.prototype.adjustFrameHeight=function(){var t,n;return n=function(t){var n,r,i;W.adjustHeaderOffset(),n=W.getFrame();if(!n||!n.contentWindow)return;if(!n.contentWindow.document.body){W.adjustFrameHeight(t,120);return}W.conf.adjustFrameHeight===!1?r="100vh":(r=e.innerHeight||e.clientHeight,i=n.contentWindow.document.body.offsetHeight,i+=60,W.headerPosition==="top"&&(i+=W.headerOffset),rDo not refresh the page!
Maximum Waiting Time: ",countdownResuming:e.countdownResumingText||"Resuming soon...",formatCountdown:function(e){var t;return t="",e=J.parseMilliseconds(e),e[2]&&(t+=e[2]+" min "),e[3]&&(t+=e[3]+" sec"),t||0}},this.lockedInputs=[],this.enable()}e.WaitScreen=l,l.version="0.10.0",l.description="Shows a waiting screen";var n,r;n=["button","select","textarea","input"],r=n.length,l.prototype.enable=function(){if(this.enabled)return;node.events.ee.game.on("REALLY_DONE",s),node.events.ee.game.on("STEPPING",o),node.events.ee.game.on("PLAYING",u),node.events.ee.game.on("PAUSED",a),node.events.ee.game.on("RESUMED",f),this.enabled=!0},l.prototype.disable=function(){if(!this.enabled)return;node.events.ee.game.off("REALLY_DONE",s),node.events.ee.game.off("STEPPING",o),node.events.ee.game.off("PLAYING",u),node.events.ee.game.off("PAUSED",a),node.events.ee.game.off("RESUMED",f),this.enabled=!1},l.prototype.lock=function(e,t){var n,r;r=this.defaultTexts,"undefined"==typeof e&&(e=r.locked),"undefined"==typeof document.getElementsByTagName&&node.warn("WaitScreen.lock: cannot lock inputs"),i(document),n=W.getFrameDocument(),n&&i(n),this.waitingDiv||(this.root||(this.root=W.getFrameRoot()||document.body),this.waitingDiv=W.add("div",this.root,this.id),this.contentDiv=W.add("div",this.waitingDiv,"ng_waitscreen-content-div")),this.waitingDiv.style.display==="none"&&(this.waitingDiv.style.display=""),this.contentDiv.innerHTML=e,this.displayCountdown&&t?(this.countdownDiv||(this.countdownDiv=W.add("div",this.waitingDiv,"ng_waitscreen-countdown-div"),this.countdownDiv.innerHTML=r.countdown,this.countdownSpan=W.add("span",this.countdownDiv,"ng_waitscreen-countdown-span")),this.countdown=t,this.countdownSpan.innerHTML=r.formatCountdown(t),this.countdownDiv.style.display="",this.countdownInterval=setInterval(function(){var e;e=W.waitScreen;if(!W.isScreenLocked()){clearInterval(e.countdownInterval);return}e.countdown-=1e3,e.countdown<0?(clearInterval(e.countdownInterval),e.countdownDiv.style.display="none",e.contentDiv.innerHTML=r.countdownResuming):e.countdownSpan.innerHTML=r.formatCountdown(e.countdown)},1e3)):this.countdownDiv&&(this.countdownDiv.style.display="none")},l.prototype.unlock=function(){var e,t;this.waitingDiv&&this.waitingDiv.style.display===""&&(this.waitingDiv.style.display="none"),this.countdownInterval&&clearInterval(this.countdownInterval);try{t=this.lockedInputs.length;for(e=-1;++e2&&(t=arguments[1],n=arguments[2]);if("undefined"==typeof n)n="ng_replace_";else if(null===n)n="";else if("string"!=typeof n)throw new TypeError("GameWindow.searchReplace: prefix must be string, null or undefined. Found: "+n);e=arguments[0];if(J.isArray(e)){s=-1,i=e.length;for(;++sn.dt)return 1}else{if(e.dtn.dt)return-1}if(e.dt===n.dt){if("undefined"==typeof e.dd)return-1;if("undefined"==typeof n.dd)return 1;if(e.ddn.dd)return 1;if(e.nddbidn.nddbid)return-1}return 0},this.DL=e.list||document.createElement(this.FIRST_LEVEL),this.DL.id=e.id||this.id,e.className&&(this.DL.className=e.className),this.options.title&&this.DL.appendChild(document.createTextNode(e.title)),this.htmlRenderer=new r(e.render)},s.prototype._add=function(e){if(!e)return;this.insert(e),this.auto_update&&this.parse()},s.prototype.addDT=function(e,t){if("undefined"==typeof e)return;this.last_dt++,t="undefined"!=typeof t?t:this.last_dt,this.last_dd=0;var n=new o({dt:t,content:e});return this._add(n)},s.prototype.addDD=function(e,t,n){if("undefined"==typeof e)return;t="undefined"!=typeof t?t:this.last_dt,n="undefined"!=typeof n?n:this.last_dd++;var r=new o({dt:t,dd:n,content:e});return this._add(r)},s.prototype.parse=function(){this.sort();var e=null,t=null,n=function(){var n=document.createElement(this.SECOND_LEVEL);return this.DL.appendChild(n),t=null,e=n,n},r=function(){var e=document.createElement(this.THIRD_LEVEL);return this.DL.appendChild(e),e};if(this.DL){while(this.DL.hasChildNodes())this.DL.removeChild(this.DL.firstChild);this.options.title&&this.DL.appendChild(document.createTextNode(this.options.title))}for(var i=0;ithis.pointers[e])this.pointers[e]=t;return this.pointers[e]},u.prototype.addMultiple=function(e,t,n,r){var i,s,o,u;f("addMultiple",e,n,r);if(t&&"string"!=typeof t||t&&"undefined"==typeof this.pointers[t])throw new TypeError("Table.addMultiple: dim must be a valid dimension (x or y) or undefined.");t=t||"x",n=this.getCurrPointer("x",n),r=this.getNextPointer("y",r),n="undefined"!=typeof n?n:this.pointers.x===null?0:this.pointers.x,r="undefined"!=typeof r?r:this.pointers.y===null?0:this.pointers.y,J.isArray(e)||(e=[e]),i=-1,s=e.length;for(;++ih+1){d=this.db[u].y-(h+1);for(a=0;a=1&&(e[0].style.display="none")})(document.getElementsByTagName("noscript"))},1e3),this.init(c.defaults),t.silly("node-window: created.")}function h(e,t,n,r,i,s,o){var u,a;n=W.getElementById(r),u=W.getIFrameDocument(n).documentElement,i&&(u.innerHTML=e.cache[t].contents),r===e.frameName&&(e.frameWindow=n.contentWindow,e.frameDocument=e.getIFrameDocument(n),e.conf.rightClickDisabled&&J.disableRightClick(e.frameDocument),e.conf.noEscape&&(e.frameDocument.onkeydown=document.onkeydown)),e.styleElement=null,p(n),a=function(){v(n,e.globalLibs.concat(e.frameLibs.hasOwnProperty(t)?e.frameLibs[t]:[])),s&&(e.cache[t].contents=u.innerHTML),o(),b()},i?d(n,a):a()}function p(e){var t,n,r,i;n=W.getIFrameDocument(e),r=W.getElementsByClassName(n,"injectedlib","script");for(t=0;t=n.length&&r&&r()})}(o,a),e.frames[f].location.replace(o)},c.prototype.clearCache=function(){this.cache={}},c.prototype.getElementById=c.prototype.gid=function(e){var t,n;return n=this.getFrameDocument(),t=null,n&&n.getElementById&&(t=n.getElementById(e)),t||(t=document.getElementById(e)),t},c.prototype.getElementsByTagName=function(e){var t;return t=this.getFrameDocument(),t?t.getElementsByTagName(e):document.getElementsByTagName(e)},c.prototype.getElementsByClassName=function(e,t){var n;return n=this.getFrameDocument()||document,J.getElementsByClassName(n,e,t)},c.prototype.loadFrame=function(e,n,r){var i,s,o,u,a,f,p,d,v,g,b,w,E,S,x;if("string"!=typeof e)throw new TypeError("GameWindow.loadFrame: uri must be string. Found: "+e);if(n&&"function"!=typeof n)throw new TypeError("GameWindow.loadFrame: func must be function or undefined. Found: "+n);if(r&&"object"!=typeof r)throw new TypeError("GameWindow.loadFrame: opts must be object or undefined. Found: "+r);r=r||{},v=this.getFrame(),g=this.frameName;if(!v)throw new Error("GameWindow.loadFrame: no frame found");if(!g)throw new Error("GameWindow.loadFrame: frame has no name");this.setStateLevel("LOADING"),i=this,w=v.contentWindow,b=W.getIFrameDocument(v),S=b.readyState,S=S==="complete",s=c.defaults.cacheDefaults.loadCache,o=c.defaults.cacheDefaults.storeCacheNow,u=c.defaults.cacheDefaults.storeCacheLater;if(r.cache){if(r.cache.loadMode)if(r.cache.loadMode==="reload")s=!1;else{if(r.cache.loadMode!=="cache")throw new Error("GameWindow.loadFrame: unkown cache load mode: "+r.cache.loadMode);s=!0}if(r.cache.storeMode)if(r.cache.storeMode==="off")o=!1,u=!1;else if(r.cache.storeMode==="onLoad")o=!0,u=!1;else{if(r.cache.storeMode!=="onClose")throw new Error("GameWindow.loadFrame: unkown cache store mode: "+r.cache.storeMode);o=!1,u=!0}}if("undefined"!=typeof r.autoParse){if("object"!=typeof r.autoParse)throw new TypeError("GameWindow.loadFrame: opts.autoParse must be object or undefined. Found: "+r.autoParse);if("undefined"!=typeof r.autoParsePrefix){if("string"!=typeof r.autoParsePrefix)throw new TypeError("GameWindow.loadFrame: opts.autoParsePrefix must be string or undefined. Found: "+r.autoParsePrefix);p=r.autoParsePrefix}if("undefined"!=typeof r.autoParseMod){if("string"!=typeof r.autoParseMod)throw new TypeError("GameWindow.loadFrame: opts.autoParseMod must be string or undefined. Found: "+r.autoParseMod);d=r.autoParseMod}f=r.autoParse}a="undefined"==typeof r.scrollUp?!0:r.scrollUp,this.unprocessedUri=e;if(this.cacheSupported===null){this.preCacheTest(function(){i.loadFrame(e,n,r)});return}e=this.processUri(e),this.cacheSupported===!1?(o=!1,u=!1,s=!1):(x=this.currentURIs[g],this.cache.hasOwnProperty(x)&&this.cache[x].cacheOnClose&&(E=b.documentElement,this.cache[x].contents=E.innerHTML),this.cache.hasOwnProperty(e)||(this.cache[e]={contents:null,cacheOnClose:!1}),this.cache[e].cacheOnClose=u,this.cache[e].contents===null&&(s=!1)),this.currentURIs[g]=e,m(this,1),v.style.visibility="hidden",(!s||!S)&&l(v,function(){i.directFrameDocumentAccess===null&&y(i),h(i,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)})}),s?S&&h(this,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)}):w.location.replace(e),w.node=t},c.prototype.processUri=function(e){return e.charAt(0)!=="/"&&e.substr(0,7)!=="http://"&&(this.uriPrefix&&(e=this.uriPrefix+e),this.uriChannel&&(e=this.uriChannel+e)),e},c.prototype.updateLoadFrameState=function(n,r,i,s,u){var a,f;a=m(this,-1),a&&this.setStateLevel("LOADED"),n&&n.call(t.game),r&&this.searchReplace(r,i,s),u&&e.scrollTo&&e.scrollTo(0,0),t.events.ee.game.emit("FRAME_LOADED"),t.events.ee.stage.emit("FRAME_LOADED"),t.events.ee.step.emit("FRAME_LOADED"),a?(f=t.game.getStageLevel(),f===o&&t.emit("LOADED")):t.silly("game-window: "+this.areLoading+" frames "+"still loading.")},c.prototype.clearPageBody=function(){this.reset(),document.body.innerHTML=""},c.prototype.clearPage=function(){this.reset();try{document.documentElement.innerHTML=""}catch(e){this.removeChildrenFromNode(document.documentElement)}},c.prototype.setUriPrefix=function(e){if(e!==null&&"string"!=typeof e)throw new TypeError("GameWindow.setUriPrefix: uriPrefix must be string or null. Found: "+e);this.conf.uriPrefix=this.uriPrefix=e},c.prototype.setUriChannel=function(e){if("string"==typeof e)e.charAt(0)!=="/"&&(e="/"+e),e.charAt(e.length-1)!=="/"&&(e+="/");else if(e!==null)throw new TypeError("GameWindow.uriChannel: uriChannel must be string or null. Found: "+e);this.uriChannel=e},c.prototype.adjustFrameHeight=function(){var t,n;return n=function(t){var n,r,i;W.adjustHeaderOffset(),n=W.getFrame();if(!n||!n.contentWindow)return;if(!n.contentWindow.document.body){W.adjustFrameHeight(t,120);return}W.conf.adjustFrameHeight===!1?r="100vh":(r=e.innerHeight||e.clientHeight,i=n.contentWindow.document.body.offsetHeight,i+=60,W.headerPosition==="top"&&(i+=W.headerOffset),rDo not refresh the page!
Maximum Waiting Time: ",countdownResuming:e.countdownResumingText||"Resuming soon...",formatCountdown:function(e){var t;return t="",e=J.parseMilliseconds(e),e[2]&&(t+=e[2]+" min "),e[3]&&(t+=e[3]+" sec"),t||0}},this.lockedInputs=[],this.enable()}e.WaitScreen=l,l.version="0.10.0",l.description="Shows a waiting screen";var n,r;n=["button","select","textarea","input"],r=n.length,l.prototype.enable=function(){if(this.enabled)return;node.events.ee.game.on("REALLY_DONE",s),node.events.ee.game.on("STEPPING",o),node.events.ee.game.on("PLAYING",u),node.events.ee.game.on("PAUSED",a),node.events.ee.game.on("RESUMED",f),this.enabled=!0},l.prototype.disable=function(){if(!this.enabled)return;node.events.ee.game.off("REALLY_DONE",s),node.events.ee.game.off("STEPPING",o),node.events.ee.game.off("PLAYING",u),node.events.ee.game.off("PAUSED",a),node.events.ee.game.off("RESUMED",f),this.enabled=!1},l.prototype.lock=function(e,t){var n,r;r=this.defaultTexts,"undefined"==typeof e&&(e=r.locked),"undefined"==typeof document.getElementsByTagName&&node.warn("WaitScreen.lock: cannot lock inputs"),i(document),n=W.getFrameDocument(),n&&i(n),this.waitingDiv||(this.root||(this.root=W.getFrameRoot()||document.body),this.waitingDiv=W.add("div",this.root,this.id),this.contentDiv=W.add("div",this.waitingDiv,"ng_waitscreen-content-div")),this.waitingDiv.style.display==="none"&&(this.waitingDiv.style.display=""),this.contentDiv.innerHTML=e,this.displayCountdown&&t?(this.countdownDiv||(this.countdownDiv=W.add("div",this.waitingDiv,"ng_waitscreen-countdown-div"),this.countdownDiv.innerHTML=r.countdown,this.countdownSpan=W.add("span",this.countdownDiv,"ng_waitscreen-countdown-span")),this.countdown=t,this.countdownSpan.innerHTML=r.formatCountdown(t),this.countdownDiv.style.display="",this.countdownInterval=setInterval(function(){var e;e=W.waitScreen;if(!W.isScreenLocked()){clearInterval(e.countdownInterval);return}e.countdown-=1e3,e.countdown<0?(clearInterval(e.countdownInterval),e.countdownDiv.style.display="none",e.contentDiv.innerHTML=r.countdownResuming):e.countdownSpan.innerHTML=r.formatCountdown(e.countdown)},1e3)):this.countdownDiv&&(this.countdownDiv.style.display="none")},l.prototype.unlock=function(){var e,t;this.waitingDiv&&this.waitingDiv.style.display===""&&(this.waitingDiv.style.display="none"),this.countdownInterval&&clearInterval(this.countdownInterval);try{t=this.lockedInputs.length;for(e=-1;++e2&&(t=arguments[1],n=arguments[2]);if("undefined"==typeof n)n="ng_replace_";else if(null===n)n="";else if("string"!=typeof n)throw new TypeError("GameWindow.searchReplace: prefix must be string, null or undefined. Found: "+n);e=arguments[0];if(J.isArray(e)){s=-1,i=e.length;for(;++sn.dt)return 1}else{if(e.dtn.dt)return-1}if(e.dt===n.dt){if("undefined"==typeof e.dd)return-1;if("undefined"==typeof n.dd)return 1;if(e.ddn.dd)return 1;if(e.nddbidn.nddbid)return-1}return 0},this.DL=e.list||document.createElement(this.FIRST_LEVEL),this.DL.id=e.id||this.id,e.className&&(this.DL.className=e.className),this.options.title&&this.DL.appendChild(document.createTextNode(e.title)),this.htmlRenderer=new r(e.render)},s.prototype._add=function(e){if(!e)return;this.insert(e),this.auto_update&&this.parse()},s.prototype.addDT=function(e,t){if("undefined"==typeof e)return;this.last_dt++,t="undefined"!=typeof t?t:this.last_dt,this.last_dd=0;var n=new o({dt:t,content:e});return this._add(n)},s.prototype.addDD=function(e,t,n){if("undefined"==typeof e)return;t="undefined"!=typeof t?t:this.last_dt,n="undefined"!=typeof n?n:this.last_dd++;var r=new o({dt:t,dd:n,content:e});return this._add(r)},s.prototype.parse=function(){this.sort();var e=null,t=null,n=function(){var n=document.createElement(this.SECOND_LEVEL);return this.DL.appendChild(n),t=null,e=n,n},r=function(){var e=document.createElement(this.THIRD_LEVEL);return this.DL.appendChild(e),e};if(this.DL){while(this.DL.hasChildNodes())this.DL.removeChild(this.DL.firstChild);this.options.title&&this.DL.appendChild(document.createTextNode(this.options.title))}for(var i=0;ithis.pointers[e])this.pointers[e]=t;return this.pointers[e]},u.prototype.addMultiple=function(e,t,n,r){var i,s,o,u;f("addMultiple",e,n,r);if(t&&"string"!=typeof t||t&&"undefined"==typeof this.pointers[t])throw new TypeError("Table.addMultiple: dim must be a valid dimension (x or y) or undefined.");t=t||"x",n=this.getCurrPointer("x",n),r=this.getNextPointer("y",r),n="undefined"!=typeof n?n:this.pointers.x===null?0:this.pointers.x,r="undefined"!=typeof r?r:this.pointers.y===null?0:this.pointers.y,J.isArray(e)||(e=[e]),i=-1,s=e.length;for(;++ih+1){d=this.db[u].y-(h+1);for(a=0;a Date: Tue, 8 Mar 2022 10:32:31 +0100 Subject: [PATCH 4/9] .html --- lib/modules/extra.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/modules/extra.js b/lib/modules/extra.js index d48b04a..0ba18fa 100644 --- a/lib/modules/extra.js +++ b/lib/modules/extra.js @@ -423,8 +423,13 @@ }; + GameWindow.prototype.setInnerHTML = function(search, replace, mod) { + console.log('***deprecated: use W.html instead of W.setInnerHTML'); + this.html(search, replace, mod); + }; + /** - * ### GameWindow.setInnerHTML + * ### GameWindow.html * * Replaces the innerHTML of the element with matching id or class name * @@ -437,7 +442,7 @@ * - 'className': replaces all elements with same class name * - 'g': replaces globally, both by id and className */ - GameWindow.prototype.setInnerHTML = function(search, replace, mod) { + GameWindow.prototype.html = function(search, replace, mod) { var el, i, len; // Only process strings or numbers. From 0f8461e10d8237030452e1b1b68b97886e396e05 Mon Sep 17 00:00:00 2001 From: Stefano Balietti Date: Tue, 8 Mar 2022 10:34:03 +0100 Subject: [PATCH 5/9] minor --- lib/modules/extra.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modules/extra.js b/lib/modules/extra.js index 0ba18fa..354c123 100644 --- a/lib/modules/extra.js +++ b/lib/modules/extra.js @@ -1,6 +1,6 @@ /** * # extra - * Copyright(c) 2019 Stefano Balietti + * Copyright(c) 2022 Stefano Balietti * MIT Licensed * * GameWindow extras @@ -424,7 +424,7 @@ }; GameWindow.prototype.setInnerHTML = function(search, replace, mod) { - console.log('***deprecated: use W.html instead of W.setInnerHTML'); + // console.log('***deprecated: use W.html instead of W.setInnerHTML'); this.html(search, replace, mod); }; From 30f21a18e31dcf1a155de9bfa0ca88e2e40234fe Mon Sep 17 00:00:00 2001 From: Stefano Balietti Date: Fri, 1 Jul 2022 14:41:18 +0200 Subject: [PATCH 6/9] built --- build/nodegame-window.js | 11 ++++++++--- build/nodegame-window.min.js | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build/nodegame-window.js b/build/nodegame-window.js index 2c0f3a6..ee05111 100644 --- a/build/nodegame-window.js +++ b/build/nodegame-window.js @@ -4116,7 +4116,7 @@ /** * # extra - * Copyright(c) 2019 Stefano Balietti + * Copyright(c) 2022 Stefano Balietti * MIT Licensed * * GameWindow extras @@ -4540,8 +4540,13 @@ }; + GameWindow.prototype.setInnerHTML = function(search, replace, mod) { + // console.log('***deprecated: use W.html instead of W.setInnerHTML'); + this.html(search, replace, mod); + }; + /** - * ### GameWindow.setInnerHTML + * ### GameWindow.html * * Replaces the innerHTML of the element with matching id or class name * @@ -4554,7 +4559,7 @@ * - 'className': replaces all elements with same class name * - 'g': replaces globally, both by id and className */ - GameWindow.prototype.setInnerHTML = function(search, replace, mod) { + GameWindow.prototype.html = function(search, replace, mod) { var el, i, len; // Only process strings or numbers. diff --git a/build/nodegame-window.min.js b/build/nodegame-window.min.js index a34afb8..00a554d 100644 --- a/build/nodegame-window.min.js +++ b/build/nodegame-window.min.js @@ -15,4 +15,4 @@ * * Depends on JSUS and nodegame-client. */ -(function(e,t){"use strict";function a(e,t){function r(){e.removeEventListener("load",r,!1),n.removeEventListener("load",r,!1),t&&setTimeout(function(){t()},120)}var n;n=e.contentWindow,e.addEventListener("load",r,!1),n.addEventListener("load",r,!1)}function f(e,t){function r(i){var s;s=J.getIFrameDocument(e);if(i.type==="load"||s.readyState==="complete")e.detachEvent("onreadystatechange",r),n.detachEvent("onload",r),t&&setTimeout(function(){t()},120)}var n;n=e.contentWindow,e.attachEvent("onreadystatechange",r),n.attachEvent("onload",r)}function l(e,t){W.isIE?f(e,t):a(e,t)}function c(){this.setStateLevel("UNINITIALIZED");if("undefined"==typeof e)throw new Error("GameWindow: no window found. Are you in a browser?");if("undefined"==typeof t)throw new Error("GameWindow: nodeGame not found");t.silly("node-window: loading..."),this.frameName=null,this.frameElement=null,this.frameWindow=null,this.frameDocument=null,this.frameRoot=null,this.headerElement=null,this.headerName=null,this.headerRoot=null,this.headerPosition=null,this.defaultHeaderPosition="top",this.conf={},this.uriChannel=null,this.areLoading=0,this.cacheSupported=null,this.directFrameDocumentAccess=null,this.cache={},this.currentURIs={},this.unprocessedUri=null,this.globalLibs=[],this.frameLibs={},this.uriPrefix=null,this.stateLevel=null,this.waitScreen=null,this.listenersAdded=null,this.screenState=t.constants.screenLevels.ACTIVE,this.styleElement=null,this.isIE=!!document.createElement("span").attachEvent,this.headerOffset=0,this.willResizeFrame=!1,this.addDefaultSetups(),this.addDefaultListeners(),setTimeout(function(){(function(e){e.length>=1&&(e[0].style.display="none")})(document.getElementsByTagName("noscript"))},1e3),this.init(c.defaults),t.silly("node-window: created.")}function h(e,t,n,r,i,s,o){var u,a;n=W.getElementById(r),u=W.getIFrameDocument(n).documentElement,i&&(u.innerHTML=e.cache[t].contents),r===e.frameName&&(e.frameWindow=n.contentWindow,e.frameDocument=e.getIFrameDocument(n),e.conf.rightClickDisabled&&J.disableRightClick(e.frameDocument),e.conf.noEscape&&(e.frameDocument.onkeydown=document.onkeydown)),e.styleElement=null,p(n),a=function(){v(n,e.globalLibs.concat(e.frameLibs.hasOwnProperty(t)?e.frameLibs[t]:[])),s&&(e.cache[t].contents=u.innerHTML),o(),b()},i?d(n,a):a()}function p(e){var t,n,r,i;n=W.getIFrameDocument(e),r=W.getElementsByClassName(n,"injectedlib","script");for(t=0;t=n.length&&r&&r()})}(o,a),e.frames[f].location.replace(o)},c.prototype.clearCache=function(){this.cache={}},c.prototype.getElementById=c.prototype.gid=function(e){var t,n;return n=this.getFrameDocument(),t=null,n&&n.getElementById&&(t=n.getElementById(e)),t||(t=document.getElementById(e)),t},c.prototype.getElementsByTagName=function(e){var t;return t=this.getFrameDocument(),t?t.getElementsByTagName(e):document.getElementsByTagName(e)},c.prototype.getElementsByClassName=function(e,t){var n;return n=this.getFrameDocument()||document,J.getElementsByClassName(n,e,t)},c.prototype.loadFrame=function(e,n,r){var i,s,o,u,a,f,p,d,v,g,b,w,E,S,x;if("string"!=typeof e)throw new TypeError("GameWindow.loadFrame: uri must be string. Found: "+e);if(n&&"function"!=typeof n)throw new TypeError("GameWindow.loadFrame: func must be function or undefined. Found: "+n);if(r&&"object"!=typeof r)throw new TypeError("GameWindow.loadFrame: opts must be object or undefined. Found: "+r);r=r||{},v=this.getFrame(),g=this.frameName;if(!v)throw new Error("GameWindow.loadFrame: no frame found");if(!g)throw new Error("GameWindow.loadFrame: frame has no name");this.setStateLevel("LOADING"),i=this,w=v.contentWindow,b=W.getIFrameDocument(v),S=b.readyState,S=S==="complete",s=c.defaults.cacheDefaults.loadCache,o=c.defaults.cacheDefaults.storeCacheNow,u=c.defaults.cacheDefaults.storeCacheLater;if(r.cache){if(r.cache.loadMode)if(r.cache.loadMode==="reload")s=!1;else{if(r.cache.loadMode!=="cache")throw new Error("GameWindow.loadFrame: unkown cache load mode: "+r.cache.loadMode);s=!0}if(r.cache.storeMode)if(r.cache.storeMode==="off")o=!1,u=!1;else if(r.cache.storeMode==="onLoad")o=!0,u=!1;else{if(r.cache.storeMode!=="onClose")throw new Error("GameWindow.loadFrame: unkown cache store mode: "+r.cache.storeMode);o=!1,u=!0}}if("undefined"!=typeof r.autoParse){if("object"!=typeof r.autoParse)throw new TypeError("GameWindow.loadFrame: opts.autoParse must be object or undefined. Found: "+r.autoParse);if("undefined"!=typeof r.autoParsePrefix){if("string"!=typeof r.autoParsePrefix)throw new TypeError("GameWindow.loadFrame: opts.autoParsePrefix must be string or undefined. Found: "+r.autoParsePrefix);p=r.autoParsePrefix}if("undefined"!=typeof r.autoParseMod){if("string"!=typeof r.autoParseMod)throw new TypeError("GameWindow.loadFrame: opts.autoParseMod must be string or undefined. Found: "+r.autoParseMod);d=r.autoParseMod}f=r.autoParse}a="undefined"==typeof r.scrollUp?!0:r.scrollUp,this.unprocessedUri=e;if(this.cacheSupported===null){this.preCacheTest(function(){i.loadFrame(e,n,r)});return}e=this.processUri(e),this.cacheSupported===!1?(o=!1,u=!1,s=!1):(x=this.currentURIs[g],this.cache.hasOwnProperty(x)&&this.cache[x].cacheOnClose&&(E=b.documentElement,this.cache[x].contents=E.innerHTML),this.cache.hasOwnProperty(e)||(this.cache[e]={contents:null,cacheOnClose:!1}),this.cache[e].cacheOnClose=u,this.cache[e].contents===null&&(s=!1)),this.currentURIs[g]=e,m(this,1),v.style.visibility="hidden",(!s||!S)&&l(v,function(){i.directFrameDocumentAccess===null&&y(i),h(i,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)})}),s?S&&h(this,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)}):w.location.replace(e),w.node=t},c.prototype.processUri=function(e){return e.charAt(0)!=="/"&&e.substr(0,7)!=="http://"&&(this.uriPrefix&&(e=this.uriPrefix+e),this.uriChannel&&(e=this.uriChannel+e)),e},c.prototype.updateLoadFrameState=function(n,r,i,s,u){var a,f;a=m(this,-1),a&&this.setStateLevel("LOADED"),n&&n.call(t.game),r&&this.searchReplace(r,i,s),u&&e.scrollTo&&e.scrollTo(0,0),t.events.ee.game.emit("FRAME_LOADED"),t.events.ee.stage.emit("FRAME_LOADED"),t.events.ee.step.emit("FRAME_LOADED"),a?(f=t.game.getStageLevel(),f===o&&t.emit("LOADED")):t.silly("game-window: "+this.areLoading+" frames "+"still loading.")},c.prototype.clearPageBody=function(){this.reset(),document.body.innerHTML=""},c.prototype.clearPage=function(){this.reset();try{document.documentElement.innerHTML=""}catch(e){this.removeChildrenFromNode(document.documentElement)}},c.prototype.setUriPrefix=function(e){if(e!==null&&"string"!=typeof e)throw new TypeError("GameWindow.setUriPrefix: uriPrefix must be string or null. Found: "+e);this.conf.uriPrefix=this.uriPrefix=e},c.prototype.setUriChannel=function(e){if("string"==typeof e)e.charAt(0)!=="/"&&(e="/"+e),e.charAt(e.length-1)!=="/"&&(e+="/");else if(e!==null)throw new TypeError("GameWindow.uriChannel: uriChannel must be string or null. Found: "+e);this.uriChannel=e},c.prototype.adjustFrameHeight=function(){var t,n;return n=function(t){var n,r,i;W.adjustHeaderOffset(),n=W.getFrame();if(!n||!n.contentWindow)return;if(!n.contentWindow.document.body){W.adjustFrameHeight(t,120);return}W.conf.adjustFrameHeight===!1?r="100vh":(r=e.innerHeight||e.clientHeight,i=n.contentWindow.document.body.offsetHeight,i+=60,W.headerPosition==="top"&&(i+=W.headerOffset),rDo not refresh the page!
Maximum Waiting Time: ",countdownResuming:e.countdownResumingText||"Resuming soon...",formatCountdown:function(e){var t;return t="",e=J.parseMilliseconds(e),e[2]&&(t+=e[2]+" min "),e[3]&&(t+=e[3]+" sec"),t||0}},this.lockedInputs=[],this.enable()}e.WaitScreen=l,l.version="0.10.0",l.description="Shows a waiting screen";var n,r;n=["button","select","textarea","input"],r=n.length,l.prototype.enable=function(){if(this.enabled)return;node.events.ee.game.on("REALLY_DONE",s),node.events.ee.game.on("STEPPING",o),node.events.ee.game.on("PLAYING",u),node.events.ee.game.on("PAUSED",a),node.events.ee.game.on("RESUMED",f),this.enabled=!0},l.prototype.disable=function(){if(!this.enabled)return;node.events.ee.game.off("REALLY_DONE",s),node.events.ee.game.off("STEPPING",o),node.events.ee.game.off("PLAYING",u),node.events.ee.game.off("PAUSED",a),node.events.ee.game.off("RESUMED",f),this.enabled=!1},l.prototype.lock=function(e,t){var n,r;r=this.defaultTexts,"undefined"==typeof e&&(e=r.locked),"undefined"==typeof document.getElementsByTagName&&node.warn("WaitScreen.lock: cannot lock inputs"),i(document),n=W.getFrameDocument(),n&&i(n),this.waitingDiv||(this.root||(this.root=W.getFrameRoot()||document.body),this.waitingDiv=W.add("div",this.root,this.id),this.contentDiv=W.add("div",this.waitingDiv,"ng_waitscreen-content-div")),this.waitingDiv.style.display==="none"&&(this.waitingDiv.style.display=""),this.contentDiv.innerHTML=e,this.displayCountdown&&t?(this.countdownDiv||(this.countdownDiv=W.add("div",this.waitingDiv,"ng_waitscreen-countdown-div"),this.countdownDiv.innerHTML=r.countdown,this.countdownSpan=W.add("span",this.countdownDiv,"ng_waitscreen-countdown-span")),this.countdown=t,this.countdownSpan.innerHTML=r.formatCountdown(t),this.countdownDiv.style.display="",this.countdownInterval=setInterval(function(){var e;e=W.waitScreen;if(!W.isScreenLocked()){clearInterval(e.countdownInterval);return}e.countdown-=1e3,e.countdown<0?(clearInterval(e.countdownInterval),e.countdownDiv.style.display="none",e.contentDiv.innerHTML=r.countdownResuming):e.countdownSpan.innerHTML=r.formatCountdown(e.countdown)},1e3)):this.countdownDiv&&(this.countdownDiv.style.display="none")},l.prototype.unlock=function(){var e,t;this.waitingDiv&&this.waitingDiv.style.display===""&&(this.waitingDiv.style.display="none"),this.countdownInterval&&clearInterval(this.countdownInterval);try{t=this.lockedInputs.length;for(e=-1;++e2&&(t=arguments[1],n=arguments[2]);if("undefined"==typeof n)n="ng_replace_";else if(null===n)n="";else if("string"!=typeof n)throw new TypeError("GameWindow.searchReplace: prefix must be string, null or undefined. Found: "+n);e=arguments[0];if(J.isArray(e)){s=-1,i=e.length;for(;++sn.dt)return 1}else{if(e.dtn.dt)return-1}if(e.dt===n.dt){if("undefined"==typeof e.dd)return-1;if("undefined"==typeof n.dd)return 1;if(e.ddn.dd)return 1;if(e.nddbidn.nddbid)return-1}return 0},this.DL=e.list||document.createElement(this.FIRST_LEVEL),this.DL.id=e.id||this.id,e.className&&(this.DL.className=e.className),this.options.title&&this.DL.appendChild(document.createTextNode(e.title)),this.htmlRenderer=new r(e.render)},s.prototype._add=function(e){if(!e)return;this.insert(e),this.auto_update&&this.parse()},s.prototype.addDT=function(e,t){if("undefined"==typeof e)return;this.last_dt++,t="undefined"!=typeof t?t:this.last_dt,this.last_dd=0;var n=new o({dt:t,content:e});return this._add(n)},s.prototype.addDD=function(e,t,n){if("undefined"==typeof e)return;t="undefined"!=typeof t?t:this.last_dt,n="undefined"!=typeof n?n:this.last_dd++;var r=new o({dt:t,dd:n,content:e});return this._add(r)},s.prototype.parse=function(){this.sort();var e=null,t=null,n=function(){var n=document.createElement(this.SECOND_LEVEL);return this.DL.appendChild(n),t=null,e=n,n},r=function(){var e=document.createElement(this.THIRD_LEVEL);return this.DL.appendChild(e),e};if(this.DL){while(this.DL.hasChildNodes())this.DL.removeChild(this.DL.firstChild);this.options.title&&this.DL.appendChild(document.createTextNode(this.options.title))}for(var i=0;ithis.pointers[e])this.pointers[e]=t;return this.pointers[e]},u.prototype.addMultiple=function(e,t,n,r){var i,s,o,u;f("addMultiple",e,n,r);if(t&&"string"!=typeof t||t&&"undefined"==typeof this.pointers[t])throw new TypeError("Table.addMultiple: dim must be a valid dimension (x or y) or undefined.");t=t||"x",n=this.getCurrPointer("x",n),r=this.getNextPointer("y",r),n="undefined"!=typeof n?n:this.pointers.x===null?0:this.pointers.x,r="undefined"!=typeof r?r:this.pointers.y===null?0:this.pointers.y,J.isArray(e)||(e=[e]),i=-1,s=e.length;for(;++ih+1){d=this.db[u].y-(h+1);for(a=0;a=1&&(e[0].style.display="none")})(document.getElementsByTagName("noscript"))},1e3),this.init(c.defaults),t.silly("node-window: created.")}function h(e,t,n,r,i,s,o){var u,a;n=W.getElementById(r),u=W.getIFrameDocument(n).documentElement,i&&(u.innerHTML=e.cache[t].contents),r===e.frameName&&(e.frameWindow=n.contentWindow,e.frameDocument=e.getIFrameDocument(n),e.conf.rightClickDisabled&&J.disableRightClick(e.frameDocument),e.conf.noEscape&&(e.frameDocument.onkeydown=document.onkeydown)),e.styleElement=null,p(n),a=function(){v(n,e.globalLibs.concat(e.frameLibs.hasOwnProperty(t)?e.frameLibs[t]:[])),s&&(e.cache[t].contents=u.innerHTML),o(),b()},i?d(n,a):a()}function p(e){var t,n,r,i;n=W.getIFrameDocument(e),r=W.getElementsByClassName(n,"injectedlib","script");for(t=0;t=n.length&&r&&r()})}(o,a),e.frames[f].location.replace(o)},c.prototype.clearCache=function(){this.cache={}},c.prototype.getElementById=c.prototype.gid=function(e){var t,n;return n=this.getFrameDocument(),t=null,n&&n.getElementById&&(t=n.getElementById(e)),t||(t=document.getElementById(e)),t},c.prototype.getElementsByTagName=function(e){var t;return t=this.getFrameDocument(),t?t.getElementsByTagName(e):document.getElementsByTagName(e)},c.prototype.getElementsByClassName=function(e,t){var n;return n=this.getFrameDocument()||document,J.getElementsByClassName(n,e,t)},c.prototype.loadFrame=function(e,n,r){var i,s,o,u,a,f,p,d,v,g,b,w,E,S,x;if("string"!=typeof e)throw new TypeError("GameWindow.loadFrame: uri must be string. Found: "+e);if(n&&"function"!=typeof n)throw new TypeError("GameWindow.loadFrame: func must be function or undefined. Found: "+n);if(r&&"object"!=typeof r)throw new TypeError("GameWindow.loadFrame: opts must be object or undefined. Found: "+r);r=r||{},v=this.getFrame(),g=this.frameName;if(!v)throw new Error("GameWindow.loadFrame: no frame found");if(!g)throw new Error("GameWindow.loadFrame: frame has no name");this.setStateLevel("LOADING"),i=this,w=v.contentWindow,b=W.getIFrameDocument(v),S=b.readyState,S=S==="complete",s=c.defaults.cacheDefaults.loadCache,o=c.defaults.cacheDefaults.storeCacheNow,u=c.defaults.cacheDefaults.storeCacheLater;if(r.cache){if(r.cache.loadMode)if(r.cache.loadMode==="reload")s=!1;else{if(r.cache.loadMode!=="cache")throw new Error("GameWindow.loadFrame: unkown cache load mode: "+r.cache.loadMode);s=!0}if(r.cache.storeMode)if(r.cache.storeMode==="off")o=!1,u=!1;else if(r.cache.storeMode==="onLoad")o=!0,u=!1;else{if(r.cache.storeMode!=="onClose")throw new Error("GameWindow.loadFrame: unkown cache store mode: "+r.cache.storeMode);o=!1,u=!0}}if("undefined"!=typeof r.autoParse){if("object"!=typeof r.autoParse)throw new TypeError("GameWindow.loadFrame: opts.autoParse must be object or undefined. Found: "+r.autoParse);if("undefined"!=typeof r.autoParsePrefix){if("string"!=typeof r.autoParsePrefix)throw new TypeError("GameWindow.loadFrame: opts.autoParsePrefix must be string or undefined. Found: "+r.autoParsePrefix);p=r.autoParsePrefix}if("undefined"!=typeof r.autoParseMod){if("string"!=typeof r.autoParseMod)throw new TypeError("GameWindow.loadFrame: opts.autoParseMod must be string or undefined. Found: "+r.autoParseMod);d=r.autoParseMod}f=r.autoParse}a="undefined"==typeof r.scrollUp?!0:r.scrollUp,this.unprocessedUri=e;if(this.cacheSupported===null){this.preCacheTest(function(){i.loadFrame(e,n,r)});return}e=this.processUri(e),this.cacheSupported===!1?(o=!1,u=!1,s=!1):(x=this.currentURIs[g],this.cache.hasOwnProperty(x)&&this.cache[x].cacheOnClose&&(E=b.documentElement,this.cache[x].contents=E.innerHTML),this.cache.hasOwnProperty(e)||(this.cache[e]={contents:null,cacheOnClose:!1}),this.cache[e].cacheOnClose=u,this.cache[e].contents===null&&(s=!1)),this.currentURIs[g]=e,m(this,1),v.style.visibility="hidden",(!s||!S)&&l(v,function(){i.directFrameDocumentAccess===null&&y(i),h(i,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)})}),s?S&&h(this,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)}):w.location.replace(e),w.node=t},c.prototype.processUri=function(e){return e.charAt(0)!=="/"&&e.substr(0,7)!=="http://"&&(this.uriPrefix&&(e=this.uriPrefix+e),this.uriChannel&&(e=this.uriChannel+e)),e},c.prototype.updateLoadFrameState=function(n,r,i,s,u){var a,f;a=m(this,-1),a&&this.setStateLevel("LOADED"),n&&n.call(t.game),r&&this.searchReplace(r,i,s),u&&e.scrollTo&&e.scrollTo(0,0),t.events.ee.game.emit("FRAME_LOADED"),t.events.ee.stage.emit("FRAME_LOADED"),t.events.ee.step.emit("FRAME_LOADED"),a?(f=t.game.getStageLevel(),f===o&&t.emit("LOADED")):t.silly("game-window: "+this.areLoading+" frames "+"still loading.")},c.prototype.clearPageBody=function(){this.reset(),document.body.innerHTML=""},c.prototype.clearPage=function(){this.reset();try{document.documentElement.innerHTML=""}catch(e){this.removeChildrenFromNode(document.documentElement)}},c.prototype.setUriPrefix=function(e){if(e!==null&&"string"!=typeof e)throw new TypeError("GameWindow.setUriPrefix: uriPrefix must be string or null. Found: "+e);this.conf.uriPrefix=this.uriPrefix=e},c.prototype.setUriChannel=function(e){if("string"==typeof e)e.charAt(0)!=="/"&&(e="/"+e),e.charAt(e.length-1)!=="/"&&(e+="/");else if(e!==null)throw new TypeError("GameWindow.uriChannel: uriChannel must be string or null. Found: "+e);this.uriChannel=e},c.prototype.adjustFrameHeight=function(){var t,n;return n=function(t){var n,r,i;W.adjustHeaderOffset(),n=W.getFrame();if(!n||!n.contentWindow)return;if(!n.contentWindow.document.body){W.adjustFrameHeight(t,120);return}W.conf.adjustFrameHeight===!1?r="100vh":(r=e.innerHeight||e.clientHeight,i=n.contentWindow.document.body.offsetHeight,i+=60,W.headerPosition==="top"&&(i+=W.headerOffset),rDo not refresh the page!
Maximum Waiting Time: ",countdownResuming:e.countdownResumingText||"Resuming soon...",formatCountdown:function(e){var t;return t="",e=J.parseMilliseconds(e),e[2]&&(t+=e[2]+" min "),e[3]&&(t+=e[3]+" sec"),t||0}},this.lockedInputs=[],this.enable()}e.WaitScreen=l,l.version="0.10.0",l.description="Shows a waiting screen";var n,r;n=["button","select","textarea","input"],r=n.length,l.prototype.enable=function(){if(this.enabled)return;node.events.ee.game.on("REALLY_DONE",s),node.events.ee.game.on("STEPPING",o),node.events.ee.game.on("PLAYING",u),node.events.ee.game.on("PAUSED",a),node.events.ee.game.on("RESUMED",f),this.enabled=!0},l.prototype.disable=function(){if(!this.enabled)return;node.events.ee.game.off("REALLY_DONE",s),node.events.ee.game.off("STEPPING",o),node.events.ee.game.off("PLAYING",u),node.events.ee.game.off("PAUSED",a),node.events.ee.game.off("RESUMED",f),this.enabled=!1},l.prototype.lock=function(e,t){var n,r;r=this.defaultTexts,"undefined"==typeof e&&(e=r.locked),"undefined"==typeof document.getElementsByTagName&&node.warn("WaitScreen.lock: cannot lock inputs"),i(document),n=W.getFrameDocument(),n&&i(n),this.waitingDiv||(this.root||(this.root=W.getFrameRoot()||document.body),this.waitingDiv=W.add("div",this.root,this.id),this.contentDiv=W.add("div",this.waitingDiv,"ng_waitscreen-content-div")),this.waitingDiv.style.display==="none"&&(this.waitingDiv.style.display=""),this.contentDiv.innerHTML=e,this.displayCountdown&&t?(this.countdownDiv||(this.countdownDiv=W.add("div",this.waitingDiv,"ng_waitscreen-countdown-div"),this.countdownDiv.innerHTML=r.countdown,this.countdownSpan=W.add("span",this.countdownDiv,"ng_waitscreen-countdown-span")),this.countdown=t,this.countdownSpan.innerHTML=r.formatCountdown(t),this.countdownDiv.style.display="",this.countdownInterval=setInterval(function(){var e;e=W.waitScreen;if(!W.isScreenLocked()){clearInterval(e.countdownInterval);return}e.countdown-=1e3,e.countdown<0?(clearInterval(e.countdownInterval),e.countdownDiv.style.display="none",e.contentDiv.innerHTML=r.countdownResuming):e.countdownSpan.innerHTML=r.formatCountdown(e.countdown)},1e3)):this.countdownDiv&&(this.countdownDiv.style.display="none")},l.prototype.unlock=function(){var e,t;this.waitingDiv&&this.waitingDiv.style.display===""&&(this.waitingDiv.style.display="none"),this.countdownInterval&&clearInterval(this.countdownInterval);try{t=this.lockedInputs.length;for(e=-1;++e2&&(t=arguments[1],n=arguments[2]);if("undefined"==typeof n)n="ng_replace_";else if(null===n)n="";else if("string"!=typeof n)throw new TypeError("GameWindow.searchReplace: prefix must be string, null or undefined. Found: "+n);e=arguments[0];if(J.isArray(e)){s=-1,i=e.length;for(;++sn.dt)return 1}else{if(e.dtn.dt)return-1}if(e.dt===n.dt){if("undefined"==typeof e.dd)return-1;if("undefined"==typeof n.dd)return 1;if(e.ddn.dd)return 1;if(e.nddbidn.nddbid)return-1}return 0},this.DL=e.list||document.createElement(this.FIRST_LEVEL),this.DL.id=e.id||this.id,e.className&&(this.DL.className=e.className),this.options.title&&this.DL.appendChild(document.createTextNode(e.title)),this.htmlRenderer=new r(e.render)},s.prototype._add=function(e){if(!e)return;this.insert(e),this.auto_update&&this.parse()},s.prototype.addDT=function(e,t){if("undefined"==typeof e)return;this.last_dt++,t="undefined"!=typeof t?t:this.last_dt,this.last_dd=0;var n=new o({dt:t,content:e});return this._add(n)},s.prototype.addDD=function(e,t,n){if("undefined"==typeof e)return;t="undefined"!=typeof t?t:this.last_dt,n="undefined"!=typeof n?n:this.last_dd++;var r=new o({dt:t,dd:n,content:e});return this._add(r)},s.prototype.parse=function(){this.sort();var e=null,t=null,n=function(){var n=document.createElement(this.SECOND_LEVEL);return this.DL.appendChild(n),t=null,e=n,n},r=function(){var e=document.createElement(this.THIRD_LEVEL);return this.DL.appendChild(e),e};if(this.DL){while(this.DL.hasChildNodes())this.DL.removeChild(this.DL.firstChild);this.options.title&&this.DL.appendChild(document.createTextNode(this.options.title))}for(var i=0;ithis.pointers[e])this.pointers[e]=t;return this.pointers[e]},u.prototype.addMultiple=function(e,t,n,r){var i,s,o,u;f("addMultiple",e,n,r);if(t&&"string"!=typeof t||t&&"undefined"==typeof this.pointers[t])throw new TypeError("Table.addMultiple: dim must be a valid dimension (x or y) or undefined.");t=t||"x",n=this.getCurrPointer("x",n),r=this.getNextPointer("y",r),n="undefined"!=typeof n?n:this.pointers.x===null?0:this.pointers.x,r="undefined"!=typeof r?r:this.pointers.y===null?0:this.pointers.y,J.isArray(e)||(e=[e]),i=-1,s=e.length;for(;++ih+1){d=this.db[u].y-(h+1);for(a=0;a Date: Fri, 7 Jul 2023 21:02:22 +0200 Subject: [PATCH 7/9] minor --- lib/modules/extra.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/modules/extra.js b/lib/modules/extra.js index ac9692d..f0558ff 100644 --- a/lib/modules/extra.js +++ b/lib/modules/extra.js @@ -425,7 +425,6 @@ }; GameWindow.prototype.setInnerHTML = function(search, replace, mod) { - // console.log('***deprecated: use W.html instead of W.setInnerHTML'); this.html(search, replace, mod); }; From 920f7596f327cd4e9f7b8a0b525af22985536bf1 Mon Sep 17 00:00:00 2001 From: Stefano Balietti Date: Tue, 25 Jul 2023 23:49:50 +0200 Subject: [PATCH 8/9] cleanup listeners --- listeners/listeners.js | 48 ------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/listeners/listeners.js b/listeners/listeners.js index a3dd241..f98a32b 100644 --- a/listeners/listeners.js +++ b/listeners/listeners.js @@ -11,23 +11,6 @@ "use strict"; - // var J = node.JSUS; - - // function getElement(idOrObj, prefix) { - // var el; - // if ('string' === typeof idOrObj) { - // el = W.getElementById(idOrObj); - // } - // else if (J.isElement(idOrObj)) { - // el = idOrObj; - // } - // else { - // throw new TypeError(prefix + ': idOrObj must be string ' + - // ' or HTML Element.'); - // } - // return el; - // } - var GameWindow = node.GameWindow; /** @@ -52,37 +35,6 @@ W.init(node.conf.window); }); -// node.on('HIDE', function(idOrObj) { -// var el; -// console.log('***GameWindow.on.HIDE is deprecated. Use ' + -// 'GameWindow.hide() instead.***'); -// el = getElement(idOrObj, 'GameWindow.on.HIDE'); -// if (el) el.style.display = 'none'; -// }); -// -// node.on('SHOW', function(idOrObj) { -// var el; -// console.log('***GameWindow.on.SHOW is deprecated. Use ' + -// 'GameWindow.show() instead.***'); -// el = getElement(idOrObj, 'GameWindow.on.SHOW'); -// if (el) el.style.display = ''; -// }); -// -// node.on('TOGGLE', function(idOrObj) { -// var el; -// console.log('***GameWindow.on.TOGGLE is deprecated. Use ' + -// 'GameWindow.toggle() instead.***'); -// el = getElement(idOrObj, 'GameWindow.on.TOGGLE'); -// if (el) { -// if (el.style.display === 'none') { -// el.style.display = ''; -// } -// else { -// el.style.display = 'none'; -// } -// } -// }); - // Disable all the input forms found within a given id element. node.on('INPUT_DISABLE', function(id) { W.toggleInputs(id, true); From 6217ef918ef8d6381e399cce25cc19123e4d2fab Mon Sep 17 00:00:00 2001 From: Stefano Balietti Date: Tue, 25 Jul 2023 23:50:07 +0200 Subject: [PATCH 9/9] Fixed error when remoteCommand pause is without msg --- build/nodegame-window.js | 53 ++---------------------------------- build/nodegame-window.min.js | 2 +- lib/WaitScreen.js | 4 ++- 3 files changed, 7 insertions(+), 52 deletions(-) diff --git a/build/nodegame-window.js b/build/nodegame-window.js index ee05111..3624410 100644 --- a/build/nodegame-window.js +++ b/build/nodegame-window.js @@ -2968,23 +2968,6 @@ "use strict"; - // var J = node.JSUS; - - // function getElement(idOrObj, prefix) { - // var el; - // if ('string' === typeof idOrObj) { - // el = W.getElementById(idOrObj); - // } - // else if (J.isElement(idOrObj)) { - // el = idOrObj; - // } - // else { - // throw new TypeError(prefix + ': idOrObj must be string ' + - // ' or HTML Element.'); - // } - // return el; - // } - var GameWindow = node.GameWindow; /** @@ -3009,37 +2992,6 @@ W.init(node.conf.window); }); -// node.on('HIDE', function(idOrObj) { -// var el; -// console.log('***GameWindow.on.HIDE is deprecated. Use ' + -// 'GameWindow.hide() instead.***'); -// el = getElement(idOrObj, 'GameWindow.on.HIDE'); -// if (el) el.style.display = 'none'; -// }); -// -// node.on('SHOW', function(idOrObj) { -// var el; -// console.log('***GameWindow.on.SHOW is deprecated. Use ' + -// 'GameWindow.show() instead.***'); -// el = getElement(idOrObj, 'GameWindow.on.SHOW'); -// if (el) el.style.display = ''; -// }); -// -// node.on('TOGGLE', function(idOrObj) { -// var el; -// console.log('***GameWindow.on.TOGGLE is deprecated. Use ' + -// 'GameWindow.toggle() instead.***'); -// el = getElement(idOrObj, 'GameWindow.on.TOGGLE'); -// if (el) { -// if (el.style.display === 'none') { -// el.style.display = ''; -// } -// else { -// el.style.display = 'none'; -// } -// } -// }); - // Disable all the input forms found within a given id element. node.on('INPUT_DISABLE', function(id) { W.toggleInputs(id, true); @@ -3179,7 +3131,9 @@ } function event_PAUSED(text) { - text = text || W.waitScreen.defaultTexts.paused; + // Ignores non-string parameters. + text = 'string' === typeof text ? + text : W.waitScreen.defaultTexts.paused; if (W.isScreenLocked()) { W.waitScreen.beforePauseInnerHTML = W.waitScreen.contentDiv.innerHTML; @@ -4541,7 +4495,6 @@ }; GameWindow.prototype.setInnerHTML = function(search, replace, mod) { - // console.log('***deprecated: use W.html instead of W.setInnerHTML'); this.html(search, replace, mod); }; diff --git a/build/nodegame-window.min.js b/build/nodegame-window.min.js index 00a554d..2f06753 100644 --- a/build/nodegame-window.min.js +++ b/build/nodegame-window.min.js @@ -15,4 +15,4 @@ * * Depends on JSUS and nodegame-client. */ -(function(e,t){"use strict";function a(e,t){function r(){e.removeEventListener("load",r,!1),n.removeEventListener("load",r,!1),t&&setTimeout(function(){t()},120)}var n;n=e.contentWindow,e.addEventListener("load",r,!1),n.addEventListener("load",r,!1)}function f(e,t){function r(i){var s;s=J.getIFrameDocument(e);if(i.type==="load"||s.readyState==="complete")e.detachEvent("onreadystatechange",r),n.detachEvent("onload",r),t&&setTimeout(function(){t()},120)}var n;n=e.contentWindow,e.attachEvent("onreadystatechange",r),n.attachEvent("onload",r)}function l(e,t){W.isIE?f(e,t):a(e,t)}function c(){this.setStateLevel("UNINITIALIZED");if("undefined"==typeof e)throw new Error("GameWindow: no window found. Are you in a browser?");if("undefined"==typeof t)throw new Error("GameWindow: nodeGame not found");t.silly("node-window: loading..."),this.frameName=null,this.frameElement=null,this.frameWindow=null,this.frameDocument=null,this.frameRoot=null,this.headerElement=null,this.headerName=null,this.headerRoot=null,this.headerPosition=null,this.defaultHeaderPosition="top",this.conf={},this.uriChannel=null,this.areLoading=0,this.cacheSupported=null,this.directFrameDocumentAccess=null,this.cache={},this.currentURIs={},this.unprocessedUri=null,this.globalLibs=[],this.frameLibs={},this.uriPrefix=null,this.stateLevel=null,this.waitScreen=null,this.listenersAdded=null,this.screenState=t.constants.screenLevels.ACTIVE,this.styleElement=null,this.isIE=!!document.createElement("span").attachEvent,this.headerOffset=0,this.willResizeFrame=!1,this.addDefaultSetups(),this.addDefaultListeners(),setTimeout(function(){(function(e){e.length>=1&&(e[0].style.display="none")})(document.getElementsByTagName("noscript"))},1e3),this.init(c.defaults),t.silly("node-window: created.")}function h(e,t,n,r,i,s,o){var u,a;n=W.getElementById(r),u=W.getIFrameDocument(n).documentElement,i&&(u.innerHTML=e.cache[t].contents),r===e.frameName&&(e.frameWindow=n.contentWindow,e.frameDocument=e.getIFrameDocument(n),e.conf.rightClickDisabled&&J.disableRightClick(e.frameDocument),e.conf.noEscape&&(e.frameDocument.onkeydown=document.onkeydown)),e.styleElement=null,p(n),a=function(){v(n,e.globalLibs.concat(e.frameLibs.hasOwnProperty(t)?e.frameLibs[t]:[])),s&&(e.cache[t].contents=u.innerHTML),o(),b()},i?d(n,a):a()}function p(e){var t,n,r,i;n=W.getIFrameDocument(e),r=W.getElementsByClassName(n,"injectedlib","script");for(t=0;t=n.length&&r&&r()})}(o,a),e.frames[f].location.replace(o)},c.prototype.clearCache=function(){this.cache={}},c.prototype.getElementById=c.prototype.gid=function(e){var t,n;return n=this.getFrameDocument(),t=null,n&&n.getElementById&&(t=n.getElementById(e)),t||(t=document.getElementById(e)),t},c.prototype.getElementsByTagName=function(e){var t;return t=this.getFrameDocument(),t?t.getElementsByTagName(e):document.getElementsByTagName(e)},c.prototype.getElementsByClassName=function(e,t){var n;return n=this.getFrameDocument()||document,J.getElementsByClassName(n,e,t)},c.prototype.loadFrame=function(e,n,r){var i,s,o,u,a,f,p,d,v,g,b,w,E,S,x;if("string"!=typeof e)throw new TypeError("GameWindow.loadFrame: uri must be string. Found: "+e);if(n&&"function"!=typeof n)throw new TypeError("GameWindow.loadFrame: func must be function or undefined. Found: "+n);if(r&&"object"!=typeof r)throw new TypeError("GameWindow.loadFrame: opts must be object or undefined. Found: "+r);r=r||{},v=this.getFrame(),g=this.frameName;if(!v)throw new Error("GameWindow.loadFrame: no frame found");if(!g)throw new Error("GameWindow.loadFrame: frame has no name");this.setStateLevel("LOADING"),i=this,w=v.contentWindow,b=W.getIFrameDocument(v),S=b.readyState,S=S==="complete",s=c.defaults.cacheDefaults.loadCache,o=c.defaults.cacheDefaults.storeCacheNow,u=c.defaults.cacheDefaults.storeCacheLater;if(r.cache){if(r.cache.loadMode)if(r.cache.loadMode==="reload")s=!1;else{if(r.cache.loadMode!=="cache")throw new Error("GameWindow.loadFrame: unkown cache load mode: "+r.cache.loadMode);s=!0}if(r.cache.storeMode)if(r.cache.storeMode==="off")o=!1,u=!1;else if(r.cache.storeMode==="onLoad")o=!0,u=!1;else{if(r.cache.storeMode!=="onClose")throw new Error("GameWindow.loadFrame: unkown cache store mode: "+r.cache.storeMode);o=!1,u=!0}}if("undefined"!=typeof r.autoParse){if("object"!=typeof r.autoParse)throw new TypeError("GameWindow.loadFrame: opts.autoParse must be object or undefined. Found: "+r.autoParse);if("undefined"!=typeof r.autoParsePrefix){if("string"!=typeof r.autoParsePrefix)throw new TypeError("GameWindow.loadFrame: opts.autoParsePrefix must be string or undefined. Found: "+r.autoParsePrefix);p=r.autoParsePrefix}if("undefined"!=typeof r.autoParseMod){if("string"!=typeof r.autoParseMod)throw new TypeError("GameWindow.loadFrame: opts.autoParseMod must be string or undefined. Found: "+r.autoParseMod);d=r.autoParseMod}f=r.autoParse}a="undefined"==typeof r.scrollUp?!0:r.scrollUp,this.unprocessedUri=e;if(this.cacheSupported===null){this.preCacheTest(function(){i.loadFrame(e,n,r)});return}e=this.processUri(e),this.cacheSupported===!1?(o=!1,u=!1,s=!1):(x=this.currentURIs[g],this.cache.hasOwnProperty(x)&&this.cache[x].cacheOnClose&&(E=b.documentElement,this.cache[x].contents=E.innerHTML),this.cache.hasOwnProperty(e)||(this.cache[e]={contents:null,cacheOnClose:!1}),this.cache[e].cacheOnClose=u,this.cache[e].contents===null&&(s=!1)),this.currentURIs[g]=e,m(this,1),v.style.visibility="hidden",(!s||!S)&&l(v,function(){i.directFrameDocumentAccess===null&&y(i),h(i,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)})}),s?S&&h(this,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)}):w.location.replace(e),w.node=t},c.prototype.processUri=function(e){return e.charAt(0)!=="/"&&e.substr(0,7)!=="http://"&&(this.uriPrefix&&(e=this.uriPrefix+e),this.uriChannel&&(e=this.uriChannel+e)),e},c.prototype.updateLoadFrameState=function(n,r,i,s,u){var a,f;a=m(this,-1),a&&this.setStateLevel("LOADED"),n&&n.call(t.game),r&&this.searchReplace(r,i,s),u&&e.scrollTo&&e.scrollTo(0,0),t.events.ee.game.emit("FRAME_LOADED"),t.events.ee.stage.emit("FRAME_LOADED"),t.events.ee.step.emit("FRAME_LOADED"),a?(f=t.game.getStageLevel(),f===o&&t.emit("LOADED")):t.silly("game-window: "+this.areLoading+" frames "+"still loading.")},c.prototype.clearPageBody=function(){this.reset(),document.body.innerHTML=""},c.prototype.clearPage=function(){this.reset();try{document.documentElement.innerHTML=""}catch(e){this.removeChildrenFromNode(document.documentElement)}},c.prototype.setUriPrefix=function(e){if(e!==null&&"string"!=typeof e)throw new TypeError("GameWindow.setUriPrefix: uriPrefix must be string or null. Found: "+e);this.conf.uriPrefix=this.uriPrefix=e},c.prototype.setUriChannel=function(e){if("string"==typeof e)e.charAt(0)!=="/"&&(e="/"+e),e.charAt(e.length-1)!=="/"&&(e+="/");else if(e!==null)throw new TypeError("GameWindow.uriChannel: uriChannel must be string or null. Found: "+e);this.uriChannel=e},c.prototype.adjustFrameHeight=function(){var t,n;return n=function(t){var n,r,i;W.adjustHeaderOffset(),n=W.getFrame();if(!n||!n.contentWindow)return;if(!n.contentWindow.document.body){W.adjustFrameHeight(t,120);return}W.conf.adjustFrameHeight===!1?r="100vh":(r=e.innerHeight||e.clientHeight,i=n.contentWindow.document.body.offsetHeight,i+=60,W.headerPosition==="top"&&(i+=W.headerOffset),rDo not refresh the page!
Maximum Waiting Time: ",countdownResuming:e.countdownResumingText||"Resuming soon...",formatCountdown:function(e){var t;return t="",e=J.parseMilliseconds(e),e[2]&&(t+=e[2]+" min "),e[3]&&(t+=e[3]+" sec"),t||0}},this.lockedInputs=[],this.enable()}e.WaitScreen=l,l.version="0.10.0",l.description="Shows a waiting screen";var n,r;n=["button","select","textarea","input"],r=n.length,l.prototype.enable=function(){if(this.enabled)return;node.events.ee.game.on("REALLY_DONE",s),node.events.ee.game.on("STEPPING",o),node.events.ee.game.on("PLAYING",u),node.events.ee.game.on("PAUSED",a),node.events.ee.game.on("RESUMED",f),this.enabled=!0},l.prototype.disable=function(){if(!this.enabled)return;node.events.ee.game.off("REALLY_DONE",s),node.events.ee.game.off("STEPPING",o),node.events.ee.game.off("PLAYING",u),node.events.ee.game.off("PAUSED",a),node.events.ee.game.off("RESUMED",f),this.enabled=!1},l.prototype.lock=function(e,t){var n,r;r=this.defaultTexts,"undefined"==typeof e&&(e=r.locked),"undefined"==typeof document.getElementsByTagName&&node.warn("WaitScreen.lock: cannot lock inputs"),i(document),n=W.getFrameDocument(),n&&i(n),this.waitingDiv||(this.root||(this.root=W.getFrameRoot()||document.body),this.waitingDiv=W.add("div",this.root,this.id),this.contentDiv=W.add("div",this.waitingDiv,"ng_waitscreen-content-div")),this.waitingDiv.style.display==="none"&&(this.waitingDiv.style.display=""),this.contentDiv.innerHTML=e,this.displayCountdown&&t?(this.countdownDiv||(this.countdownDiv=W.add("div",this.waitingDiv,"ng_waitscreen-countdown-div"),this.countdownDiv.innerHTML=r.countdown,this.countdownSpan=W.add("span",this.countdownDiv,"ng_waitscreen-countdown-span")),this.countdown=t,this.countdownSpan.innerHTML=r.formatCountdown(t),this.countdownDiv.style.display="",this.countdownInterval=setInterval(function(){var e;e=W.waitScreen;if(!W.isScreenLocked()){clearInterval(e.countdownInterval);return}e.countdown-=1e3,e.countdown<0?(clearInterval(e.countdownInterval),e.countdownDiv.style.display="none",e.contentDiv.innerHTML=r.countdownResuming):e.countdownSpan.innerHTML=r.formatCountdown(e.countdown)},1e3)):this.countdownDiv&&(this.countdownDiv.style.display="none")},l.prototype.unlock=function(){var e,t;this.waitingDiv&&this.waitingDiv.style.display===""&&(this.waitingDiv.style.display="none"),this.countdownInterval&&clearInterval(this.countdownInterval);try{t=this.lockedInputs.length;for(e=-1;++e2&&(t=arguments[1],n=arguments[2]);if("undefined"==typeof n)n="ng_replace_";else if(null===n)n="";else if("string"!=typeof n)throw new TypeError("GameWindow.searchReplace: prefix must be string, null or undefined. Found: "+n);e=arguments[0];if(J.isArray(e)){s=-1,i=e.length;for(;++sn.dt)return 1}else{if(e.dtn.dt)return-1}if(e.dt===n.dt){if("undefined"==typeof e.dd)return-1;if("undefined"==typeof n.dd)return 1;if(e.ddn.dd)return 1;if(e.nddbidn.nddbid)return-1}return 0},this.DL=e.list||document.createElement(this.FIRST_LEVEL),this.DL.id=e.id||this.id,e.className&&(this.DL.className=e.className),this.options.title&&this.DL.appendChild(document.createTextNode(e.title)),this.htmlRenderer=new r(e.render)},s.prototype._add=function(e){if(!e)return;this.insert(e),this.auto_update&&this.parse()},s.prototype.addDT=function(e,t){if("undefined"==typeof e)return;this.last_dt++,t="undefined"!=typeof t?t:this.last_dt,this.last_dd=0;var n=new o({dt:t,content:e});return this._add(n)},s.prototype.addDD=function(e,t,n){if("undefined"==typeof e)return;t="undefined"!=typeof t?t:this.last_dt,n="undefined"!=typeof n?n:this.last_dd++;var r=new o({dt:t,dd:n,content:e});return this._add(r)},s.prototype.parse=function(){this.sort();var e=null,t=null,n=function(){var n=document.createElement(this.SECOND_LEVEL);return this.DL.appendChild(n),t=null,e=n,n},r=function(){var e=document.createElement(this.THIRD_LEVEL);return this.DL.appendChild(e),e};if(this.DL){while(this.DL.hasChildNodes())this.DL.removeChild(this.DL.firstChild);this.options.title&&this.DL.appendChild(document.createTextNode(this.options.title))}for(var i=0;ithis.pointers[e])this.pointers[e]=t;return this.pointers[e]},u.prototype.addMultiple=function(e,t,n,r){var i,s,o,u;f("addMultiple",e,n,r);if(t&&"string"!=typeof t||t&&"undefined"==typeof this.pointers[t])throw new TypeError("Table.addMultiple: dim must be a valid dimension (x or y) or undefined.");t=t||"x",n=this.getCurrPointer("x",n),r=this.getNextPointer("y",r),n="undefined"!=typeof n?n:this.pointers.x===null?0:this.pointers.x,r="undefined"!=typeof r?r:this.pointers.y===null?0:this.pointers.y,J.isArray(e)||(e=[e]),i=-1,s=e.length;for(;++ih+1){d=this.db[u].y-(h+1);for(a=0;a=1&&(e[0].style.display="none")})(document.getElementsByTagName("noscript"))},1e3),this.init(c.defaults),t.silly("node-window: created.")}function h(e,t,n,r,i,s,o){var u,a;n=W.getElementById(r),u=W.getIFrameDocument(n).documentElement,i&&(u.innerHTML=e.cache[t].contents),r===e.frameName&&(e.frameWindow=n.contentWindow,e.frameDocument=e.getIFrameDocument(n),e.conf.rightClickDisabled&&J.disableRightClick(e.frameDocument),e.conf.noEscape&&(e.frameDocument.onkeydown=document.onkeydown)),e.styleElement=null,p(n),a=function(){v(n,e.globalLibs.concat(e.frameLibs.hasOwnProperty(t)?e.frameLibs[t]:[])),s&&(e.cache[t].contents=u.innerHTML),o(),b()},i?d(n,a):a()}function p(e){var t,n,r,i;n=W.getIFrameDocument(e),r=W.getElementsByClassName(n,"injectedlib","script");for(t=0;t=n.length&&r&&r()})}(o,a),e.frames[f].location.replace(o)},c.prototype.clearCache=function(){this.cache={}},c.prototype.getElementById=c.prototype.gid=function(e){var t,n;return n=this.getFrameDocument(),t=null,n&&n.getElementById&&(t=n.getElementById(e)),t||(t=document.getElementById(e)),t},c.prototype.getElementsByTagName=function(e){var t;return t=this.getFrameDocument(),t?t.getElementsByTagName(e):document.getElementsByTagName(e)},c.prototype.getElementsByClassName=function(e,t){var n;return n=this.getFrameDocument()||document,J.getElementsByClassName(n,e,t)},c.prototype.loadFrame=function(e,n,r){var i,s,o,u,a,f,p,d,v,g,b,w,E,S,x;if("string"!=typeof e)throw new TypeError("GameWindow.loadFrame: uri must be string. Found: "+e);if(n&&"function"!=typeof n)throw new TypeError("GameWindow.loadFrame: func must be function or undefined. Found: "+n);if(r&&"object"!=typeof r)throw new TypeError("GameWindow.loadFrame: opts must be object or undefined. Found: "+r);r=r||{},v=this.getFrame(),g=this.frameName;if(!v)throw new Error("GameWindow.loadFrame: no frame found");if(!g)throw new Error("GameWindow.loadFrame: frame has no name");this.setStateLevel("LOADING"),i=this,w=v.contentWindow,b=W.getIFrameDocument(v),S=b.readyState,S=S==="complete",s=c.defaults.cacheDefaults.loadCache,o=c.defaults.cacheDefaults.storeCacheNow,u=c.defaults.cacheDefaults.storeCacheLater;if(r.cache){if(r.cache.loadMode)if(r.cache.loadMode==="reload")s=!1;else{if(r.cache.loadMode!=="cache")throw new Error("GameWindow.loadFrame: unkown cache load mode: "+r.cache.loadMode);s=!0}if(r.cache.storeMode)if(r.cache.storeMode==="off")o=!1,u=!1;else if(r.cache.storeMode==="onLoad")o=!0,u=!1;else{if(r.cache.storeMode!=="onClose")throw new Error("GameWindow.loadFrame: unkown cache store mode: "+r.cache.storeMode);o=!1,u=!0}}if("undefined"!=typeof r.autoParse){if("object"!=typeof r.autoParse)throw new TypeError("GameWindow.loadFrame: opts.autoParse must be object or undefined. Found: "+r.autoParse);if("undefined"!=typeof r.autoParsePrefix){if("string"!=typeof r.autoParsePrefix)throw new TypeError("GameWindow.loadFrame: opts.autoParsePrefix must be string or undefined. Found: "+r.autoParsePrefix);p=r.autoParsePrefix}if("undefined"!=typeof r.autoParseMod){if("string"!=typeof r.autoParseMod)throw new TypeError("GameWindow.loadFrame: opts.autoParseMod must be string or undefined. Found: "+r.autoParseMod);d=r.autoParseMod}f=r.autoParse}a="undefined"==typeof r.scrollUp?!0:r.scrollUp,this.unprocessedUri=e;if(this.cacheSupported===null){this.preCacheTest(function(){i.loadFrame(e,n,r)});return}e=this.processUri(e),this.cacheSupported===!1?(o=!1,u=!1,s=!1):(x=this.currentURIs[g],this.cache.hasOwnProperty(x)&&this.cache[x].cacheOnClose&&(E=b.documentElement,this.cache[x].contents=E.innerHTML),this.cache.hasOwnProperty(e)||(this.cache[e]={contents:null,cacheOnClose:!1}),this.cache[e].cacheOnClose=u,this.cache[e].contents===null&&(s=!1)),this.currentURIs[g]=e,m(this,1),v.style.visibility="hidden",(!s||!S)&&l(v,function(){i.directFrameDocumentAccess===null&&y(i),h(i,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)})}),s?S&&h(this,e,v,g,s,o,function(){i.updateLoadFrameState(n,f,d,p,a)}):w.location.replace(e),w.node=t},c.prototype.processUri=function(e){return e.charAt(0)!=="/"&&e.substr(0,7)!=="http://"&&(this.uriPrefix&&(e=this.uriPrefix+e),this.uriChannel&&(e=this.uriChannel+e)),e},c.prototype.updateLoadFrameState=function(n,r,i,s,u){var a,f;a=m(this,-1),a&&this.setStateLevel("LOADED"),n&&n.call(t.game),r&&this.searchReplace(r,i,s),u&&e.scrollTo&&e.scrollTo(0,0),t.events.ee.game.emit("FRAME_LOADED"),t.events.ee.stage.emit("FRAME_LOADED"),t.events.ee.step.emit("FRAME_LOADED"),a?(f=t.game.getStageLevel(),f===o&&t.emit("LOADED")):t.silly("game-window: "+this.areLoading+" frames "+"still loading.")},c.prototype.clearPageBody=function(){this.reset(),document.body.innerHTML=""},c.prototype.clearPage=function(){this.reset();try{document.documentElement.innerHTML=""}catch(e){this.removeChildrenFromNode(document.documentElement)}},c.prototype.setUriPrefix=function(e){if(e!==null&&"string"!=typeof e)throw new TypeError("GameWindow.setUriPrefix: uriPrefix must be string or null. Found: "+e);this.conf.uriPrefix=this.uriPrefix=e},c.prototype.setUriChannel=function(e){if("string"==typeof e)e.charAt(0)!=="/"&&(e="/"+e),e.charAt(e.length-1)!=="/"&&(e+="/");else if(e!==null)throw new TypeError("GameWindow.uriChannel: uriChannel must be string or null. Found: "+e);this.uriChannel=e},c.prototype.adjustFrameHeight=function(){var t,n;return n=function(t){var n,r,i;W.adjustHeaderOffset(),n=W.getFrame();if(!n||!n.contentWindow)return;if(!n.contentWindow.document.body){W.adjustFrameHeight(t,120);return}W.conf.adjustFrameHeight===!1?r="100vh":(r=e.innerHeight||e.clientHeight,i=n.contentWindow.document.body.offsetHeight,i+=60,W.headerPosition==="top"&&(i+=W.headerOffset),rDo not refresh the page!
Maximum Waiting Time: ",countdownResuming:e.countdownResumingText||"Resuming soon...",formatCountdown:function(e){var t;return t="",e=J.parseMilliseconds(e),e[2]&&(t+=e[2]+" min "),e[3]&&(t+=e[3]+" sec"),t||0}},this.lockedInputs=[],this.enable()}e.WaitScreen=l,l.version="0.10.0",l.description="Shows a waiting screen";var n,r;n=["button","select","textarea","input"],r=n.length,l.prototype.enable=function(){if(this.enabled)return;node.events.ee.game.on("REALLY_DONE",s),node.events.ee.game.on("STEPPING",o),node.events.ee.game.on("PLAYING",u),node.events.ee.game.on("PAUSED",a),node.events.ee.game.on("RESUMED",f),this.enabled=!0},l.prototype.disable=function(){if(!this.enabled)return;node.events.ee.game.off("REALLY_DONE",s),node.events.ee.game.off("STEPPING",o),node.events.ee.game.off("PLAYING",u),node.events.ee.game.off("PAUSED",a),node.events.ee.game.off("RESUMED",f),this.enabled=!1},l.prototype.lock=function(e,t){var n,r;r=this.defaultTexts,"undefined"==typeof e&&(e=r.locked),"undefined"==typeof document.getElementsByTagName&&node.warn("WaitScreen.lock: cannot lock inputs"),i(document),n=W.getFrameDocument(),n&&i(n),this.waitingDiv||(this.root||(this.root=W.getFrameRoot()||document.body),this.waitingDiv=W.add("div",this.root,this.id),this.contentDiv=W.add("div",this.waitingDiv,"ng_waitscreen-content-div")),this.waitingDiv.style.display==="none"&&(this.waitingDiv.style.display=""),this.contentDiv.innerHTML=e,this.displayCountdown&&t?(this.countdownDiv||(this.countdownDiv=W.add("div",this.waitingDiv,"ng_waitscreen-countdown-div"),this.countdownDiv.innerHTML=r.countdown,this.countdownSpan=W.add("span",this.countdownDiv,"ng_waitscreen-countdown-span")),this.countdown=t,this.countdownSpan.innerHTML=r.formatCountdown(t),this.countdownDiv.style.display="",this.countdownInterval=setInterval(function(){var e;e=W.waitScreen;if(!W.isScreenLocked()){clearInterval(e.countdownInterval);return}e.countdown-=1e3,e.countdown<0?(clearInterval(e.countdownInterval),e.countdownDiv.style.display="none",e.contentDiv.innerHTML=r.countdownResuming):e.countdownSpan.innerHTML=r.formatCountdown(e.countdown)},1e3)):this.countdownDiv&&(this.countdownDiv.style.display="none")},l.prototype.unlock=function(){var e,t;this.waitingDiv&&this.waitingDiv.style.display===""&&(this.waitingDiv.style.display="none"),this.countdownInterval&&clearInterval(this.countdownInterval);try{t=this.lockedInputs.length;for(e=-1;++e2&&(t=arguments[1],n=arguments[2]);if("undefined"==typeof n)n="ng_replace_";else if(null===n)n="";else if("string"!=typeof n)throw new TypeError("GameWindow.searchReplace: prefix must be string, null or undefined. Found: "+n);e=arguments[0];if(J.isArray(e)){s=-1,i=e.length;for(;++sn.dt)return 1}else{if(e.dtn.dt)return-1}if(e.dt===n.dt){if("undefined"==typeof e.dd)return-1;if("undefined"==typeof n.dd)return 1;if(e.ddn.dd)return 1;if(e.nddbidn.nddbid)return-1}return 0},this.DL=e.list||document.createElement(this.FIRST_LEVEL),this.DL.id=e.id||this.id,e.className&&(this.DL.className=e.className),this.options.title&&this.DL.appendChild(document.createTextNode(e.title)),this.htmlRenderer=new r(e.render)},s.prototype._add=function(e){if(!e)return;this.insert(e),this.auto_update&&this.parse()},s.prototype.addDT=function(e,t){if("undefined"==typeof e)return;this.last_dt++,t="undefined"!=typeof t?t:this.last_dt,this.last_dd=0;var n=new o({dt:t,content:e});return this._add(n)},s.prototype.addDD=function(e,t,n){if("undefined"==typeof e)return;t="undefined"!=typeof t?t:this.last_dt,n="undefined"!=typeof n?n:this.last_dd++;var r=new o({dt:t,dd:n,content:e});return this._add(r)},s.prototype.parse=function(){this.sort();var e=null,t=null,n=function(){var n=document.createElement(this.SECOND_LEVEL);return this.DL.appendChild(n),t=null,e=n,n},r=function(){var e=document.createElement(this.THIRD_LEVEL);return this.DL.appendChild(e),e};if(this.DL){while(this.DL.hasChildNodes())this.DL.removeChild(this.DL.firstChild);this.options.title&&this.DL.appendChild(document.createTextNode(this.options.title))}for(var i=0;ithis.pointers[e])this.pointers[e]=t;return this.pointers[e]},u.prototype.addMultiple=function(e,t,n,r){var i,s,o,u;f("addMultiple",e,n,r);if(t&&"string"!=typeof t||t&&"undefined"==typeof this.pointers[t])throw new TypeError("Table.addMultiple: dim must be a valid dimension (x or y) or undefined.");t=t||"x",n=this.getCurrPointer("x",n),r=this.getNextPointer("y",r),n="undefined"!=typeof n?n:this.pointers.x===null?0:this.pointers.x,r="undefined"!=typeof r?r:this.pointers.y===null?0:this.pointers.y,J.isArray(e)||(e=[e]),i=-1,s=e.length;for(;++ih+1){d=this.db[u].y-(h+1);for(a=0;a