Skip to content

Commit 1406773

Browse files
author
Mauve Signweaver
committed
fix: Make up button consistant
1 parent 0327140 commit 1406773

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

app/ui/omni-box.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,7 @@ class OmniBox extends HTMLElement {
254254
this.input.value = newValue
255255

256256
const { pathname, hostname } = new URL(newValue)
257-
let slashCount = pathname.split('/').length
258-
if (!hostname) {
259-
slashCount -= 1
260-
}
261-
if (pathname.endsWith('/')) {
262-
slashCount -= 1
263-
}
264-
265-
const hasUpperFolders = slashCount > 2
257+
const hasUpperFolders = pathname !== '/'
266258
this.upButton.classList.toggle('hidden', !hasUpperFolders)
267259

268260
const noFocus = (new URL(window.location.href).searchParams).get('noFocus') === 'true'

app/ui/script.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ search.addEventListener('forward', () => {
3636
})
3737

3838
search.addEventListener('up', () => {
39-
currentWindow.loadURL(new URL('../', search.src).href)
39+
const next = search.src.endsWith('/') ? '../' : './'
40+
currentWindow.loadURL(new URL(next, search.src).href)
4041
})
4142

4243
search.addEventListener('navigate', ({ detail }) => {

0 commit comments

Comments
 (0)