Remove Not enough followers

Remove items with less than 1000 followers or rating less than 4.5

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Remove Not enough followers
// @namespace    http://royalroad.com/
// @version      1.1
// @description  Remove items with less than 1000 followers or rating less than 4.5
// @match        *://www.royalroad.com/fictions/rising-stars
// @grant        none
// @license MIT
// ==/UserScript==


(function() {
    'use strict';

    function removeLowQualityItems() {
        console.log("Removing < 1000 followers and < 4.5 rating item");
        var items = $(".fiction-list-item.row");
        items.each(function() {
            var followersText = $(this).find('.fa-users').next('span').text();
            var followers = parseInt(followersText.replace(/[^0-9]/g, ''), 10);

            var ratingText = $(this).find('.fa-star').next('span').attr('title');
            var rating = parseFloat(ratingText);

            if (followers < 1000 || rating < 4.5) {
                $(this).remove();
            }
        });
    }

    function waitForElements(selector, callback) {
        var elements = $(selector);
        if (elements.length) {
            callback();
        } else {
            console.log("Waiting for elements:", selector);
            setTimeout(function() {
                waitForElements(selector, callback);
            }, 100);
        }
    }

    $(document).ready(function() {
        waitForElements('.fiction-list-item.row', removeLowQualityItems);
    });
})();