Skip to content

Instantly share code, notes, and snippets.

@iagdotme
Created May 19, 2017 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iagdotme/fab8e5715a6e213e9f16b6ff38fe8fb0 to your computer and use it in GitHub Desktop.
Save iagdotme/fab8e5715a6e213e9f16b6ff38fe8fb0 to your computer and use it in GitHub Desktop.
Fun Title Changer
<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