Greasy Fork

Greasy Fork is available in English.

YTS - Hide Opened Movies

Hide all movies that you have previously opened when browsing YTS.

当前为 2024-02-06 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         YTS - Hide Opened Movies
// @namespace    http://greasyfork.icu/en/users/670188-hacker09?sort=daily_installs
// @version      2
// @description  Hide all movies that you have previously opened when browsing YTS.
// @author       hacker09
// @include      https://yts.mx/browse-movies/*
// @include      https://yts.mx/movies/*
// @icon         https://yts.mx/assets/images/website/apple-touch-icon-180x180.png
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_listValues
// @run-at       document-end
// ==/UserScript==

(function() {
  'use strict';
  if (location.href.match('https://yts.mx/movies') !== null) { //If the opened link is a movie page
    GM_setValue(location.href, location.href); //Store the URL
  } //Finishes the if condition

  setInterval(function() { //Starts the setInterval function
    GM_listValues().forEach((link) => { //ForEach stored URL
      document.querySelector(`[href="${GM_getValue(link)}"]`) !== null ? document.querySelector(`[href="${GM_getValue(link)}"]`).parentNode.style.display = 'none' : ''; //Hide the previously opened movie page
    }); //Finishes the ForEach loop
  }, 2000); //Finishes the setInterval function
})();