util.js 978 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * @param {"mail"|"tel"} type
  3. */
  4. function getSens(type)
  5. {
  6. switch(type)
  7. {
  8. case "mail":
  9. return atob("Y29udGFjdEBzdjQ0My5uZXQ=");
  10. case "tel":
  11. return atob("KzQ5IDE3NiA3MzU1NDk4NQ==");
  12. case "addr":
  13. return atob("S+R0aGUtS29sbHdpdHotV2VnIDE1PGJyPjcwNTY5IFN0dXR0Z2FydDxicj5EZXV0c2NobGFuZA==");
  14. }
  15. }
  16. function insSens(clickText)
  17. {
  18. /** @type {HTMLElement[]} */
  19. const elements = document.querySelectorAll(".insSens");
  20. for(const el of elements)
  21. {
  22. el.innerText = clickText || "Click to reveal";
  23. el.classList.add("mimica");
  24. el.classList.remove("insSens");
  25. el.addEventListener("click", () => {
  26. if(!el.dataset.type || el.dataset.type.length < 1)
  27. return;
  28. const txt = getSens(el.dataset.type);
  29. if(!txt) return;
  30. el.innerHTML = txt;
  31. el.classList.remove("mimica");
  32. el.dataset.type = "";
  33. });
  34. }
  35. }