Healthy Hentai

Remove Bloody Galleries In hitomi

  1. // ==UserScript==
  2. // @name Healthy Hentai
  3. // @name:zh-CN Healthy Hentai
  4. // @description Remove Bloody Galleries In hitomi
  5. // @description:zh-CN 移除 hitomi 中含有血腥标签的图集
  6. // @version 0.1.0
  7. // @author jferroal
  8. // @license GPL-3.0
  9. // @include https://hitomi.la/*
  10. // @run-at document-idle
  11. // @namespace https://greasyfork.org/users/34556
  12. // ==/UserScript==
  13.  
  14. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  15. (function () {
  16. function hideGalleryContainTags(galleries, tags = ['guro', 'blood']) {
  17. galleries.forEach((node) => {
  18. const galleryTags = Array.from(node.querySelectorAll('.relatedtags > ul > li')).map((e) => e.innerText);
  19. if (galleryTags.some((gt) => tags.some((t) => (new RegExp(t, 'gi')).test(gt)))) {
  20. node.style.display = 'none';
  21. }
  22. });
  23. }
  24.  
  25. function startCheck() {
  26. let tryTimes = 0;
  27. let checkInterval = setInterval(() => {
  28. const galleries = Array.from(document.querySelectorAll('.gallery-content > div'));
  29. if (!galleries.length) {
  30. tryTimes += 1;
  31. }
  32. if (tryTimes > 20 || galleries.length) {
  33. hideGalleryContainTags(galleries);
  34. clearInterval(checkInterval);
  35. checkInterval = null;
  36. }
  37. }, 500);
  38. }
  39.  
  40. // listen page button click
  41. window.addEventListener('click', startCheck);
  42. // window.addEventListener('scroll', startCheck);
  43. startCheck();
  44. })();
  45. },{}]},{},[1]);