0){b.layers[1].animations[0].animations[0].property="opacity";d.layers[1].animations[0].animations[0].property="opacity";b.layers[1].animations[0].animations[0].from={scalar:1};b.layers[1].animations[0].animations[0].to={scalar:0};d.layers[1].animations[0].animations[0].from={scalar:1};d.layers[1].animations[0].animations[0].to={scalar:0}}else{b.layers[1].animations[0].property="opacity";d.layers[1].animations[0].property="opacity";b.layers[1].animations[0].from={scalar:1};b.layers[1].animations[0].to={scalar:0};d.layers[1].animations[0].from={scalar:1};d.layers[1].animations[0].to={scalar:0}}}},adjustEffectsForFirefox:function(s,n){switch(s.name){case"apple:scale":var r=n.baseLayer.layers[0];var l=s.baseLayer.layers[0];if(r.layers[0].animations.length>0){var m=r.layers[0];r.layers[0]=r.layers[1];r.layers[1]=m;r.layers[1].initialState.hidden=true;var f=l.layers[0];l.layers[0]=l.layers[1];l.layers[1]=f;l.layers[1].initialState.hidden=true;var a=r.layers[1].animations[0].beginTime;var c=r.layers[1].animations[0].duration;var h=r.layers[1].animations[0].animations[0].beginTime;var e=r.layers[1].animations[0].animations[0].duration;var k;if(a==h){for(var g=0,p=r.layers[1].animations[0].animations.length;g1){for(var g=0,p=r.layers[1].animations[0].animations.length;g
0){var v=m.layers[0];m.layers[0]=m.layers[1];m.layers[1]=v;m.layers[1].initialState.hidden=true;var q=h.layers[0];h.layers[0]=h.layers[1];h.layers[1]=q;h.layers[1].initialState.hidden=true;var n=m.layers[1].animations[0].beginTime;var l=m.layers[1].animations[0].duration;var r=m.layers[1].animations[0].animations[0].beginTime;var a=m.layers[1].animations[0].animations[0].duration;var e;if(n==r){for(var s=0,k=m.layers[1].animations[0].animations.length;s1){for(var s=0,k=m.layers[1].animations[0].animations.length;s0){var v=JSON.parse(JSON.stringify(m.layers[1]));m.layers.splice(0,0,v);var q=JSON.parse(JSON.stringify(h.layers[1]));h.layers.splice(0,0,q);var n=m.layers[1].animations[0].beginTime;var l=m.layers[1].animations[0].duration;var r=m.layers[1].animations[0].animations[0].beginTime;var a=m.layers[1].animations[0].animations[0].duration;var e;if(n==r){for(var s=0,k=m.layers[1].animations[0].animations.length;sG){G=l}if(z>g){g=z}}C.particleCount={x:G+1,y:g+1}}this.applyScaleFactorForLayer(M.baseLayer,n.baseLayer,k,M.name,I,C)}for(var O=0,t=T.hyperlinks.length;OG){G=l}if(z>g){g=z}}C.particleCount={x:G+1,y:g+1}}this.applyScaleFactorForLayer(R.baseLayer,S.baseLayer,k,R.name,I,C)}}}}for(var p in this.script.slides){if(this.script.slides.hasOwnProperty(p)){var a=this.script.slides[p];var v=this.script.originalSlides[p];for(var E in a.assets){if(a.assets.hasOwnProperty(E)){var r=a.assets[E];var P=v.assets[E];r.width=P.width*k;r.height=P.height*k}}}}},adjustForCropAnimation:function(a,b,j,h){var d=this.script.slideWidth;var f=this.script.slideHeight;var k=Math.floor(d/j);var g=Math.floor(f/h);var e=Math.round(b.x/b.width);var c=Math.round(b.y/b.height);if(b.width!=1||b.height!=1){if(e!=j-1){a.width=k}else{a.width=d-k*(j-1)}if(c!=h-1){a.height=g}else{a.height=f-g*(h-1)}a.position.pointX=k*e+a.width/2;a.position.pointY=g*c+a.height/2;a.contentsRect.x=k*e/d;a.contentsRect.y=g*c/f;a.contentsRect.width=a.width/d;a.contentsRect.height=a.height/f}},downloadScript:function(b){this.delegate=b;if(this.delegate.getKPFJsonStringForShow){this.script=JSON.parse(this.delegate.getKPFJsonStringForShow());if(this.script==null){debugMessageAlways(kDebugScriptMangaer_DownloadScript,"An error occured on the server. KPF header json is null.");return}this.slideManager=new SlideManager({header:this.script});this.slideManager.getSlides(this.script.slideList,this.delegate);return}this.downloadTimeout=setTimeout(this.scriptDidNotDownload.bind(this),kMaxScriptDownloadWaitTime);this.downloadAlreadyFailed=false;var c=this.showUrl+"header.json";if(window.location.protocol==="file:"){c=c+"p";window.local_header=(function(d){this.scriptDidDownload(d,true)}).bind(this);var a=document.createElement("script");a.setAttribute("src",c);document.head.appendChild(a)}else{new Ajax.Request(c,{method:"get",onSuccess:this.scriptDidDownload.bind(this),onFailure:this.scriptDidNotDownload.bind(this)})}},scriptDidDownload:function(b,a){clearTimeout(this.downloadTimeout);if(a){this.script=b}else{this.script=JSON.parse(b.responseText)}this.slideManager=new SlideManager({header:this.script});this.slideManager.downloadSlides(this.script.slideList)},scriptDidNotDownload:function(a){this.downloadAlreadyFailed=true;if(a){clearTimeout(this.downloadTimeout)}document.fire(kScriptDidNotDownloadEvent,{})},sceneIndexFromSlideIndex:function(a){if((this.script==null)||(a<0)||(a>=this.script.slideList.length)){return -1}return this.script.sceneIndexFromSlideIndexLookup[a]},slideIndexFromSceneIndex:function(a){if((this.script==null)||(a<0)||(a>=this.script.events.length)){return -1}return this.script.slideIndexFromSceneIndexLookup[a]}});
================================================
FILE: assets/player/ShowController.js
================================================
var kShowControllerState_Stopped="Stopped";var kShowControllerState_Starting="Starting";var kShowControllerState_DownloadingScript="DownloadingScipt";var kShowControllerState_SettingUpScene="SettingUpScene";var kShowControllerState_IdleAtFinalState="IdleAtFinalState";var kShowControllerState_IdleAtInitialState="IdleAtInitialState";var kShowControllerState_WaitingToJump="WaitingToJump";var kShowControllerState_ReadyToJump="ReadyToJump";var kShowControllerState_WaitingToDisplay="WaitingToDisplay";var kShowControllerState_ReadyToDisplay="ReadyToDisplay";var kShowControllerState_WaitingToPlay="WaitingToPlay";var kShowControllerState_ReadyToPlay="ReadyToPlay";var kShowControllerState_Playing="Playing";var kKeyDownEvent="keydown";var kSlideIndexDidChangeEvent="ShowController:SlideIndexDidChangeEvent";var ShowController=Class.create({initialize:function(){this.delegate=extractDelegateFromUrlParameter();this.delegate.showDidLoad();this.showUrl="../";this.displayManager=new DisplayManager();this.scriptManager=new ScriptManager(this.showUrl);this.textureManager=new TextureManager(this.showUrl);this.stageManager=new StageManager(this.textureManager,this.scriptManager);this.touchController=new TouchController();this.animationManager=new AnimationManager();this.orientationController=new OrientationController();this.activeHyperlinks=new Array();this.movieHyperlinks=new Array();this.script=null;this.currentSceneIndex=-1;this.nextSceneIndex=-1;this.currentSlideIndex=-1;this.previousSlideIndex=-1;this.currentSoundTrackIndex=0;this.transformOriginValue="";this.accumulatingDigits=false;this.digitAccumulator=0;this.firstSlide=true;this.lastSlideViewedIndex=-1;this.accountID="";this.guid="";this.locale="EN";this.isNavigationBarVisible=false;this.isFullscreen=false;this.volume=3;this.muted=false;this.soundTrackPlayer=null;this.sceneIndexOfPrebuiltAnimations=-1;this.queuedUserAction=null;document.observe(kScriptDidDownloadEvent,this.handleScriptDidDownloadEvent.bind(this));document.observe(kScriptDidNotDownloadEvent,this.handleScriptDidNotDownloadEvent.bind(this));document.observe(kStageIsReadyEvent,this.handleStageIsReadyEvent.bind(this));document.observe(kStageSizeDidChangeEvent,this.handleStageSizeDidChangeEvent.bind(this));document.observe(kFullscreenChangeEventName,this.handleFullscreenChangeEvent.bind(this));Event.observe(window,"resize",this.handleWindowResizeEvent.bind(this));this.touchController.registerTapEventCallback(this.handleTapEvent.bind(this));this.changeState(kShowControllerState_Stopped);this.movieCache=null;this.movieCacheInfo=null;this.audioCache=null;this.playbackController=new KPFPlaybackController({},this.stageManager.stage);this.navigatorController=new NavigatorController(document.getElementById("slideshowNavigator"));this.slideNumberController=new SlideNumberController(document.getElementById("slideNumberControl"));this.slideNumberDisplay=new SlideNumberDisplay(document.getElementById("slideNumberDisplay"));this.helpPlacard=new HelpPlacardController(document.getElementById("helpPlacard"));this.isRecording=false;this.isRecordingStarted=false;if(browserPrefix=="ms"&&browserVersion<10){this.animationSupported=false}else{this.animationSupported=true}document.observe("contextmenu",this.handleContextMenuEvent.bind(this));document.observe(kKeyDownEvent,this.handleKeyDownEvent.bind(this));document.observe(kSwipeEvent,this.handleSwipeEvent.bind(this));Event.observe(this.displayManager.previousButton,"click",this.goBackToPreviousSlide.bind(this,"tapPreviousButton"));Event.observe(this.displayManager.nextButton,"click",this.advanceToNextBuild.bind(this,"tapNextButton"))},startShow:function(){this.changeState(kShowControllerState_DownloadingScript);this.scriptManager.downloadScript(this.delegate)},exitShow:function(a){clearTimeout(this.exitTimeout);if(a){this.delegate.showExited()}else{this.exitTimeout=setTimeout((function(){this.delegate.showExited()}).bind(this),750)}},promptUserToTryAgain:function(b){var a=false;a=confirm(b);return a},handleScriptDidDownloadEvent:function(e){switch(this.state){case kShowControllerState_DownloadingScript:this.script=e.memo.script;if(this.script.showMode==kShowModeHyperlinksOnly){this.displayManager.setHyperlinksOnlyMode()}this.changeState(kShowControllerState_Starting);var h;var c=parseInt(getUrlParameter("restartingSceneIndex"));var f=document.URL.split("?");var a=f[0].split("#");if(a[1]){c=parseInt(a[1])}if(c){h=c}else{var d=getUrlParameter("currentSlide");var g;if(d){g=parseInt(d)}else{g=1}h=this.scriptManager.sceneIndexFromSlideIndex(g-1)}if(this.script.recording){if(this.script.recording.eventTracks[0].type==="navigation"){this.narrationManager=new NarrationManager(this.script.recording);h=this.narrationManager.sceneIndexFromNavigationEvent(this.narrationManager.navigationEvents[0]);this.isRecording=true;this.jumpToScene(h,false);break}}if(h>this.script.lastSceneIndex){break}var e=this.script.events[h];var b=e.automaticPlay==1||e.automaticPlay==true;this.jumpToScene(h,b);break;default:debugMessage(kDebugShowController_HandleScriptDidDownloadEvent,"- hmmm we seem to have arrived here from an unpredicted state");break}},handleScriptDidNotDownloadEvent:function(b){debugMessage(kDebugShowController_HandleScriptDidNotDownloadEvent);var a=this.promptUserToTryAgain(kUnableToReachiWorkTryAgain);if(a){this.scriptManager.downloadScript()}else{this.displayManager.clearLaunchMode();this.displayManager.hideWaitingIndicator()}},handleStageIsReadyEvent:function(a){if(this.isFullscreen){setTimeout((function(){this.displayManager.stageArea.style.opacity=1}).bind(this),50)}else{setTimeout((function(){this.displayManager.stageArea.style.opacity=1}).bind(this),500)}this.positionSlideNumberControl();this.positionSlideNumberDisplay();this.positionHelpPlacard()},positionSlideNumberControl:function(){var b=(this.displayManager.usableDisplayWidth-this.slideNumberController.width)/2;var a=this.displayManager.stageAreaTop+this.displayManager.stageAreaHeight-(this.slideNumberController.height+16);this.slideNumberController.setPosition(b,a)},positionSlideNumberDisplay:function(){var b=(this.displayManager.usableDisplayWidth-this.slideNumberDisplay.width)/2;var a=this.displayManager.stageAreaTop+this.displayManager.stageAreaHeight-(this.slideNumberDisplay.height+16);this.slideNumberDisplay.setPosition(b,a)},positionHelpPlacard:function(){var b=(this.displayManager.usableDisplayWidth-this.helpPlacard.width)/2;var a=(this.displayManager.usableDisplayHeight-this.helpPlacard.height)/2;this.helpPlacard.setPosition(b,a)},handleFullscreenChangeEvent:function(){if(document.webkitIsFullScreen||document.mozFullScreen){this.isFullscreen=true}else{this.isFullscreen=false}setTimeout((function(){this.displayManager.layoutDisplay()}).bind(this),0)},handleWindowResizeEvent:function(){clearTimeout(this.resizeTimer);this.resizeTimer=setTimeout(this.changeWindowSize.bind(this),1000)},changeWindowSize:function(){if(this.delegate.setViewScale){this.scriptManager.reapplyScaleFactor();this.textureManager.slideCache=null;this.textureManager.slideCache={};var a=this.currentSceneIndex;if(this.state===kShowControllerState_IdleAtFinalState){if(this.currentSceneIndex=kKeyCode_Numeric_0)&&(c<=kKeyCode_Numeric_9)){c=kKeyCode_0+(c-kKeyCode_Numeric_0)}c+=(a.shiftKey?kKeyModifier_Shift:0);c+=(a.altKey?kKeyModifier_Alt:0);c+=(a.ctrlKey?kKeyModifier_Ctrl:0);c+=(a.metaKey?kKeyModifier_Meta:0);if(this.isRecording){return}var b=false;switch(c){case kKeyCode_Escape:this.exitShow(true);break;case kKeyCode_Slash:case kKeyCode_Slash+kKeyModifier_Shift:if(this.helpPlacard.isShowing){this.helpPlacard.hide()}else{this.helpPlacard.show()}break;case kKeyCode_Q:this.exitShow(true);break;case kKeyCode_S:if(this.slideNumberController.isShowing){if(this.slideNumberTimeout){clearTimeout(this.slideNumberTimeout)}this.slideNumberTimeout=setTimeout(this.hideAndResetSlideNumberController.bind(this),0)}if(this.slideNumberDisplay.isShowing){this.slideNumberDisplay.hide()}else{this.slideNumberDisplay.setSlideNumber(this.currentSlideIndex+1);this.slideNumberDisplay.show()}break;case kKeyCode_Return:if(this.accumulatingDigits){this.accumulatingDigits=false;if(this.script.showMode!=kShowModeHyperlinksOnly){if(this.digitAccumulator>this.script.slideCount){this.digitAccumulator=this.script.slideCount}else{if(this.digitAccumulator<1){this.digitAccumulator=1}}this.slideNumberController.setSlideNumber(this.digitAccumulator);this.jumpToSlide(this.digitAccumulator)}else{debugMessage(kDebugShowController_OnKeyPress,"- can't do it, we're in hyperlinks only mode")}break}case kKeyCode_N:case kKeyCode_Space:case kKeyCode_DownArrow:case kKeyCode_RightArrow:case kKeyCode_PageDown:case kKeyCode_RightArrow+kKeyModifier_Shift:this.advanceToNextBuild("onKeyPress");break;case kKeyCode_DownArrow+kKeyModifier_Shift:case kKeyCode_PageDown+kKeyModifier_Shift:case kKeyCode_CloseBracket:case kKeyCode_Equal+kKeyModifier_Shift:case kKeyCode_Equal:case kKeyCode_Plus:this.advanceToNextSlide("onKeyPress");break;case kKeyCode_LeftArrow+kKeyModifier_Shift:case kKeyCode_PageUp+kKeyModifier_Shift:case kKeyCode_OpenBracket:this.goBackToPreviousBuild("onKeyPress");break;case kKeyCode_P:case kKeyCode_PageUp:case kKeyCode_LeftArrow:case kKeyCode_UpArrow:case kKeyCode_UpArrow+kKeyModifier_Shift:case kKeyCode_Hyphen:case kKeyCode_Minus:this.goBackToPreviousSlide("onKeyPress");break;case kKeyCode_Delete:b=true;if(this.accumulatingDigits){if(this.digitAccumulator<10){if(this.slideNumberTimeout){clearTimeout(this.slideNumberTimeout)}this.slideNumberTimeout=setTimeout(this.hideAndResetSlideNumberController.bind(this),0)}else{if(this.slideNumberTimeout){clearTimeout(this.slideNumberTimeout)}this.slideNumberTimeout=setTimeout(this.hideAndResetSlideNumberController.bind(this),7000);var d=this.digitAccumulator.toString();this.digitAccumulator=parseInt(d.substring(0,d.length-1));this.slideNumberController.setSlideNumber(this.digitAccumulator)}}break;case kKeyCode_Home:if(this.script.showMode!=kShowModeHyperlinksOnly){this.jumpToSlide(1)}else{debugMessage(kDebugShowController_OnKeyPress,"- can't do it, we're in hyperlinks only mode")}break;case kKeyCode_End:if(this.script.showMode!=kShowModeHyperlinksOnly){this.jumpToSlide(this.script.slideCount)}else{debugMessage(kDebugShowController_OnKeyPress,"- can't do it, we're in hyperlinks only mode")}break;default:if(this.slideNumberTimeout){clearTimeout(this.slideNumberTimeout)}this.slideNumberTimeout=setTimeout(this.hideAndResetSlideNumberController.bind(this),7000);if((c>=kKeyCode_0)&&(c<=kKeyCode_9)){if(this.slideNumberDisplay.isShowing){this.slideNumberDisplay.hide()}b=true;if(this.accumulatingDigits===false){this.accumulatingDigits=true;this.digitAccumulator=0}if(this.digitAccumulator.toString().length<4){this.digitAccumulator*=10;this.digitAccumulator+=(c-kKeyCode_0);this.slideNumberController.setSlideNumber(this.digitAccumulator);if(!this.slideNumberController.isShowing){this.slideNumberController.show()}}}else{b=true}break}if(this.accumulatingDigits&&(b===false)){}},hideAndResetSlideNumberController:function(){if(this.slideNumberTimeout){clearTimeout(this.slideNumberTimeout)}this.accumulatingDigits=false;this.digitAccumulator=0;this.slideNumberController.hide()},hideSlideNumberDisplay:function(){this.slideNumberDisplay.hide()},toggleFullscreen:function(){if(browserPrefix==="ms"){return}setTimeout((function(){this.displayManager.stageArea.style.opacity=0}).bind(this),0);this.displayManager.hideHUD(true);if(document.webkitIsFullScreen||document.mozFullScreen){this.isFullscreen=false;(document.webkitCancelFullScreen&&document.webkitCancelFullScreen())||(document.mozCancelFullScreen&&document.mozCancelFullScreen())}else{this.isFullscreen=true;(document.body.webkitRequestFullScreen&&document.body.webkitRequestFullScreen())||(document.body.mozRequestFullScreen&&document.body.mozRequestFullScreen())}},changeState:function(a){if(a!=this.state){this.leavingState();this.state=a;this.enteringState()}},leavingState:function(){switch(this.state){case kShowControllerState_Stopped:break;case kShowControllerState_Starting:break;case kShowControllerState_SettingUpScene:break;case kShowControllerState_IdleAtFinalState:break;case kShowControllerState_IdleAtInitialState:break;case kShowControllerState_WaitingToJump:break;case kShowControllerState_ReadyToJump:break;case kShowControllerState_WaitingToPlay:this.displayManager.hideWaitingIndicator();break;case kShowControllerState_ReadyToPlay:break;case kShowControllerState_Playing:break}},enteringState:function(){switch(this.state){case kShowControllerState_Stopped:break;case kShowControllerState_Starting:this.displayManager.showWaitingIndicator();break;case kShowControllerState_SettingUpScene:break;case kShowControllerState_IdleAtFinalState:case kShowControllerState_IdleAtInitialState:this.updateSlideNumber();this.displayManager.hideWaitingIndicator();this.createHyperlinksForCurrentState("idle");runInNextEventLoop(this.doIdleProcessing.bind(this));break;case kShowControllerState_WaitingToJump:break;case kShowControllerState_ReadyToJump:break;case kShowControllerState_WaitingToPlay:this.displayManager.showWaitingIndicator();break;case kShowControllerState_ReadyToPlay:break;case kShowControllerState_Playing:break}},doIdleProcessing:function(){this.preloadAppropriateScenes();if(this.queuedUserAction!=null){this.queuedUserAction();this.queuedUserAction=null}else{var a=this.stageManager.stage;if(a.childNodes.length!=0){this.updateNavigationButtons()}else{}}},truncatedSlideIndex:function(a){return this.truncatedIndex(a,this.script.lastSlideIndex,this.script.loopSlideshow)},truncatedSceneIndex:function(a){return this.truncatedIndex(a,this.script.lastSceneIndex,this.script.loopSlideshow)},truncatedIndex:function(a,c,b){if(a<0){if(b){a=a+c+1}else{a=-1}}else{if(a>c){if(b){a=a-c-1}else{a=-1}}}return a},preloadAppropriateScenes:function(){var d=this.currentSceneIndex;if(this.state===kShowControllerState_IdleAtFinalState){d++}var a=this.script.slideIndexFromSceneIndexLookup[d];var e=this.scriptManager.sceneIndexFromSlideIndex(this.truncatedSlideIndex(a-1));var b=this.scriptManager.sceneIndexFromSlideIndex(this.truncatedSlideIndex(a-2));var p=this.scriptManager.sceneIndexFromSlideIndex(this.truncatedSlideIndex(a-3));var g=this.truncatedSceneIndex(d-1);var f=this.truncatedSceneIndex(d-2);var c=this.truncatedSceneIndex(d-3);var n=this.truncatedSceneIndex(d+1);var m=this.truncatedSceneIndex(d+2);var k=this.truncatedSceneIndex(d+3);var l=this.scriptManager.sceneIndexFromSlideIndex(this.truncatedSlideIndex(a+1));var j=this.scriptManager.sceneIndexFromSlideIndex(this.truncatedSlideIndex(a+2));var i=this.scriptManager.sceneIndexFromSlideIndex(this.truncatedSlideIndex(a+3));var o={};var h=(gIpad===true);if(!h&&p!=-1){o[p]=true}if(!h&&b!=-1){o[b]=true}if(!h&&e!=-1){o[e]=true}if(!h&&c!=-1){o[c]=true}if(!h&&f!=-1){o[f]=true}if(!h&&g!=-1){o[g]=true}o[this.currentSceneIndex]=true;o[d]=true;if(n!=-1){o[n]=true}if(!h&&m!=-1){o[m]=true}if(!h&&k!=-1){o[k]=true}if(!h&&l!=-1){o[l]=true}if(!h&&j!=-1){o[j]=true}if(!h&&i!=-1){o[i]=true}this.textureManager.preloadScenes(o)},advanceToNextBuild:function(b){if(this.script.showMode===kShowModeHyperlinksOnly&&b!="currentSceneDidComplete"){return false}if(this.displayManager.infoPanelIsShowing){return false}var a=false;switch(this.state){case kShowControllerState_IdleAtFinalState:if(this.nextSceneIndex===-1){if(this.delegate.getKPFJsonStringForShow){this.stopSoundTrack();this.exitShow()}else{this.stopSoundTrack();break}}a=true;this.jumpToScene(this.nextSceneIndex,true);break;case kShowControllerState_IdleAtInitialState:if(this.currentSceneIndex>=this.script.numScenes){if(this.script.loopSlideshow){a=true;this.jumpToScene(0,false)}else{if(this.delegate.getKPFJsonStringForShow){this.stopSoundTrack();this.exitShow()}else{this.stopSoundTrack();break}}}else{a=true;this.playCurrentScene()}break;default:debugMessage(kDebugShowController_AdvanceToNextBuild,"nextSceneIndex: "+this.nextSceneIndex+" can't advance now, not in an idle state (currently in '"+this.state+"' state), queue up action to run in next idle time");if(this.queuedUserAction==null){a=true;this.queuedUserAction=this.advanceToNextBuild.bind(this,b)}break}return a},advanceToNextSlide:function(d){if(this.script.showMode==kShowModeHyperlinksOnly){return}if(this.displayManager.infoPanelIsShowing){return}var b=this.currentSceneIndex;switch(this.state){case kShowControllerState_IdleAtFinalState:b=b+1;case kShowControllerState_IdleAtInitialState:var f=this.scriptManager.slideIndexFromSceneIndex(b);var c;if(f===this.script.slideCount-1){if(this.script.loopSlideshow){c=0}else{return}}else{c=this.currentSlideIndex+1}var g=this.scriptManager.sceneIndexFromSlideIndex(c);var e=this.script.events[g];var a=e.automaticPlay==1||e.automaticPlay==true;this.jumpToSlide(c+1,a);break;default:debugMessage(kDebugShowController_AdvanceToNextSlide,"can't advance now, not in an idle state (currently in '"+this.state+"' state), queue up action to run in next idle time");if(this.queuedUserAction==null){this.queuedUserAction=this.advanceToNextSlide.bind(this,d)}break}},goBackToPreviousBuild:function(c){this.resetMediaCache();if(this.script.showMode==kShowModeHyperlinksOnly){return}if(this.displayManager.infoPanelIsShowing){return}var a=this.currentSceneIndex;switch(this.state){case kShowControllerState_IdleAtFinalState:a=a+1;case kShowControllerState_Playing:case kShowControllerState_IdleAtInitialState:var b;if(a===0){if(this.script.loopSlideshow){b=this.script.events.length-1}else{return}}else{b=a-1}this.jumpToScene(b,false);break;default:debugMessage(kDebugShowController_GoBackToPreviousBuild,"can't go back now, not in an idle state (currently in '"+this.state+"' state)");if(this.queuedUserAction==null){this.queuedUserAction=this.goBackToPreviousBuild.bind(this,c)}break}},goBackToPreviousSlide:function(c){if(this.script.showMode==kShowModeHyperlinksOnly){return}if(this.displayManager.infoPanelIsShowing){return}var b=this.currentSceneIndex;switch(this.state){case kShowControllerState_IdleAtFinalState:b=b+1;case kShowControllerState_Playing:case kShowControllerState_IdleAtInitialState:var d=this.scriptManager.slideIndexFromSceneIndex(b);var a;if(d===0){if(this.script.loopSlideshow){a=this.script.slideCount-1}else{a=0}}else{if(d===-1&&b>0){a=this.script.slideCount-1}else{a=this.currentSlideIndex-1}}this.jumpToSlide(a+1);break;default:debugMessage(kDebugShowController_GoBackToPreviousSlide,"can't go back now, not in an idle state (currently in '"+this.state+"' state)");if(this.queuedUserAction==null){this.queuedUserAction=this.goBackToPreviousSlide.bind(this,c)}break}},calculatePreviousSceneIndex:function(a){if(a==-1){previousSceneIndex=-1}else{previousSceneIndex=a-1}return previousSceneIndex},jumpToSlide:function(b,a){var c=b-1;var d=this.scriptManager.sceneIndexFromSlideIndex(c);this.resetMediaCache();if(a==null){a=false}this.jumpToScene(d,a)},jumpToScene:function(d,c){this.lastSlideViewedIndex=this.scriptManager.slideIndexFromSceneIndex(this.currentSceneIndex);if(d===-1){return}switch(this.state){case kShowControllerState_Starting:var b="position:absolute;background-color:transparent; left:0px; top:0px; width:"+this.displayManager.usableDisplayWidth+"px; height:"+this.displayManager.usableDisplayHeight+"px;";this.starting=true;this.maskElement=document.createElement("div");this.maskElement.setAttribute("style",b);document.body.appendChild(this.maskElement);case kShowControllerState_IdleAtInitialState:case kShowControllerState_IdleAtFinalState:case kShowControllerState_ReadyToJump:break;default:debugMessage(kDebugShowController_JumpToScene,"can't jump now, currently in '"+this.state+"' state which does not supports jumping...");return}if(this.textureManager.isScenePreloaded(d)===false){this.changeState(kShowControllerState_WaitingToJump);var a={sceneIndex:d,automaticPlay:c};this.waitForSceneToLoadTimeout=setTimeout(this.handleSceneDidNotLoad.bind(this,a),kMaxSceneDownloadWaitTime);this.textureManager.loadScene(d,this.handleSceneDidLoad.bind(this,a));return}this.changeState(kShowControllerState_SettingUpScene);runInNextEventLoop(this.jumpToScene_partThree.bind(this,d,c))},handleSceneDidLoad:function(a){clearTimeout(this.waitForSceneToLoadTimeout);this.displayManager.setNextButtonEnabled(this.currentSceneIndex<(this.script.pageCount-1));switch(this.state){case kShowControllerState_WaitingToJump:this.changeState(kShowControllerState_ReadyToJump);this.jumpToScene_partTwo(a.sceneIndex,a.automaticPlay);break;default:break}},handleSceneDidNotLoad:function(a){clearTimeout(this.waitForSceneToLoadTimeout);this.queuedUserAction=null;var b=this.promptUserToTryAgain(kUnableToReachiWorkTryAgain);if(b){var d=window.location.href;var f;var e=d.indexOf("&restartingSceneIndex");if(e===-1){f=d}else{f=d.substring(0,e)}var c=f+"&restartingSceneIndex="+a.sceneIndex;window.location.replace(c)}else{this.changeState(kShowControllerState_IdleAtFinalState)}},jumpToScene_partTwo:function(b,a){this.changeState(kShowControllerState_SettingUpScene);runInNextEventLoop(this.jumpToScene_partThree.bind(this,b,a))},jumpToScene_partThree:function(c,a){var b=false;if(b){runInNextEventLoop(this.jumpToScene_partFour.bind(this,c,a))}else{this.jumpToScene_partFour(c,a)}},jumpToScene_partFour:function(b,a){this.displayScene(b);if(this.starting){if(this.maskElement!=null){document.body.removeChild(this.maskElement);this.maskElement=null;this.starting=false}window.focus()}if(this.helpPlacard.isShowing){this.helpPlacard.hide()}if(this.slideNumberDisplay.isShowing){this.slideNumberDisplay.hide()}if(this.slideNumberController.isShowing){if(this.slideNumberTimeout){clearTimeout(this.slideNumberTimeout)}this.slideNumberTimeout=setTimeout(this.hideAndResetSlideNumberController.bind(this),500)}if(a){this.playCurrentScene()}else{this.changeState(kShowControllerState_IdleAtInitialState);if(this.isRecording&&!this.isRecordingStarted){this.narrationManager.start();this.isRecordingStarted=true}}},displayScene:function(g,c){if(g===-1){return}this.animationManager.deleteAllAnimations();var f=this.scriptManager.slideIndexFromSceneIndex(this.currentSceneIndex);var b=c?c.slideIndex:this.scriptManager.slideIndexFromSceneIndex(g);if(f!=b){this.resetMediaCache()}this.setCurrentSceneIndexTo(g);if(c){this.playbackController.renderEvent(c)}else{var e=this.script.slideIndexFromSceneIndexLookup[g];var d=this.script.slideList[e];var a=new KPFEvent({slideId:d,slideIndex:e,sceneIndex:g,event:this.script.events[g],animationSupported:this.animationSupported});this.playbackController.renderEvent(a)}this.updateNavigationButtons()},setCurrentSceneIndexTo:function(a){this.currentSceneIndex=a;this.assignNextSceneIndex();this.updateSlideNumber();this.updateNavigationButtons()},assignNextSceneIndex:function(){this.nextSceneIndex=this.calculateNextSceneIndex(this.currentSceneIndex)},calculateNextSceneIndex:function(b){var a=this.calculateNextSceneIndex_internal(b);return a},calculateNextSceneIndex_internal:function(b){var a=-1;if(b0){a=true}if(c===0&&this.script.lastSceneIndex===0){b=true}else{if(this.currentSceneIndex0;d--){var e=this.activeHyperlinks[d-1];var c=e.targetRectangle;hyperlinkLeft=Math.floor(c.x);hyperlinkTop=Math.floor(c.y);hyperlinkRight=hyperlinkLeft+Math.floor(c.width);hyperlinkBottom=hyperlinkTop+Math.floor(c.height);if((b.pointX>=hyperlinkLeft)&&(b.pointX<=hyperlinkRight)&&(b.pointY>=hyperlinkTop)&&(b.pointY<=hyperlinkBottom)){return e}}return null},createHyperlinksForCurrentState:function(a){var b=-1;switch(this.state){case kShowControllerState_IdleAtInitialState:b=this.currentSceneIndex;break;case kShowControllerState_IdleAtFinalState:if(this.currentSceneIndex0){for(var a=0;a0){this.hyperlinkPlane.removeChild(this.hyperlinkPlane.firstChild)}this.audioTrackOffset=this.audioTrackSpacer},handleStageSizeDidChangeEvent:function(a){this.stageWidth=a.memo.width;this.stageHeight=a.memo.height;this.adjustStageToFit(this.stage);this.adjustStageToFit(this.hyperlinkPlane)},handleShowSizeDidChangeEvent:function(a){this.showWidth=a.memo.width;this.showHeight=a.memo.height;this.adjustStageToFit(this.stage);this.adjustStageToFit(this.hyperlinkPlane);this.audioTrackIconSize=this.showHeight/4;this.audioTrackSpacer=this.audioTrackIconSize/4;this.audioTrackOffset=this.audioTrackSpacer},adjustStageToFit:function(b){if((this.showWidth!=0)&&(this.stageWidth!=0)){var d=this.stageHeight/this.showHeight;var f=this.stageWidth/this.showWidth;var a="scaleX("+f+") scaleY("+d+")";var e=20;var c=Math.tan(Math.PI/180*e/2)*15*(this.showWidth>this.showHeight?this.showHeight:this.showWidth);this.perspective=c;setElementProperty(b,kTransformOriginPropertyName,kTransformOriginCenterPropertyValue);setElementProperty(b,kTransformPropertyName,a);setElementProperty(b,kPerspectiveOriginPropertyName,kTransformOriginCenterPropertyValue);setElementProperty(b,kTransformStylePropertyName,kTransformStylePreserve3DPropertyValue);setElementPosition(b,(d-1)*this.showHeight/2,(f-1)*this.showWidth/2,this.showWidth,this.showHeight);document.fire(kStageIsReadyEvent,{})}},debugGetStageStatistics:function(){var a={numTextures:0,numPixels:0,numDegraded:0};this.debugRecursivelyWalkDomFrom(this.stage,a);return a}});
================================================
FILE: assets/player/TextureManager.js
================================================
var KNStaticAssets={};KNStaticAssets["KNTransitionSwoosh_Shadow.png"]=new Image();KNStaticAssets["KNTransitionSwoosh_Shadow.png"].src=static_url("KNTransitionSwoosh_Shadow.png");KNStaticAssets["KNTransitionSlide_Black.png"]=new Image();KNStaticAssets["KNTransitionSlide_Black.png"].src=static_url("KNTransitionSlide_Black.png");var TextureManager=Class.create({initialize:function(a){this.script=null;this.showUrl=a;this.sceneCache={};this.slideCache={};this.sceneDidLoadCallbackHandler=null;this.viewScale=1;document.observe(kScriptDidDownloadEvent,(function(b){this.handleScriptDidDownloadEvent(b)}).bind(this),false)},setSceneDidLoadCallbackHandler:function(a,b){this.sceneDidLoadCallbackHandler={handler:a,sceneIndex:b}},processTextureDidLoadCallback:function(d,b){if(this.sceneDidLoadCallbackHandler==null){return}var c=this.sceneDidLoadCallbackHandler.sceneIndex;var a=this.script.slideIndexFromSceneIndexLookup[c];if(a!=b){return}if(this.isSlidePreloaded(b)){this.callSceneDidLoadCallback()}},processSlideDidLoadCallback:function(b){if(this.sceneDidLoadCallbackHandler==null){return}var c=this.sceneDidLoadCallbackHandler.sceneIndex;var a=this.script.slideIndexFromSceneIndexLookup[c];if(a!=b){return}this.callSceneDidLoadCallback()},processSceneDidLoadCallback:function(a){if(this.sceneDidLoadCallbackHandler&&a===this.sceneDidLoadCallbackHandler.sceneIndex&&this.isScenePreloaded(a)){this.callSceneDidLoadCallback()}},callSceneDidLoadCallback:function(){this.sceneDidLoadCallbackHandler.handler();this.sceneDidLoadCallbackHandler=null},loadScene:function(c,a){if(c<0||c>this.script.numScenes){return}if(a){this.setSceneDidLoadCallbackHandler(a,c)}var b=this.script.slideIndexFromSceneIndexLookup[c];if(this.delegate.loadTextureBySlideIndex){this.assetForSlide(b)}else{this.requestTexturesForSlide(b)}},preloadScenes:function(a){for(var c in a){var b=this.script.slideIndexFromSceneIndexLookup[c];if(b==null){continue}if(this.slideCache.hasOwnProperty(b)===false){this.loadScene(c)}}},isSlidePreloaded:function(b){var a=false;if(this.slideCache[b]){a=true;for(var c in this.slideCache[b].textureRequests){if(this.slideCache[b].textureRequests[c]===false){a=false;break}}}return a},isScenePreloaded:function(c){var b=this.script.slideIndexFromSceneIndexLookup[c];var a=this.isSlidePreloaded(b);return a},handleScriptDidDownloadEvent:function(a){this.script=a.memo.script;this.delegate=a.memo.delegate},assetForSlide:function(f){var d=this.slideCache[f];var c=this.script.slideList[f];var b=this.script.slides[c];var a=b.assets;if(d==null){this.slideCache[f]={};this.slideCache[f].textureAssets={};this.slideCache[f].textureRequests={};for(var g in a){var e=a[g];if(e.type==="texture"){this.slideCache[f].textureRequests[g]=false;this.requestAsset(g,e,c,f)}}}else{if(this.isSlidePreloaded(f)){this.processSlideDidLoadCallback(f)}else{for(var g in a){var e=a[g];if(this.slideCache[f].textureRequests[g]===false&&e.type==="texture"){this.requestAsset(g,e,c,f)}}}}},requestAsset:function(d,b,a,c){requestedSlideIndex=c;if(b.assetRequest.type==="slide"){if(b.assetRequest.state==="incoming"||b.assetRequest.state==="incoming-reflection"){if(b.assetRequest.slide){requestedSlideIndex=this.script.slideList.indexOf(b.assetRequest.slide);if(requestedSlideIndex===-1){if(this.script.loopSlideshow){requestedSlideIndex=0}else{requestedSlideIndex=c;b.assetRequest.state="KNTransitionSlide_Black.png"}}}else{if(cthis.trackAreaRight){debugMessage(kDebugTouchController_IsTouchWithinTrackArea,"- nope, x > right");return false}if(a.clientYthis.trackAreaBottom){debugMessage(kDebugTouchController_IsTouchWithinTrackArea,"- nope, y > bottom");return false}debugMessage(kDebugTouchController_IsTouchWithinTrackArea,"- yes it is!");return true},handleTouchStartEvent:function(b){debugMessage(kDebugTouchController_HandleTouchStartEvent,"touch event has "+b.touches.length+" fingers...");if(this.swipeInProgress===false){debugMessage(kDebugTouchController_HandleTouchStartEvent,"- this is the first finger down event...");var a=b.touches[0];if(this.isTouchWithinTrackArea(a)){debugMessage(kDebugTouchController_HandleTouchStartEvent,"- start tracking a swipt event...");if(this.preventDefault){b.preventDefault()}this.swipeInProgress=true;this.swipeFingerCount=b.touches.length;this.swipeStartTime=new Date();this.swipeStartX=a.clientX;this.swipeStartY=a.clientY}else{debugMessage(kDebugTouchController_HandleTouchStartEvent,"- but it is outside of the track area")}}else{debugMessage(kDebugTouchController_HandleTouchStartEvent,"- this is a subsequent finger down event. update finger count...");if(b.touches.length>this.swipeFingerCount){this.swipeFingerCount=b.touches.length;debugMessage(kDebugTouchController_HandleTouchStartEvent,"- this.swipeFingerCount:"+this.swipeFingerCount)}}},handleTouchMoveEvent:function(a){if(this.preventDefault){a.preventDefault()}debugMessage(kDebugTouchController_HandleTouchCancelEvent,"")},handleTouchEndEvent:function(a){debugMessage(kDebugTouchController_HandleTouchEndEvent,"touch event has "+a.touches.length+" fingers...");if(this.swipeInProgress){if(this.preventDefault){a.preventDefault()}if(a.touches.length===0){debugMessage(kDebugTouchController_HandleTouchEndEvent,"- "+this.swipeFingerCount+" finger swipe is complete.");var h=a.changedTouches[0];var m=document.viewport.getDimensions();var e=m.width/3;var d=m.height/3;var g=m.width/3;var k=h.clientX-this.swipeStartX;var i=h.clientY-this.swipeStartY;var c=Math.abs(k);var b=Math.abs(i);var o=new Date();var q=o-this.swipeStartTime;var l=false;var p=false;var f=400;var j=20;if(q800){debugMessage(kDebugTouchController_HandleTouchEndEvent,"- elapsed time too long to be a swipe, ignoring...")}else{if(c>b){if(b>d){debugMessage(kDebugTouchController_HandleTouchEndEvent,"- vertical magnitude too high, ignoring...")}else{p=true}}else{if(c>g){debugMessage(kDebugTouchController_HandleTouchEndEvent,"- horizontal magnitude too high, ignoring...")}else{p=true}}}if(l){debugMessage(kDebugTouchController_HandleTouchEndEvent,"- it's a "+this.swipeFingerCount+" finger tap");if(this.tapEventCallback){var a={};a.memo={};a.memo.fingers=this.swipeFingerCount;a.memo.pointX=h.clientX;a.memo.pointY=h.clientY;debugMessage(kDebugTouchController_HandleTouchEndEvent,"- invoking callback with pointX: "+h.clientX+" pointY: "+h.clientY+"...");this.tapEventCallback(a);debugMessage(kDebugTouchController_HandleTouchEndEvent,"- back from callback")}else{debugMessage(kDebugTouchController_HandleTouchEndEvent,"- firing TapEvent...");document.fire(kTapEvent,{fingers:this.swipeFingerCount,pointX:h.clientX,pointY:h.clientY})}}else{if(p){var n;if(c>b){n=(k<0?"left":"right")}else{n=(i<0?"up":"down")}debugMessage(kDebugTouchController_HandleTouchEndEvent,"- it's a "+this.swipeFingerCount+" finger swipe in the "+n+" direction");document.fire(kSwipeEvent,{direction:n,fingers:this.swipeFingerCount})}}this.swipeInProgress=false;this.swipeFingerCount=0}}else{debugMessage(kDebugTouchController_HandleTouchEndEvent,"- false alarm. swipe has already ended.")}},handleTouchCancelEvent:function(a){debugMessage(kDebugTouchController_HandleTouchCancelEvent,"");this.swipeInProgress=false},handleGestureStartEvent:function(a){debugMessage(kDebugTouchController_HandleGestureStartEvent,"");if(this.preventDefault){a.preventDefault()}},handleGestureEndEvent:function(a){debugMessage(kDebugTouchController_HandleGestureEndEvent,"");if(this.preventDefault){a.preventDefault()}}});
================================================
FILE: assets/player/Utilities.js
================================================
var s=Class.create({initialize:function(){}});function getMobileOSVersionInfo(){var b=navigator.userAgent.match(/iPhone OS ([\d_]+)/)||navigator.userAgent.match(/iPad OS ([\d_]+)/)||navigator.userAgent.match(/CPU OS ([\d_]+)/);var c={major:0,minor:0,point:0};if(b){var a=b[1].split("_");c.major=parseInt(a[0]);if(a.length>1){c.minor=parseInt(a[1])}if(a.length>2){c.point=parseInt(a[2])}}return c}function isMobileSafari(){if(navigator.userAgent.indexOf("iPod")!=-1){return true}else{if(navigator.userAgent.indexOf("iPhone")!=-1){return true}else{if(navigator.userAgent.indexOf("iPad")!=-1){return true}else{return false}}}}function isiPad(){return(navigator.userAgent.indexOf("iPad")!=-1)}function getUrlParameter(b){b=b.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var a="[\\?&]"+b+"=([^]*)";var c=new RegExp(a);var d=c.exec(window.location.href);if(d==null){return""}else{return d[1]}}function setElementProperty(c,b,a){if(browserPrefix=="ms"){c.style[b]=a}else{c.style.setProperty(b,a,null)}}function setElementOpaque(a){a.style.opacity=1}function setElementTransparent(a){a.style.opacity=0}function setElementPosition(b,e,d,c,a){if(b==null){window.console.log("null element passed to setElementPosition "+e+", "+d+", "+c+", "+a);return}b.style.top=e+"px";b.style.left=d+"px";b.style.width=c+"px";b.style.height=a+"px"}function setElementRect(a,b){if(a==null){return}a.style.top=b.y;a.style.left=b.x;a.style.width=b.width;a.style.height=b.height}function centerElementInDiv(c,e,d,a,b){if(c==null){return}var g=(b-d)/2;var f=(a-e)/2;setElementPosition(c,g,f,e,d)}function showElement(a){if(a==null){return}a.style.visibility="visible"}function hideElement(a){if(a==null){return}a.style.visibility="hidden"}function runInNextEventLoop(a){setTimeout(a,100)}function ensureScaleFactorNotZero(a){if(a==0){return 0.000001}else{return a}}function scaleSizeWithinSize(c,g,e,d){var f={};var b=c/g;var a=e/d;if(b>a){f.width=e;f.height=g*(e/c)}else{if(b9?"":"0")+a}Object.extend(Date.prototype,{format:function(D){D=D+"";var I=this;var l="";var v=0;var G="";var f="";var j=I.getFullYear()+"";var g=I.getMonth()+1;var F=I.getDate();var o=I.getDay();var n=I.getHours();var x=I.getMinutes();var q=I.getSeconds();var t,u,b,r,J,e,C,B,z,p,N,n,L,i,a,A;var w=new Object();if(j.length<4){j=""+(j-0+1900)}w.y=""+j;w.yyyy=j;w.yy=j.substring(2,4);w.M=g;w.MM=LZ(g);w.MMM=MONTH_NAMES[g-1];w.NNN=MONTH_NAMES[g+11];w.d=F;w.dd=LZ(F);w.E=DAY_NAMES[o+7];w.EE=DAY_NAMES[o];w.H=n;w.HH=LZ(n);if(n==0){w.h=12}else{if(n>12){w.h=n-12}else{w.h=n}}w.hh=LZ(w.h);if(n>11){w.K=n-12}else{w.K=n}w.k=n+1;w.KK=LZ(w.K);w.kk=LZ(w.k);if(n>11){w.a="PM"}else{w.a="AM"}w.m=x;w.mm=LZ(x);w.s=q;w.ss=LZ(q);while(v-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div"),b=document.createElement("form"),a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"