haoshuaiyu126.com / 资源位ID检测

// ==UserScript==
// @name         资源位ID检测
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  try to take over the world!
// @author       You
// @match        http://*.gome.com.cn/*// ==UserScript==
// @name         资源位ID检测
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://*.gome.com.cn/*
// @match        https://*.gome.com.cn/*
// @match        http://*.gomeplus.com/*
// @match        https://*.gomeplus.com/*
// @grant        none
// ==/UserScript==

(function () {
    var datacodes = [];
    setInterval(function () {
        var styleContents = '';
        document.querySelectorAll('a[data-code]').forEach(function ($a) {
            var datacode = $a.getAttribute('data-code');
            if (datacodes.indexOf(datacode) === -1) {
                var _width = $a.offsetWidth || $a.getBoundingClientRect().width;
                if (_width > 60) {
                    datacodes.push(datacode);
                    styleContents += "[data-code=\"" + datacode + "\"]:before {content: \"" + datacode + "\";float: left;font-size: 5px !important;color: red;border: none;position:absolute;z-index: 1000;white-space: pre;background: black;}\n";
                }
            }
        });
        if (styleContents.length) {
            var styleDiv = document.createElement('style');
            styleDiv.innerHTML = styleContents;
            document.querySelector('head').appendChild(styleDiv);
        }
    }, 1000);
})();