user-script/amazon-shorten.user.js

10 lines
293 B
JavaScript
Raw Normal View History

2022-04-22 21:26:36 +09:00
// ==UserScript==
// @match https://www.amazon.co.jp/*
// ==/UserScript==
"use strict";
const { pathname } = window.location;
const dp = pathname.match(/(?<=\/(?:dp|gp\/product)\/)\w*/)?.[0];
const to = dp && `/dp/${dp}`;
if (to && pathname !== to) window.history.replaceState(null, "", to);