Greasy Fork is available in English.

駿河屋のお気に入りリスト、入荷リストから購入可能商品のみハイライト

駿河屋の購入可能なお気に入り商品のハイライティングをします

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==
// @name         駿河屋のお気に入りリスト、入荷リストから購入可能商品のみハイライト
// @license      Apache License 2.0
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  駿河屋の購入可能なお気に入り商品のハイライティングをします
// @author       Keisuke URAGO <bravo@resourcez.org>
// @match        https://www.suruga-ya.jp/pcmypage/action_favorite_list/detail/*
// @match        https://www.suruga-ya.jp/pcmypage/action_nyuka_search/list*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=suruga-ya.jp
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    const addTarget = node => {
        for(var e of node.querySelectorAll('td.gnavBox')) {
            if(e.querySelector('input[type=button]').value.match(/^カ/)){
                e.style.backgroundColor='#CCFFCC'
            }
            for (var a of e.querySelectorAll('a[href*="/product/detail/"]')) {
                a.setAttribute('target', '_blank')
            }
        }
    }
    window.addEventListener('load', () => {
        const container = document.querySelector('.read.mt10')
        addTarget(container)

        const observer = new MutationObserver((mutations) => {
            for(var mutation of mutations) {
                if (mutation.type == 'childList') {
                    for(var node of mutation.addedNodes) {
                        addTarget(node)
                    }
                }
            }
        });

        const config = { attributes: false, childList: true, characterData: false };

        observer.observe(container, config);
    })
})();