summaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js19
1 files changed, 19 insertions, 0 deletions
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