Created
May 19, 2017 09:51
-
-
Save iagdotme/fab8e5715a6e213e9f16b6ff38fe8fb0 to your computer and use it in GitHub Desktop.
Fun Title Changer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var title = document.title; | |
var blurMessage = [ | |
"Please come back! :-( ", | |
"Don't you love me anymore? :-(", | |
"Fancy a cookie? ", | |
"I'm feeling lonely :-( ", | |
"I need a hug... ", | |
"Just checking my email...", | |
"Let's have a pizza party!", | |
"Doing a quick FB Live!", | |
"Are you Seriously Social?", | |
"In Space, no one can hear you scream...", | |
"Researching the Meaning of Life", | |
"Just connecting to Skynet...", | |
"2468 Who do you appreciate?", | |
"Fancy a cup of tea?", | |
"Nice weather we're having!", | |
"Checking my Twitter...", | |
"Just updating my tool list", | |
"Drinking a cup of coffee...", | |
"Was it something I said?", | |
"Busy procrastinating..." | |
]; | |
var intervalTimer = null; | |
var timeoutTimer = null; | |
window.addEventListener("blur", function () { | |
intervalTimer = setInterval(function() { | |
var rand = Math.floor((Math.random() * blurMessage.length)); | |
document.title = blurMessage[rand]; | |
timeoutTimer = setTimeout(function() { | |
document.title = title; | |
},5000); | |
},12000); | |
}); | |
window.addEventListener("focus", function(){ | |
clearInterval(intervalTimer); | |
clearTimeout(timeoutTimer); | |
document.title = title; | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment