Small indexOf optimization.
This commit is contained in:
parent
9de43acd3d
commit
9ba7f2c3f2
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.1.3 - 2013-04-28
|
||||
* 4chan X - Version 1.1.3 - 2013-04-30
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
|
||||
// ==/UserScript==
|
||||
/*
|
||||
* 4chan X - Version 1.1.3 - 2013-04-28
|
||||
* 4chan X - Version 1.1.3 - 2013-04-30
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -335,7 +335,7 @@
|
||||
i = this.length;
|
||||
while (i--) {
|
||||
if (this[i] === object) {
|
||||
break;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
@ -349,6 +349,7 @@
|
||||
arg = args[_i];
|
||||
this.push.apply(this, arg);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Array.prototype.remove = function(object) {
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
|
||||
// ==/UserScript==
|
||||
/*
|
||||
* 4chan X - Version 1.1.3 - 2013-04-28
|
||||
* 4chan X - Version 1.1.3 - 2013-04-30
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -332,7 +332,7 @@
|
||||
i = this.length;
|
||||
while (i--) {
|
||||
if (this[i] === object) {
|
||||
break;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
@ -346,6 +346,7 @@
|
||||
arg = args[_i];
|
||||
this.push.apply(this, arg);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Array.prototype.remove = function(object) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.1.3 - 2013-04-28
|
||||
* 4chan X - Version 1.1.3 - 2013-04-30
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -314,7 +314,7 @@
|
||||
i = this.length;
|
||||
while (i--) {
|
||||
if (this[i] === object) {
|
||||
break;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
@ -328,6 +328,7 @@
|
||||
arg = args[_i];
|
||||
this.push.apply(this, arg);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Array.prototype.remove = function(object) {
|
||||
|
||||
@ -16,14 +16,14 @@ Array::contains = (object) ->
|
||||
Array::indexOf = (object) ->
|
||||
i = @length
|
||||
while i--
|
||||
break if @[i] is object
|
||||
return i if @[i] is object
|
||||
return i
|
||||
|
||||
Array::pushArrays = ->
|
||||
args = arguments
|
||||
for arg in args
|
||||
@push.apply @, arg
|
||||
return
|
||||
return @
|
||||
|
||||
Array::remove = (object) ->
|
||||
if (index = @indexOf object) > -1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user