2016-04-28 01:21:14 +02:00
|
|
|
/**
|
|
|
|
* Redirect to a "random" link in current page
|
|
|
|
* - naive code -
|
|
|
|
*/
|
|
|
|
|
2016-04-28 03:13:11 +02:00
|
|
|
javascript:(function(r = "http://swapthatlink.com", c = document.location.href){
|
2016-04-28 02:13:23 +02:00
|
|
|
var l = Array.prototype.slice.call(document.getElementsByTagName('a')),
|
2016-05-01 20:21:46 +02:00
|
|
|
e = new RegExp("^(javascript|mailto|(https?)?" + c + "/?#)"),
|
2016-04-28 03:13:11 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2016-04-28 02:13:23 +02:00
|
|
|
document.location.href = r;
|
|
|
|
return;
|
2016-04-28 01:21:14 +02:00
|
|
|
})();
|