Fakku Blacklist

Flag media on Fakku that has tags that you don't want to see

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
  1. // ==UserScript==
  2. // @name Fakku Blacklist
  3. // @namespace https://jacenboy.com/
  4. // @version 1.1
  5. // @description Flag media on Fakku that has tags that you don't want to see
  6. // @author JacenBoy
  7. // @match http*://*.fakku.net/*
  8. // @require https://openuserjs.org/src/libs/sizzle/GM_config.js
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Prepare the config page
  17. GM_config.init({
  18. "id": "blacklistConfig",
  19. "title": "Fakku Blacklist",
  20. "fields": {
  21. "blacklist": {
  22. "label": "Blacklist (comma separated)",
  23. "type": "text",
  24. "default": ""
  25. }
  26. }
  27. });
  28.  
  29. // Generate option to open config panel
  30. const menuoption = document.createElement("a");
  31. menuoption.href = "#";
  32. menuoption.onclick = () => {GM_config.open();};
  33. const menuli = document.createElement("li");
  34. menuli.appendChild(document.createTextNode("Blacklist"));
  35. menuoption.appendChild(menuli);
  36. document.getElementById("my-account-drop-links").appendChild(menuoption);
  37.  
  38. // Generate blacklist array
  39. const blacklist = GM_config.get("blacklist").toLowerCase().replace(/\s/g, "").split(",");
  40.  
  41. // Loop through the tags and recolor the ones marked as blacklisted
  42. var taglists = document.getElementsByClassName("tags");
  43. for (var list of taglists) {
  44. var tags = list.getElementsByTagName("a");
  45. for (var tag of tags) {
  46. if (blacklist.includes(tag.innerText.toLowerCase().replace(/\s/g, ""))) {
  47. tag.style.backgroundColor = "rgb(215, 0, 0)";
  48. tag.style.color = "rgb(255, 255, 255)";
  49. }
  50. }
  51. }
  52. })();