您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Append __wsmode__=9 to relay.jd.com/file/design?xxx URLs
当前为
// ==UserScript== // @name JD Relay URL Modifier // @namespace http://tampermonkey.net/ // @version 0.3 // @description Append __wsmode__=9 to relay.jd.com/file/design?xxx URLs // @author Your Name // @match *://relay.jd.com/file* // @match *://relay-test.jd.com/file* // @match *://relay0.jd.com/file* // @grant none // @license MIT // ==/UserScript== ;(function () { "use strict" const inFile = window.location.pathname.startsWith("/file/design") // 创建按钮 let button = document.createElement("button") button.innerText = "Toggle __wsmode__" button.style.position = "fixed" button.style.bottom = "10px" button.style.right = "10px" button.style.zIndex = "1000" document.body.appendChild(button) // 从 localStorage 获取状态 let isEnabled = localStorage.getItem("wsmodeEnabled") === "true" // 设置按钮初始状态 button.style.backgroundColor = isEnabled ? "green" : "red" // 按钮点击事件 button.addEventListener("click", () => { isEnabled = !isEnabled localStorage.setItem("wsmodeEnabled", isEnabled) button.style.backgroundColor = isEnabled ? "green" : "red" // 通知其他页面 localStorage.setItem("wsmodeChanged", Date.now()) }) // 获取当前 URL let url = new URL(window.location.href) // 检查是否已经有 __wsmode__ 参数并且功能开启 if (isEnabled && !url.searchParams.has("__wsmode__")) { // 添加 __wsmode__ 参数 url.searchParams.append("__wsmode__", "9") // 重定向到新的 URL window.location.replace(url.toString()) } // 监听新打开的 relay.jd.com/file/design 页面 window.addEventListener("message", (event) => { console.log("Received message from relay.jd.com:", event) if ( event.origin === "https://relay.jd.com" && event.data === "checkWsmode" ) { event.source.postMessage({ wsmodeEnabled: isEnabled }, event.origin) } }) // 在 relay.jd.com/file/design 页面中检查 __wsmode__ 参数 if (inFile) { window.opener.postMessage("checkWsmode", "https://relay.jd.com") window.addEventListener("message", (event) => { if ( event.origin === "https://relay.jd.com" && typeof event.data.wsmodeEnabled !== "undefined" ) { if (event.data.wsmodeEnabled) { if (!url.searchParams.has("__wsmode__")) { url.searchParams.append("__wsmode__", "9") window.location.replace(url.toString()) } } else { if (url.searchParams.has("__wsmode__")) { url.searchParams.delete("__wsmode__") window.location.replace(url.toString()) } } } }) } // 监听 localStorage 变化 window.addEventListener("storage", (event) => { if (event.key === "wsmodeChanged") { isEnabled = localStorage.getItem("wsmodeEnabled") === "true" button.style.backgroundColor = isEnabled ? "green" : "red" if (inFile) { if (isEnabled && !url.searchParams.has("__wsmode__")) { url.searchParams.append("__wsmode__", "9") window.location.replace(url.toString()) } else if (!isEnabled && url.searchParams.has("__wsmode__")) { url.searchParams.delete("__wsmode__") window.location.replace(url.toString()) } } } }) })()
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址