mirror of
https://github.com/kou029w/user-script.git
synced 2025-01-18 08:05:09 +00:00
queryが存在するURLも短くする
This commit is contained in:
parent
ca7340747b
commit
9cffd9ba3d
1 changed files with 2 additions and 3 deletions
|
@ -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}`);
|
||||
|
|
Loading…
Add table
Reference in a new issue