Ao3 Show every pairing except THAT one

Hides works by one particular ship.

当前为 2019-02-03 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Ao3 Show every pairing except THAT one
  3. // @namespace https://greasyfork.org/en/users/36620
  4. // @version 1
  5. // @description Hides works by one particular ship.
  6. // @author Modified by Neeve, originally by scriptfairy
  7. // @include http://archiveofourown.org/*
  8. // @include https://archiveofourown.org/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. /* CONFIG
  13. keep a plaintext file of your config because they will not be saved when the script updates */
  14.  
  15. var relationships = ['Jeon Jungkook/Park Jimin','Min Yoongi | Suga/Park Jimin','Kim Namjoon | RM/Kim Seokjin | Jin','Kim Namjoon | Rap Monster/Kim Seokjin | Jin','Jeon Jungkook/Kim Taehyung | V','Jeon Jungkook | Jungkook/Kim Taehyung | V', 'Jeon Jeongguk | Jungkook/Kim Taehyung | V','Jung Hoseok | J-Hope/Min Yoongi | Suga','Jung Hoseok | J-Hope/Park Jimin','Kim Taehyung | V/Min Yoongi | Suga','Kim Seokjin | Jin/Park Jimin','Kim Seokjin | Jin/Kim Taehyung | V','Kim Seokjin | Jin/Min Yoongi | Suga','Jeon Jungkook/Min Yoongi | Suga','Jung Hoseok | J-Hope/Kim Taehyung | V','Kim Namjoon | RM/Min Yoongi | Suga','Kim Namjoon | Rap Monster/Min Yoongi | Suga','Kim Namjoon | RM/Park Jimin','Kim Namjoon | Rap Monster/Park Jimin','Jeon Jungkook/Kim Seokjin | Jin','Jeon Jungkook/Jung Hoseok | J-Hope','Kim Namjoon | RM/Kim Taehyung | V','Kim Namjoon | Rap Monster/Kim Taehyung | V','Jung Hoseok | J-Hope/Kim Namjoon | RM','Jung Hoseok | J-Hope/Kim Namjoon | Rap Monster','Jeon Jungkook/Kim Namjoon | RM','Jeon Jungkook/Kim Namjoon | Rap Monster','Jung Hoseok | J-Hope/Kim Seokjin | Jin'];
  16. // remove the relationship from this list which you do not want to read. There may be more than one for a relationship.
  17. // this has been customised to the BTS fandom. For other fandoms: enter every pairing for your fandom, and remove the ones you don't want to read.
  18. // There is definitely an easier way to do this, and when I find out how I will update this script. In theory.
  19.  
  20. var characters = [ ];
  21. // the character tags you want to see (exact, case-sensitive)
  22.  
  23. var relpad = 1;
  24. // you want to see at least one of your relationships within this many relationship tags
  25.  
  26. var charpad = 5;
  27. // you want to see at least one of your characters within this many character tags
  28.  
  29. /* END CONFIG */
  30.  
  31. (function($) {
  32. $('<style>').text(
  33. '.workhide{border:1px solid rgb(221,221,221);margin:0.643em 0em;padding:0.429em 0.75em;height:29px;} .workhide .left{float:left;padding-top:5px;} .workhide .right{float:right}'
  34. ).appendTo($('head'));
  35. if (relationships.length === 0 && characters.length === 0) {return;}
  36. var checkfandom = document.createElement('div');
  37. var fandomlink = $('h2.heading a')[0].href;
  38. fandomlink = fandomlink.slice(fandomlink.indexOf('tags'));
  39. $(checkfandom).load('/'+fandomlink+' .parent', function(){
  40. if ($('ul', checkfandom).text() == "No Fandom") {return;}
  41. else {
  42. for(i=0;i<$('.index .blurb').length;i++){
  43. var tags = $('.index .blurb ul.tags')[i];
  44. var reltags = $('.relationships', tags).slice(0,relpad); var chartags = $('.characters', tags).slice(0,charpad);
  45. var temprel = []; var tempchar = [];
  46. $(reltags).map(function() {
  47. temprel.push(this.innerText);
  48. });
  49. $(chartags).map(function() {
  50. tempchar.push(this.innerText);
  51. });
  52. var relmatch = temprel.filter(function(n) {
  53. return relationships.indexOf(n) != -1;
  54. });
  55. var charmatch = tempchar.filter(function(n) {
  56. return characters.indexOf(n) != -1;
  57. });
  58. if (relmatch.length === 0 && charmatch.length === 0) {
  59. var work = $('.index .blurb')[i];
  60. work.style.display = 'none';
  61. var button = document.createElement('div');
  62. button.setAttribute('class','workhide');
  63. button.innerHTML = '<div class="left">This work does not prioritize your preferred tags.</div><div class="right"><button type="button" class="showwork">Show Work</button></div>';
  64. $(work).after(button);
  65. }
  66. }
  67. $(document).ready(function(){
  68. $('.showwork').click(function() {
  69. var blurb = $(this).parents('.workhide').prev()[0];
  70. $(blurb).removeAttr('style');
  71. $(this).parents('.workhide').remove();
  72. });
  73. });
  74. }
  75. });
  76.  
  77.  
  78. })(window.jQuery);