1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-14 01:22:13 +02:00

Issue #2745 - Move JS files to footer. (Tested with and without JS/CSS caching)

This commit is contained in:
Lóna Lore 2017-07-25 19:20:11 +02:00
parent a40be42092
commit e7f2844481
4 changed files with 30 additions and 51 deletions

View File

@ -53,62 +53,42 @@ if(!deftrue('e_MENUMANAGER_ACTIVE'))
function loadJSAddons()
{
if(deftrue('e_MENUMANAGER_ACTIVE'))
{
return;
}
// e107::js('core', 'bootstrap/js/bootstrap-modal.js', 'jquery', 2); // Special Version see: https://github.com/twitter/bootstrap/pull/4224
e107::css('core', 'bootstrap-select/bootstrap-select.min.css', 'jquery');
e107::js('core', 'bootstrap-select/bootstrap-select.min.js', 'jquery', 2);
// TODO use Library Manager. Remove unused libraries...
e107::css('core', 'bootstrap-select/bootstrap-select.min.css', 'jquery');
e107::js('footer', '{e_WEB}js/bootstrap-select/bootstrap-select.min.js', 'jquery', 2);
// e107::css('core', 'bootstrap-multiselect/css/bootstrap-multiselect.css', 'jquery');
e107::js('core', 'bootstrap-multiselect/js/bootstrap-multiselect.js', 'jquery', 2);
// e107::css('core', 'bootstrap-multiselect/css/bootstrap-multiselect.css', 'jquery');
e107::js('footer', '{e_WEB}js/bootstrap-multiselect/js/bootstrap-multiselect.js', 'jquery', 2);
// TODO: remove typeahead.
e107::js('core', 'bootstrap-jasny/js/jasny-bootstrap.js', 'jquery', 2);
e107::js('footer', '{e_WEB}js/bootstrap-jasny/js/jasny-bootstrap.js', 'jquery', 2);
e107::css('core', 'bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css', 'jquery');
e107::js('core', 'bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js', 'jquery', 2);
e107::css('core', 'bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css', 'jquery');
e107::js('footer', '{e_WEB}js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js', 'jquery', 2);
e107::js('core', 'jquery.h5validate.min.js','jquery',2);
e107::js('footer','{e_WEB}js/jquery.h5validate.min.js','jquery', 2);
e107::js('core', 'jquery.elastic.js', 'jquery', 2);
e107::js('core', 'jquery.at.caret.min.js', 'jquery', 2);
// e107::js('core', 'jquery-ui-timepicker-addon.js', 'jquery', 2);
//e107::css('core', 'chosen/chosen.css', 'jquery');
//e107::js('core', 'chosen/chosen.jquery.min.js', 'jquery', 2);
// e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2); // loaded in form-handler.
// e107::css('core', 'bootstrap-tag/bootstrap-tag.css', 'jquery');
// e107::js('core', 'bootstrap-tag/bootstrap-tag.js', 'jquery', 2);
// e107::js("core", "tags/jquery.tagit.js","jquery",3);
// e107::css('core', 'tags/jquery.tagit.css', 'jquery');
e107::js('footer', '{e_WEB}js/jquery.elastic.js', 'jquery', 2);
e107::js('footer', '{e_WEB}js/jquery.at.caret.min.js', 'jquery', 2);
e107::css('core', 'core/admin.jquery.css', 'jquery');
e107::js("core", "core/admin.jquery.js","jquery",4); // Load all default functions.
e107::css('core', 'core/all.jquery.css', 'jquery');
e107::css('core', 'core/admin.jquery.css', 'jquery');
e107::css('core', 'core/all.jquery.css', 'jquery');
e107::js("core", "core/all.jquery.js","jquery",4); // Load all default functions.
e107::js('footer', '{e_WEB}js/core/admin.jquery.js', 'jquery', 5); // Load all default functions.
e107::js('footer', '{e_WEB}js/core/all.jquery.js', 'jquery', 5); // Load all default functions.
$plUpload = "plupload/i18n/".e_LAN.".js";
$plUpload = '{e_WEB}js/plupload/i18n/' . e_LAN . '.js';
if(e_LAN != 'en' && file_exists(e_WEB_JS.$plUpload))
if(e_LAN != 'en' && file_exists(e_WEB_JS . $plUpload))
{
e107::js('core', $plUpload);
e107::js('footer', $plUpload, 'jquery', 5);
}
}
// Load library dependencies.

View File

@ -31,18 +31,17 @@ e107::getTheme('current', true)->loadLibrary();
if(deftrue('BOOTSTRAP'))
{
e107::js('core', 'bootstrap-notify/js/bootstrap-notify.js','jquery');
e107::css('core', 'bootstrap-notify/css/bootstrap-notify.css','jquery');
e107::js('footer', '{e_WEB}js/bootstrap-notify/js/bootstrap-notify.js', 'jquery', 2);
e107::css('core', 'bootstrap-notify/css/bootstrap-notify.css', 'jquery');
}
// ------------------
// e107::js('core', 'jquery.elastic.js', 'jquery', 2);
e107::js('core', 'rate/js/jquery.raty.js', 'jquery', 2);
e107::css('core', 'core/all.jquery.css', 'jquery');
e107::js('footer', '{e_WEB}js/rate/js/jquery.raty.js', 'jquery', 2);
e107::css('core', 'core/all.jquery.css', 'jquery');
e107::js("core", "core/front.jquery.js","jquery",5); // Load all default functions.
e107::js("core", "core/all.jquery.js","jquery",5); // Load all default functions.
e107::js('footer', '{e_WEB}js/core/front.jquery.js', 'jquery', 5); // Load all default functions.
e107::js('footer', '{e_WEB}js/core/all.jquery.js', 'jquery', 5); // Load all default functions.
$js_body_onload = array(); // Legacy array of code to load with page.

View File

@ -1429,11 +1429,10 @@ class e_form
$text .= "<input type='{$ftype}' name='{$name}' id='{$id}' value='{$hiddenValue}' />";
}
// Load it in the footer.
// FIXME use Library Manager (e107::library()) instead?
// TODO use Library Manager...
e107::css('core', 'bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css', 'jquery');
e107::js('core', 'bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js', 'jquery', 2);
e107::js('core', 'bootstrap-datetimepicker/js/bootstrap-datetimepicker.init.js', 'jquery', 2);
e107::js('footer', '{e_WEB}js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js', 'jquery', 4);
e107::js('footer', '{e_WEB}js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.init.js', 'jquery', 5);
if(e_LANGUAGE !== 'English')
{

View File

@ -814,7 +814,8 @@ class e_parse_shortcode
if(isset($this->editableCodes['perms']) && getperms($this->editableCodes['perms']))
{
e107::js('core', 'jquery.contenteditable.js', 'jquery');
// TODO use Library Manager...
e107::js('footer', '{e_WEB}js/jquery.contenteditable.js', 'jquery', 2);
$_SESSION['editable'][e_TOKEN] = $this->editableCodes;