Last active
July 21, 2017 13:27
-
-
Save stripedpurple/34b9ec8ce1b3b1e4b737fc7f9aa393fa to your computer and use it in GitHub Desktop.
Adds Season and Episode Number to episode title
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
// ==UserScript== | |
// @name Hulu Titler | |
// @namespace http://stripedpurple.io/ | |
// @version 0.1 | |
// @description Adds Season and Episode Number to episode title | |
// @author Austin Barrett | |
// @match http*://www.hulu.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
window.onload = function () { | |
getEpisode(); | |
setInterval(getEpisode, 10 * 1000); | |
}; | |
})(); | |
var getEpisode = function() { | |
var currentTitle = document.getElementsByClassName('video-titles')[0].getElementsByClassName('episode-title')[0]; | |
if (!currentTitle.innerHTML.match(/\ss\d*?\se\d*/gi)) { | |
var showTitle = document.getElementsByClassName('show-title')[0].innerHTML.trim(); | |
var windowTitle = document.title.replace(/watch /gi, '').replace(/( online at)?(\s\|)? hulu/gi, '').replace(showTitle, ''); | |
if (windowTitle.includes('Season')) { | |
currentTitle.innerHTML += " - " + windowTitle.replace(/(eason |pisode )/gi, ''); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment