mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-21 21:49:31 -07:00
fix(customCursor.ts): move import statement for active to the top for better organization
fix(customCursor.ts): add return type void to onMouse function for clarity fix(customCursor.ts): add passive option to window event listener for mousemove to improve performance fix(stageNav.ts): move import statement for setCustomCursor to the top for better organization fix(stageNav.ts): add return type void to handleClick function for clarity fix(stageNav.ts): add return type void to handleKey function for clarity fix(stageNav.ts): add passive option to overlay event listeners for click, keydown, mouseover, and focus to improve performance fix(stageNav.ts): add passive option to window event listener for keydown to improve performance fix(stageNav.ts): add return type void to nextImage function for clarity fix(stageNav.ts): add return type void to prevImage function for clarity fix(gallery.ts): move import statement for Swiper to the top for better organization fix(gallery.ts): add return type void to slideUp function for clarity fix(gallery.ts): add return type void to initGallery function for clarity fix(gallery.ts): add passive option to window event listener for touchstart to improve performance fix(gallery.ts): add return type void to changeSlide function for clarity fix(gallery.ts): add return type void to scrollToActive function for clarity fix(gallery.ts): add return type void to createGallery function for clarity fix(gallery.ts): add passive option to close event listeners for click and keydown to improve performance fix(gallery.ts): add passive option to overlay event listeners for click, keydown, mouseover, and focus to improve performance fix(gallery.ts): add passive option to window event listener for touchstart to improve performance fix(nav.ts): add return type void to initNav function for clarity fix(utils.ts): add return type number to getRandom function for clarity fix(utils.ts): add return type void to onVisible function for clarity fix(utils.ts): add return type void to addWatcher function in Watchable class for clarity
This commit is contained in:
@@ -39,13 +39,16 @@ const links = Array.from(linksDiv.getElementsByClassName('link')) as HTMLAnchorE
|
||||
|
||||
// current link index
|
||||
const currentLinkIndex = document
|
||||
.getElementById('main')!
|
||||
.getAttribute('currentMenuItemIndex') as string
|
||||
.getElementById('main')
|
||||
?.getAttribute('currentMenuItemIndex') as string
|
||||
|
||||
// set current link
|
||||
for (let [index, link] of links.entries()) {
|
||||
for (const [index, link] of links.entries()) {
|
||||
if (index === parseInt(currentLinkIndex)) {
|
||||
// set current link style
|
||||
link.classList.add('current')
|
||||
// set current link title (only if not home)
|
||||
if (index !== 0) document.title = link.innerText + ' | ' + document.title
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,14 +56,26 @@ for (let [index, link] of links.entries()) {
|
||||
* init
|
||||
*/
|
||||
|
||||
export function initNav() {
|
||||
export function initNav(): void {
|
||||
// init threshold text
|
||||
updateThresholdText()
|
||||
// init index text
|
||||
updateIndexText()
|
||||
// event listeners
|
||||
decButton.addEventListener('click', () => decThreshold())
|
||||
incButton.addEventListener('click', () => incThreshold())
|
||||
decButton.addEventListener(
|
||||
'click',
|
||||
() => {
|
||||
decThreshold()
|
||||
},
|
||||
{ passive: true }
|
||||
)
|
||||
incButton.addEventListener(
|
||||
'click',
|
||||
() => {
|
||||
incThreshold()
|
||||
},
|
||||
{ passive: true }
|
||||
)
|
||||
}
|
||||
|
||||
// helper
|
||||
|
||||
Reference in New Issue
Block a user