您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Show the shortest possible URL for Amazon items.
- // ==UserScript==
- // @name Amazon URL Cleaner
- // @description Show the shortest possible URL for Amazon items.
- // @namespace https://arantius.com/misc/greasemonkey/
- // @match https://www.amazon.com/dp/*
- // @match https://www.amazon.com/*/dp/*
- // @match https://www.amazon.com/gp/product/*
- // @match https://www.amazon.com/*/ASIN/*
- // @run-at document-start
- // @version 9
- // @grant none
- // @icon https://www.amazon.com/favicon.ico
- // ==/UserScript==
- function getProductId() {
- var m;
- m = document.location.href.match(/(?:.+\/)?dp\/([^/?]+)/);
- if (m) return m[1];
- m = document.location.href.match(/gp\/product\/([^/?]+)/);
- if (m) return m[1];
- m = document.location.href.match(/ASIN\/([^/?]+)/);
- if (m) return m[1];
- }
- var productId = getProductId();
- if (productId) {
- history.replaceState(
- {}, document.title, 'https://www.amazon.com/dp/' + productId);
- }