1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Defer header javascripts to footer when js/css caching is enabled.

This commit is contained in:
Cameron
2020-12-02 20:15:13 -08:00
parent 3491d7c832
commit 6fd582655a
3 changed files with 12 additions and 4 deletions

View File

@@ -282,6 +282,11 @@ if (function_exists('theme_foot'))
// F any included JS footer scripts
// DEPRECATED - use e107::getJs()->footerFile('{e_PLUGIN}myplug/js/my.js', $zone = 2)
//
if(!empty($pref['jscsscachestatus']))
{
e107::getJs()->renderCached('js');
e107::getJs()->renderJs('header_inline', 5);
}
global $footer_js;
if (isset($footer_js) && is_array($footer_js))
{

View File

@@ -564,8 +564,11 @@ e107Event.trigger('loaded', null, document);
});
",'prototype',5);
if(empty($pref['jscsscachestatus'])) // render in header when cache disabled, otherwise render in footer. (see footer_default.php)
{
e107::getJs()->renderCached('js');
e107::getJs()->renderJs('header_inline', 5);
}

View File

@@ -802,7 +802,7 @@ class e_jsmanager
return null;
}
$text = '';
$text = "\n\n<!-- [JSManager] Links -->\n";
foreach($this->_e_link as $v)
{
@@ -1590,7 +1590,7 @@ class e_jsmanager
}
echo "\n\n<!-- Cached ".$type." -->\n";
echo "\n\n<!-- [JSManager] Cached ".strtoupper($type)." -->\n";
if($type == 'js')
{