function showDiv(select){
    let hiddenDiv = document.getElementById('hidden_div');
    if (select.value != 1) {
        hiddenDiv.classList.remove('is-hidden');
    } else{
        hiddenDiv.classList.add('is-hidden');
    }
}

function play() {
           var audio = document.getElementById("audio");
    		var img = document.getElementById("img");
    
    		function play() {
    			  audio.play();
    		}
    
    		function stop() {
      			audio.pause();
    		}
    
    		img.addEventListener('click', play);
    		img.addEventListener('mouseover', play);
    		img.addEventListener('mouseout', stop);
}

// document.addEventListener('DOMContentLoaded', () => {
//     (document.querySelectorAll('.toggle') || []).forEach(($toggle) => {
//         $toggle.addEventListener('click', () => {
//
//         });
//     });
// });

document.addEventListener('DOMContentLoaded', () => {
    // Get all "navbar-burger" elements
    const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);

    // Add a click event on each of them
    $navbarBurgers.forEach( el => {
        el.addEventListener('click', () => {

            // Get the target from the "data-target" attribute
            const target = el.dataset.target;
            const $target = document.getElementById(target);

            // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
            el.classList.toggle('is-active');
            $target.classList.toggle('is-active');
        });
    });
});

document.addEventListener('DOMContentLoaded', () => {
    (document.querySelectorAll('.notification .delete') || []).forEach(($delete) => {
        const $notification = $delete.parentNode;
        $delete.addEventListener('click', () => {
            $notification.parentNode.removeChild($notification);
        });
    });
});

document.addEventListener('DOMContentLoaded', () => {
    (document.querySelectorAll('#endpointURL') || []).forEach(($urlInput) => {
        $urlInput.addEventListener('input', (e) => {
            window.localStorage.setItem("uri", e.target.value);
            console.log('Storing uri input ' + e.target.value);
        });
    });
});

document.addEventListener('DOMContentLoaded', () => {
    let data = window.localStorage.getItem("uri");
    if (data) {
        (document.querySelectorAll('#endpointURL') || []).forEach(($urlInput) => {
            $urlInput.setAttribute('value', data);
            console.log('Setting uri input to ' + data);
        });
    }
});

