From: Tim Düsterhus Date: Mon, 25 May 2015 00:56:12 +0000 (+0200) Subject: Work around race condition in WCF.js loading X-Git-Tag: 3.0.0_Beta_1~2310^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=46badb6a09f7fb866e0c7d92b273f9c425aa1500;p=GitHub%2FWoltLab%2FWCF.git Work around race condition in WCF.js loading --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 9df9906bec..9eb35d71b2 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -186,7 +186,8 @@ window.shuffle = function(array) { /** * Initialize WCF namespace */ -window.WCF = {}; +// non strict equals by intent +if (window.WCF == null) window.WCF = { }; /** * Extends jQuery with additional methods. @@ -3239,25 +3240,28 @@ WCF.Dictionary = Class.extend({ } }); -/** - * @deprecated Use WoltLab/WCF/Language - */ -WCF.Language = { - add: function(key, value) { - require(['WoltLab/WCF/Language'], function(Language) { - Language.add(key, value); - }); - }, - addObject: function(object) { - require(['WoltLab/WCF/Language'], function(Language) { - Language.addObject(object); - }); - }, - get: function(key, parameters) { - // This cannot be sanely provided as a compatibility wrapper. - throw new Error('Call to deprecated WCF.Language.get("' + key + '")'); - } -}; +// non strict equals by intent +if (window.WCF.Language == null) { + /** + * @deprecated Use WoltLab/WCF/Language + */ + WCF.Language = { + add: function(key, value) { + require(['WoltLab/WCF/Language'], function(Language) { + Language.add(key, value); + }); + }, + addObject: function(object) { + require(['WoltLab/WCF/Language'], function(Language) { + Language.addObject(object); + }); + }, + get: function(key, parameters) { + // This cannot be sanely provided as a compatibility wrapper. + throw new Error('Call to deprecated WCF.Language.get("' + key + '")'); + } + }; +} /** * Handles multiple language input fields. diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Bootstrap.js b/wcfsetup/install/files/js/WoltLab/WCF/Bootstrap.js index 1638436554..659313b7a8 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Bootstrap.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Bootstrap.js @@ -25,6 +25,9 @@ define( // perfectScrollbar does not need to be bound anywhere, it just has to be loaded for WCF.js window.Favico = favico; window.enquire = enquire; + // non strict equals by intent + if (window.WCF == null) window.WCF = { }; + if (window.WCF.Language == null) window.WCF.Language = { }; window.WCF.Language.get = Language.get; window.WCF.Language.add = Language.add; window.WCF.Language.addObject = Language.addObject;