diff --git a/script.js b/script.js new file mode 100644 index 0000000..1e78c08 --- /dev/null +++ b/script.js @@ -0,0 +1,113 @@ + function copyButton() { + navigator.clipboard.writeText('meowing.zip'); + var x = document.getElementById("copy-toast"); + x.className = "show"; + setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000); + } + document.addEventListener("DOMContentLoaded", function() { + const t = document.querySelectorAll('input[name="theme"]') + , c = document.querySelectorAll('input[name="color"]') + , i = document.getElementById("disable-bg") + , o = document.getElementById("disable-animations"); + function a() { + const t = document.querySelector('input[name="theme"]:checked').value; + const c = document.querySelector('input[name="color"]:checked').value; + localStorage.setItem("disable-bg", i.checked), + localStorage.setItem("disable-animations", o.checked) + } + !function() { + const t = localStorage.getItem("theme"); + if (t) { + const e = document.querySelector(`input[name="theme"][value="${t}"]`); + e && (e.checked = !0) + } + const c = localStorage.getItem("color"); + if (c) { + const e = document.querySelector(`input[name="color"][value="${t}"]`); + e && (e.checked = !0) + } + "true" === localStorage.getItem("disable-bg") && (i.checked = !0); + "true" === localStorage.getItem("disable-animations") && (o.checked = !0) + }(), + document.addEventListener("DOMContentLoaded", function() { + let e = document.getElementById("alt-popup"); + function t() { + document.querySelectorAll("[alt], [aria-label]").forEach(e => { + e.addEventListener("mousemove", n), + e.addEventListener("mouseout", i) + } + ) + } + function n(t) { + const n = t.target.getAttribute("alt") + , i = t.target.getAttribute("aria-label") + , o = n || i; + if (o) { + e.textContent = o, + e.style.opacity = "0", + e.style.visibility = "visible", + e.style.position = "fixed"; + const n = window.innerWidth + , i = window.innerHeight + , c = e.offsetWidth + , a = e.offsetHeight; + let l = t.clientX + 20 + , s = t.clientY + 20; + l + c > n && (l = t.clientX - c - 10), + s + a > i && (s = t.clientY - a - 10), + l < 0 && (l = 10), + s < 0 && (s = 10), + e.style.left = l + "px", + e.style.top = s + "px", + e.style.opacity = "1", + e.style.visibility = "visible" + } + } + function i() { + e.style.opacity = "0", + e.style.visibility = "hidden" + } + if (t(), + window.MutationObserver) { + const e = new MutationObserver(e => { + e.forEach(e => { + e.addedNodes.length && t() + } + ) + } + ); + document.body && e.observe(document.body, { + childList: !0, + subtree: !0 + }) + } + }), + t.forEach(e => { + e.addEventListener("change", function() { + a() + }) + } + ), + i.addEventListener("change", a), + o.addEventListener("change", a) + }); + function openTab(evt, tabName) { + // Declare all variables + var i, tabcontent, tablinks; + + // Get all elements with class="tabcontent" and hide them + tabcontent = document.getElementsByClassName("tabcontent"); + for (i = 0; i < tabcontent.length; i++) { + tabcontent[i].style.display = "none"; + } + + // Get all elements with class="tablinks" and remove the class "active" + tablinks = document.getElementsByClassName("tablinks"); + for (i = 0; i < tablinks.length; i++) { + tablinks[i].className = tablinks[i].className.replace(" active", ""); + } + + // Show the current tab, and add an "active" class to the button that opened the tab + document.getElementById(tabName).style.display = "block"; + evt.currentTarget.className += " active"; + }