Browse Source

Merge some javascript

- Removed unused JS functions
- Inlined functions not often used
- Minimized some overly verbose functions
undefined
spaghetti 7 years ago
committed by Tomochin
parent
commit
6fcaef20cf
2 changed files with 5 additions and 6 deletions
  1. +4
    -5
      design/privateheader.php
  2. +1
    -1
      design/publicheader.php

+ 4
- 5
design/privateheader.php View File

@@ -95,11 +95,10 @@ foreach ($ExtraCSS as $CSS) {
<?
}

$Scripts = array_merge(array('jquery', 'script_start', 'ajax.class', 'global', 'jquery.autocomplete', 'autocomplete', 'tooltipster', 'tooltipster_settings'), explode(',', $JSIncludes));
$Scripts = array_merge(array('jquery', 'global', 'ajax.class', 'jquery.autocomplete', 'autocomplete', 'tooltipster', 'tooltipster_settings'), explode(',', $JSIncludes));
foreach ($Scripts as $Script) {
if (trim($Script) == '') {
continue;
}
if (trim($Script) == '') { continue; }
$Async = (in_array($Script, ['jquery','global','ajax.class'])) ? '' : 'async';
if (($ScriptStats = G::$Cache->get_value("script_stats_$Script")) === false || $ScriptStats['mtime'] != filemtime(SERVER_ROOT.STATIC_SERVER."functions/$Script.js")) {
$ScriptStats['mtime'] = filemtime(SERVER_ROOT.STATIC_SERVER."functions/$Script.js");
$ScriptStats['hash'] = base64_encode(hash_file(INTEGRITY_ALGO, SERVER_ROOT.STATIC_SERVER."functions/$Script.js", true));
@@ -107,7 +106,7 @@ foreach ($Scripts as $Script) {
G::$Cache->cache_value("script_stats_$Script", $ScriptStats);
}
?>
<script src="<?=STATIC_SERVER."functions/$Script.js?v=$ScriptStats[mtime]"?>" type="text/javascript" integrity="<?="$ScriptStats[algo]-$ScriptStats[hash]"?>"></script>
<script src="<?=STATIC_SERVER."functions/$Script.js?v=$ScriptStats[mtime]"?>" type="text/javascript" integrity="<?="$ScriptStats[algo]-$ScriptStats[hash]"?>" <?=$Async?>></script>
<?
}



+ 1
- 1
design/publicheader.php View File

@@ -11,7 +11,7 @@ define('FOOTER_FILE',SERVER_ROOT.'/design/publicfooter.php');
<link rel="shortcut icon" href="favicon.ico?v=<?=md5_file('favicon.ico');?>" />
<link href="<?=STATIC_SERVER ?>styles/public/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/public/style.css')?>" rel="stylesheet" type="text/css" />
<?
$Scripts = ['jquery', 'script_start', 'ajax.class', 'cookie.class', 'storage.class', 'global', 'public'];
$Scripts = ['jquery', 'global', 'ajax.class', 'cookie.class', 'storage.class', 'public'];
foreach($Scripts as $Script) {
if (($ScriptStats = G::$Cache->get_value("script_stats_$Script")) === false || $ScriptStats['mtime'] != filemtime(SERVER_ROOT.STATIC_SERVER."functions/$Script.js")) {
$ScriptStats['mtime'] = filemtime(SERVER_ROOT.STATIC_SERVER."functions/$Script.js");


Loading…
Cancel
Save