From a8160b8d39bda6c466a3be33e6d25de81e94cded Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 26 Jun 2015 17:56:10 +0200 Subject: [PATCH] Some minor fixes and optimizations --- com.woltlab.wcf/templates/headIncludeJavaScript.tpl | 2 +- wcfsetup/install/files/acp/templates/header.tpl | 7 +++++++ .../template/plugin/JsFunctionTemplatePlugin.class.php | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index c600cd8de3..1d7e9be560 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -194,7 +194,7 @@ requirejs.config({ {/if} {* invoke background queue roughly every 10th request *} - if (Math.random().toString()[2] === '0') { + if (Math.random() < 0.1) { require(['Ajax'], function(Ajax) { // fire and forget background queue perform task Ajax.apiOnce({ diff --git a/wcfsetup/install/files/acp/templates/header.tpl b/wcfsetup/install/files/acp/templates/header.tpl index cf908d1528..679a5d61be 100644 --- a/wcfsetup/install/files/acp/templates/header.tpl +++ b/wcfsetup/install/files/acp/templates/header.tpl @@ -98,6 +98,12 @@ }); {js application='wcf' lib='jquery'} + + {js application='wcf' lib='jquery-ui'} {js application='wcf' lib='jquery-ui' file='touchPunch' bundle='WCF.Combined'} {js application='wcf' lib='jquery-ui' file='nestedSortable' bundle='WCF.Combined'} @@ -105,6 +111,7 @@ {js application='wcf' file='WCF' bundle='WCF.Combined'} {js application='wcf' acp='true' file='WCF.ACP'} diff --git a/wcfsetup/install/files/lib/system/template/plugin/JsFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/JsFunctionTemplatePlugin.class.php index 6091ac5cb2..3c1cd1a380 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/JsFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/JsFunctionTemplatePlugin.class.php @@ -73,11 +73,11 @@ class JsFunctionTemplatePlugin implements IFunctionTemplatePlugin { $src .= $tagArgs['file']; } - if (in_array($src, $this->includedFiles)) { + if (isset($this->includedFiles[$src])) { return ''; } - $this->includedFiles[] = $src; + $this->includedFiles[$src] = true; $src .= (!ENABLE_DEBUG_MODE ? '.min' : '') . '.js?v=' . LAST_UPDATE_TIME; $relocate = !RequestHandler::getInstance()->isACPRequest() && (!isset($tagArgs['core']) || $tagArgs['core'] !== 'true'); -- 2.20.1