main.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. // document.addEventListener('DOMContentLoaded', () => {
  10. // (document.querySelectorAll('.toggle') || []).forEach(($toggle) => {
  11. // $toggle.addEventListener('click', () => {
  12. //
  13. // });
  14. // });
  15. // });
  16. document.addEventListener('DOMContentLoaded', () => {
  17. // Get all "navbar-burger" elements
  18. const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
  19. // Add a click event on each of them
  20. $navbarBurgers.forEach( el => {
  21. el.addEventListener('click', () => {
  22. // Get the target from the "data-target" attribute
  23. const target = el.dataset.target;
  24. const $target = document.getElementById(target);
  25. // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
  26. el.classList.toggle('is-active');
  27. $target.classList.toggle('is-active');
  28. });
  29. });
  30. });
  31. document.addEventListener('DOMContentLoaded', () => {
  32. (document.querySelectorAll('.notification .delete') || []).forEach(($delete) => {
  33. const $notification = $delete.parentNode;
  34. $delete.addEventListener('click', () => {
  35. $notification.parentNode.removeChild($notification);
  36. });
  37. });
  38. });
  39. document.addEventListener('DOMContentLoaded', () => {
  40. (document.querySelectorAll('#endpointURL') || []).forEach(($urlInput) => {
  41. $urlInput.addEventListener('input', (e) => {
  42. window.localStorage.setItem("uri", e.target.value);
  43. console.log('Storing uri input ' + e.target.value);
  44. });
  45. });
  46. });
  47. document.addEventListener('DOMContentLoaded', () => {
  48. let data = window.localStorage.getItem("uri");
  49. if (data) {
  50. (document.querySelectorAll('#endpointURL') || []).forEach(($urlInput) => {
  51. $urlInput.setAttribute('value', data);
  52. console.log('Setting uri input to ' + data);
  53. });
  54. }
  55. });