diff --git a/assets/js/app.js b/assets/js/app.js index e75c319294..9259ad7a30 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -20,11 +20,18 @@ require('select2/dist/js/select2.full.min'); require('flatpickr'); //import('bootstrap-vue'); import('bootstrap'); -import('webpack-jquery-ui'); -import('webpack-jquery-ui/css'); +require('webpack-jquery-ui'); +require('webpack-jquery-ui/css'); + +// const frameReady = require('/public/main/inc/lib/javascript/jquery.frameready.js'); +// +// global.frameReady = frameReady; +// window.frameReady = frameReady; + require('./vendor'); import('./main'); require('bootstrap-daterangepicker'); +import('qtip2'); //require('bootstrap-daterangepicker/daterangepicker.js'); require('blueimp-file-upload'); diff --git a/assets/js/lp.js b/assets/js/lp.js index a117bc425e..d76e009158 100644 --- a/assets/js/lp.js +++ b/assets/js/lp.js @@ -10,6 +10,10 @@ global.jQuery = $; import('webpack-jquery-ui'); import('webpack-jquery-ui/css'); +const frameReady = require('/public/main/inc/lib/javascript/jquery.frameready.js'); + +global.frameReady = frameReady; +window.frameReady = frameReady; var hljs = require('highlight.js'); global.hljs = hljs; diff --git a/public/main/inc/lib/javascript/jquery.frameready.js b/public/main/inc/lib/javascript/jquery.frameready.js index 45b5fbd58a..319be324e7 100644 --- a/public/main/inc/lib/javascript/jquery.frameready.js +++ b/public/main/inc/lib/javascript/jquery.frameready.js @@ -4,107 +4,121 @@ * @param {Array} resources * @constructor */ -$.frameReady = function (callback, targetSelector, resources) { - /** - * @type {window} - */ - var targetWindow = document.querySelector(targetSelector); - /** - * @type {Document} - */ - var targetDocument = null; - - var scripts = resources.filter(function (resource) { - return resource.type === 'script'; - }); - var stylesheets = resources.filter(function (resource) { - return resource.type === 'stylesheet'; - }); - - var scriptsCount = (function () { - var count = 0; + +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof module === 'object' && typeof module.exports === 'object') { + factory(require('jquery')); + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { + $.frameReady = function (callback, targetSelector, resources) { /** - * @param {Object} parentScript + * @type {window} */ - function countScripts(parentScript) { - count++; - - if (!parentScript.hasOwnProperty('deps')) { - return; - } + var targetWindow = document.querySelector(targetSelector); + /** + * @type {Document} + */ + var targetDocument = null; - parentScript.deps.forEach(countScripts); - } + var scripts = resources.filter(function (resource) { + return resource.type === 'script'; + }); + var stylesheets = resources.filter(function (resource) { + return resource.type === 'stylesheet'; + }); - scripts.forEach(countScripts); + var scriptsCount = (function () { + var count = 0; - return count; - })(); - var scripsLoadedCount = 0; + /** + * @param {Object} parentScript + */ + function countScripts(parentScript) { + count++; - targetWindow.onload = function () { - scripsLoadedCount = 0; + if (!parentScript.hasOwnProperty('deps')) { + return; + } - targetDocument = targetWindow.contentDocument; + parentScript.deps.forEach(countScripts); + } - scripts.forEach(function (script) { - createScript(script); - }); + scripts.forEach(countScripts); - stylesheets.forEach(function (stylesheet) { - createStylesheet(stylesheet); - }); - }; + return count; + })(); + var scripsLoadedCount = 0; - /** - * @param {Object} script - */ - function createScript(script) { - /** - * @type {HTMLScriptElement} - */ - var elParent = targetWindow.contentDocument.createElement('script'); - elParent.async = false; - elParent.onload = function () { - scripsLoadedCount++; + targetWindow.onload = function () { + scripsLoadedCount = 0; - if (!script.hasOwnProperty('deps')) { - tryExecuteCallback(); + targetDocument = targetWindow.contentDocument; - return; - } + scripts.forEach(function (script) { + createScript(script); + }); - script.deps.forEach(function (scriptB) { - createScript(scriptB); + stylesheets.forEach(function (stylesheet) { + createStylesheet(stylesheet); }); }; - elParent.setAttribute('src', script.src); - - targetDocument.body.appendChild(elParent); - } - /** - * @param {Object} stylesheet - */ - function createStylesheet(stylesheet) { /** - * @type {HTMLLinkElement} + * @param {Object} script */ - var el = targetWindow.contentDocument.createElement('link'); - el.setAttribute('href', stylesheet.src); - el.setAttribute('rel', "stylesheet"); - el.setAttribute('type', "text/css"); - if (targetDocument.head) { - targetDocument.head.appendChild(el); + function createScript(script) { + /** + * @type {HTMLScriptElement} + */ + var elParent = targetWindow.contentDocument.createElement('script'); + elParent.async = false; + elParent.onload = function () { + scripsLoadedCount++; + + if (!script.hasOwnProperty('deps')) { + tryExecuteCallback(); + + return; + } + + script.deps.forEach(function (scriptB) { + createScript(scriptB); + }); + }; + elParent.setAttribute('src', script.src); + + targetDocument.body.appendChild(elParent); } - } - function tryExecuteCallback() { - if (scripsLoadedCount < scriptsCount) { - return; + /** + * @param {Object} stylesheet + */ + function createStylesheet(stylesheet) { + /** + * @type {HTMLLinkElement} + */ + var el = targetWindow.contentDocument.createElement('link'); + el.setAttribute('href', stylesheet.src); + el.setAttribute('rel', "stylesheet"); + el.setAttribute('type', "text/css"); + if (targetDocument.head) { + targetDocument.head.appendChild(el); + } } - targetWindow.contentWindow.eval('(' + callback.toString() + ')();'); - } -}; + function tryExecuteCallback() { + if (scripsLoadedCount < scriptsCount) { + return; + } + + targetWindow.contentWindow.eval('(' + callback.toString() + ')();'); + } + }; +})); \ No newline at end of file diff --git a/public/main/lp/lp_view.php b/public/main/lp/lp_view.php index 9dda0765a0..a70ddae220 100644 --- a/public/main/lp/lp_view.php +++ b/public/main/lp/lp_view.php @@ -90,13 +90,6 @@ $platform_theme = api_get_setting('stylesheets'); $my_style = $platform_theme; $ajaxUrl = api_get_path(WEB_AJAX_PATH).'lp.ajax.php?a=get_item_prerequisites&'.api_get_cidreq(); $htmlHeadXtra[] = ''; - -$htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; } -// Impress js if ('impress' === $lp->getDefaultViewMod()) { $lp_id = $lp->getIid(); $url = api_get_path(WEB_CODE_PATH)."lp/lp_impress.php?lp_id=$lp_id&".api_get_cidreq(); @@ -208,7 +200,7 @@ if (!isset($src)) { switch ($lpType) { case CLp::LP_TYPE: $oLP->stop_previous_item(); - $htmlHeadXtra[] = ''; + $htmlHeadXtra[] = ''; $preReqCheck = $oLP->prerequisites_match($lp_item_id); if (true === $preReqCheck) { @@ -250,7 +242,7 @@ if (!isset($src)) { case CLp::SCORM_TYPE: // save old if asset $oLP->stop_previous_item(); // save status manually if asset - $htmlHeadXtra[] = ''; + $htmlHeadXtra[] = ''; $preReqCheck = $oLP->prerequisites_match($lp_item_id); if (true === $preReqCheck) { $src = $oLP->get_link('http', $lp_item_id, $get_toc_list); @@ -261,7 +253,7 @@ if (!isset($src)) { break; case CLp::AICC_TYPE: $oLP->stop_previous_item(); // save status manually if asset - $htmlHeadXtra[] = ''; + $htmlHeadXtra[] = ''; $preReqCheck = $oLP->prerequisites_match($lp_item_id); if (true === $preReqCheck) { $src = $oLP->get_link( @@ -567,8 +559,9 @@ $template->assign('menu_location', $menuLocation); $template->assign('disable_js_in_lp_view', (int) api_get_configuration_value('disable_js_in_lp_view')); $template->assign('lp_preview_image', ''.$oLP->getNameNoTags().''); -$frameReady = Display::getFrameReadyBlock('#content_id, #content_id_blank'); -$template->assign('frame_ready', $frameReady); +//$frameReady = Display::getFrameReadyBlock('#content_id, #content_id_blank'); +//$template->assign('frame_ready', $frameReady); +$template->assign('frame_ready', ''); $template->displayTemplate('@ChamiloCore/LearnPath/view.html.twig'); // Restore a global setting. diff --git a/src/CoreBundle/Resources/views/LearnPath/view.html.twig b/src/CoreBundle/Resources/views/LearnPath/view.html.twig index 3ca4c6dc7e..5a26abd379 100644 --- a/src/CoreBundle/Resources/views/LearnPath/view.html.twig +++ b/src/CoreBundle/Resources/views/LearnPath/view.html.twig @@ -147,17 +147,15 @@ {% include '@ChamiloCore/LearnPath/scorm_list.html.twig' %} - {# end TOC layout #} - {# end left zone #} {% endif %} {# Right zone #}
-