Advertisement
Guest User

Untitled

a guest
Nov 15th, 2023
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. <style>
  2. .button {
  3. background: none;
  4. cursor: auto;
  5. border-color: none;
  6. font-size: 16px;
  7. padding: 0.5rem 0.75rem;
  8. display: flex;
  9. justify-content: center;
  10. align-items: center;
  11. border-radius: 10px;
  12. transition:
  13. color 0.1s,
  14. background 0.1s;
  15. height: max-content;
  16. width: max-content;
  17. font-weight: normal;
  18. text-decoration: none;
  19. color: #fff;
  20. gap: 0.5rem;
  21. }
  22.  
  23. button.secondary,
  24. .button.secondary {
  25. border-style: none;
  26. border-width: 0px;
  27. border-color: none;
  28. }
  29.  
  30. button:hover,
  31. .button:hover {
  32. border-style: none;
  33. border-width: 0px;
  34. border-color: none;
  35. }
  36.  
  37. button.secondary:hover,
  38. .button.secondary:hover {
  39. border-style: none;
  40. border-width: 0px;
  41. border-color: none;
  42. }
  43.  
  44. button.border,
  45. .button.border {
  46. border-style: none;
  47. border-width: 0px;
  48. border-color: none;
  49. box-shadow: inset 0 0 0 0px var(--background-surface2a);
  50. }
  51.  
  52. button.border:hover,
  53. .button.border:hover {
  54. border:none;
  55. background: none;
  56. box-shadow: inset 0 0 0 0px var(--background-surface2a);
  57. }
  58.  
  59.  
  60. button.tertiary,
  61. .button.tertiary {
  62. background: none;
  63. }
  64.  
  65. button.tertiary:hover,
  66. .button.tertiary:hover {
  67. background: none;
  68. }
  69.  
  70. #audio-button{
  71. transition: all 1s ease-in-out 0s;
  72. }
  73.  
  74. #audio-button:hover{
  75. transform: rotate(11deg);
  76. filter: blur(0px);
  77. }
  78.  
  79. }
  80.  
  81. </style>
  82. <div>
  83. <button class="round border tooltip-wrapper" id="audio-button">
  84. <!-- icons from https://primer.style/foundations/icons/ - MIT licensed by GitHub -->
  85. <img id="audio-muted" src="https://i.postimg.cc/ncxzhyKd/Untitled719-20231114102130.png" height="25px" width="auto"><path d="M8 2.75v10.5a.751.751 0 0 1-1.238.57L3.473 11H1.75A1.75 1.75 0 0 1 0 9.25v-2.5C0 5.784.784 5 1.75 5h1.722l3.29-2.82A.75.75 0 0 1 8 2.75Zm3.28 2.47L13 6.94l1.72-1.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L14.06 8l1.72 1.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L13 9.06l-1.72 1.72a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L11.94 8l-1.72-1.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-7.042 1.1a.752.752 0 0 1-.488.18h-2a.25.25 0 0 0-.25.25v2.5c0 .138.112.25.25.25h2c.179 0 .352.064.488.18L6.5 11.62V4.38Z"></path>
  86.  
  87. <img id="audio-unmuted" src="https://i.postimg.cc/ncxzhyKd/Untitled719-20231114102130.png" height="80px" width="auto" style="display: none;" ><path d="M7.563 2.069A.75.75 0 0 1 8 2.75v10.5a.751.751 0 0 1-1.238.57L3.472 11H1.75A1.75 1.75 0 0 1 0 9.25v-2.5C0 5.784.784 5 1.75 5h1.723l3.289-2.82a.75.75 0 0 1 .801-.111ZM6.5 4.38 4.238 6.319a.748.748 0 0 1-.488.181h-2a.25.25 0 0 0-.25.25v2.5c0 .138.112.25.25.25h2c.179 0 .352.064.488.18L6.5 11.62Zm6.096-2.038a.75.75 0 0 1 1.06 0 8 8 0 0 1 0 11.314.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042 6.5 6.5 0 0 0 0-9.193.75.75 0 0 1 0-1.06Zm-1.06 2.121-.001.001a5 5 0 0 1 0 7.07.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734 3.5 3.5 0 0 0 0-4.95.75.75 0 1 1 1.061-1.061Z"></path>
  88. </div>
  89. </button>
  90.  
  91. <script>
  92. // set audio
  93. const AudioURL = "https://dl.dropbox.com/scl/fi/y0g3mff45v7azmw1jfnyn/They-Might-Be-Giants-Istanbul-Not-Constantinople.mp3?rlkey=hf2dc8476akmuwikitwup5lfd&dl=0";
  94.  
  95. // state
  96. let Playing = false;
  97. const audio = new Audio(AudioURL);
  98.  
  99. // get icons
  100. const Icons = {
  101. Muted: Builder.Page.Element.querySelector("#audio-muted"),
  102. Unmuted: Builder.Page.Element.querySelector("#audio-unmuted"),
  103. };
  104.  
  105. // ...
  106. Builder.Page.Element.querySelector("#audio-button").addEventListener("click", () => {
  107. Playing = !Playing; // swap playing state
  108.  
  109. // toggle icons
  110. if (Playing) {
  111. Icons.Muted.style.display = "none";
  112. Icons.Unmuted.style.display = "block";
  113. } else {
  114. Icons.Muted.style.display = "block";
  115. Icons.Unmuted.style.display = "none";
  116. }
  117.  
  118. // play/stop audio
  119. if (Playing) audio.play();
  120. else audio.pause();
  121. });
  122. </script>
  123. </div>
  124.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement