diff --git a/e107_core/templates/footer_default.php b/e107_core/templates/footer_default.php
index 791f8b571..cb31bd1e8 100644
--- a/e107_core/templates/footer_default.php
+++ b/e107_core/templates/footer_default.php
@@ -387,6 +387,29 @@ if (abs($_serverTime - $lastSet) > 120)
*/
echo "\n";
+
+
+ if($this->_js_defer)
+ {
+ echo "\n";
+ }
+ else
+ {
+ $tp = e107::getParser();
+ $json = $tp->toJSON($this->_e_js_settings);
+ echo "\n";
+ }
break;
case 'framework': // CDN frameworks - rendered before consolidation script (if enabled)
@@ -1483,8 +1495,8 @@ class e_jsmanager
$path = $tp->replaceConstants($path, 'abs').'?external=1'; // &'.$this->getCacheId();
$path = $this->url($path);
-
- echo $pre.''.$post;
+ $defer = ($this->_js_defer) ? ' defer' : '';
+ echo $pre.''.$post;
echo "\n";
continue;
}
@@ -1583,8 +1595,8 @@ class e_jsmanager
{
continue;
}
-
- echo $pre.''.$post;
+ $defer = ($this->_js_defer && strpos($inline,'defer')===false) ? ' defer' : '';
+ echo $pre.''.$post;
echo "\n";
continue;
}
@@ -1759,7 +1771,8 @@ class e_jsmanager
if($type == 'js')
{
- echo "\n\n";
+ $deferCache = ($this->_js_defer) ? 'defer' : '';
+ echo "\n\n";
}
else
{
@@ -1979,7 +1992,9 @@ class e_jsmanager
}
echo '';
echo "\n";
@@ -2054,6 +2069,12 @@ class e_jsmanager
return ($this->isInAdmin() ? 'admin' : 'front');
}
+ public function getSettings()
+ {
+ return $this->_e_js_settings;
+ }
+
+
/**
* Get current theme name
*
diff --git a/e107_web/js/core/all.jquery.js b/e107_web/js/core/all.jquery.js
index b66313dbc..c305e9e93 100644
--- a/e107_web/js/core/all.jquery.js
+++ b/e107_web/js/core/all.jquery.js
@@ -1491,8 +1491,7 @@ $(document).ready(function()
// Legacy Stuff to be converted.
// BC Expandit() function
- var nowLocal = new Date(); /* time at very beginning of js execution */
- var localTime = Math.floor(nowLocal.getTime()/1000); /* time, in ms -- recorded at top of jscript */
+
function expandit(e) {
@@ -1547,26 +1546,7 @@ $(document).ready(function()
-function SyncWithServerTime(serverTime, path, domain)
-{
- if (serverTime)
- {
- /* update time difference cookie */
- var serverDelta=Math.floor(localTime-serverTime);
- if(!path) path = '/';
- if(!domain) domain = '';
- else domain = '; domain=' + domain;
- document.cookie = 'e107_tdOffset='+serverDelta+'; path='+path+domain;
- document.cookie = 'e107_tdSetTime='+(localTime-serverDelta)+'; path='+path+domain+'; samesite=strict'; /* server time when set */
- }
- var tzCookie = 'e107_tzOffset=';
-// if (document.cookie.indexOf(tzCookie) < 0) {
- /* set if not already set */
- var timezoneOffset = nowLocal.getTimezoneOffset(); /* client-to-GMT in minutes */
- document.cookie = tzCookie + timezoneOffset+'; path='+path+domain+'; samesite=strict';
-// }
-}
function urljump(url){
diff --git a/e107_web/js/core/settings.jquery.php b/e107_web/js/core/settings.jquery.php
new file mode 100644
index 000000000..a9e9195ad
--- /dev/null
+++ b/e107_web/js/core/settings.jquery.php
@@ -0,0 +1,20 @@
+toJSON(e107::getJs()->getSettings());
+
+$js = '$(document).ready(function() {';
+$js .= "var e107 = e107 || {'settings': {}, 'behaviors': {}};\n";
+$js .= "jQuery.extend(e107.settings, " . $json . ");\n";
+$js .= '});';
+
+header ('ETag: "' . md5($js).'"' );
+echo $js;
+echo_gzipped_page();
\ No newline at end of file
diff --git a/e107_web/js/e_js.php b/e107_web/js/e_js.php
index 07ac544ba..dd76bc04a 100644
--- a/e107_web/js/e_js.php
+++ b/e107_web/js/e_js.php
@@ -385,7 +385,7 @@ function preview_image(src_val,img_path, not_found)
//-->";
-header ('ETag: "' . md5($text).'"' );
+header ('ETag: "' . md5($js).'"' );
echo $js;
echo_gzipped_page();
?>
\ No newline at end of file