Created
April 9, 2012 11:07
-
-
Save codeincontext/2342892 to your computer and use it in GitHub Desktop.
UserScript to hide certain programs from the iPlayer web interface
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 iPlayer Filter | |
// @namespace http://skatty.me/ | |
// @description Hides crap shows from BBC iPlayer | |
// @include http://bbc.co.uk/iplayer/* | |
// @include http://www.bbc.co.uk/iplayer/* | |
// ==/UserScript== | |
var load,execute,loadAndExecute;load=function(a,b,c){var d;d=document.createElement("script"),d.setAttribute("src",a),b!=null&&d.addEventListener("load",b),c!=null&&d.addEventListener("error",c),document.body.appendChild(d);return d},execute=function(a){var b,c;typeof a=="function"?b="("+a+")();":b=a,c=document.createElement("script"),c.textContent=b,document.body.appendChild(c);return c},loadAndExecute=function(a,b){return load(a,function(){return execute(b)})}; | |
loadAndExecute("//ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js", function() { | |
var titlesToHide = ["The Voice", "EastEnders", "Football", "Casualty"]; | |
filterShows(); | |
// Need to work out where to hook this in to instead of just repeating | |
setInterval(filterShows, 250); | |
function filterShows() { | |
$(".content li").each(function(index) { | |
var $show = $(this); | |
var showTitle = $show.find("h3 a").text(); | |
$.each(titlesToHide, function(_, titleToHide) { | |
if (showTitle.indexOf(titleToHide) != -1) { | |
$show.hide(); | |
} | |
}); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It now repeats in order to catch dynamically displayed content