1
0
Fork 0
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:
François Vieille 2016-04-28 03:13:11 +02:00
parent f1395af43f
commit 999c4e7cd6
2 changed files with 12 additions and 9 deletions

View file

@ -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
View file

@ -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})();