tao-test/app/taoDelivery/views/js/loader/taoDelivery.min.js

2 lines
8.8 KiB
JavaScript

function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}define("taoDelivery/controller/DeliveryServer/index",["jquery","lodash","i18n","module","core/router","ui/feedback","core/logger","layout/loading-bar","context","util/locale","url-polyfill"],function($,_,__,module,router,feedback,loggerFactory,loadingBar,context,locale){'use strict';var logger=loggerFactory("deliveryServer"),accessibilityLaunchKeyCodes=[13,32],displayPermanentMessage=function(level,content){level&&content&&feedback($(".permanent-feedback"))[level](content,{timeout:-1,popup:!1})},getLTIErrorParameters=function(){var _URL=new URL(window.location.href),searchParams=_URL.searchParams;return["lti_errormsg","lti_errorlog"].reduce(function(params,paramName){return searchParams.has(paramName)&&(params[paramName]=searchParams.get(paramName)),params},{})};return{start:function start(parameters){var deliveryStarted=!1,runDelivery=function(url){_.isString(url)&&!_.isEmpty(url)&&(deliveryStarted=!0,loadingBar.start(),window.location.href=url)},config=module.config();parameters&&parameters.messages&&_.forEach(parameters.messages,function(message){displayPermanentMessage(message.level,message.content)});var _getLTIErrorParameter=getLTIErrorParameters(),ltiErrorMsg=_getLTIErrorParameter.lti_errormsg,ltiErrorLog=_getLTIErrorParameter.lti_errorlog;ltiErrorMsg&&displayPermanentMessage("error",ltiErrorMsg.length?ltiErrorMsg:__("An error occurred!"));ltiErrorLog&&logger.error(ltiErrorLog);var launchDelivery=function(e){var $elt=$(e.currentTarget);e.preventDefault(),e.stopPropagation(),deliveryStarted||$elt.hasClass("disabled")||runDelivery($elt.data().launch_url)};(function(){$(".delivery-scope").attr({dir:locale.getLanguageDirection(context.locale)})})(),$(".entry-point").on("click",launchDelivery),$(".entry-point").on("keyup",function(e){accessibilityLaunchKeyCodes.includes(e.which)&&launchDelivery(e)}),config&&_.isArray(config.extraRoutes)&&config.extraRoutes.length&&router.dispatch(config.extraRoutes)}}}),define("taoDelivery/controller/routes",[],function(){'use strict';return{}}),define("tpl!taoDelivery/tpl/fullscreen-modal-feedback",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper,buffer="";return buffer+="(",(helper=helpers.launchButton)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.launchButton,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+")",buffer}function program3(depth0,data){var helper,options,buffer="";return buffer+="\n <button class=\"btn-info small enter-full-screen\" type=\"button\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Enter full screen",options):helperMissing.call(depth0,"__","Enter full screen",options)))+"</button>\n ",buffer}function program5(depth0,data){var helper,options,buffer="";return buffer+="\n <button class=\"btn-info small close-full-screen-prompt\" type=\"button\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Close this prompt",options):helperMissing.call(depth0,"__","Close this prompt",options)))+"</button>\n ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",escapeExpression=this.escapeExpression,helperMissing=helpers.helperMissing,self=this;return buffer+="<div class=\"modal-feedback modal full-screen-modal\">\n <div class=\"modal-body clearfix\">\n <p class=\"message\">\n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"This test needs to be taken in full screen mode",options):helperMissing.call(depth0,"__","This test needs to be taken in full screen mode",options)))+"\n ",stack1=helpers.unless.call(depth0,depth0&&depth0.fsSupported,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </p>\n <div class=\"rgt\">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.fsSupported,{hash:{},inverse:self.program(5,program5,data),fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </div>\n </div>\n</div>",buffer})}),define("taoDelivery/controller/runtime/service/fullScreen",["jquery","lodash","i18n","ui/feedback","ui/modal","tpl!taoDelivery/tpl/fullscreen-modal-feedback"],function($,_,__,feedback,modal,dialogTpl){'use strict';var $dialog,$body,d=document,dElem=d.documentElement,fs={changeInterval:null,isSupported:!!(d.exitFullscreen||d.msExitFullscreen||d.mozCancelFullScreen||d.webkitExitFullscreen),requestFullscreen:dElem.requestFullscreen||dElem.msRequestFullscreen||dElem.mozRequestFullScreen||function(){dElem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)},fullscreenchange:function(){for(var prefixes=["","ms","moz","webkit"],i=prefixes.length;i--;)if("on"+prefixes[i]+"fullscreenchange"in dElem)return prefixes[i]+"fullscreenchange";return"myfullscreenchange"}(),fullScreen:function fullScreen(){return!!(d.fullscreenElement||d.mozFullScreen||d.webkitIsFullScreen||(screen.availHeight||screen.height-30)<=window.innerHeight)},awaitFsChange:function awaitFsChange(){var event=d.createEvent("Event");event.initEvent(fs.fullscreenchange,!0,!0),clearInterval(fs.changeInterval),fs.changeInterval=setInterval(function(){fs.fullScreen()||d.dispatchEvent(event)},2e3)}},handleUserInput=function(evt){return fs.isSupported?void("keydown"===evt.type&&13!==(evt.keyCode||evt.which)||(fs.requestFullscreen.call(dElem),dElem.className+=" fullscreen",$dialog.modal("close"))):void $dialog.modal("close")},triggerResize=function(){return _.throttle(function(){var frame=document.getElementById("iframeDeliveryExec"),frameWindow=frame&&frame.contentWindow,frame$=frameWindow&&frameWindow.$,$win=frame$&&frame$(frameWindow)||$(window);$win.trigger("resize")},250)}(),init=function(){$body=$(document.body),document.addEventListener(fs.fullscreenchange,function(){fs.fullScreen()?triggerResize():(dElem.className=dElem.className.replace(/\bfullscreen\b/,""),$dialog.modal("open"))}),fs.isSupported||fs.awaitFsChange(),modal($body),$dialog=$(dialogTpl({fsSupported:fs.isSupported,launchButton:0===navigator.platform.toLowerCase().indexOf("Mac")?"Ctrl+\u2318+F":"F11"})),$dialog[0].querySelector("button").addEventListener("click",function(e){handleUserInput(e)}),document.addEventListener("keydown",function(e){fs.fullScreen()||handleUserInput(e)}),$dialog.on("opened.modal",function(){clearInterval(fs.changeInterval)}),$dialog.on("closed.modal",function(){fs.isSupported||(fs.awaitFsChange(),triggerResize())}),$body.append($dialog),$dialog.modal({width:500,animate:!1,disableClosing:!0,startClosed:!0}),!1==(screen.availHeight||screen.height-30)<=window.innerHeight&&$dialog.modal("open")};return{init:init}}),define("taoDelivery/controller/runtime/service/deliveryExecution",["lodash","jquery","taoDelivery/controller/runtime/service/fullScreen","layout/loading-bar","ui/dialog/alert","layout/logout-event"],function(_,$,fullScreen,loadingBar,dialogAlert,logoutEvent){'use strict';function resizeMainFrame(){var height=$(window).outerHeight()-$headerHeight-$footerHeight;$frameContainer.height(height),$frame.height(height),forceRepaint($frameContainer)}var $frameContainer,$frame,$headerHeight,$footerHeight,forceRepaint=function($target){var sel=$target[0];sel&&(sel.style.display="none",sel.offsetHeight,sel.style.display="")};return{start:function start(options){var serviceApi=options.serviceApi;!options.deliveryServerConfig.requireFullScreen||fullScreen.init(),$frameContainer=$("#outer-delivery-iframe-container"),$frame=$frameContainer.find("iframe"),$headerHeight=$("body > .content-wrap > header").outerHeight()||0,$footerHeight=$("body > footer").outerHeight()||0,$(document).on("serviceforbidden",function(){logoutEvent()}),serviceApi.onFinish(function(){window.location=options.finishDeliveryExecution}).onExit(function(){window.location=options.exitDeliveryExecution}),$(document).on("loading",function(){loadingBar.start()}).on("unloading",function(){setTimeout(function(){loadingBar.stop()},300)}).on("messagealert",function(e,data){data&&dialogAlert(data.message,data.action)}).on("shutdown-com",function(){$(document).off("heightchange"),$frame.off("load.eventHeight").off("load.cors")}),serviceApi.loadInto($frame.get(0)),$(window).on("resize",_.throttle(function(){resizeMainFrame()},250)),resizeMainFrame()}}}),define("taoDelivery/loader/taoDelivery.bundle",function(){});
//# sourceMappingURL=taoDelivery.min.js.map