Greasy Fork

Greasy Fork is available in English.

MangaDex Update Hider

Allows the user to hide specific titles from the mangadex update page permanently by clicking the icon to the right of the title.

当前为 2020-08-09 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         MangaDex Update Hider
// @namespace    MDHider
// @version      1.0
// @description  Allows the user to hide specific titles from the mangadex update page permanently by clicking the icon to the right of the title.
// @author       MadHatter
// @match        https://mangadex.org/updates*
// @grant       GM_setValue
// @grant       GM_getValue
// @require https://code.jquery.com/jquery-3.5.1.min.js
// @run-at      document-end
// ==/UserScript==

const KEY = 'MD_FILTER_KEY';

(function() {
    'use strict';
    addIcons();
    filterPage();
})();

function addIcons() {
    let titles = document.getElementsByClassName("manga_title");
    for(const title of titles){
        title.parentElement.append(createBanIcon());
    }
}

function filterPage() {
    let titles = GM_getValue(KEY, []);
    for (const title of titles) {
        hideMe(title);
    }
}

function createBanIcon(){
    let ban = document.createElement("span");
    ban.className = "fas fa-ban";
    ban.style = "margin-left: 5px;"
    ban.onclick = () => {
        let title = ban.previousElementSibling.title;
        hideMe(title);
        addBanToStorage(title);
    };
    return ban;
}

function addBanToStorage(title){
    let titles = GM_getValue(KEY, []);
    if(title){
        titles.push(title);
        GM_setValue(KEY, titles);
        console.log(`${title} has been saved to storage`);
    }
}

function hideMe(title){
    let parent_row = $('[title="'+title+'"]').parentsUntil('tbody','tr');
    let rows = parent_row.nextAll();
    let found = false;
    let row;
    let child;
    $(parent_row).hide();
    for(row of rows){
        for(child of $(row).children()){
            if($(child).find("div").attr('class')=='medium_logo rounded'){
                found = true;
                break;
            }
        }
        if(found){
            break;
        }
        $(row).hide();
    }
}