Skip to content

Instantly share code, notes, and snippets.

@t5r7
Last active August 28, 2017 08:15
Show Gist options
  • Save t5r7/319209f3200bc428ea8be38c821e7775 to your computer and use it in GitHub Desktop.
Save t5r7/319209f3200bc428ea8be38c821e7775 to your computer and use it in GitHub Desktop.
Bring back "Hello Procrastinators"
if (location.hostname == 'www.youtube.com') {
console.log('Hey, we\'re on YouTube!');
dateDiv = document.querySelector('.date');
channelNameDiv = document.getElementById('owner-container');
video = document.querySelector('.html5-main-video');
profilePic = document.querySelector('.ytd-video-owner-renderer img');
helloProcrasinators = new Audio('https://raw.githubusercontent.com/mrdnomaid/NerdCubedSoundboard/master/sounds/hello.mp3');
oldLogo = 'https://i.imgur.com/1m8Ws3o.png';
function doTheThing() {
video.pause();
helloProcrasinators.play();
setTimeout(function() {
video.play();
}, 2000);
}
if (channelNameDiv.innerHTML.indexOf('OfficialNerdCubed') != -1) {
console.log('This is a video on Dan\'s channel. That\'s a good start.');
console.log('Let\'s fix his profile picture');
profilePic.src = oldLogo;
if (dateDiv.innerHTML.indexOf('2016') != -1) {
console.log('It\'s from 2016! Time to say hello!');
doTheThing();
} else if (dateDiv.innerHTML.indexOf('2017') != -1) {
console.log('It\'s from 2017! Time to say hello!');
doTheThing();
} else {
console.log('The video seems to be from before 2016, no need to say hello, Dan\'s already done that for me.');
}
} else {
console.log('This isn\'t a video by Dan :(');
}
};

CC BY-SA 4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment