shush / Shush Filter

// ==UserScript==
// @name          Shush Filter
// @description   TV Show, Reality TV and Movie filtering for Shush.se - For more information see http://forum.shush.se/showthread.php?tid=4845
// @version       4
// @namespace     Shush.se
// @require       http://code.jquery.com/jquery-1.9.1.js
// @require       http://code.jquery.com/ui/1.10.1/jquery-ui.js
// @include       http://www.shush.se/index.php?shows
// @include       http://www.shush.se/index.php?reality
// @include       http://www.shush.se/index.php?movies
// @include       http://www.shush.se/index.php?showlist*
// @include       https://www.shush.se/index.php?shows
// @include       https://www.shush.se/index.php?reality
// @include       https://www.shush.se/index.php?movies
// @include       https://www.shush.se/index.php?showlist*
// @updateURL     https://openuserjs.org/meta/shush/Shush_Filter.meta.js
// ==/UserScript==

$("div.menu").append(' | Filter: <input type="text" id="filter" name="filter"/>');
$("#filter").focus();

if ((window.location.href.indexOf("index.php?shows") >= 0) || window.location.href.indexOf("index.php?reality") >= 0)
{
	$("#filter").keyup(function() {
		var filterStr = this.value;
		$('a[href^="index.php?showlist"]').each(function() {
			var showName = $(this).children().first().children().eq(1).text();
			$(this).parent().toggle(showName.toLowerCase().indexOf(filterStr.toLowerCase()) >= 0);
		});
	});
}

if (window.location.href.indexOf("index.php?movies") >= 0)
{
	$("#filter").keyup(function() {
		var filterStr = this.value;
		$('a[href^="index.php?id"]').each(function() {
			var movieName = $(this).children().first().children().first().attr('title');
			$(this).parent().toggle(movieName.toLowerCase().indexOf(filterStr.toLowerCase()) >= 0);
		});
	});	
}

if (window.location.href.indexOf("index.php?showlist") >= 0)
{
	$("#filter").keyup(function() {
		var filterStr = this.value;		
		$('a[href^="index.php?id"]').each(function() {
			var episodeName = $(this).text();
			$(this).toggle(episodeName.toLowerCase().indexOf(filterStr.toLowerCase()) >= 0);
			$(this).next().toggle(episodeName.toLowerCase().indexOf(filterStr.toLowerCase()) >= 0);
		});	
	});		
}