A replacement for the filtered Netflix of the past. Written in a bit of a drunken rage. I got around the now lack of Netflix API by checking the boxes that popup and looking for a rating, and then saving the info into localStorage. Thus, it will not filter things until you've hovered over them once.
当前为
// ==UserScript==
// @name New Filtered Netflix
// @namespace http://www.netflix.com/
// @version 0.1
// @description A replacement for the filtered Netflix of the past. Written in a bit of a drunken rage. I got around the now lack of Netflix API by checking the boxes that popup and looking for a rating, and then saving the info into localStorage. Thus, it will not filter things until you've hovered over them once.
// @match http://*.netflix.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
// @copyright 2014+, Nigel Fish
// @author Nigel Fish
// ==/UserScript==
$(document).ready(function() {
function hideThatTitleYo(title) {
var selector = 'img[alt="' + title + '"]';
$(selector).css({
'-webkit-filter' : 'grayscale(100%)',
'-moz-filter' : 'grayscale(100%)',
'-o-filter' : 'grayscale(100%)',
'-ms-filter': 'grayscale(100%)',
'filter': 'grayscale(100%)',
'opacity': '0.4'
});
}
var titles = JSON.parse(localStorage.getItem("filteredTitlesYo"));
if (titles === null) {
titles = {};
} else {
//loop and hide
for (var key in titles) {
hideThatTitleYo(key);
}
}
$('.boxShot').hover(function() {
//check if we've rated this movie
var movieTitle = $(this).find('.boxShotImg').attr('alt');
//check the popup box name
//wait a second first
setTimeout(function() {
var bobContent = $('.bobContent');
var bobTitle = bobContent.find('.bobMovieHeader .title').html();
if (bobTitle != undefined) bobTitle = bobTitle.trim();
//check if movie watched
if ((bobContent).find('.sbmfrt').length != 0) {
//store locally that it was watched and shade image
titles[bobTitle] = true;
localStorage.setItem("filteredTitlesYo", JSON.stringify(titles));
hideThatTitleYo(bobTitle);
}
}, 1000);
});
});