From: Benoît Pin Date: Tue, 31 Mar 2015 13:15:43 +0000 (+0200) Subject: lint. X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/commitdiff_plain/73450073e4f23715046272dcdee5d0dd2ec54615?ds=sidebyside;hp=01f97c60e0e0e1daad66e31749f2bd72e99a27e3 lint. --- diff --git a/Products/Plinn/skins/ajax_scripts/plinn_script_loader.js b/Products/Plinn/skins/ajax_scripts/plinn_script_loader.js index d78ff6c..fc8b660 100644 --- a/Products/Plinn/skins/ajax_scripts/plinn_script_loader.js +++ b/Products/Plinn/skins/ajax_scripts/plinn_script_loader.js @@ -1,13 +1,17 @@ -// (c) Benoît PIN 2006-2007 +// (c) Benoît PIN 2006-2015 // http://plinn.org // Licence GPL // // +var ScriptRegistry; +var globalScriptRegistry; + +(function() { function ScriptRegistry() { - this.loadedScripts = new Object(); - this.pendingScripts = new Array(); + this.loadedScripts = {}; + this.pendingScripts = []; this.HEAD = document.getElementsByTagName('head')[0]; this.isLoading = false; } @@ -28,7 +32,7 @@ ScriptRegistry.prototype.loadScript = function(scriptOb) { } if(!this.isLoading && this.pendingScripts.length) this._loadNextScript(); -} +}; ScriptRegistry.prototype._loadNextScript = function() { var firstScript = this.pendingScripts[0]; @@ -52,7 +56,9 @@ ScriptRegistry.prototype._loadNextScript = function() { break; case 'code' : try { + /* jshint ignore:start */ eval(firstScript[1].text); + /* jshint ignore:end */ } catch(e) { if (window.console) { @@ -64,15 +70,17 @@ ScriptRegistry.prototype._loadNextScript = function() { } this._removeScriptAfterLoad(); break; - }; -} + } +}; ScriptRegistry.prototype._removeScriptAfterLoad = function() { this.pendingScripts.shift(); if(this.pendingScripts.length) - this._loadNextScript() + this._loadNextScript(); else this.isLoading = false; -} +}; + +globalScriptRegistry = new ScriptRegistry(); -globalScriptRegistry = new ScriptRegistry(); \ No newline at end of file +}()); \ No newline at end of file