Skip to content

Instantly share code, notes, and snippets.

@leonbrandt
Last active October 29, 2018 08:19
Show Gist options
  • Save leonbrandt/0f34fd3ce474f5e1567f16161b2e5984 to your computer and use it in GitHub Desktop.
Save leonbrandt/0f34fd3ce474f5e1567f16161b2e5984 to your computer and use it in GitHub Desktop.
IMDb cast year-hider (Greasemonkey / Tampermonkey)
// ==UserScript==
// @name IMDb cast year-hider
// @namespace https://www.leonbrandt.com
// @version 1.0
// @description Hides years next to cast-entrys: never get spoiled again who dies in a tv-show while browsing IMDb
// @author Leon Brandt
// @homepage https://www.leonbrandt.com
// @updateURL https://gist.github.com/leonbrandt/0f34fd3ce474f5e1567f16161b2e5984/raw/imdb-cast-year-hider.user.js
// @match https://www.imdb.com/title/*
// @grant none
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
function hide(e) {
e.style.background = "#000000";
e.style.color = "#000000";
e.childNodes.forEach(c => {
if(c.style != undefined){ c.style.visibility = "hidden"; }
});
}
function show(e) {
e.style.background = "none";
e.style.color = "#136CB2";
e.childNodes.forEach(c => {
if(c.style != undefined){ c.style.visibility = "visible"; }
});
}
document.querySelectorAll("table.cast_list td.character a.toggle-episodes").forEach(function(e){
hide(e);
e.addEventListener("mouseover", function(){ show(e); });
e.addEventListener("mouseout", function(){ hide(e); });
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment