Change script location.

Split js code.
Added cache and changed loading mechanism for js sources.
This commit is contained in:
Oleg Sh
2023-11-06 19:16:50 +02:00
parent c29ad15e3c
commit 43a4b44a22
86 changed files with 7738 additions and 3383 deletions

View File

@@ -173,11 +173,15 @@
return SITE_ROOT . "{$dir}{$uri}";
}
function RootCacheJS($uri = '', $version = '') {
function RootCacheJS($uri = '') {
global $g_config;
return Root(($g_config['use_js_cache'] ? $uri . ".cache" :
$uri) . "?v=" . $version);
$cacheFilePath = Root($uri . ".cache");
$filePath = Root($uri);
$cacheExists = file_exists("." . $cacheFilePath);
$finalFileName = $cacheExists && $g_config['use_js_cache'] ? $cacheFilePath : $filePath;
return $finalFileName . "?v=" . $g_config['engine_version'];
}
/**