From 9cffd9ba3d63a529056228adf61457c0533274c0 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Thu, 13 Apr 2023 11:02:51 +0900 Subject: [PATCH] =?UTF-8?q?query=E3=81=8C=E5=AD=98=E5=9C=A8=E3=81=99?= =?UTF-8?q?=E3=82=8BURL=E3=82=82=E7=9F=AD=E3=81=8F=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- amazon-shorten.user.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/amazon-shorten.user.js b/amazon-shorten.user.js index f9240aa..6351ed0 100644 --- a/amazon-shorten.user.js +++ b/amazon-shorten.user.js @@ -4,6 +4,5 @@ "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); +const dp = pathname.match(/(?<=\/dp\/|\/gp\/product\/)\w*/)?.[0]; +if (dp) window.history.replaceState(null, "", `/dp/${dp}`);