Tiny Customize

针对一些常用网站的反反广告、自动化等。

Versione datata 20/05/2016. Vedi la nuova versione l'ultima versione.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo 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 针对一些常用网站的反反广告、自动化等。
// @namespace   [email protected]
// @author      [email protected]
// @include     http://forum.gamer.com.tw/*
// @version     1.0.1
// @grant       none
// ==/UserScript==

if (typeof unsafeWindow == "undefined")
{
    unsafeWindow = window;
}

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

    // 巴哈姆特 - 反广告检测。
    const action = function()
    {
        if (unsafeWindow.AntiAd)
        {
            unsafeWindow.AntiAd.check = function() {};
        }
    };
    actions.push(action);

    return actions;
};

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

    // 巴哈姆特 - 自动开启图片。
    let action = function()
    {
        if (unsafeWindow.forumShowAllMedia)
        {
            unsafeWindow.forumShowAllMedia();
        }
    };
    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. 延迟执行。
unsafeWindow.addEventListener("load", function()
{
    exec(getLazyActions());
}, true);