YTS - Hide Opened Movies

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

// ==UserScript==
// @name         YTS - Hide Opened Movies
// @namespace    https://greasyfork.org/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
})();