Remove items without new chapter

Add dropdown filter for fiction items

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Remove items without new chapter
// @namespace    http://royalroad.com/
// @version      0.2
// @description  Add dropdown filter for fiction items
// @author       You
// @match        *://www.royalroad.com/my/follows
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    $(document).ready(function() {
        const hideText = "Hide NoNew";
        const showText = "Show All";
        function clickHandling() {
            var allItems = $(".fiction-list-item");
            if (toggleButton.text() === hideText) {
                allItems.each(function() {
                    console.log($(this).text());
                    if ($(this).text().includes('Last Update & Last Read')) {
                        $(this).hide();
                    }
                });
                toggleButton.text(showText);
            } else {
                allItems.each(function() {
                    $(this).show();
                });
                toggleButton.text(hideText);
            }
        }

        let toggleButton = $(`<button class="btn btn-circle btn-sm blue">${hideText}</button>`);
        toggleButton.on('click', function() {
            clickHandling();
        });

        $('.actions').prepend(toggleButton);
        clickHandling();
    });

})();