Skip to content

Instantly share code, notes, and snippets.

@stripedpurple
Last active July 21, 2017 13:27
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 stripedpurple/34b9ec8ce1b3b1e4b737fc7f9aa393fa to your computer and use it in GitHub Desktop.
Save stripedpurple/34b9ec8ce1b3b1e4b737fc7f9aa393fa to your computer and use it in GitHub Desktop.
Adds Season and Episode Number to episode title
// ==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