2 lines
3.2 KiB
JavaScript
2 lines
3.2 KiB
JavaScript
(function(){'use strict';var loaderScript=document.getElementById("amd-loader"),configUrl=loaderScript.getAttribute("data-config"),bundle=loaderScript.getAttribute("data-bundle"),loadController=function(){var controllerOptions={},controllerPath=loaderScript.getAttribute("data-controller"),params=loaderScript.getAttribute("data-params");try{controllerOptions=JSON.parse(params)}catch(err){controllerOptions={}}window.require([controllerPath],function(controller){var startController=function(){window.started||(window.started=!0,controller.start(controllerOptions))};document.addEventListener("readystatechange",startController,!1),"complete"===document.readyState&&startController()})};window.require([configUrl],function(){window.loadBundles||(window.loaded={},window.loadBundles=function(bundles){bundles=bundles||[],bundles=bundles.concat(window.bundles),bundles=bundles.filter(function(item,index){return item&&bundles.indexOf(item)===index&&!0!==window.loaded[item]}),require(bundles,function(){bundles.forEach(function(item){window.loaded[item]=!0}),loadController()})}),bundle||window.bundles&&window.bundles.length?window.loadBundles([bundle]):loadController()})})(),define("loader/bootstrap",function(){}),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&¶meters.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/loader/deliveryServerIndex.bundle",function(){});
|
|
//# sourceMappingURL=deliveryServerIndex.min.js.map
|