* Spike out all-articles.html * Use it somewhere * Do the thing * Use 3 columns * Increase space between links * Hide standalone categories * Move all-articles to bottom of product-landing * Add obj_size filter * Add buttons if numArticles > 10 * Add click event to show * Add a chevron ^ * Assign maxArticles for some DRY fun * Add some comments
19 lines
620 B
JavaScript
19 lines
620 B
JavaScript
/**
|
|
* Handles the client-side events for `includes/all-articles.html`.
|
|
*/
|
|
export default function allArticles () {
|
|
const buttons = document.querySelectorAll('button.js-all-articles-show-more')
|
|
|
|
for (const btn of buttons) {
|
|
btn.addEventListener('click', evt => {
|
|
// Show all hidden links
|
|
const hiddenLinks = evt.currentTarget.parentElement.querySelectorAll('li.d-none')
|
|
for (const link of hiddenLinks) {
|
|
link.classList.remove('d-none')
|
|
}
|
|
// Remove the button, since we don't need it anymore
|
|
evt.currentTarget.parentElement.removeChild(evt.currentTarget)
|
|
})
|
|
}
|
|
}
|