Website/slides/cse662fa2017/2017-09-01-FunctionalDataStructures/assets/player/ShowController.js

1 line
35 KiB
JavaScript
Raw Normal View History

2017-09-01 12:07:46 -04:00
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(kKeyDownEvent,this.handleKeyDownEvent.bind(this));document.observe(kSwipeEvent,this.handleSwipeEvent.bind(this));Event.observe(this.displayManager.body,"click",this.handleClickEvent.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.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(isIE&&browserVersion<10){this.animationSupported=false}else{this.animationSupported=true}document.observe("contextmenu",this.handleContextMenuEvent.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(b){switch(thi