main.js 2.1 KB

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