Yahoo T-Point Auto Skip

Automatically skips the T-Point / PayPay registration nag screen on Yahoo! Japan.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @author         たかだか。/TKDK.
// @name           Yahoo T-Point Auto Skip
// @name:ja        Yahoo T-Point Auto Skip
// @namespace      https://twitter.com/djtkdk_086969
// @description:ja Yahoo! Japan ログイン後の「T-POINT利用手続き/PayPay連携/LINEアカウント連携」画面を自動的にスキップします。
// @description    Automatically skips the T-Point / PayPay registration nag screen on Yahoo! Japan.
// @include        *://tcard.yahoo.co.jp/*
// @include        *://wallet.yahoo.co.jp/*
// @include        *://paypay.yahoo.co.jp/*
// @include        *://id.lylink.yahoo.co.jp/*
// @version        0.2.2.005
// @grant          none
// @license        MIT License; https://opensource.org/licenses/mit-license.php
// @homepage       https://twitter.com/djtkdk_086969
// @compatible     firefox
// @compatible     chrome
// ==/UserScript==

(function() {
    console.log("YTPAS: Started.");
    window.addEventListener ('DOMContentLoaded', checkElem());

    var mo =
        new MutationObserver(function(mutationEventList) {
            checkElem();
        });
    var mo_conf = {
        childList: true,
        attributes: true,
        characterData: false,
        subtree: true
    };
    mo.observe(document.querySelector('body'), mo_conf);

    function checkElem() {
        console.log("YTPAS: Checking elements...");
        let skipButtonT = document.getElementById("skipButton");
        let skipButtonP = document.getElementById("ppskip");
        if (skipButtonT !== null &&
           location.href.startsWith('https://tcard.yahoo.co.jp/') &&
           document.title.match(/[TT]ポイント利用手続き/) !== null) {
           console.log("YTPAS: T-Point nag screen detected. Skipping...");
           skipButtonT.click();
        }
        if (skipButtonP !== null &&
            (
                location.href.startsWith('https://wallet.yahoo.co.jp/paypay/agreement/') ||
                location.href.startsWith('https://paypay.yahoo.co.jp/agreement/')
            ) &&
            document.title.match(/ヤフーからの大切なお知らせです/) !== null) {
            console.log("YTPAS: PayPay nag screen detected. Skipping...");
            skipButtonP.click();
        }
        if (location.href.includes("id.lylink.yahoo.co.jp")) {
            // LINEアカウント連携
            let lyHeader = document.getElementsByTagName("h1");
            let lyFlag = false;
            if (lyHeader.length > 0) {
                [].slice.call(lyHeader).forEach( (e) => {
                    if (e.innerText == "アカウント連携をしましょう") {
                        lyFlag = true;
                    }
                });
            }
            if (lyFlag) {
                console.log("YTPAS: LINE nag screen detected. Skipping...");
                let lyBtn = document.querySelectorAll("button.btn");
            if (lyBtn.length > 0) {
                [].slice.call(lyBtn).forEach( (e) => {
                    if (e.innerText == "あとで行う") {
                        e.click();
                    }
                });
            }
            }
        }
    }
})();