Skip to content

Commit b1f7404

Browse files
committed
links/hot_reload: handle logo and dropdown self link
Make them absolute on load. Signed-off-by: Jorge Marques <[email protected]>
1 parent 95a4337 commit b1f7404

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

adi_doctools/theme/cosmic/scripts/hot_reload.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ export class HotReload {
139139
}
140140
})
141141
}
142+
init_others () {
143+
let logo = DOM.get('.sphinxsidebarwrapper > a')
144+
logo.href = logo.href.replace(/#$/, '')
145+
}
142146
popstate (ev) {
143147
let url = new URL(location.href)
144148
url.hash = ''
@@ -151,7 +155,8 @@ export class HotReload {
151155
init () {
152156
this.location_href = location.href
153157

154-
this.init_toctree ()
158+
this.init_toctree()
159+
this.init_others()
155160
this.hot_links()
156161
window.addEventListener('popstate', (ev) => {
157162
this.popstate(ev)

adi_doctools/theme/cosmic/scripts/links.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ export class Links {
5555
let home = "index.html"
5656
this.$.linksOverlay = []
5757
this.$.linksSidebar = []
58+
let self_link = this.parent.state.offline ?
59+
this.parent.state.content_root :
60+
new URL(this.parent.state.content_root, location.href)
5861
for (const [key, value] of Object.entries(obj)) {
5962
if (!('name' in value))
6063
continue
6164

6265
let base = key == this.parent.state.repository ?
63-
this.parent.state.content_root :
64-
`${prefix}${key}/`
66+
self_link : `${prefix}${key}/`
6567
this.$.linksSidebar.push(new DOM('a', {
6668
'href': `${base}${home}`,
6769
'className': this.parent.state.repository === key ? 'current' : '',

0 commit comments

Comments
 (0)