Greasy Fork

移除广告、好用网站收藏

进入网站【http://0000.com】看到收藏菜单

当前为 2023-02-08 提交的版本,查看 最新版本

// ==UserScript==
// @name         移除广告、好用网站收藏
// @namespace    http://tampermonkey.net/
// @version      1.81
// @description  进入网站【http://0000.com】看到收藏菜单
// @author       Godow
// @match        *://*/*
// @run-at       document-body
// @icon         https://goduck.cc/favicon.ico
// @grant        none
// @license MIT
// ==/UserScript==


// 我的主页,常用网站收藏
const myHome = () => {
    document.querySelectorAll("body *").forEach(i => i.remove());
    const myLink = {
        "影视工厂": "//www.ysgcapp.com/",
        "新视觉影院": "//www.dh6080.com/",
        "BL解析": "//svip.bljiex.cc",
        "照片转卡通": "//www.toonme.com",
        "图片智能擦除": "//magicstudio.com/magiceraser",
        "图片消除背景": "//www.remove.bg/zh",
        "红白机游戏": "//www.yikm.net/",
        "在线鼠标作图": "//weavesilk.com/",
        "改图鸭": "//www.gaituya.com/manhua/",
    };

    Object.keys(myLink).forEach(i => {
        let a = document.createElement('a');
        a.href = myLink[i];
        a.appendChild(document.createTextNode(i));
        a.style = "margin: 20px 50px;display: inline-block";
        document.body.appendChild(a);
    })
}


// 跳过中间页
const jumpMidPage = () => {
    if (/^\?target\=http/.test(location.search)) {
        const targetUrl = decodeURIComponent(location.search).match(/^\?target\=http.+/)?.[0]?.split(':')?.[1];
        if (targetUrl) {
            location.href = targetUrl;
        }
    }
}


(function() {
    'use strict';

    jumpMidPage();


    const host = document.location.host;
    let fn;
    switch(host) {
        case '0000.com':
        case 'www.0000.com':
            fn = myHome;
            break;
        // BL解析
        case 'svip.bljiex.cc':
            fn = () => document.querySelectorAll('#section~*')?.forEach(i => i.remove());
            break;
        // 影视工厂
        case host.match(/^www.ysgc.*/)?.input:
            fn = () => {
                document.querySelectorAll('a[id*="_ad_"],#HMRichBox,#mhbottom_ad_box,#fulerbox,#hm_cpm_show,#fix_bottom_dom,div[id*="ad"]')?.forEach(i => i.remove());
                document.querySelector(".col-lg-wide-75 > .myui-panel").style = "display: none";
            };
            break;

        default:
            fn = () => {
                // 删除谷歌广告
                document.querySelectorAll(".adsbygoogle")?.forEach(i => i.remove());
                // 左下角弹窗广告
                document.querySelector("#HMRichBox")?.remove();
                document.querySelector("#adv_wrap_hh")?.remove();
            }
            break;
    }

    if (fn) {
        const timerFn = (interval, count) => {
            const timer = setInterval(() => {
                fn();
                if((--count) < 0) {
                    clearInterval(timer);
                }
            }, interval)
        }
        timerFn(100, 5);
        timerFn(800, 3);
    }
})();