Greasy Fork

Greasy Fork is available in English.

我家在... 改

自动修改淘宝/天猫/京东等购物页面的“配送至”地址,在你分享商品截图的时候保护隐私

目前为 2024-10-30 提交的版本。查看 最新版本

// ==UserScript==
// @name         我家在... 改
// @namespace    https://114514.plus/
// @version      0.1.6
// @description  自动修改淘宝/天猫/京东等购物页面的“配送至”地址,在你分享商品截图的时候保护隐私
// @author       Archeb / jkfujr
// @match        https://item.jd.com/*.html*
// @match        https://*.detail.tmall.com/item.htm*
// @match        https://*.detail.tmall.hk/hk/item.htm*
// @match        https://item.taobao.com/item.htm*
// @grant        none
// @license      GNU GPLv3
// ==/UserScript==

(function () {
    "use strict";
    var fakeAddress1 = "日本";
    var fakeAddress2 = "下北沢";

    setTimeout(function () {
        switch (window.location.host) {
            case "item.jd.com":
                document.querySelector(".ui-area-text").innerText = fakeAddress1 + " " + fakeAddress2;
                break;
            case "detail.tmall.com":
            case "detail.tmall.hk":
            case "chaoshi.detail.tmall.com":
            case "item.taobao.com":
                var addressElement1 = document.querySelector("[class^='mui-addr-tri-1--']");
                var addressElement2 = document.querySelector("[class^='mui-addr-tri-2--']");

                // 如果找到单地址
                if (addressElement1 && !addressElement2) {
                    addressElement1.textContent = fakeAddress1;
                }

                // 如果找到双地址

                if (addressElement1 && addressElement2) {
                    addressElement1.textContent = fakeAddress1;
                    addressElement2.textContent = fakeAddress2;
                }
                break;
        }
    }, 2500);
})();