djledda.de main
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

48 lines
1.7 KiB

  1. import SexyTooltip from "./SexyTooltip.js";
  2. const tooltipDiv = document.getElementById("tooltipCarrier") as HTMLDivElement;
  3. const tooltip = new SexyTooltip(tooltipDiv);
  4. const dudes = document.querySelectorAll(".dude") as NodeListOf<HTMLImageElement>;
  5. const shakers = document.querySelectorAll(".shakeable") as NodeListOf<HTMLElement>;
  6. const emailLink = document.getElementById("emailLink") as HTMLAnchorElement;
  7. let numDudesDroppingSickBeats: number = 0;
  8. dudes.forEach((dude) => dude.addEventListener("mouseup", () => toggleDude(dude)));
  9. function toggleDude(dude: HTMLImageElement) {
  10. if (dude.classList.contains("spinMe")) {
  11. numDudesDroppingSickBeats -= 1;
  12. dude.addEventListener("animationiteration", function listener() {
  13. dude.classList.remove("spinMe");
  14. dude.removeEventListener("animationiteration", listener as EventListenerOrEventListenerObject);
  15. });
  16. } else {
  17. numDudesDroppingSickBeats += 1;
  18. dude.classList.add("spinMe");
  19. }
  20. updateShakers();
  21. }
  22. function updateShakers() {
  23. shakers.forEach((shaker) => {
  24. if (numDudesDroppingSickBeats === 0) {
  25. shaker.classList.remove("shakeMe");
  26. } else if (!shaker.classList.contains("shakeMe")) {
  27. shaker.classList.add("shakeMe");
  28. }
  29. });
  30. }
  31. emailLink.addEventListener("click", (event) => {
  32. const myDomain = "gmail";
  33. const myTld = "com";
  34. const myName = "danjledda";
  35. const dot = ".";
  36. const at = "@";
  37. let link = "mailto:" + myName + myDomain + myTld;
  38. link = link.slice(0, 10) + dot + link.slice(10, 11) + dot + link.slice(11, 16) + at + link.slice(16, 21) + dot +
  39. link.slice(21);
  40. window.location.href = link;
  41. });