+++ /dev/null
-/**
- * Compat array utils..
- *
- * <script type="text/javascript">
- *
- */
-Array.prototype.filter = function(fun /*, thisp*/)
- {
- var len = this.length;
- if (typeof(fun) != "function")
- throw "typeerror";
-
- var res = new Array();
- var thisp = arguments[1];
- var t = this;
- for (var i = 0; i < len; i++)
- {
-
- var val = t[i]; // in case fun mutates this
- if (fun.call(thisp, val, i, t))
- res.push(val);
- //}
- }
-
- return res;
- };
-
-Array.prototype.map = function(fun /*, thisp*/)
- {
- var len = this.length;
- if (typeof(fun) != "function")
- throw "typeerror";
-
- var res = new Array(len);
- var thisp = arguments[1];
- for (var i = 0; i < len; i++)
- {
-
- res[i] = fun.call(thisp, this[i], i, this);
- }
-
- return res;
- };
-
-if (typeof(Array.prototype['lastIndexOf']) == 'undefined')
-{
- Array.prototype.lastIndexOf = function(elt /*, from*/)
- {
- var len = this.length;
-
- var from = Number(arguments[1]);
- if (isNaN(from)) {
- from = len - 1;
- } else {
- from = (from < 0)
- ? Math.ceil(from)
- : Math.floor(from);
- if (from < 0)
- from += len;
- else if (from >= len)
- from = len - 1;
- }
- var _t = this;
- for (; from > -1; from--)
- {
- if ((typeof(_t[from]) !== 'undefined') &&
- this[from] === elt)
- return from;
- }
- return -1;
- };
-}
\ No newline at end of file