1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Issue #5192 - Javascript defer option. (experimental)

This commit is contained in:
camer0n
2024-02-09 16:46:16 -08:00
parent 209f0ea898
commit 8921e92aa6
6 changed files with 98 additions and 52 deletions

View File

@@ -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){

View File

@@ -0,0 +1,20 @@
<?php
$_E107['minimal'] = true;
require_once("../../../class2.php");
ob_start();
ob_implicit_flush(0);
header("last-modified: " . gmdate("D, d M Y H:i:s",mktime(0,0,0,15,2,2004)) . " GMT");
header('Content-type: text/javascript');
$tp = e107::getParser();
$json = $tp->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();

View File

@@ -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();
?>