File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ // ==UserScript==
2+ // @name Tmall URL Redirect
3+ // @namespace https://mt25cyb.github.io/
4+ // @version 0.3
5+ // @description Tmall URL Redirect
6+ // @author martin
7+ // @match https://*.tmall.com/*
8+ // @match https://*.taobao.com/*
9+ // @grant none
10+ // ==/UserScript==
11+
12+ ( function ( ) {
13+ 'use strict' ;
14+
15+ // 获取原网址的商品 ID
16+ const urlParams = new URLSearchParams ( window . location . search ) ;
17+ const itemId = urlParams . get ( 'id' ) ;
18+
19+ // 检查是否包含商品 ID 且不匹配排除的网址
20+ if ( itemId && window . location . href !== 'https://main.m.taobao.com/detail/index.html?id=' + itemId ) {
21+ // 构建新的 Taobao 网址
22+ const newUrl = `https://main.m.taobao.com/detail/index.html?id=${ itemId } ` ;
23+
24+ // 跳转到新的网址
25+ window . location . href = newUrl ;
26+ }
27+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments