1
0
Fork 0
mirror of https://github.com/prise6/anywhere synced 2024-04-27 21:02:43 +02:00
anywhere/Js/anywhere.js
François Vieille e73c4d3e02 Change code
2016-05-01 22:30:38 +02:00

20 lines
523 B
JavaScript

/**
* Redirect to a "random" link in current page
* - naive code -
*/
javascript:(function(r, c){
var l = Array.prototype.slice.call(document.getElementsByTagName('a')),
e = new RegExp("^(javascript|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;
})("http://swapthatlink.com", document.location.href);