prolapse / ph_user_hide

// ==UserScript==
// @name         ph_user_hide
// @license      MIT
// @namespace    http://tampermonkey.net/
// @version      0.1
// @updateURL    https://openuserjs.org/meta/prolapse/ph_user_hide.meta.js
// @downloadURL  https://openuserjs.org/install/prolapse/ph_user_hide.user.js
// @description  удалить говно-пользователей-уродов
// @author       anon
// @match        https://*.pornhub.com/*
// @grant        GM_getValue
// @grant        GM_setValue
// @icon         https://di.phncdn.com/www-static/favicon.ico
// ==/UserScript==

(function () {
  'use strict';
  const videoListItems = document.querySelectorAll('#videoCategory > li.pcVideoListItem, #recommendedVideos > .pcVideoListItem.js-pop.videoblock.videoBox, #relatedVideosCenter > .pcVideoListItem.js-pop.videoblock.videoBox, #videoSearchResult > li.pcVideoListItem');
  const hiddenAuthors = GM_getValue('hiddenAuthors', []);

  videoListItems.forEach(videoListItem => {
    //ищем и скрываем видео в выдаче поиска
    const authorNameElement = videoListItem.querySelector('div.thumbnail-info-wrapper.clearfix > div.videoUploaderBlock.clearfix > div > a, div.thumbnail-info-wrapper.clearfix > div.videoUploaderBlock.clearfix > div > span, div.wrap > div.thumbnail-info-wrapper.clearfix > div.videoUploaderBlock.clearfix > div.usernameWrap > a');
    if (!authorNameElement) {
      return;
    }
    const authorName = authorNameElement.textContent.trim();
    if (hiddenAuthors.includes(authorName)) {
      videoListItem.style.display = 'none';
    }
    else {
      const closeButton = document.createElement('a');
      //кнопочка-крестик для скрытия
      closeButton.textContent = 'x';
      closeButton.style.cursor = 'pointer';
      closeButton.style.color = 'red';
      closeButton.title = 'скрыть видео этого урода';
      closeButton.style.marginLeft = '5px';
      closeButton.addEventListener('click', () => {
        hiddenAuthors.push(authorName);
        GM_setValue('hiddenAuthors', hiddenAuthors);
        videoListItem.style.display = 'none';
        // скрываем видео пользователя в блоках рекомендаций и похожих видео
        const authorNameElements = document.querySelectorAll(`div.thumbnail-info-wrapper.clearfix > div.videoUploaderBlock.clearfix > div > a[href="/user/${authorName}"], div.thumbnail-info-wrapper.clearfix > div.videoUploaderBlock.clearfix > div > span[title="${authorName}"]`);
        authorNameElements.forEach(element => {
          const videoListItem = element.closest('.pcVideoListItem');
          if (videoListItem) {
            videoListItem.style.display = 'none';
          }
        });
      });
      authorNameElement.parentNode.appendChild(closeButton);
    }
  });
})();