Skip to content

Instantly share code, notes, and snippets.

@bunnywong
Created September 12, 2015 10:31
Show Gist options
  • Save bunnywong/fcc3906327f19708af49 to your computer and use it in GitHub Desktop.
Save bunnywong/fcc3906327f19708af49 to your computer and use it in GitHub Desktop.
Alert when iPhone available
var alt = $('.image-content img').attr('alt');
if (alt =="We'll be back soon") {
var rand = (Math.floor(Math.random() * 200) + 1 ) / 100; // 0.01 to 2 sec
console.log("We'll be back soon :D ");
console.log('random refresh in ' + rand + 'sec');
setTimeout(redirect(), rand);
} else {
alert('PAGE AVAILABLE !!!');
}
function redirect() {
window.location = location.protocol + '//' + location.host + location.pathname + '?' + Date.now();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment