main.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. function showDiv(select){
  2. let hiddenDiv = document.getElementById('hidden_div');
  3. if (select.value != 1) {
  4. hiddenDiv.classList.remove('is-hidden');
  5. } else{
  6. hiddenDiv.classList.add('is-hidden');
  7. }
  8. }
  9. function play() {
  10. var audio = document.getElementById("audio");
  11. var img = document.getElementById("img");
  12. function play() {
  13. audio.play();
  14. }
  15. function stop() {
  16. audio.pause();
  17. }
  18. img.addEventListener('click', play);
  19. img.addEventListener('mouseover', play);
  20. img.addEventListener('mouseout', stop);
  21. }
  22. // document.addEventListener('DOMContentLoaded', () => {
  23. // (document.querySelectorAll('.toggle') || []).forEach(($toggle) => {
  24. // $toggle.addEventListener('click', () => {
  25. //
  26. // });
  27. // });
  28. // });
  29. document.addEventListener('DOMContentLoaded', () => {
  30. // Get all "navbar-burger" elements
  31. const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
  32. // Add a click event on each of them
  33. $navbarBurgers.forEach( el => {
  34. el.addEventListener('click', () => {
  35. // Get the target from the "data-target" attribute
  36. const target = el.dataset.target;
  37. const $target = document.getElementById(target);
  38. // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
  39. el.classList.toggle('is-active');
  40. $target.classList.toggle('is-active');
  41. });
  42. });
  43. });
  44. document.addEventListener('DOMContentLoaded', () => {
  45. (document.querySelectorAll('.notification .delete') || []).forEach(($delete) => {
  46. const $notification = $delete.parentNode;
  47. $delete.addEventListener('click', () => {
  48. $notification.parentNode.removeChild($notification);
  49. });
  50. });
  51. });
  52. document.addEventListener('DOMContentLoaded', () => {
  53. (document.querySelectorAll('#endpointURL') || []).forEach(($urlInput) => {
  54. $urlInput.addEventListener('input', (e) => {
  55. window.localStorage.setItem("uri", e.target.value);
  56. console.log('Storing uri input ' + e.target.value);
  57. });
  58. });
  59. });
  60. document.addEventListener('DOMContentLoaded', () => {
  61. let data = window.localStorage.getItem("uri");
  62. if (data) {
  63. (document.querySelectorAll('#endpointURL') || []).forEach(($urlInput) => {
  64. $urlInput.setAttribute('value', data);
  65. console.log('Setting uri input to ' + data);
  66. });
  67. }
  68. });