Skip to content

Commit 9520162

Browse files
committed
Add popQuery option to goUp
1 parent 4a0b64e commit 9520162

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

background_scripts/all_commands.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ const allCommands = [
132132
advanced: true,
133133
options: {
134134
popAnchor: "Remove the anchor/fragment/hash from the URL, if present.",
135+
popQuery: "Remove query parameters from the URL, if present.",
135136
},
136137
},
137138

content_scripts/mode_normal.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ const NormalModeCommands = {
144144
--c;
145145
}
146146

147+
// Pop query params.
148+
if (c > 0 && registryEntry.options.popQuery && url.search !== "") {
149+
url.search = "";
150+
url.hash = "";
151+
--c;
152+
}
153+
147154
// Pop path segments.
148155
if (c > 0 && url.pathname != "/") {
149156
url.pathname = url.pathname.split("/").slice(0, -c).join("/");

0 commit comments

Comments
 (0)