mirror of
https://github.com/prise6/anywhere
synced 2024-04-26 12:50:30 +02:00
Update js : speed code
This commit is contained in:
parent
f1395af43f
commit
999c4e7cd6
|
@ -3,15 +3,18 @@
|
|||
* - naive code -
|
||||
*/
|
||||
|
||||
javascript:(function(){
|
||||
javascript:(function(r = "http://swapthatlink.com", c = document.location.href){
|
||||
var l = Array.prototype.slice.call(document.getElementsByTagName('a')),
|
||||
c = document.location.href;
|
||||
var e = new RegExp("^(mailto|(https?)?"+c+"/?#)"),
|
||||
r = "http://swapthatlink.com";
|
||||
for (var i = l.length-1;i>=0;i--){
|
||||
if (e.test(l[i].href.slice(0,1)) || l[i].href == c) l.splice(i,0);
|
||||
};
|
||||
if (l.length>0) r = l[Math.floor(Math.random()*l.length)].href;
|
||||
e = new RegExp("^(mailto|(https?)?" + c + "/?#)"),
|
||||
f = false;
|
||||
while(!f & l.length>0){
|
||||
i = Math.floor(Math.random()*l.length);
|
||||
if (e.test(l[i].href) || l[i].href == c) l.splice(i,1);
|
||||
else {
|
||||
r = l[i].href;
|
||||
f = true;
|
||||
}
|
||||
}
|
||||
document.location.href = r;
|
||||
return;
|
||||
})();
|
2
Js/anywhere.min.js
vendored
2
Js/anywhere.min.js
vendored
|
@ -1 +1 @@
|
|||
javascript:(function(){var l=Array.prototype.slice.call(document.getElementsByTagName('a')),c=document.location.href;var e=new RegExp("^(mailto|(https?)?"+c+"/?#)"),r="http://swapthatlink.com";for(var i=l.length-1;i>=0;i--){if(e.test(l[i].href.slice(0,1))||l[i].href==c)l.splice(i,0)};if(l.length>0)r=l[Math.floor(Math.random()*l.length)].href;document.location.href=r;return})();
|
||||
javascript:(function(r="http://swapthatlink.com",c=document.location.href){var l=Array.prototype.slice.call(document.getElementsByTagName('a')),e=new RegExp("^(mailto|(https?)?"+c+"/?#)"),f=false;while(!f&l.length>0){i=Math.floor(Math.random()*l.length);if(e.test(l[i].href)||l[i].href==c)l.splice(i,1);else{r=l[i].href;f=true}}document.location.href=r;return})();
|
Loading…
Reference in a new issue