summaryrefslogtreecommitdiff
path: root/src/www/js/support.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/www/js/support.js')
-rw-r--r--src/www/js/support.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/www/js/support.js b/src/www/js/support.js
index eefda3f8b..47753e768 100644
--- a/src/www/js/support.js
+++ b/src/www/js/support.js
@@ -22,12 +22,21 @@ if(!Array.isArray) {
// Create a clone of an array
// http://davidwalsh.name/javascript-clone-array
-// Note that iterating over an array with for...in will include "clone" as a key!
-// if(!Array.clone) {
-// Array.prototype.clone = function() {
-// return this.slice(0);
-// };
-// }
+if(!Array.clone) {
+ Array.clone = function(arg) {
+ return arg.slice(0);
+ };
+}
+
+// Array Remove - By John Resig (MIT Licensed)
+// http://ejohn.org/blog/javascript-array-remove/if(!Array.remove) {
+if(!Array.remove) {
+ Array.remove = function(arg, from, to) {
+ var rest = arg.slice((to || from) + 1 || arg.length);
+ arg.length = from < 0 ? arg.length + from : from;
+ return arg.push.apply(arg, rest);
+ };
+}
/* --- JSONP ---------------------------------------------------------------- */