From b0f166fc836129464a2bdfa03357e844568c1104 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 26 Jul 2011 16:43:12 +0200 Subject: some javascript changes --- core/js/js.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'core/js') diff --git a/core/js/js.js b/core/js/js.js index 9117f08349a..2dac6907d96 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -55,3 +55,22 @@ OC={ $('head').append(style); } } + +if (!Array.prototype.filter) { + Array.prototype.filter = function(fun /*, thisp*/) { + var len = this.length >>> 0; + if (typeof fun != "function") + throw new TypeError(); + + var res = []; + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (i in this) { + var val = this[i]; // in case fun mutates this + if (fun.call(thisp, val, i, this)) + res.push(val); + } + } + return res; + }; +} \ No newline at end of file -- cgit v1.2.3