Greasy Fork

来自缓存

Greasy Fork is available in English.

Remove from watchlist when rated

Removes rated movies from IMDB watchlist page

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Remove from watchlist when rated
// @namespace    hydric
// @version      1.0.1
// @description  Removes rated movies from IMDB watchlist page
// @author       hydric
// @match        http://www.imdb.com/*
// @grant        none
// @run-at 	     document-idle
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// ==/UserScript==

(function() {
    'use strict';
    var interval = setTimeout(function() {
		if (window.location.href.indexOf("title") > -1){
			if ($('.star-rating-value').length){
				$('div[title="Click to remove from watchlist"]').click();
			}
			clearInterval(interval);
		}
		if (window.location.href.indexOf("watchlist") > -1){
				var varArray = [];
				$('.star-rating-value').each(function( index ) {
					if($(this).text()  > 0){
						var datareactid = $(this).attr('data-reactid');
						var regexp = /\$.*\$(.*?)\./ig;
						var match = regexp.exec(datareactid);
						var movieidentifier = match[1];
						varArray.push(movieidentifier);
					}
				});
				var uniqueset = new Set(varArray);
				function unwatch(value1, value2, set) {
					$('div[title="Click to remove from watchlist"][data-reactid*="'+value1+'"]').click();
				};
				uniqueset.forEach(unwatch);
		}
        clearInterval(interval);
    }, 5000);
})();