DLsite filter

filter dlsite result by type

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         DLsite filter
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  filter dlsite result by type
// @author       Oscar0159
// @match        https://www.dlsite.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=dlsite.com
// @grant        none
// @license      MIT
// ==/UserScript==

var block_list = ['漫畫', '單篇', '單行本', 'CG・插畫', '雜誌/精選集', '聲音作品・ASMR', '小說'];

// 隱藏的透明度
var opacity = "15%";

// 是否刪除元素
var delete_element = false;

(function() {
    'use strict';

    window.onload = function() {
        var hasElement = document.querySelector(".work_category");
        if (hasElement) {
            main();
        }
    }

    function main(){
        var block_elements = document.querySelectorAll('.work_category');

        block_elements.forEach(function(element) {
            var text = element.querySelector('a').textContent;
            // check if the text is in the block list
            if (block_list.indexOf(text) > -1) {
                // hide the element
                element.parentNode.parentNode.style.opacity = opacity;

                if (delete_element) {
                    // delete the element
                    element.parentNode.parentNode.parentNode.remove();
                }
            }
        });
    }
})();