34 lines
913 B
JavaScript
34 lines
913 B
JavaScript
|
const $ = q => document.querySelector(q);
|
||
|
const $$ = q => document.querySelectorAll(q);
|
||
|
|
||
|
function toggleClassClicker(i, clazz) {
|
||
|
document.getElementById("clicker-" + i).classList.toggle(clazz);
|
||
|
}
|
||
|
|
||
|
function toggleClass(i, clazz) {
|
||
|
document.getElementById(i).classList.toggle(clazz);
|
||
|
}
|
||
|
|
||
|
function showElement(i) {
|
||
|
toggleClassClicker(i, "hidden")
|
||
|
}
|
||
|
|
||
|
const toggleFAQ = id => $('#faq-' + id).parentElement.querySelector('button>span').innerHTML = $('#faq-' + id).classList.toggle('hidden')?'+':'-';
|
||
|
|
||
|
const closeAnnouncementHandler = (el) => {
|
||
|
el.addEventListener('click', e => {
|
||
|
console.log('click!');
|
||
|
console.log(e.target.parentElement);
|
||
|
e.target.parentElement.classList.toggle('hidden');
|
||
|
})
|
||
|
}
|
||
|
|
||
|
document.addEventListener('DOMContentLoaded', () => {
|
||
|
let els = $$('#announcement .close');
|
||
|
els.forEach(el => {
|
||
|
if(el) closeAnnouncementHandler(el);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
|