🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2025/12/25 10:50:32
🔄 下次更新时间:2025/12/25 11:50:32
手动刷新缓存

Tiny Customize

为常用网站添加功能定制。例如:3DMGame、贴吧、淘宝、GitHub...

Versione datata 10/12/2016. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name        Tiny Customize
// @description 为常用网站添加功能定制。例如:3DMGame、贴吧、淘宝、GitHub...
// @namespace   https://greasyfork.org/zh-CN/scripts/19823-tiny-customize
// @homepageURL https://greasyfork.org/zh-CN/scripts/19823-tiny-customize
// @author      nonoroazoro
// @include     /^https?:\/\/(.+\.)?github\./
// @include     http://bbs.3dmgame.com/*
// @include     http://bbs.kafan.cn/*
// @include     http://forum.gamer.com.tw/*
// @include     http://poedb.tw/dps*
// @include     http://www.poelab.com/*
// @include     http://tieba.baidu.com/*
// @include     https://forum.gamer.com.tw/*
// @include     https://login.taobao.com/*
// @include     https://www.chiphell.com/*
// @version     1.1.11
// @grant       none
// ==/UserScript==

const host = window.location.host;
const href = window.location.href;
const pathname = window.location.pathname;

/**
 * 获取立即执行的操作。
 */
const getInstantActions = function ()
{
    const actions = [];

    if (host === "forum.gamer.com.tw")
    {
        // 巴哈姆特。

        // 反反广告检测。
        const action = function ()
        {
            if (window.AntiAd)
            {
                window.AntiAd.check = function () { };
                window.AntiAd.block = function () { };
                window.AntiAd.verifyLink = function () { return false; };
            }
        };
        actions.push(action);
    }
    else if (
        host === "bbs.kafan.cn" ||
        host === "bbs.3dmgame.com" ||
        host === "www.chiphell.com"
    )
    {
        // 卡饭、3DMGame、Chiphell 论坛(Discuz 驱动的论坛)。

        // 屏蔽方向键翻页。
        const action = function ()
        {
            if (window.keyPageScroll)
            {
                window.keyPageScroll = function () { };
            }
        };
        actions.push(action);
    }
    else if (/^https?\:\/\/poedb\.tw(\/?.*)\/dps/.test(href))
    {
        // 流亡编年史。

        // 屏蔽默认自动全选物品信息、自动查询物品信息。
        const action = function ()
        {
            const elem = document.querySelector(`#iteminfo`);
            elem.addEventListener("click", (e) =>
            {
                e.stopPropagation();
            }, true);

            elem.addEventListener("keydown", (e) =>
            {
                if (e.key === "Enter")
                {
                    document.querySelector(`form[action^="dps"]`).submit();
                    e.preventDefault();
                }
            }, true);

            elem.addEventListener("keyup", (e) =>
            {
                if (e.ctrlKey && (e.key === "v" || e.key === "V"))
                {
                    document.querySelector(`form[action^="dps"]`).submit();
                }
            });
        };
        actions.push(action);
    }
    else if (host === "login.taobao.com")
    {
        // 淘宝。

        // 默认显示密码登录(而非 QR 码登录)界面。
        let action = function ()
        {
            // 始终显示密码登录。
            let elems = document.querySelectorAll(`.static-form, .iconfont.static`);
            for (let elem of elems)
            {
                elem.setAttribute("style", "display: block !important");
            }

            // 删除扫码登录。
            elems = document.querySelectorAll(`.login-switch, .login-tip, .iconfont.quick, .quick-form`);
            for (let elem of elems)
            {
                elem.remove();
            }
        };
        actions.push(action);
    }
    else if (/^(.+\.)?github\./.test(host))
    {
        // GitHub。

        // 禁用快捷键: "s","w"。
        _disableKeydown("s w");
    }

    return actions;
};

/**
 * 获取延迟执行的操作。
 */
const getLazyActions = function ()
{
    const actions = [];

    if (host === "forum.gamer.com.tw")
    {
        // 巴哈姆特。

        // 自动开启图片。
        let action = function ()
        {
            if (window.forumShowAllMedia)
            {
                window.forumShowAllMedia();
            }
        };
        actions.push(action);
    }
    else if (host === "www.poelab.com")
    {
        // POE Lab

        // 屏蔽广告、垃圾内容。
        const action = function ()
        {
            setTimeout(function ()
            {
                let elems = document.querySelectorAll(`#SITE_HEADER, #SITE_FOOTER, #comp-ins6bwbr, #comp-inp1vdys, #comp-iqi4594d, #comp-iqi4593n, #comp-isp5y3ur, #comp-isoxkvo7, #comp-iuc01ycy, #comp-iuhmp4z3, #comp-iuk7qtfg, #comp-iuf27gqt`);
                for (let elem of elems)
                {
                    elem.setAttribute("style", "display: none !important;");
                }
            }, 800);
        };
        actions.push(action);
    }
    else if (host === "tieba.baidu.com")
    {
        // 贴吧。

        // 个人中心新标签打开。
        let action = function ()
        {
            const timer = window.setInterval(() =>
            {
                const elem = document.querySelector(`a.u_menu_wrap[title^="点击到个人中心"`);
                if (elem)
                {
                    elem.target = "_blank";
                    window.clearInterval(timer);
                }
            }, 100);
        };
        actions.push(action);

        // 删除广告贴。
        action = function ()
        {
            let spans;
            const elems = document.querySelectorAll(`#j_p_postlist > div`);
            for (let elem of elems)
            {
                spans = elem.querySelectorAll(`.core_reply_tail span`);
                for (let s of spans)
                {
                    if (s.innerText.trim() === "商业推广")
                    {
                        elem.remove();
                        break;
                    }
                }
            }
        };
        actions.push(action);
    }

    return actions;
};

/**
 * 立即执行指定的操作。
 */
const exec = function (p_actions)
{
    if (p_actions)
    {
        p_actions.forEach(function (p_action)
        {
            p_action();
        });
    }
};

// 1. 立即执行。
exec(getInstantActions());

// 2. 延迟执行。
window.addEventListener("load", function ()
{
    exec(getLazyActions());
}, true);

/**
 * 禁止键盘快捷键(单键)。
 */
function _disableKeydown(p_keys)
{
    if (typeof p_keys === "string")
    {
        const keys = p_keys.split(/\W+/);
        document.addEventListener("keydown", (e) =>
        {
            if (keys.indexOf(e.key.toLowerCase()) !== -1)
            {
                e.stopPropagation();
            }
        }, true);
    }
}