Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix version picker for old articles #219

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified build/ui-bundle.zip
Binary file not shown.
18 changes: 11 additions & 7 deletions src/js/01-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
}
}

function addVersionPickerEventListeners () {
document.getElementById('navbarProductName').addEventListener('click', versionPickerToggleHandler)

const navbarProductVersionEl = document.getElementById('navbarProductVersion')
if (navbarProductVersionEl) {
navbarProductVersionEl.addEventListener('click', versionPickerToggleHandler)
}
}

if (document.getElementsByClassName('nav-container').length > 0) {
var navContainer = document.querySelector('.nav-container')
var navToggle = document.querySelector('.nav-toggle')
Expand All @@ -22,6 +31,8 @@
// NOTE don't let click events propagate outside of nav container
navContainer.addEventListener('click', concealEvent)

addVersionPickerEventListeners()

var menuPanel = navContainer.querySelector('[data-panel=menu]')
if (!menuPanel) return
var nav = navContainer.querySelector('.nav')
Expand Down Expand Up @@ -55,13 +66,6 @@
}
})

document.getElementById('navbarProductName').addEventListener('click', versionPickerToggleHandler)

const navbarProductVersionEl = document.getElementById('navbarProductVersion')
if (navbarProductVersionEl) {
navbarProductVersionEl.addEventListener('click', versionPickerToggleHandler)
}

// NOTE prevent text from being selected by double click
menuPanel.addEventListener('mousedown', function (e) {
if (e.detail > 1) e.preventDefault()
Expand Down
Loading