您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
hides works if chosen tags are late in sequence
当前为
- // ==UserScript==
- // @name ao3 secondary char&pairing filter
- // @namespace https://greasyfork.org/en/users/36620
- // @version 0.2
- // @description hides works if chosen tags are late in sequence
- // @author scriptfairy
- // @match http*://archiveofourown.org/tags*works*
- // @grant none
- // ==/UserScript==
- /* CONFIG */
- var relationships = ["Pepper Potts/Tony Stark", "Poe Dameron/Finn/Rey", "Loren & Tobias (Animorphs)"];
- // the relationship tags you want to see
- var characters = ["Bruce Banner", "EVE (WALL-E)", "Jamie Moriarty | Irene Adler"];
- // the character tags you want to see
- var relpad = 3;
- // you want to see at least one of your relationships within this many relationship tags
- var charpad = 5;
- // you want to see at least one of your characters within this many character tags
- /* END CONFIG */
- (function($) {
- $('<style>').text(
- '.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}'
- ).appendTo($('head'));
- if (relationships.length === 0 && characters.length === 0) {return;}
- for(i=0;i<$('.index .blurb').length;i++){
- var tags = $('.index .blurb ul.tags')[i];
- var reltags = $('.relationships', tags).slice(0,relpad); var chartags = $('.characters', tags).slice(0,charpad);
- var temprel = []; var tempchar = [];
- $(reltags).map(function() {
- temprel.push(this.innerText);
- });
- $(chartags).map(function() {
- tempchar.push(this.innerText);
- });
- var relmatch = temprel.filter(function(n) {
- return relationships.indexOf(n) != -1;
- });
- var charmatch = tempchar.filter(function(n) {
- return characters.indexOf(n) != -1;
- });
- if (relmatch.length === 0 && charmatch.length === 0) {
- var work = $('.index .blurb')[i];
- work.style.display = 'none';
- var button = document.createElement('div');
- button.setAttribute('class','workhide');
- 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>';
- $(work).after(button);
- }
- }
- $(document).ready(function(){
- $('.showwork').click(function() {
- var blurb = $(this).parents('.workhide').prev()[0];
- $(blurb).removeAttr('style');
- $(this).parents('.workhide').remove();
- });
- });
- })(window.jQuery);