mirror of
https://github.com/prise6/anywhere
synced 2024-05-08 21:06:32 +02:00
Fix ancre & mailto & empty array
This commit is contained in:
parent
9223e1f1b8
commit
004041be1d
|
@ -4,11 +4,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
javascript:(function(){
|
javascript:(function(){
|
||||||
var l = Array.prototype.slice.call(document.getElementsByTagName('a'));
|
var l = Array.prototype.slice.call(document.getElementsByTagName('a')),
|
||||||
for(var i = l.length-1;i>=0;i--){
|
c = document.location.href;
|
||||||
if(/^(#|mailto)/.test(l[i].href.slice(0,1))||l[i].href==document.location.href)l.splice(i,0);
|
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);
|
||||||
};
|
};
|
||||||
r=l[Math.floor(Math.random()*l.length)].href;
|
if (l.length>0) r = l[Math.floor(Math.random()*l.length)].href;
|
||||||
console.log(r);
|
document.location.href = r;
|
||||||
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'));for(var i=l.length-1;i>=0;i--){if(/^(#|mailto)/.test(l[i].href.slice(0,1))||l[i].href==document.location.href)l.splice(i,0)};r=l[Math.floor(Math.random()*l.length)].href;console.log(r);document.location.href=r})();
|
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})();
|
Loading…
Reference in a new issue