Inquisitor

Tags/Author/Folder filtering for FimFiction (stories & feed)

Dec 24th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        FIMFiction - hide anthro & EqG.
  3. // @description  Hide stories that have tags "Anthro" or "Equestria Girls" or any other tag specified in settings. Also can hide folder or authors in group posts feed.
  4. // @namespace   anonymous
  5. // @include     http*://*.fimfiction.net/*
  6. // @version     0.35
  7. // @grant       none
  8. // ==/UserScript==
  9.  
  10. // Blocked tags for card view & full view
  11. var blocked = ["anthro", "equestria_girls", "equestria-girls",
  12.         "flash-sentry", "main-7-eqg", "twilight-sparkle-eqg", "rarity-eqg", "rainbow-dash-eqg", "fluttershy-eqg", "applejack-eqg", "pinkie-pie-eqg",
  13.         "adagio-dazzle", "sonata-dusk", "aria-blaze", "the-dazzlings", "spike-eqg", "shadowbolts-eqg", "vice-principal-luna", "principal-celestia"];
  14.  
  15. // Blocked folder names for groups in personal feed
  16. var folders = ["Anthro", "Anthropomorphic", "Vore"];
  17.  
  18. // Blocked author names for groups in personal feed
  19. var authors = []
  20.  
  21. function hideStory(stories, hide_parent) {
  22.     for(var i = 0; i < stories.length; i++)
  23.     {
  24.         var tags = stories[i].querySelectorAll('.story-tags > li > a, .story-card__tags > li > a');
  25.         for(var n = 0; n < tags.length; n++)
  26.         {
  27.             blocked.forEach(function(blockedtag) {
  28.                 if ((tags[n].dataset.tag == blockedtag)||(tags[n].className == blockedtag)) {
  29.                     stories[i].style.display = 'none';
  30.                     if (hide_parent) stories[i].parentNode.style.display = 'none';
  31.                 }
  32.             });
  33.         }
  34.     }
  35. }
  36.  
  37. function hideFeed(stories) {
  38.     for(var i = 0; i < stories.length; i++)
  39.     {
  40.         var folderNames = stories[i].querySelectorAll('.group_stories > li > a');
  41.         for(var n = 0; n < folderNames.length; n++)
  42.         {
  43.             folders.forEach(function(blockedfolder) {
  44.                 if (folderNames[n].textContent == blockedfolder) {
  45.                     stories[i].style.display = 'none';
  46.                 }
  47.             });
  48.         }
  49.         var authorNames = stories[i].querySelectorAll('.group_stories > li > ul > li > a[href^="/user"]');
  50.         for(var n = 0; n < authorNames.length; n++)
  51.         {
  52.             authors.forEach(function(blockedauthor) {
  53.                 if (authorNames[n].textContent == blockedauthor) {
  54.                     stories[i].style.opacity = '.5';
  55.                 }
  56.             });
  57.         }
  58.     }
  59. }
  60.  
  61. var storycards = document.getElementsByClassName('story-card-container');
  62. hideStory(storycards, true);
  63. var stories = document.getElementsByClassName('story_container');
  64. hideStory(stories);
  65.  
  66. var group_feed = document.getElementsByClassName('feed_group_item');
  67. hideFeed(group_feed);
Add Comment
Please, Sign In to add comment