Skip to content

Commit

Permalink
Issue #5192 Disable defer when in admin mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
CaMer0n committed Mar 2, 2024
1 parent 8921e92 commit 4b0c341
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions e107_handlers/js_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ public function renderJs($mod, $zone = null, $external = true, $return = false)
case 'settings':


if($this->_js_defer)
if($this->_js_defer && !$this->isInAdmin())
{
echo "<script src='".e_WEB_ABS."js/core/settings.jquery.php' defer></script>\n";
}
Expand Down Expand Up @@ -1495,7 +1495,7 @@ public function renderFile($file_path_array, $external = false, $label = '', $mo

$path = $tp->replaceConstants($path, 'abs').'?external=1'; // &amp;'.$this->getCacheId();
$path = $this->url($path);
$defer = ($this->_js_defer) ? ' defer' : '';
$defer = ($this->_js_defer && !$this->isInAdmin()) ? ' defer' : '';
echo $pre.'<script src="'.$path.'"'.$defer.'></script>'.$post;
echo "\n";
continue;
Expand Down Expand Up @@ -1595,7 +1595,7 @@ public function renderFile($file_path_array, $external = false, $label = '', $mo
{
continue;
}
$defer = ($this->_js_defer && strpos($inline,'defer')===false) ? ' defer' : '';
$defer = ($this->_js_defer && !$this->isInAdmin() && strpos($inline,'defer')===false) ? ' defer' : '';
echo $pre.'<script src="'.$path.'"'.$inline.$defer.'></script>'.$post;
echo "\n";
continue;
Expand Down Expand Up @@ -1771,7 +1771,7 @@ public function renderCached($type)

if($type == 'js')
{
$deferCache = ($this->_js_defer) ? 'defer' : '';
$deferCache = ($this->_js_defer && !$this->isInAdmin()) ? 'defer' : '';
echo "<script src='".$this->url(e_WEB_ABS."cache/".$fileName,'js',false)."' $deferCache></script>\n\n";
}
else
Expand Down Expand Up @@ -1992,9 +1992,9 @@ function renderInline($content_array, $label = '', $type = 'js')
}
echo '<script>';
echo "\n//<![CDATA[\n";
echo ($this->_js_defer) ? "window.onload = function(){\n" : '';
echo ($this->_js_defer && !$this->isInAdmin()) ? "window.onload = function(){\n" : '';
echo implode("\n\n", $content_array);
echo ($this->_js_defer) ? "};\n" : '';
echo ($this->_js_defer && !$this->isInAdmin()) ? "};\n" : '';
echo "\n//]]>\n";
echo '</script>';
echo "\n";
Expand Down

0 comments on commit 4b0c341

Please sign in to comment.