AO3 Filter Bookmarks By Length

Script to filter bookmarks based on word count. Edit min_len and max_len to taste.

当前为 2024-03-17 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         AO3 Filter Bookmarks By Length
// @namespace    https://greasyfork.org/en/users/296127-doleful-shades
// @version      0.1
// @description  Script to filter bookmarks based on word count. Edit min_len and max_len to taste.
// @author       dolefulshades
// @match      http://archiveofourown.org/*/bookmarks*
// @match      https://archiveofourown.org/*/bookmarks*
// @match      http://archiveofourown.org/bookmarks*
// @match      https://archiveofourown.org/bookmarks*
// @grant    none
// @license    MIT
// ==/UserScript==

// minimum length
var min_len = 0;

// maximum length
var max_len = Infinity;


(function($) {
    var works = $('.bookmarks-index .blurb:has(.stats)'); //all works
    var words = $(".bookmarks-index .blurb .stats dt:contains('Words:')"); //all "Words:" descriptors before word count
    //$(words).css('color', 'red');
    for(var i=0;i<$(works).length;i++){
        var len = $($(words)[i].nextElementSibling).text().replace(',',''); //get word count for each work
        //console.log(len);

        if (true && len < min_len||len > max_len) { //if the word count does not fall between min_len and max_len, hide the work
            //console.log('hid '+len);
            var work = $(works)[i];
            $(work).hide();
        }
    }

})(window.jQuery);