From 6c85c1b4edbe323db12dfddecfb19e37258b101a Mon Sep 17 00:00:00 2001 From: Cole Kissane Date: Wed, 10 Oct 2018 16:27:59 -0700 Subject: [PATCH] Fix problems with window.orientation deprecation (FIXES HTML-199) --- Client/player/pocketCodePlayer.js | 2 +- Client/player/pocketCodePlayer.min.js | 2 +- Client/pocketCode/libs/smartJs/sj.custom.min.js | 2 +- Client/pocketCode/scripts/components/device.js | 10 +++++----- Client/pocketCode/scripts/components/deviceFeature.js | 2 +- Client/smartJs/sj-ui.js | 2 +- Client/smartJs/sj.js | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Client/player/pocketCodePlayer.js b/Client/player/pocketCodePlayer.js index 0ad0db2b..3f2c35b2 100755 --- a/Client/player/pocketCodePlayer.js +++ b/Client/player/pocketCodePlayer.js @@ -846,7 +846,7 @@ PocketCode.Web = { function PlayerInterface() { this._domLoaded = false; this._addDomListener(window, 'load', this._initOnLoad); - this._isMobile = (typeof window.orientation !== 'undefined') || !!navigator.userAgent.match(/iPad|iPhone|Android|BlackBerry|Phone|ZuneWP7|WPDesktop|webOS/i); + this._isMobile = (typeof ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined)) !== 'undefined') || !!navigator.userAgent.match(/iPad|iPhone|Android|BlackBerry|Phone|ZuneWP7|WPDesktop|webOS/i); } PlayerInterface.prototype = { diff --git a/Client/player/pocketCodePlayer.min.js b/Client/player/pocketCodePlayer.min.js index 319839a2..ef1abc63 100755 --- a/Client/player/pocketCodePlayer.min.js +++ b/Client/player/pocketCodePlayer.min.js @@ -1 +1 @@ -'use strict';if(!PocketCode)var PocketCode={};PocketCode.server=0;if(PocketCode.server===0)PocketCode.domain='https://share.catrob.at/';else if(PocketCode.server===1)PocketCode.domain='https://web-test.catrob.at/';else PocketCode.domain='http://localhost/';PocketCode.websiteUrl=PocketCode.domain+'pocketcode/';PocketCode.projectUrl=PocketCode.websiteUrl+'program/{projectId}';PocketCode.mobileUrl=PocketCode.domain+'html5/player/{projectId}';PocketCode.mobileUrlRfc3066=PocketCode.domain+'html5/player/{projectId}/{rfc3066}';PocketCode.logoUrl=PocketCode.domain+'html5/pocketCode/img/logo.png';document.addEventListener('DOMContentLoaded',function(){var a=window.location.hostname,localFile=window.location.protocol=='file:';var b;if(!localFile&&(a==='localhost'||a===''))b='pocketCodePlayer.css';else b=PocketCode.domain+'html5/player/pocketCodePlayer.css';var c=document.createElement('link');c.href=b;c.type='text/css';c.rel='stylesheet';document.getElementsByTagName('head')[0].appendChild(c)});PocketCode.crossOrigin=new((function(){function CrossOrigin(){this._current=true;this._supported=false;this._initialized=false;var b=window.location,a=document.createElement('a');a.href=PocketCode.domain;var c=b.protocol=='https:'?'443':b.port;var d=a.port;if(d=='0')d='';if(a.hostname==b.hostname&&(d==b.port||d==c)&&a.protocol==b.protocol){this._current=false;this._initialized=true}else{var e=new Image();if(!('crossOrigin'in e)){this._initialized=true;return}e.crossOrigin='anonymous';e.onload=function(){this._supported=true;this._initialized=true}.bind(this);e.onerror=function(){this._supported=false;this._initialized=true}.bind(this);e.src=PocketCode.domain+'html5/pocketCode/img/favicon.png'}}Object.defineProperties(CrossOrigin.prototype,{current:{get:function(){return this._current},},supported:{get:function(){return this._supported},},initialized:{get:function(){return this._initialized},},});return CrossOrigin})())(),PocketCode.Web={resourceRoot:'',FullscreenApi:new((function(){function FullscreenApi(){if(window.addEventListener)window.addEventListener('load',this._initOnLoad.bind(this),false)}FullscreenApi.prototype={_initOnLoad:function(){this.supported=function(){if(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)return true;return false}();if(this.supported){this._addDomListener(document,'fullscreenchange',this._fullscreenchangeHandler);this._addDomListener(document,'webkitfullscreenchange',this._fullscreenchangeHandler);this._addDomListener(document,'mozfullscreenchange',this._fullscreenchangeHandler);this._addDomListener(document,'MSFullscreenChange',this._fullscreenchangeHandler)}this.lastExitDate=Date.now();this.onFullscreenChange=function(a){}},_addDomListener:function(a,b,c){var d=function(e){e.stopPropagation();return c.call(this,e)}.bind(this);if(a.addEventListener)a.addEventListener(b,d,false);return d},_removeDomListener:function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false);else a.detachEvent('on'+b,c)},bindF11:function(){if(this.supported&&!this.isBrowserFullscreen()){this._l1=this._addDomListener(document,'keydown',this._keyHandler);this._l2=this._addDomListener(document,'keyup',this._keyHandler);this._l3=this._addDomListener(document,'keypress',this._keyHandler)}},unbindF11:function(){if(!this._l1||!this._l2||!this._l3)return;this._removeDomListener(document,'keydown',this._l1);this._removeDomListener(document,'keyup',this._l2);this._removeDomListener(document,'keypress',this._l3)},isJsFullscreen:function(){if(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)return true;return false},isBrowserFullscreen:function(){return(window.outerHeight>=screen.height&&window.outerWidth>=screen.width)},requestFullscreen:function(a){a=a||document.documentElement;if(a.requestFullscreen){a.requestFullscreen()}else if(a.webkitRequestFullscreen){a.webkitRequestFullscreen()}else if(a.mozRequestFullScreen){a.mozRequestFullScreen()}else if(a.msRequestFullscreen){a.msRequestFullscreen()}},exitFullscreen:function(){if(document.exitFullscreen){document.exitFullscreen()}else if(document.webkitExitFullscreen){document.webkitExitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}},toggleFullscreen:function(e){if(this.supported){if(this.isJsFullscreen())this.exitFullscreen();else this.requestFullscreen()}},_fullscreenchangeHandler:function(e){window.setTimeout(function(){var a=this.isJsFullscreen;if(!a())this.lastExitDate=Date.now();this.onFullscreenChange(a())}.bind(this),10)},_keyHandler:function(e){e=e||window.event;var a=e.keyCode||e.which;if(a===122&&!e.altKey){e.preventDefault();e.stopPropagation();if(e.type==='keydown'&&!this.lastKeyDown){this.lastKeyDown=Date.now()}else if(e.type==='keyup'){var b=this.lastKeyDown-this.lastExitDate;if(!isNaN(b)&&b>700)this.toggleFullscreen(e);this.lastKeyDown=undefined}return false}},};return FullscreenApi})())(),ExitButton:(function(){function ExitButton(){var a=document.createElement('button');a.className='pc-webButton pc-backButton';a.innerHTML=''+''+''+''+'Exit';this.dom=a}return ExitButton})(),WebOverlay:(function(){function WebOverlay(){this.hwRatio=15/9;this.hPixelOffset=160;this.vPixelOffset=34;this.vpMinHeight=370;var a=document.createElement('div');a.className='pc-playerViewport';this.viewportContainer=a;var b=document.createElement('button');b.className='pc-webButton';b.innerHTML=''+''+'';this.closeButton=b;b=document.createElement('button');b.className='pc-webButton';b.innerHTML=''+''+'';this.fullscreenButton=b;b=document.createElement('button');b.className='pc-webButton';b.innerHTML=''+''+'';this.muteButton=b;var c=document.createElement('div');c.className='pc-webOverlay';c.dir='ltr';c.innerHTML='
'+'';var d=document.createElement('div');d.className='pc-webLayout';c.appendChild(d);var e=document.createElement('div');e.className='pc-webLayoutRow';e.innerHTML='
'+'
';d.appendChild(e);var f=document.createElement('div');f.className='pc-centerCol';e.appendChild(f);var g=document.createElement('div');g.className='pc-webViewportBorder';f.appendChild(g);g.appendChild(this.viewportContainer);var h=document.createElement('div');h.className='pc-rightCol';e.appendChild(h);var i=document.createElement('div');this.menuContainer=i;i.className='pc-webMenu';h.appendChild(i);i.appendChild(this.closeButton);i.appendChild(this.fullscreenButton);i.appendChild(this.muteButton);this.muteButton.disabled=true;this._dom=c;this.hidden=true;this._addDomListener(window,'resize',this._onResizeHandler);this._addDomListener(this.fullscreenButton,'click',this._toggleFullscreenHandler);this._addDomListener(this.fullscreenButton,'touchend',this._toggleFullscreenHandler)}WebOverlay.prototype={_addDomListener:function(a,b,c){var d=function(e){e.stopPropagation();return c.call(this,e)}.bind(this);if(a.addEventListener)a.addEventListener(b,d,false);return d},_removeDomListener:function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false)},_onResizeHandler:function(e){var a=this.viewportContainer.style;var b=window.innerWidth-this.hPixelOffset;var c=window.innerHeight-this.vPixelOffset;if(c=c/b){h=c;w=c/d}else{w=b;h=b*d}if(h100.0)throw new Error('invalid parameter: percentage');this.hidePending();var b=this.progressBar.style;b.display='';b.width=a+'%'},hideProgress:function(){this.progressBar.style.display='none'},_renderPending:function(){this._pendingCount++;var a=this._progressItems.children;if(this._pendingCount>a.length+3)this._pendingCount=1;for(var i=1,l=a.length;i<=l;i++){if(i>=this._pendingCount-3&&i<=this._pendingCount)a[i-1].style.backgroundColor='#ef7716';else a[i-1].style.backgroundColor=''}},setPending:function(){this.hideProgress();this._renderPending();this._loadingTimer=setInterval(this._renderPending.bind(this),400)},hidePending:function(){if(this._loadingTimer)clearInterval(this._loadingTimer);this._pendingCount=0;var a=this._progressItems.children;for(var i=0,l=a.length;i14)?14:a;this._dom.style.fontSize=a+'px'},show:function(){this._clickHandler=this._addDomListener(document,'click',function(e){e.preventDefault()});this._dblClickHandler=this._addDomListener(document,'dblclick',function(e){e.preventDefault()});this._touchStartHandler=this._addDomListener(document,'touchstart',function(e){e.preventDefault()});this._touchLeaveandler=this._addDomListener(document,'touchleave',function(e){e.preventDefault()});this._touchMoveHandler=this._addDomListener(document,'touchmove',function(e){e.preventDefault()});this._loadingIndicator.show();this._dom.style.display='';this._onResizeHandler()},hide:function(){this._removeDomListener(document,'click',this._clickHandler);this._removeDomListener(document,'dblclick',this._dblClickHandler);this._removeDomListener(document,'touchstart',this._touchStartHandler);this._removeDomListener(document,'touchleave',this._touchLeaveandler);this._removeDomListener(document,'touchmove',this._touchMoveHandler);this._dom.style.display='none';this._loadingIndicator.hide()},showBorder:function(){this._container.className+=' pc-splashScreenBorder '},hideBorder:function(){this._container.className=this._container.className.replace(' pc-splashScreenBorder ','').trim()},setProgress:function(a,b){if(a!==b){this._text.nodeValue=this._loadingText+'['+a+'/'+b+']';this._loadingIndicator.setProgress(100/b*a)}else{this._text.nodeValue=this._initialisingText;this._loadingIndicator.setPending()}},showError:function(){this._loadingIndicator.setProgress(0);this._text.parentNode.style.color='#A31515';this._text.nodeValue=this._errorText},};return SplashScreen})(),ResourceLoader:(function(){function ResourceLoader(a){this._resources=a;this._root=a.root;this._files=a.files;this._version=Date.now().toString().substring(3,6);this.onProgress=function(){};this.onError=function(){}};ResourceLoader.prototype={startLoading:function(){this._loadingAborted=false;var a=0;var b=this._files;if(b.length>0){this._updateProgress(0,b.length);this._loadingFileIdx=0;var c=b[0];this._requestFile(this._root,c,this._onFileLoadHandler,this._onErrorHandler)}},abortLoading:function(){this._loadingAborted=true},_requestFile:function(a,b,c,d){var e=a+b.url;if(document.getElementById(e)){setTimeout(c.bind(this),10);return}var f=document.head||document.getElementsByTagName("head")[0];switch(b.type){case'js':var g=false;var h=document.createElement("script");h.async=false;h.onerror=d.bind(this);h.onload=h.onreadystatechange=function(){if(!g&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){g=true;h.onload=h.onreadystatechange=null;setTimeout(c.bind(this),10)}}.bind(this);f.appendChild(h);h.id=e;h.src=e+'?v='+this._version;break;case'css':var i=document.createElement("link");i.type="text/css";i.rel="stylesheet";i.id=e;f.appendChild(i);var j=new Image();j.onerror=function(){i.href=e;setTimeout(c.bind(this),10)}.bind(this);j.src=e+'?v='+this._version;break}},_onFileLoadHandler:function(){if(this._errorOccured)return;if(this._loadingAborted)return;var a=this._files;var l=a.length;if(this._loadingFileIdx++0)history.back();else window.close()}},_deviceEmulatorLoadHandler:function(e){this._webOverlay.appendEmulator(e.emulator)},};return PlayerInterface})())(),};PocketCode.Web.resources={root:function(){var a=window.location.hostname,localFile=window.location.protocol=='file:';if(!localFile&&(a==='localhost'||a===''))return'../';return PocketCode.domain+'html5/'}(),files:[{url:'pocketCode/libs/smartJs/sj.custom.min.js',type:'js'},{url:'pocketCode/libs/soundjs/soundjs-0.6.1.custom.min.js',type:'js'},{url:'pocketCode/libs/iscroll/iscroll-5.3.1.custom.min.js',type:'js'},{url:'pocketCode/css/pocketCode.min.css',type:'css'},{url:'pocketCode/scripts/core.js',type:'js'},{url:'pocketCode/scripts/ui.js',type:'js'},{url:'pocketCode/scripts/model/bricksCore.js',type:'js'},{url:'pocketCode/scripts/model/bricksControl.js',type:'js'},{url:'pocketCode/scripts/model/bricksEvent.js',type:'js'},{url:'pocketCode/scripts/model/bricksLook.js',type:'js'},{url:'pocketCode/scripts/model/bricksMotion.js',type:'js'},{url:'pocketCode/scripts/model/bricksPen.js',type:'js'},{url:'pocketCode/scripts/model/bricksSound.js',type:'js'},{url:'pocketCode/scripts/model/bricksData.js',type:'js'},{url:'pocketCode/scripts/model/bricksUserScript.js',type:'js'},{url:'pocketCode/scripts/model/userVariable.js',type:'js'},{url:'pocketCode/scripts/model/userVariableHost.js',type:'js'},{url:'pocketCode/scripts/model/look.js',type:'js'},{url:'pocketCode/scripts/model/sprite.js',type:'js'},{url:'pocketCode/scripts/model/scene.js',type:'js'},{url:'pocketCode/scripts/components/publishSubscribe.js',type:'js'},{url:'pocketCode/scripts/components/collisionManager.js',type:'js'},{url:'pocketCode/scripts/components/physicsWorld.js',type:'js'},{url:'pocketCode/scripts/components/deviceFeature.js',type:'js'},{url:'pocketCode/scripts/components/device.js',type:'js'},{url:'pocketCode/scripts/components/formula.js',type:'js'},{url:'pocketCode/scripts/components/imageHelper.js',type:'js'},{url:'pocketCode/scripts/components/imageStore.js',type:'js'},{url:'pocketCode/scripts/components/gameEngine.js',type:'js'},{url:'pocketCode/scripts/components/i18nProvider.js',type:'js'},{url:'pocketCode/scripts/components/math.js',type:'js'},{url:'pocketCode/scripts/components/loggingProvider.js',type:'js'},{url:'pocketCode/scripts/components/parser.js',type:'js'},{url:'pocketCode/scripts/components/proxy.js',type:'js'},{url:'pocketCode/scripts/components/renderingItem.js',type:'js'},{url:'pocketCode/scripts/components/soundManager.js',type:'js'},{url:'pocketCode/scripts/ui/button.js',type:'js'},{url:'pocketCode/scripts/ui/canvas.js',type:'js'},{url:'pocketCode/scripts/ui/dialog.js',type:'js'},{url:'pocketCode/scripts/ui/input.js',type:'js'},{url:'pocketCode/scripts/ui/expander.js',type:'js'},{url:'pocketCode/scripts/ui/menu.js',type:'js'},{url:'pocketCode/scripts/ui/playerStartScreen.js',type:'js'},{url:'pocketCode/scripts/ui/playerToolbar.js',type:'js'},{url:'pocketCode/scripts/ui/scrollContainer.js',type:'js'},{url:'pocketCode/scripts/ui/deviceEmulator.js',type:'js'},{url:'pocketCode/scripts/view/pageView.js',type:'js'},{url:'pocketCode/scripts/view/playerPageView.js',type:'js'},{url:'pocketCode/scripts/view/playerViewportView.js',type:'js'},{url:'pocketCode/scripts/controller/controllerCore.js',type:'js'},{url:'pocketCode/scripts/controller/playerPageController.js',type:'js'},{url:'pocketCode/scripts/controller/playerViewportController.js',type:'js'},{url:'player/scripts/playerApplication.js',type:'js'},{url:'player/scripts/ui/playerMenu.js',type:'js'},],};if(!launchProject){var launchProject=function(a,b,c){PocketCode.Web.PlayerInterface.launchProject(a,b,c)}} +'use strict';if(!PocketCode)var PocketCode={};PocketCode.server=0;if(PocketCode.server===0)PocketCode.domain='https://share.catrob.at/';else if(PocketCode.server===1)PocketCode.domain='https://web-test.catrob.at/';else PocketCode.domain='http://localhost/';PocketCode.websiteUrl=PocketCode.domain+'pocketcode/';PocketCode.projectUrl=PocketCode.websiteUrl+'program/{projectId}';PocketCode.mobileUrl=PocketCode.domain+'html5/player/{projectId}';PocketCode.mobileUrlRfc3066=PocketCode.domain+'html5/player/{projectId}/{rfc3066}';PocketCode.logoUrl=PocketCode.domain+'html5/pocketCode/img/logo.png';document.addEventListener('DOMContentLoaded',function(){var a=window.location.hostname,localFile=window.location.protocol=='file:';var b;if(!localFile&&(a==='localhost'||a===''))b='pocketCodePlayer.css';else b=PocketCode.domain+'html5/player/pocketCodePlayer.css';var c=document.createElement('link');c.href=b;c.type='text/css';c.rel='stylesheet';document.getElementsByTagName('head')[0].appendChild(c)});PocketCode.crossOrigin=new((function(){function CrossOrigin(){this._current=true;this._supported=false;this._initialized=false;var b=window.location,a=document.createElement('a');a.href=PocketCode.domain;var c=b.protocol=='https:'?'443':b.port;var d=a.port;if(d=='0')d='';if(a.hostname==b.hostname&&(d==b.port||d==c)&&a.protocol==b.protocol){this._current=false;this._initialized=true}else{var e=new Image();if(!('crossOrigin'in e)){this._initialized=true;return}e.crossOrigin='anonymous';e.onload=function(){this._supported=true;this._initialized=true}.bind(this);e.onerror=function(){this._supported=false;this._initialized=true}.bind(this);e.src=PocketCode.domain+'html5/pocketCode/img/favicon.png'}}Object.defineProperties(CrossOrigin.prototype,{current:{get:function(){return this._current},},supported:{get:function(){return this._supported},},initialized:{get:function(){return this._initialized},},});return CrossOrigin})())(),PocketCode.Web={resourceRoot:'',FullscreenApi:new((function(){function FullscreenApi(){if(window.addEventListener)window.addEventListener('load',this._initOnLoad.bind(this),false)}FullscreenApi.prototype={_initOnLoad:function(){this.supported=function(){if(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)return true;return false}();if(this.supported){this._addDomListener(document,'fullscreenchange',this._fullscreenchangeHandler);this._addDomListener(document,'webkitfullscreenchange',this._fullscreenchangeHandler);this._addDomListener(document,'mozfullscreenchange',this._fullscreenchangeHandler);this._addDomListener(document,'MSFullscreenChange',this._fullscreenchangeHandler)}this.lastExitDate=Date.now();this.onFullscreenChange=function(a){}},_addDomListener:function(a,b,c){var d=function(e){e.stopPropagation();return c.call(this,e)}.bind(this);if(a.addEventListener)a.addEventListener(b,d,false);return d},_removeDomListener:function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false);else a.detachEvent('on'+b,c)},bindF11:function(){if(this.supported&&!this.isBrowserFullscreen()){this._l1=this._addDomListener(document,'keydown',this._keyHandler);this._l2=this._addDomListener(document,'keyup',this._keyHandler);this._l3=this._addDomListener(document,'keypress',this._keyHandler)}},unbindF11:function(){if(!this._l1||!this._l2||!this._l3)return;this._removeDomListener(document,'keydown',this._l1);this._removeDomListener(document,'keyup',this._l2);this._removeDomListener(document,'keypress',this._l3)},isJsFullscreen:function(){if(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)return true;return false},isBrowserFullscreen:function(){return(window.outerHeight>=screen.height&&window.outerWidth>=screen.width)},requestFullscreen:function(a){a=a||document.documentElement;if(a.requestFullscreen){a.requestFullscreen()}else if(a.webkitRequestFullscreen){a.webkitRequestFullscreen()}else if(a.mozRequestFullScreen){a.mozRequestFullScreen()}else if(a.msRequestFullscreen){a.msRequestFullscreen()}},exitFullscreen:function(){if(document.exitFullscreen){document.exitFullscreen()}else if(document.webkitExitFullscreen){document.webkitExitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}},toggleFullscreen:function(e){if(this.supported){if(this.isJsFullscreen())this.exitFullscreen();else this.requestFullscreen()}},_fullscreenchangeHandler:function(e){window.setTimeout(function(){var a=this.isJsFullscreen;if(!a())this.lastExitDate=Date.now();this.onFullscreenChange(a())}.bind(this),10)},_keyHandler:function(e){e=e||window.event;var a=e.keyCode||e.which;if(a===122&&!e.altKey){e.preventDefault();e.stopPropagation();if(e.type==='keydown'&&!this.lastKeyDown){this.lastKeyDown=Date.now()}else if(e.type==='keyup'){var b=this.lastKeyDown-this.lastExitDate;if(!isNaN(b)&&b>700)this.toggleFullscreen(e);this.lastKeyDown=undefined}return false}},};return FullscreenApi})())(),ExitButton:(function(){function ExitButton(){var a=document.createElement('button');a.className='pc-webButton pc-backButton';a.innerHTML=''+''+''+''+'Exit';this.dom=a}return ExitButton})(),WebOverlay:(function(){function WebOverlay(){this.hwRatio=15/9;this.hPixelOffset=160;this.vPixelOffset=34;this.vpMinHeight=370;var a=document.createElement('div');a.className='pc-playerViewport';this.viewportContainer=a;var b=document.createElement('button');b.className='pc-webButton';b.innerHTML=''+''+'';this.closeButton=b;b=document.createElement('button');b.className='pc-webButton';b.innerHTML=''+''+'';this.fullscreenButton=b;b=document.createElement('button');b.className='pc-webButton';b.innerHTML=''+''+'';this.muteButton=b;var c=document.createElement('div');c.className='pc-webOverlay';c.dir='ltr';c.innerHTML='
'+'';var d=document.createElement('div');d.className='pc-webLayout';c.appendChild(d);var e=document.createElement('div');e.className='pc-webLayoutRow';e.innerHTML='
'+'
';d.appendChild(e);var f=document.createElement('div');f.className='pc-centerCol';e.appendChild(f);var g=document.createElement('div');g.className='pc-webViewportBorder';f.appendChild(g);g.appendChild(this.viewportContainer);var h=document.createElement('div');h.className='pc-rightCol';e.appendChild(h);var i=document.createElement('div');this.menuContainer=i;i.className='pc-webMenu';h.appendChild(i);i.appendChild(this.closeButton);i.appendChild(this.fullscreenButton);i.appendChild(this.muteButton);this.muteButton.disabled=true;this._dom=c;this.hidden=true;this._addDomListener(window,'resize',this._onResizeHandler);this._addDomListener(this.fullscreenButton,'click',this._toggleFullscreenHandler);this._addDomListener(this.fullscreenButton,'touchend',this._toggleFullscreenHandler)}WebOverlay.prototype={_addDomListener:function(a,b,c){var d=function(e){e.stopPropagation();return c.call(this,e)}.bind(this);if(a.addEventListener)a.addEventListener(b,d,false);return d},_removeDomListener:function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false)},_onResizeHandler:function(e){var a=this.viewportContainer.style;var b=window.innerWidth-this.hPixelOffset;var c=window.innerHeight-this.vPixelOffset;if(c=c/b){h=c;w=c/d}else{w=b;h=b*d}if(h100.0)throw new Error('invalid parameter: percentage');this.hidePending();var b=this.progressBar.style;b.display='';b.width=a+'%'},hideProgress:function(){this.progressBar.style.display='none'},_renderPending:function(){this._pendingCount++;var a=this._progressItems.children;if(this._pendingCount>a.length+3)this._pendingCount=1;for(var i=1,l=a.length;i<=l;i++){if(i>=this._pendingCount-3&&i<=this._pendingCount)a[i-1].style.backgroundColor='#ef7716';else a[i-1].style.backgroundColor=''}},setPending:function(){this.hideProgress();this._renderPending();this._loadingTimer=setInterval(this._renderPending.bind(this),400)},hidePending:function(){if(this._loadingTimer)clearInterval(this._loadingTimer);this._pendingCount=0;var a=this._progressItems.children;for(var i=0,l=a.length;i14)?14:a;this._dom.style.fontSize=a+'px'},show:function(){this._clickHandler=this._addDomListener(document,'click',function(e){e.preventDefault()});this._dblClickHandler=this._addDomListener(document,'dblclick',function(e){e.preventDefault()});this._touchStartHandler=this._addDomListener(document,'touchstart',function(e){e.preventDefault()});this._touchLeaveandler=this._addDomListener(document,'touchleave',function(e){e.preventDefault()});this._touchMoveHandler=this._addDomListener(document,'touchmove',function(e){e.preventDefault()});this._loadingIndicator.show();this._dom.style.display='';this._onResizeHandler()},hide:function(){this._removeDomListener(document,'click',this._clickHandler);this._removeDomListener(document,'dblclick',this._dblClickHandler);this._removeDomListener(document,'touchstart',this._touchStartHandler);this._removeDomListener(document,'touchleave',this._touchLeaveandler);this._removeDomListener(document,'touchmove',this._touchMoveHandler);this._dom.style.display='none';this._loadingIndicator.hide()},showBorder:function(){this._container.className+=' pc-splashScreenBorder '},hideBorder:function(){this._container.className=this._container.className.replace(' pc-splashScreenBorder ','').trim()},setProgress:function(a,b){if(a!==b){this._text.nodeValue=this._loadingText+'['+a+'/'+b+']';this._loadingIndicator.setProgress(100/b*a)}else{this._text.nodeValue=this._initialisingText;this._loadingIndicator.setPending()}},showError:function(){this._loadingIndicator.setProgress(0);this._text.parentNode.style.color='#A31515';this._text.nodeValue=this._errorText},};return SplashScreen})(),ResourceLoader:(function(){function ResourceLoader(a){this._resources=a;this._root=a.root;this._files=a.files;this._version=Date.now().toString().substring(3,6);this.onProgress=function(){};this.onError=function(){}};ResourceLoader.prototype={startLoading:function(){this._loadingAborted=false;var a=0;var b=this._files;if(b.length>0){this._updateProgress(0,b.length);this._loadingFileIdx=0;var c=b[0];this._requestFile(this._root,c,this._onFileLoadHandler,this._onErrorHandler)}},abortLoading:function(){this._loadingAborted=true},_requestFile:function(a,b,c,d){var e=a+b.url;if(document.getElementById(e)){setTimeout(c.bind(this),10);return}var f=document.head||document.getElementsByTagName("head")[0];switch(b.type){case'js':var g=false;var h=document.createElement("script");h.async=false;h.onerror=d.bind(this);h.onload=h.onreadystatechange=function(){if(!g&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){g=true;h.onload=h.onreadystatechange=null;setTimeout(c.bind(this),10)}}.bind(this);f.appendChild(h);h.id=e;h.src=e+'?v='+this._version;break;case'css':var i=document.createElement("link");i.type="text/css";i.rel="stylesheet";i.id=e;f.appendChild(i);var j=new Image();j.onerror=function(){i.href=e;setTimeout(c.bind(this),10)}.bind(this);j.src=e+'?v='+this._version;break}},_onFileLoadHandler:function(){if(this._errorOccured)return;if(this._loadingAborted)return;var a=this._files;var l=a.length;if(this._loadingFileIdx++0)history.back();else window.close()}},_deviceEmulatorLoadHandler:function(e){this._webOverlay.appendEmulator(e.emulator)},};return PlayerInterface})())(),};PocketCode.Web.resources={root:function(){var a=window.location.hostname,localFile=window.location.protocol=='file:';if(!localFile&&(a==='localhost'||a===''))return'../';return PocketCode.domain+'html5/'}(),files:[{url:'pocketCode/libs/smartJs/sj.custom.min.js',type:'js'},{url:'pocketCode/libs/soundjs/soundjs-0.6.1.custom.min.js',type:'js'},{url:'pocketCode/libs/iscroll/iscroll-5.3.1.custom.min.js',type:'js'},{url:'pocketCode/css/pocketCode.min.css',type:'css'},{url:'pocketCode/scripts/core.js',type:'js'},{url:'pocketCode/scripts/ui.js',type:'js'},{url:'pocketCode/scripts/model/bricksCore.js',type:'js'},{url:'pocketCode/scripts/model/bricksControl.js',type:'js'},{url:'pocketCode/scripts/model/bricksEvent.js',type:'js'},{url:'pocketCode/scripts/model/bricksLook.js',type:'js'},{url:'pocketCode/scripts/model/bricksMotion.js',type:'js'},{url:'pocketCode/scripts/model/bricksPen.js',type:'js'},{url:'pocketCode/scripts/model/bricksSound.js',type:'js'},{url:'pocketCode/scripts/model/bricksData.js',type:'js'},{url:'pocketCode/scripts/model/bricksUserScript.js',type:'js'},{url:'pocketCode/scripts/model/userVariable.js',type:'js'},{url:'pocketCode/scripts/model/userVariableHost.js',type:'js'},{url:'pocketCode/scripts/model/look.js',type:'js'},{url:'pocketCode/scripts/model/sprite.js',type:'js'},{url:'pocketCode/scripts/model/scene.js',type:'js'},{url:'pocketCode/scripts/components/publishSubscribe.js',type:'js'},{url:'pocketCode/scripts/components/collisionManager.js',type:'js'},{url:'pocketCode/scripts/components/physicsWorld.js',type:'js'},{url:'pocketCode/scripts/components/deviceFeature.js',type:'js'},{url:'pocketCode/scripts/components/device.js',type:'js'},{url:'pocketCode/scripts/components/formula.js',type:'js'},{url:'pocketCode/scripts/components/imageHelper.js',type:'js'},{url:'pocketCode/scripts/components/imageStore.js',type:'js'},{url:'pocketCode/scripts/components/gameEngine.js',type:'js'},{url:'pocketCode/scripts/components/i18nProvider.js',type:'js'},{url:'pocketCode/scripts/components/math.js',type:'js'},{url:'pocketCode/scripts/components/loggingProvider.js',type:'js'},{url:'pocketCode/scripts/components/parser.js',type:'js'},{url:'pocketCode/scripts/components/proxy.js',type:'js'},{url:'pocketCode/scripts/components/renderingItem.js',type:'js'},{url:'pocketCode/scripts/components/soundManager.js',type:'js'},{url:'pocketCode/scripts/ui/button.js',type:'js'},{url:'pocketCode/scripts/ui/canvas.js',type:'js'},{url:'pocketCode/scripts/ui/dialog.js',type:'js'},{url:'pocketCode/scripts/ui/input.js',type:'js'},{url:'pocketCode/scripts/ui/expander.js',type:'js'},{url:'pocketCode/scripts/ui/menu.js',type:'js'},{url:'pocketCode/scripts/ui/playerStartScreen.js',type:'js'},{url:'pocketCode/scripts/ui/playerToolbar.js',type:'js'},{url:'pocketCode/scripts/ui/scrollContainer.js',type:'js'},{url:'pocketCode/scripts/ui/deviceEmulator.js',type:'js'},{url:'pocketCode/scripts/view/pageView.js',type:'js'},{url:'pocketCode/scripts/view/playerPageView.js',type:'js'},{url:'pocketCode/scripts/view/playerViewportView.js',type:'js'},{url:'pocketCode/scripts/controller/controllerCore.js',type:'js'},{url:'pocketCode/scripts/controller/playerPageController.js',type:'js'},{url:'pocketCode/scripts/controller/playerViewportController.js',type:'js'},{url:'player/scripts/playerApplication.js',type:'js'},{url:'player/scripts/ui/playerMenu.js',type:'js'},],};if(!launchProject){var launchProject=function(a,b,c){PocketCode.Web.PlayerInterface.launchProject(a,b,c)}} diff --git a/Client/pocketCode/libs/smartJs/sj.custom.min.js b/Client/pocketCode/libs/smartJs/sj.custom.min.js index c9ec68e1..7e8d3b8b 100755 --- a/Client/pocketCode/libs/smartJs/sj.custom.min.js +++ b/Client/pocketCode/libs/smartJs/sj.custom.min.js @@ -7,4 +7,4 @@ * This is free and unencumbered software released into the public domain. * For more information, please refer to */ -'use strict';Object.prototype.merge=function(o){if(typeof o!=='object')return this;for(var m in o){if(o.hasOwnProperty(m)){if(typeof this[m]==='object'&&typeof o[m]==='object'&&!(o[m]instanceof Array))this[m].merge(o[m]);else this[m]=o[m]}}return this};Object.defineProperty(Object.prototype,'merge',{enumerable:false});Function.prototype.extends=function(a,b){b=b!==false?true:false;var c=this.prototype;if(b)this.prototype=new a();else this.prototype=Object.create(a.prototype);this.prototype.constructor=c.constructor};Object.defineProperty(Function.prototype,'extends',{enumerable:false});Array.prototype.insert=function(a,o){this.splice(a,0,o)};Object.defineProperty(Array.prototype,'insert',{enumerable:false});Array.prototype.remove=function(o){var a,counter=0;while((a=this.indexOf(o))!==-1){this.splice(a,1);counter++}return counter};Object.defineProperty(Array.prototype,'remove',{enumerable:false});Array.prototype.dispose=function(){for(var i=this.length-1;i>=0;i--){if(this[i]&&typeof this[i].dispose==='function'){this[i].dispose()}}this.length=0};Object.defineProperty(Array.prototype,'dispose',{enumerable:false});var SmartJs={_version:0.1,_objectId:0,getNewId:function(){return'sj'+this._objectId++},Device:{isIOs:((typeof window.orientation!=='undefined')&&navigator.userAgent.match(/iPad|iPhone|iPod/i)&&!navigator.userAgent.match(/IEMobile|Windows Phone/i)),isFirefoxOS:(!!"mozApps"in navigator&&navigator.userAgent.search("Mobile")!=-1&&avigator.userAgent.search("Android")<0),isTouch:('ontouchstart'in window)||('msMaxTouchPoints'in navigator&&navigator.msMaxTouchPoints>0)||('maxTouchPoints'in navigator&&navigator.maxTouchPoints>0),isMobile:(typeof window.orientation!=='undefined')||!!navigator.userAgent.match(/iPad|iPhone|Android|BlackBerry|Phone|ZuneWP7|WPDesktop|webOS/i),},isBrowserCompatible:function(){var d=true;var f={Object_getPrototypeOf:function(){if(!Object.getPrototypeOf){d=false;return false}return true}(),Object_defineProperty:function(){if(!Object.defineProperty){d=false;return false}else{var a={};try{Object.defineProperty(a,'a',{value:'test',writable:true,enumerable:true,configurable:true})}catch(ex){d=false;return false}}return true}(),Array_indexOf:function(){if([].indexOf)return true;d=false;return false}(),document_addEventListener:function(){if(document.addEventListener)return true;d=false;return false}(),event_stopPropagation:function(){var e=document.createEvent('MouseEvents');e.initEvent('click',false,true);if(e.stopPropagation)return true;d=false;return false}(),String_trim:function(){if(''.trim)return true;d=false;return false}(),window_getComputedStyle:function(){if(!window.getComputedStyle){d=false;return false}return true}(),cssBoxSizing_borderBox:function(){var a=document.createElement('div');var b=a.style;b.position='absolute';b.top='-200px';b.left='-200px';b.boxSizing='border-box';b.border='solid 30px black';b.height='100px';b.width='100px';document.body.appendChild(a);var c=Math.abs(a.offsetHeight-100)<2&&Math.abs(a.offsetWidth-100)<2;document.body.removeChild(a);a=undefined;if(c)return true;d=false;return false}(),xmlHttpRequest:function(){try{var a=new XMLHttpRequest()}catch(e){d=false;return false}return true}(),};return{result:d,tests:f}},};SmartJs.Core={};SmartJs.Core={String:(function(){function Strg(a){this._string=a;this._format=arguments}Strg.prototype.merge({toString:function(){return this._string.replace(/({)(\d+)(})/gi,function(a,b,c){var d=parseInt(c)+1;return this._format[d].toString()}.bind(this))},});return Strg})(),Component:(function(){function Component(a){if(a)this._mergeProperties(a)}Object.defineProperties(Component.prototype,{objClassName:{get:function(){return this.constructor.toString().match(/function\s*(\w+)/)[1]},},});Component.prototype.merge({__dispose:function(a){if(this._disposing||this._disposed)return;this._disposing=true;for(var b in this){if(typeof this[b]==='function'||!this.hasOwnProperty(b))continue;if(this[b]&&typeof this[b].dispose==='function'&&(!this[b]._disposing||!this[b]._disposed)){this[b].dispose()}if(typeof b!=='function'&&b!=='_disposing')delete this[b]}var c=Object.getPrototypeOf(this);if(typeof c.__dispose==='function')c.__dispose(true);if(!a)this._disposed=true;delete this._disposing},dispose:function(){this.__dispose();delete this.constructor;this._disposed=true},_mergeProperties:function(a,b){if(!a)return;b=b||this;for(var p in a){if(typeof a[p]==='object'&&!(a[p]instanceof Array)){this._mergeProperties(a[p],b[p])}else{var c=b[p];try{b[p]=a[p]}catch(e){}}}},});return Component})(),};SmartJs.Core.EventTarget=(function(){EventTarget.extends(SmartJs.Core.Component,false);function EventTarget(a){SmartJs.Core.Component.call(this,a)}EventTarget.prototype.merge({_addDomListener:function(a,b,c,d){var f=function(e){e=e||{};if(d){if(d.hasOwnProperty('stopPropagation')&&d.stopPropagation!==false)e.stopPropagation();e.merge(d)}return c.call(this,e)}.bind(this);if(a.addEventListener)a.addEventListener(b,f,false);else a.attachEvent('on'+b,f);return f},_removeDomListener:function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false);else a.detachEvent('on'+b,c)},});return EventTarget})();SmartJs.Event={Event:(function(){Event.extends(SmartJs.Core.Component);function Event(a){this.target=a;this._listeners=[]};Object.defineProperties(Event.prototype,{listenersAttached:{get:function(){return this._listeners&&this._listeners.length>0},},});Event.prototype.merge({addEventListener:function(a){var b=this.__listenerIndex(a);if(b==-1){this._listeners.push(a);return true}return false},removeEventListener:function(a){if(this._disposed)return false;var b=this.__listenerIndex(a);if(b>=0){this._listeners.splice(b,1);return true}return false},__listenerIndex:function(a){var b=this._listeners.indexOf(a);if(b>=0)return b;var c=this._listeners;var d;for(var i=0,l=c.length;i0||(document.cookie='test').indexOf.call(document.cookie,'test')>-1))&&!!JSON;if(this._supported)this._deleteKey('test')}CookieAdapter.prototype.merge({_setValue:function(a,b){document.cookie=a+'='+b+'; path=/; expires='+this._expires},_getValue:function(a){var b=(document.cookie.match('(^|; )'+a+'=([^;]*)')||0)[2];if(b)return b;return undefined},_deleteKey:function(a){document.cookie=a+'=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;'},_clear:function(){var a=document.cookie.split(';'),cookie;for(var i=0;i-1)this.deleteKey(cookie.substr(0,b))}},});return CookieAdapter})(),LocalStorageAdapter:(function(){LocalStorageAdapter.extends(SmartJs.Components.StorageAdapter,false);function LocalStorageAdapter(){SmartJs.Components.StorageAdapter.call(this);try{localStorage.setItem('test','test');localStorage.removeItem('test');this._supported=true}catch(e){this._supported=false}}LocalStorageAdapter.prototype.merge({_setValue:function(a,b){localStorage.setItem(a,b)},_getValue:function(a){return localStorage.getItem(a)},_deleteKey:function(a){localStorage.removeItem(a)},_clear:function(){var a=[];for(var i=0,l=localStorage.length;i0){this._loading=true;this._requestFile(0)}else this._onLoad.dispatchEvent()},abortLoading:function(){this._loading=false},_fileErrorHandler:function(e){if(!this._loading)return;this._loading=false;var a=e.fileIndex;this._onError.dispatchEvent({file:this._registeredFiles[e.fileIndex],element:e.element})},_fileSuccessHandler:function(e){if(!this._loading)return;var a=e.fileIndex;if(this.useSizeForProgressCalculation){var b=this._registeredFiles[a];this._loadedSize+=b.size;this._onProgressChange.dispatchEvent({progress:Math.round(this._loadedSize/this._totalSize*100),file:this._registeredFiles[a],element:e.element})}else this._onProgressChange.dispatchEvent({progress:Math.round((a+1)/this._registeredFiles.length*100),file:this._registeredFiles[a],element:e.element});if(a+1==this._registeredFiles.length){this._loading=false;this._onLoad.dispatchEvent()}else{var c=this._requestFile.bind(this,a+1);window.setTimeout(c,20)}},_requestFile:function(a){if(this._disposed)return;var b=document.head||document.getElementsByTagName('head')[0];var c=this._registeredFiles[a];var d=document.getElementById(c.url);if(d){this._fileSuccessHandler({fileIndex:a,element:d});return}switch(c.type){case'js':var f=document.createElement('script');f.async=false;this._addDomListener(f,'error',this._fileErrorHandler,{fileIndex:a,element:f});var g=false;f.onload=f.onreadystatechange=function(e){if(!g&&(!f.readyState||f.readyState==='loaded'||f.readyState==='complete')){g=true;f.onload=f.onreadystatechange=null;e=e||{};e.merge({fileIndex:a,element:f});this._fileSuccessHandler(e)}}.bind(this);b.appendChild(f);f.id=f.src=c.url;break;case'css':var h=document.createElement('link');h.type='text/css';h.rel='stylesheet';h.id=c.url;b.appendChild(h);var i=new Image();this._addDomListener(i,'error',this._fileSuccessHandler,{fileIndex:a,element:h});i.src=c.url;break;case'img':var j=new Image();if('crossOrigin'in j&&this._crossOriginProperty)j.crossOrigin=this._crossOriginProperty;this._addDomListener(j,'error',this._fileErrorHandler,{fileIndex:a,element:j});this._addDomListener(j,'load',this._fileSuccessHandler,{fileIndex:a,element:j});j.src=c.url;break;default:this._loading=false;throw new Error('invalid fileType: '+c.type);}},dispose:function(){SmartJs.Core.EventTarget.prototype.dispose.call(this)},});return ResourceLoader})(),});SmartJs.Ui={};SmartJs.Ui._Window=(function(){Window.extends(SmartJs.Core.EventTarget);function Window(){this._hiddenProperty='hidden';this._visible=true;this._onResize=new SmartJs.Event.Event(window);this._onVisibilityChange=new SmartJs.Event.Event(window);var a='resize';if(window.orientationchange)a='orientationchange';this._addDomListener(window,a,function(e){this._onResize.dispatchEvent({height:this.height,width:this.width})});var b='';if(typeof document.hidden!==undefined){this._hiddenProperty='hidden';b='visibilitychange'}else if(typeof document.mozHidden!==undefined){this._hiddenProperty='mozHidden';b='mozvisibilitychange'}else if(typeof document.msHidden!==undefined){this._hiddenProperty='msHidden';b='msvisibilitychange'}else if(typeof document.webkitHidden!==undefined){this._hiddenProperty='webkitHidden';b='webkitvisibilitychange'}if(b!=='')this._addDomListener(document,b,this._visibilityChangeHandler);if(b==''||SmartJs.Device.isIOs){if('onfocusin'in document){this._addDomListener(document,'focusin',this._visibilityChangeHandler);this._addDomListener(document,'focusout',this._visibilityChangeHandler)}else{this._addDomListener(window,'pageshow',this._visibilityChangeHandler);this._addDomListener(window,'pagehide',this._visibilityChangeHandler);this._addDomListener(window,'focus',this._visibilityChangeHandler);this._addDomListener(window,'blur',this._visibilityChangeHandler)}}}Object.defineProperties(Window.prototype,{onResize:{get:function(){return this._onResize},},onVisibilityChange:{get:function(){return this._onVisibilityChange},},});Object.defineProperties(Window.prototype,{title:{get:function(){return document.title},set:function(a){document.title=a},},visible:{get:function(){return this._visible},},height:{get:function(){if(window.innerHeight){return window.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight}else if(document.body.clientHeight){return document.body.clientHeight}return 0},},width:{get:function(){if(window.innerWidth){return window.innerWidth}else if(document.documentElement&&document.documentElement.clientWidth){return document.documentElement.clientWidth}else if(document.body.clientWidth){return document.body.clientWidth}return 0},},});Window.prototype.merge({_visibilityChangeHandler:function(e){e=e||window.event;var a={blur:false,focusout:false,pagehide:false};if(e.type in a)this._visible=false;else this._visible=document[this._hiddenProperty]===true?false:true;this._onVisibilityChange.dispatchEvent({visible:this._visible}.merge(e))},dispose:function(){},});return Window})();SmartJs.Ui.Window=new SmartJs.Ui._Window();SmartJs.Ui.merge({TextNode:(function(){TextNode.extends(SmartJs.Core.Component);function TextNode(b){this._text=b||'';this._dom=document.createTextNode(this._text);this._onResize=new SmartJs.Event.Event(this);this._onResize.addEventListener(new SmartJs.Event.EventListener(function(e){var a=this._parent;if(a&&a!==e.caller)this._parent.onLayoutChange.dispatchEvent({caller:this})},this))}Object.defineProperties(TextNode.prototype,{text:{get:function(){return this._text},set:function(a){this._text=a;this._dom.textContent=a;this._onResize.dispatchEvent()},},});TextNode.prototype.merge({hide:function(){this._dom.textContent='';this._onResize.dispatchEvent()},show:function(){this._dom.textContent=this._text;this._onResize.dispatchEvent()},verifyResize:function(){},dispose:function(){if(this._parent)this._parent._removeChild(this);else if(document.body.contains(this._dom))this._dom.parentNode.removeChild(this._dom);SmartJs.Core.Component.prototype.dispose.call(this)},});return TextNode})(),Control:(function(){Control.extends(SmartJs.Core.EventTarget,false);function Control(d,f){this._id=SmartJs.getNewId();if(d instanceof HTMLElement)this._dom=d;else if(typeof d==='string')this._dom=document.createElement(d);this._dom.id=this._id;this._parent=undefined;this._childs=[];this._cachedSize={height:0,width:0,innerHeight:0,innerWidth:0};this._onResize=new SmartJs.Event.Event(this);this._onResize.addEventListener(new SmartJs.Event.EventListener(function(e){var a=this._cachedSize;a.height=this.height;a.width=this.width;if(a.innerHeight!==this._innerHeight||a.innerWidth!==this._innerWidth){a.innerHeight=this._innerHeight;a.innerWidth=this._innerWidth;var b=this._childs;for(var i=0,l=b.length;i0){e=true;break}if(!e)return;var f=this.__removeClassName(a);this.__addClassName(f,b);this.verifyResize(this)},_appendChild:function(a){this._insertAt(this._childs.length,a)},_insertAt:function(a,b){var c=this._childs.indexOf(b);var d=b._parent;c=-1;if(d){c=d._childs.indexOf(b);d._removeChild(b);if(d===this&&c<=a)a--}else if(b.rendered)b._dom.parentNode.removeChild(b._dom);try{if(a===this._childs.length)this._dom.appendChild(b._dom);else this._dom.insertBefore(b._dom,this._childs[a]._dom)}catch(e){if(d)d._insertBefore(b,d._childs[c]);throw new Error(e.message+', possibly caused by appending a control to one of its own child controls (recursion loop)');}b._parent=this;this._childs.insert(a,b);b.verifyResize(this);this.onLayoutChange.dispatchEvent({},b)},_insertBefore:function(a,b){var c=this._childs.indexOf(b);this._insertAt(c,a)},_insertAfter:function(a,b){var c=this._childs.indexOf(b);this._insertAt(c+1,a)},_replaceChild:function(a,b){var c=this._childs.indexOf(b);this._removeChild(b,true);this._insertAt(c,a)},_removeChild:function(a,b){if(a._parent!==this)return;a._parent=undefined;if(a._disposed)return;if(this._childs.remove(a)>0){if(a._dom.parentNode==this._dom)this._dom.removeChild(a._dom);if(!b)this.onLayoutChange.dispatchEvent()}},hide:function(){var a=this._dom.style;if(a.display==='none')return;this._styleBeforeHide=a.display;a.display='none';if(this._parent)this._parent.onLayoutChange.dispatchEvent({},this)},show:function(){var a=this._dom.style;if(a.display!=='none')return;a.display=this._styleBeforeHide||'';if(this._parent)this._parent.onLayoutChange.dispatchEvent({},this);this.verifyResize(this)},dispose:function(){if(this._parent)this._parent._removeChild(this);else if(this.rendered)this._dom.parentNode.removeChild(this._dom);if(this._childs)this._childs.dispose();this._disposed=true},});return Control})(),});SmartJs.Ui.merge({HtmlTag:(function(){HtmlTag.extends(SmartJs.Ui.Control,false);function HtmlTag(a,b){SmartJs.Ui.Control.call(this,a,b)}Object.defineProperties(HtmlTag.prototype,{dom:{get:function(){return this._dom},},});HtmlTag.prototype.merge({setDomAttribute:function(a,b){this._dom.setAttribute(a,b)},getDomAttribute:function(a){return this._dom.getAttribute(a)},addDomListener:function(a,b,c){return this._addDomListener(this._dom,a,b,c)},removeDomListener:function(a,b){return this._removeDomListener(this._dom,a,b)},appendChild:function(a){return this._appendChild(a)},insertAt:function(a,b){return this._insertAt(a,b)},insertBefore:function(a,b){return this._insertBefore(a,b)},insertAfter:function(a,b){return this._insertAfter(a,b)},replaceChild:function(a,b){return this._replaceChild(a,b)},removeChild:function(a){return this._removeChild(a)},});return HtmlTag})(),Image:(function(){Image.extends(SmartJs.Ui.Control,false);function Image(a){var b={style:{width:'auto',height:'auto'}};if(a)b.merge(a);SmartJs.Ui.Control.call(this,'img',b);this._addDomListener(this._dom,'load',function(e){this._onLoad.dispatchEvent()});this._onLoad=new SmartJs.Event.Event(this)}Object.defineProperties(Image.prototype,{onLoad:{get:function(){return this._onLoad},},});Object.defineProperties(Image.prototype,{src:{get:function(){return this._dom.src},set:function(a){this._dom.src=a},},naturalWidth:{get:function(){return this._dom.naturalWidth},},naturalHeight:{get:function(){return this._dom.naturalHeight},},crossOrigin:{set:function(a){if('crossOrigin'in this._dom)this._dom.crossOrigin=a},},});return Image})(),ContainerControl:(function(){ContainerControl.extends(SmartJs.Ui.Control,false);function ContainerControl(a){SmartJs.Ui.Control.call(this,'div',a);this.__container=this}Object.defineProperties(ContainerControl.prototype,{_container:{set:function(a){this.__container=a},get:function(){return this.__container},},_innerHeight:{get:function(){if(this.__container!==this)return this.__container._innerHeight;if(!this.rendered)return 0;var a=window.getComputedStyle(this._dom);var b=this._dom.clientHeight;b-=parseInt(a.paddingTop)||0;b-=parseInt(a.paddingBottom)||0;return b},},_innerWidth:{get:function(){if(this.__container!==this)return this.__container._innerWidth;if(!this.rendered)return 0;var a=window.getComputedStyle(this._dom);var b=this._dom.clientWidth;b-=parseInt(a.paddingLeft)||0;b-=parseInt(a.paddingRight)||0;return b},},});ContainerControl.prototype.merge({appendChild:function(a){var b=this.__container;if(b!==this)return b.appendChild(a);return this._appendChild(a)},insertAt:function(a,b){var c=this.__container;if(c!==this)return c.insertAt(a,b);return this._insertAt(a,b)},insertBefore:function(a,b){var c=this.__container;if(c!==this)return c.insertBefore(a,b);return this._insertBefore(a,b)},insertAfter:function(a,b){var c=this.__container;if(c!==this)return c.insertAfter(a,b);return this._insertAfter(a,b)},replaceChild:function(a,b){var c=this.__container;if(c!==this)return c.replaceChild(a,b);return this._replaceChild(a,b)},removeChild:function(a){var b=this.__container;if(b!==this)return b.removeChild(a);return this._removeChild(a)},});return ContainerControl})(),Viewport:(function(){Viewport.extends(SmartJs.Ui.Control,false);function Viewport(a){SmartJs.Ui.Control.call(this,'div',a||{style:{height:'100%',width:'100%'}});this._parentHtmlElement=undefined;this._window=SmartJs.Ui.Window;this._resizeListener=new SmartJs.Event.EventListener(this.verifyResize,this);this._window.onResize.addEventListener(this._resizeListener)}Viewport.prototype.merge({addToDom:function(a){a=a||document.body;if(this._parentHtmlElement===a)return;if(this._parentHtmlElement)this._parentHtmlElement.removeChild(this._dom);a.appendChild(this._dom);this._parentHtmlElement=a;this.onResize.dispatchEvent()},dispose:function(){this._window.onResize.removeEventListener(this._resizeListener);SmartJs.Ui.Control.prototype.dispose.call(this)},});return Viewport})(),}); +'use strict';Object.prototype.merge=function(o){if(typeof o!=='object')return this;for(var m in o){if(o.hasOwnProperty(m)){if(typeof this[m]==='object'&&typeof o[m]==='object'&&!(o[m]instanceof Array))this[m].merge(o[m]);else this[m]=o[m]}}return this};Object.defineProperty(Object.prototype,'merge',{enumerable:false});Function.prototype.extends=function(a,b){b=b!==false?true:false;var c=this.prototype;if(b)this.prototype=new a();else this.prototype=Object.create(a.prototype);this.prototype.constructor=c.constructor};Object.defineProperty(Function.prototype,'extends',{enumerable:false});Array.prototype.insert=function(a,o){this.splice(a,0,o)};Object.defineProperty(Array.prototype,'insert',{enumerable:false});Array.prototype.remove=function(o){var a,counter=0;while((a=this.indexOf(o))!==-1){this.splice(a,1);counter++}return counter};Object.defineProperty(Array.prototype,'remove',{enumerable:false});Array.prototype.dispose=function(){for(var i=this.length-1;i>=0;i--){if(this[i]&&typeof this[i].dispose==='function'){this[i].dispose()}}this.length=0};Object.defineProperty(Array.prototype,'dispose',{enumerable:false});var SmartJs={_version:0.1,_objectId:0,getNewId:function(){return'sj'+this._objectId++},Device:{isIOs:((typeof ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined))!=='undefined')&&navigator.userAgent.match(/iPad|iPhone|iPod/i)&&!navigator.userAgent.match(/IEMobile|Windows Phone/i)),isFirefoxOS:(!!"mozApps"in navigator&&navigator.userAgent.search("Mobile")!=-1&&avigator.userAgent.search("Android")<0),isTouch:('ontouchstart'in window)||('msMaxTouchPoints'in navigator&&navigator.msMaxTouchPoints>0)||('maxTouchPoints'in navigator&&navigator.maxTouchPoints>0),isMobile:(typeof ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined))!=='undefined')||!!navigator.userAgent.match(/iPad|iPhone|Android|BlackBerry|Phone|ZuneWP7|WPDesktop|webOS/i),},isBrowserCompatible:function(){var d=true;var f={Object_getPrototypeOf:function(){if(!Object.getPrototypeOf){d=false;return false}return true}(),Object_defineProperty:function(){if(!Object.defineProperty){d=false;return false}else{var a={};try{Object.defineProperty(a,'a',{value:'test',writable:true,enumerable:true,configurable:true})}catch(ex){d=false;return false}}return true}(),Array_indexOf:function(){if([].indexOf)return true;d=false;return false}(),document_addEventListener:function(){if(document.addEventListener)return true;d=false;return false}(),event_stopPropagation:function(){var e=document.createEvent('MouseEvents');e.initEvent('click',false,true);if(e.stopPropagation)return true;d=false;return false}(),String_trim:function(){if(''.trim)return true;d=false;return false}(),window_getComputedStyle:function(){if(!window.getComputedStyle){d=false;return false}return true}(),cssBoxSizing_borderBox:function(){var a=document.createElement('div');var b=a.style;b.position='absolute';b.top='-200px';b.left='-200px';b.boxSizing='border-box';b.border='solid 30px black';b.height='100px';b.width='100px';document.body.appendChild(a);var c=Math.abs(a.offsetHeight-100)<2&&Math.abs(a.offsetWidth-100)<2;document.body.removeChild(a);a=undefined;if(c)return true;d=false;return false}(),xmlHttpRequest:function(){try{var a=new XMLHttpRequest()}catch(e){d=false;return false}return true}(),};return{result:d,tests:f}},};SmartJs.Core={};SmartJs.Core={String:(function(){function Strg(a){this._string=a;this._format=arguments}Strg.prototype.merge({toString:function(){return this._string.replace(/({)(\d+)(})/gi,function(a,b,c){var d=parseInt(c)+1;return this._format[d].toString()}.bind(this))},});return Strg})(),Component:(function(){function Component(a){if(a)this._mergeProperties(a)}Object.defineProperties(Component.prototype,{objClassName:{get:function(){return this.constructor.toString().match(/function\s*(\w+)/)[1]},},});Component.prototype.merge({__dispose:function(a){if(this._disposing||this._disposed)return;this._disposing=true;for(var b in this){if(typeof this[b]==='function'||!this.hasOwnProperty(b))continue;if(this[b]&&typeof this[b].dispose==='function'&&(!this[b]._disposing||!this[b]._disposed)){this[b].dispose()}if(typeof b!=='function'&&b!=='_disposing')delete this[b]}var c=Object.getPrototypeOf(this);if(typeof c.__dispose==='function')c.__dispose(true);if(!a)this._disposed=true;delete this._disposing},dispose:function(){this.__dispose();delete this.constructor;this._disposed=true},_mergeProperties:function(a,b){if(!a)return;b=b||this;for(var p in a){if(typeof a[p]==='object'&&!(a[p]instanceof Array)){this._mergeProperties(a[p],b[p])}else{var c=b[p];try{b[p]=a[p]}catch(e){}}}},});return Component})(),};SmartJs.Core.EventTarget=(function(){EventTarget.extends(SmartJs.Core.Component,false);function EventTarget(a){SmartJs.Core.Component.call(this,a)}EventTarget.prototype.merge({_addDomListener:function(a,b,c,d){var f=function(e){e=e||{};if(d){if(d.hasOwnProperty('stopPropagation')&&d.stopPropagation!==false)e.stopPropagation();e.merge(d)}return c.call(this,e)}.bind(this);if(a.addEventListener)a.addEventListener(b,f,false);else a.attachEvent('on'+b,f);return f},_removeDomListener:function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false);else a.detachEvent('on'+b,c)},});return EventTarget})();SmartJs.Event={Event:(function(){Event.extends(SmartJs.Core.Component);function Event(a){this.target=a;this._listeners=[]};Object.defineProperties(Event.prototype,{listenersAttached:{get:function(){return this._listeners&&this._listeners.length>0},},});Event.prototype.merge({addEventListener:function(a){var b=this.__listenerIndex(a);if(b==-1){this._listeners.push(a);return true}return false},removeEventListener:function(a){if(this._disposed)return false;var b=this.__listenerIndex(a);if(b>=0){this._listeners.splice(b,1);return true}return false},__listenerIndex:function(a){var b=this._listeners.indexOf(a);if(b>=0)return b;var c=this._listeners;var d;for(var i=0,l=c.length;i0||(document.cookie='test').indexOf.call(document.cookie,'test')>-1))&&!!JSON;if(this._supported)this._deleteKey('test')}CookieAdapter.prototype.merge({_setValue:function(a,b){document.cookie=a+'='+b+'; path=/; expires='+this._expires},_getValue:function(a){var b=(document.cookie.match('(^|; )'+a+'=([^;]*)')||0)[2];if(b)return b;return undefined},_deleteKey:function(a){document.cookie=a+'=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;'},_clear:function(){var a=document.cookie.split(';'),cookie;for(var i=0;i-1)this.deleteKey(cookie.substr(0,b))}},});return CookieAdapter})(),LocalStorageAdapter:(function(){LocalStorageAdapter.extends(SmartJs.Components.StorageAdapter,false);function LocalStorageAdapter(){SmartJs.Components.StorageAdapter.call(this);try{localStorage.setItem('test','test');localStorage.removeItem('test');this._supported=true}catch(e){this._supported=false}}LocalStorageAdapter.prototype.merge({_setValue:function(a,b){localStorage.setItem(a,b)},_getValue:function(a){return localStorage.getItem(a)},_deleteKey:function(a){localStorage.removeItem(a)},_clear:function(){var a=[];for(var i=0,l=localStorage.length;i0){this._loading=true;this._requestFile(0)}else this._onLoad.dispatchEvent()},abortLoading:function(){this._loading=false},_fileErrorHandler:function(e){if(!this._loading)return;this._loading=false;var a=e.fileIndex;this._onError.dispatchEvent({file:this._registeredFiles[e.fileIndex],element:e.element})},_fileSuccessHandler:function(e){if(!this._loading)return;var a=e.fileIndex;if(this.useSizeForProgressCalculation){var b=this._registeredFiles[a];this._loadedSize+=b.size;this._onProgressChange.dispatchEvent({progress:Math.round(this._loadedSize/this._totalSize*100),file:this._registeredFiles[a],element:e.element})}else this._onProgressChange.dispatchEvent({progress:Math.round((a+1)/this._registeredFiles.length*100),file:this._registeredFiles[a],element:e.element});if(a+1==this._registeredFiles.length){this._loading=false;this._onLoad.dispatchEvent()}else{var c=this._requestFile.bind(this,a+1);window.setTimeout(c,20)}},_requestFile:function(a){if(this._disposed)return;var b=document.head||document.getElementsByTagName('head')[0];var c=this._registeredFiles[a];var d=document.getElementById(c.url);if(d){this._fileSuccessHandler({fileIndex:a,element:d});return}switch(c.type){case'js':var f=document.createElement('script');f.async=false;this._addDomListener(f,'error',this._fileErrorHandler,{fileIndex:a,element:f});var g=false;f.onload=f.onreadystatechange=function(e){if(!g&&(!f.readyState||f.readyState==='loaded'||f.readyState==='complete')){g=true;f.onload=f.onreadystatechange=null;e=e||{};e.merge({fileIndex:a,element:f});this._fileSuccessHandler(e)}}.bind(this);b.appendChild(f);f.id=f.src=c.url;break;case'css':var h=document.createElement('link');h.type='text/css';h.rel='stylesheet';h.id=c.url;b.appendChild(h);var i=new Image();this._addDomListener(i,'error',this._fileSuccessHandler,{fileIndex:a,element:h});i.src=c.url;break;case'img':var j=new Image();if('crossOrigin'in j&&this._crossOriginProperty)j.crossOrigin=this._crossOriginProperty;this._addDomListener(j,'error',this._fileErrorHandler,{fileIndex:a,element:j});this._addDomListener(j,'load',this._fileSuccessHandler,{fileIndex:a,element:j});j.src=c.url;break;default:this._loading=false;throw new Error('invalid fileType: '+c.type);}},dispose:function(){SmartJs.Core.EventTarget.prototype.dispose.call(this)},});return ResourceLoader})(),});SmartJs.Ui={};SmartJs.Ui._Window=(function(){Window.extends(SmartJs.Core.EventTarget);function Window(){this._hiddenProperty='hidden';this._visible=true;this._onResize=new SmartJs.Event.Event(window);this._onVisibilityChange=new SmartJs.Event.Event(window);var a='resize';if(((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined))change)a='orientationchange';this._addDomListener(window,a,function(e){this._onResize.dispatchEvent({height:this.height,width:this.width})});var b='';if(typeof document.hidden!==undefined){this._hiddenProperty='hidden';b='visibilitychange'}else if(typeof document.mozHidden!==undefined){this._hiddenProperty='mozHidden';b='mozvisibilitychange'}else if(typeof document.msHidden!==undefined){this._hiddenProperty='msHidden';b='msvisibilitychange'}else if(typeof document.webkitHidden!==undefined){this._hiddenProperty='webkitHidden';b='webkitvisibilitychange'}if(b!=='')this._addDomListener(document,b,this._visibilityChangeHandler);if(b==''||SmartJs.Device.isIOs){if('onfocusin'in document){this._addDomListener(document,'focusin',this._visibilityChangeHandler);this._addDomListener(document,'focusout',this._visibilityChangeHandler)}else{this._addDomListener(window,'pageshow',this._visibilityChangeHandler);this._addDomListener(window,'pagehide',this._visibilityChangeHandler);this._addDomListener(window,'focus',this._visibilityChangeHandler);this._addDomListener(window,'blur',this._visibilityChangeHandler)}}}Object.defineProperties(Window.prototype,{onResize:{get:function(){return this._onResize},},onVisibilityChange:{get:function(){return this._onVisibilityChange},},});Object.defineProperties(Window.prototype,{title:{get:function(){return document.title},set:function(a){document.title=a},},visible:{get:function(){return this._visible},},height:{get:function(){if(window.innerHeight){return window.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight}else if(document.body.clientHeight){return document.body.clientHeight}return 0},},width:{get:function(){if(window.innerWidth){return window.innerWidth}else if(document.documentElement&&document.documentElement.clientWidth){return document.documentElement.clientWidth}else if(document.body.clientWidth){return document.body.clientWidth}return 0},},});Window.prototype.merge({_visibilityChangeHandler:function(e){e=e||window.event;var a={blur:false,focusout:false,pagehide:false};if(e.type in a)this._visible=false;else this._visible=document[this._hiddenProperty]===true?false:true;this._onVisibilityChange.dispatchEvent({visible:this._visible}.merge(e))},dispose:function(){},});return Window})();SmartJs.Ui.Window=new SmartJs.Ui._Window();SmartJs.Ui.merge({TextNode:(function(){TextNode.extends(SmartJs.Core.Component);function TextNode(b){this._text=b||'';this._dom=document.createTextNode(this._text);this._onResize=new SmartJs.Event.Event(this);this._onResize.addEventListener(new SmartJs.Event.EventListener(function(e){var a=this._parent;if(a&&a!==e.caller)this._parent.onLayoutChange.dispatchEvent({caller:this})},this))}Object.defineProperties(TextNode.prototype,{text:{get:function(){return this._text},set:function(a){this._text=a;this._dom.textContent=a;this._onResize.dispatchEvent()},},});TextNode.prototype.merge({hide:function(){this._dom.textContent='';this._onResize.dispatchEvent()},show:function(){this._dom.textContent=this._text;this._onResize.dispatchEvent()},verifyResize:function(){},dispose:function(){if(this._parent)this._parent._removeChild(this);else if(document.body.contains(this._dom))this._dom.parentNode.removeChild(this._dom);SmartJs.Core.Component.prototype.dispose.call(this)},});return TextNode})(),Control:(function(){Control.extends(SmartJs.Core.EventTarget,false);function Control(d,f){this._id=SmartJs.getNewId();if(d instanceof HTMLElement)this._dom=d;else if(typeof d==='string')this._dom=document.createElement(d);this._dom.id=this._id;this._parent=undefined;this._childs=[];this._cachedSize={height:0,width:0,innerHeight:0,innerWidth:0};this._onResize=new SmartJs.Event.Event(this);this._onResize.addEventListener(new SmartJs.Event.EventListener(function(e){var a=this._cachedSize;a.height=this.height;a.width=this.width;if(a.innerHeight!==this._innerHeight||a.innerWidth!==this._innerWidth){a.innerHeight=this._innerHeight;a.innerWidth=this._innerWidth;var b=this._childs;for(var i=0,l=b.length;i0){e=true;break}if(!e)return;var f=this.__removeClassName(a);this.__addClassName(f,b);this.verifyResize(this)},_appendChild:function(a){this._insertAt(this._childs.length,a)},_insertAt:function(a,b){var c=this._childs.indexOf(b);var d=b._parent;c=-1;if(d){c=d._childs.indexOf(b);d._removeChild(b);if(d===this&&c<=a)a--}else if(b.rendered)b._dom.parentNode.removeChild(b._dom);try{if(a===this._childs.length)this._dom.appendChild(b._dom);else this._dom.insertBefore(b._dom,this._childs[a]._dom)}catch(e){if(d)d._insertBefore(b,d._childs[c]);throw new Error(e.message+', possibly caused by appending a control to one of its own child controls (recursion loop)');}b._parent=this;this._childs.insert(a,b);b.verifyResize(this);this.onLayoutChange.dispatchEvent({},b)},_insertBefore:function(a,b){var c=this._childs.indexOf(b);this._insertAt(c,a)},_insertAfter:function(a,b){var c=this._childs.indexOf(b);this._insertAt(c+1,a)},_replaceChild:function(a,b){var c=this._childs.indexOf(b);this._removeChild(b,true);this._insertAt(c,a)},_removeChild:function(a,b){if(a._parent!==this)return;a._parent=undefined;if(a._disposed)return;if(this._childs.remove(a)>0){if(a._dom.parentNode==this._dom)this._dom.removeChild(a._dom);if(!b)this.onLayoutChange.dispatchEvent()}},hide:function(){var a=this._dom.style;if(a.display==='none')return;this._styleBeforeHide=a.display;a.display='none';if(this._parent)this._parent.onLayoutChange.dispatchEvent({},this)},show:function(){var a=this._dom.style;if(a.display!=='none')return;a.display=this._styleBeforeHide||'';if(this._parent)this._parent.onLayoutChange.dispatchEvent({},this);this.verifyResize(this)},dispose:function(){if(this._parent)this._parent._removeChild(this);else if(this.rendered)this._dom.parentNode.removeChild(this._dom);if(this._childs)this._childs.dispose();this._disposed=true},});return Control})(),});SmartJs.Ui.merge({HtmlTag:(function(){HtmlTag.extends(SmartJs.Ui.Control,false);function HtmlTag(a,b){SmartJs.Ui.Control.call(this,a,b)}Object.defineProperties(HtmlTag.prototype,{dom:{get:function(){return this._dom},},});HtmlTag.prototype.merge({setDomAttribute:function(a,b){this._dom.setAttribute(a,b)},getDomAttribute:function(a){return this._dom.getAttribute(a)},addDomListener:function(a,b,c){return this._addDomListener(this._dom,a,b,c)},removeDomListener:function(a,b){return this._removeDomListener(this._dom,a,b)},appendChild:function(a){return this._appendChild(a)},insertAt:function(a,b){return this._insertAt(a,b)},insertBefore:function(a,b){return this._insertBefore(a,b)},insertAfter:function(a,b){return this._insertAfter(a,b)},replaceChild:function(a,b){return this._replaceChild(a,b)},removeChild:function(a){return this._removeChild(a)},});return HtmlTag})(),Image:(function(){Image.extends(SmartJs.Ui.Control,false);function Image(a){var b={style:{width:'auto',height:'auto'}};if(a)b.merge(a);SmartJs.Ui.Control.call(this,'img',b);this._addDomListener(this._dom,'load',function(e){this._onLoad.dispatchEvent()});this._onLoad=new SmartJs.Event.Event(this)}Object.defineProperties(Image.prototype,{onLoad:{get:function(){return this._onLoad},},});Object.defineProperties(Image.prototype,{src:{get:function(){return this._dom.src},set:function(a){this._dom.src=a},},naturalWidth:{get:function(){return this._dom.naturalWidth},},naturalHeight:{get:function(){return this._dom.naturalHeight},},crossOrigin:{set:function(a){if('crossOrigin'in this._dom)this._dom.crossOrigin=a},},});return Image})(),ContainerControl:(function(){ContainerControl.extends(SmartJs.Ui.Control,false);function ContainerControl(a){SmartJs.Ui.Control.call(this,'div',a);this.__container=this}Object.defineProperties(ContainerControl.prototype,{_container:{set:function(a){this.__container=a},get:function(){return this.__container},},_innerHeight:{get:function(){if(this.__container!==this)return this.__container._innerHeight;if(!this.rendered)return 0;var a=window.getComputedStyle(this._dom);var b=this._dom.clientHeight;b-=parseInt(a.paddingTop)||0;b-=parseInt(a.paddingBottom)||0;return b},},_innerWidth:{get:function(){if(this.__container!==this)return this.__container._innerWidth;if(!this.rendered)return 0;var a=window.getComputedStyle(this._dom);var b=this._dom.clientWidth;b-=parseInt(a.paddingLeft)||0;b-=parseInt(a.paddingRight)||0;return b},},});ContainerControl.prototype.merge({appendChild:function(a){var b=this.__container;if(b!==this)return b.appendChild(a);return this._appendChild(a)},insertAt:function(a,b){var c=this.__container;if(c!==this)return c.insertAt(a,b);return this._insertAt(a,b)},insertBefore:function(a,b){var c=this.__container;if(c!==this)return c.insertBefore(a,b);return this._insertBefore(a,b)},insertAfter:function(a,b){var c=this.__container;if(c!==this)return c.insertAfter(a,b);return this._insertAfter(a,b)},replaceChild:function(a,b){var c=this.__container;if(c!==this)return c.replaceChild(a,b);return this._replaceChild(a,b)},removeChild:function(a){var b=this.__container;if(b!==this)return b.removeChild(a);return this._removeChild(a)},});return ContainerControl})(),Viewport:(function(){Viewport.extends(SmartJs.Ui.Control,false);function Viewport(a){SmartJs.Ui.Control.call(this,'div',a||{style:{height:'100%',width:'100%'}});this._parentHtmlElement=undefined;this._window=SmartJs.Ui.Window;this._resizeListener=new SmartJs.Event.EventListener(this.verifyResize,this);this._window.onResize.addEventListener(this._resizeListener)}Viewport.prototype.merge({addToDom:function(a){a=a||document.body;if(this._parentHtmlElement===a)return;if(this._parentHtmlElement)this._parentHtmlElement.removeChild(this._dom);a.appendChild(this._dom);this._parentHtmlElement=a;this.onResize.dispatchEvent()},dispose:function(){this._window.onResize.removeEventListener(this._resizeListener);SmartJs.Ui.Control.prototype.dispose.call(this)},});return Viewport})(),}); diff --git a/Client/pocketCode/scripts/components/device.js b/Client/pocketCode/scripts/components/device.js index 3bf76ff8..c10ee581 100755 --- a/Client/pocketCode/scripts/components/device.js +++ b/Client/pocketCode/scripts/components/device.js @@ -107,7 +107,7 @@ PocketCode.Device = (function () { this._initDeviceMotionListener = this._addDomListener(window, 'devicemotion', this._initDeviceMotionHandler); this._orientationChangeListener = this._addDomListener(window, 'orientationchange', this._orientationChangeHandler); - this._windowOrientation = window.orientation; + this._windowOrientation = ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined)); } else { //initialized but no supported var features = this._features; @@ -557,7 +557,7 @@ PocketCode.Device = (function () { //this._rotationRate = e.rotationRate; }, _orientationChangeHandler: function () { - this._windowOrientation = window.orientation; + this._windowOrientation = ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined)); }, //geo location _setGeoLocationInitialized: function () { @@ -814,7 +814,7 @@ PocketCode.MediaDevice = (function () { }, _cameraChangeHandler: function (e) { e = e || this._camStatus; - e.merge({ orientation: window.orientation || 0, transparency: this._cameraTransparency }); + e.merge({ orientation: ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined)) || 0, transparency: this._cameraTransparency }); this._camStatus = e; /** if (e.on && e.width && e.height && e.src) this._fd.start(e.src, e.width, e.height, e.orientation); @@ -855,7 +855,7 @@ PocketCode.MediaDevice = (function () { // video.width = width; // video.height = height; // if (this._cam.on) - // this._onCameraChange.dispatchEvent({ on: true, src: video, height: video.videoHeight, width: video.videoWidth, orientation: window.orientation || 0, transparency: this._cameraTransparency }); + // this._onCameraChange.dispatchEvent({ on: true, src: video, height: video.videoHeight, width: video.videoWidth, orientation: ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined)) || 0, transparency: this._cameraTransparency }); }, setCameraTransparency: function (value) { if (value < 0.0) @@ -873,7 +873,7 @@ PocketCode.MediaDevice = (function () { src: video, height: video.videoHeight, width: video.videoWidth, - orientation: window.orientation || 0, + orientation: ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined)) || 0, transparency: value }); return true; diff --git a/Client/pocketCode/scripts/components/deviceFeature.js b/Client/pocketCode/scripts/components/deviceFeature.js index f8e1f991..bdab06ac 100755 --- a/Client/pocketCode/scripts/components/deviceFeature.js +++ b/Client/pocketCode/scripts/components/deviceFeature.js @@ -467,7 +467,7 @@ PocketCode.merge({ video.play(); this._startCameraStreamOnInit = false; this._on = true; - //var orientation = window.orientation || 0; + //var orientation = ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined)) || 0; this._onChange.dispatchEvent({ on: true, src: video, height: video.videoHeight, width: video.videoWidth }); } diff --git a/Client/smartJs/sj-ui.js b/Client/smartJs/sj-ui.js index 088e48c3..30af05da 100755 --- a/Client/smartJs/sj-ui.js +++ b/Client/smartJs/sj-ui.js @@ -24,7 +24,7 @@ SmartJs.Ui._Window = (function () { //static class //var onResizeHandler = function () { }; var resizeEventName = 'resize'; - if (window.orientationchange) + if (((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined))change) resizeEventName = 'orientationchange'; this._addDomListener(window, resizeEventName, function (e) { this._onResize.dispatchEvent({ height: this.height, width: this.width }); }); diff --git a/Client/smartJs/sj.js b/Client/smartJs/sj.js index c7a646f1..d7a1219f 100755 --- a/Client/smartJs/sj.js +++ b/Client/smartJs/sj.js @@ -151,10 +151,10 @@ var SmartJs = { * SmartJs.Device is a helper object to simply indicate if a device supports touch events and/or is a mobile device */ Device: { - isIOs: ((typeof window.orientation !== 'undefined') && navigator.userAgent.match(/iPad|iPhone|iPod/i) && !navigator.userAgent.match(/IEMobile|Windows Phone/i)), + isIOs: ((typeof ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined)) !== 'undefined') && navigator.userAgent.match(/iPad|iPhone|iPod/i) && !navigator.userAgent.match(/IEMobile|Windows Phone/i)), isFirefoxOS: (!!"mozApps" in navigator && navigator.userAgent.search("Mobile") != -1 && avigator.userAgent.search("Android") < 0), isTouch: ('ontouchstart' in window) || ('msMaxTouchPoints' in navigator && navigator.msMaxTouchPoints > 0) || ('maxTouchPoints' in navigator && navigator.maxTouchPoints > 0), - isMobile: (typeof window.orientation !== 'undefined') || !!navigator.userAgent.match(/iPad|iPhone|Android|BlackBerry|Phone|ZuneWP7|WPDesktop|webOS/i), + isMobile: (typeof ((window.orientation!==undefined)?window.orientation:((window.screen!==undefined)?window.screen.orientation.angle:undefined)) !== 'undefined') || !!navigator.userAgent.match(/iPad|iPhone|Android|BlackBerry|Phone|ZuneWP7|WPDesktop|webOS/i), }, /**