// ==UserScript== // @name Remove shopee tracker // @name:zh-TW 移除蝦皮追蹤器 // @name:zh-CN 移除虾皮追踪器 // @namespace https://greasyfork.org // @version 0.0.3 // @description Efficiently clean Shopee product URLs. // @description:zh-TW 高效的清理蝦皮商品網址 // @description:zh-CN 高效的清理虾皮商品网址 // @author Pixmi // @match *://shopee.tw/* // @match *://shopee.ph/* // @match *://shopee.sg/* // @match *://shopee.com.my/* // @icon https://icons.duckduckgo.com/ip2/shopee.com.ico // @grant none // @license MPL-2.0 // @run-at document-body // @downloadURL none // ==/UserScript== (function() { 'use strict'; const cleanURL = (url) => { const match = url.match(new RegExp(/\-i\.([\d]+)\.([\d]+)/)); if (!match) return url; return `/product/${match[1]}/${match[2]}`; } const originalPushState = history.pushState; const originalReplaceState = history.replaceState; history.pushState = function(state, title, url) { if (url) { url = cleanURL(url); } return originalPushState.call(this, state, title, url); }; history.replaceState = function(state, title, url) { if (url) { url = cleanURL(url); } return originalReplaceState.call(this, state, title, url); }; })();