沃尔玛查询upc

在页面显示商品UPC码

目前為 2021-07-08 提交的版本,檢視 最新版本

// ==UserScript==
// @name         沃尔玛查询upc
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  在页面显示商品UPC码
// @author       Take
// @match        *://www.walmart.com/ip/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    var html = document.documentElement.outerHTML;
    var a = html.indexOf('"upc":"');
    var b = html.indexOf('","fetched"');
    var upc = html.substring(a+7,b);
    console.log("upc为:",upc);
    if(upc!="" && upc.length<=12){
        var div = document.createElement("div");
        div.innerHTML = "<div class='upc' onclick='copyText()'>UPC:"+upc+" <a target='_blank' href='https://www.amazon.com/s?k="+upc+"&ref=nb_sb_noss'>Go></a></div><style>a{color:white;text-decoration:none}a:hover{color:#f5a8a8;text-decoration:none}.upc{position: fixed;right: 0;top: 23%;background-color: #2271dc;border-radius: 5px;color: white;padding: 5px 15px;z-index: 99999;}</style>";
        document.body.appendChild(div);
    }



})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址