diff options
author | portix <none@none> | 2012-08-21 15:02:54 +0200 |
---|---|---|
committer | portix <none@none> | 2012-08-21 15:02:54 +0200 |
commit | 99a66bed6491a00be08bbb261957408e49f6cf6c (patch) | |
tree | adfe7d459ffe6f8633d6aec683f2f62428484773 /scripts | |
parent | 2c6a5cb341efc9da66ade7a977857f6932e7819e (diff) | |
parent | 981b5f9c52884f3ca22f9dab4acd9d56c712543c (diff) | |
download | dwb-99a66bed6491a00be08bbb261957408e49f6cf6c.zip |
Automated merge with ssh://bitbucket.org/portix/dwb
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/extensions.js | 12 | ||||
-rw-r--r-- | scripts/lib/util.js | 11 |
2 files changed, 23 insertions, 0 deletions
diff --git a/scripts/lib/extensions.js b/scripts/lib/extensions.js index b6b6beb2..499d3332 100644 --- a/scripts/lib/extensions.js +++ b/scripts/lib/extensions.js @@ -172,6 +172,18 @@ _unload(arguments[0], false); return extensions.load.apply(this, arguments); } + }, + "toggle" : { + value : function(name, c) { + if (_registered[name] !== undefined) { + _unload(name); + return false; + } + else { + extensions.load(name, c); + return true; + } + } } }); })(); diff --git a/scripts/lib/util.js b/scripts/lib/util.js index c6836f72..59601686 100644 --- a/scripts/lib/util.js +++ b/scripts/lib/util.js @@ -21,4 +21,15 @@ } }); } + if (Array.prototype.fastIndexOf === undefined) { + Object.defineProperty(Array.prototype, "fastIndexOf", { + value : function (v) { + for (var i=0, l=this.length; i<l; ++i) { + if (this[i] == v) + return i; + } + return -1; + } + }); + } })(); |