summaryrefslogtreecommitdiff
path: root/www/scripts
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2026-06-28 23:55:39 +0800
committeraltaf-creator <dev@altafcreator.com>2026-06-28 23:55:39 +0800
commitb8e0094052a2947bbf9e40147050d18ae2d94420 (patch)
tree90a9964387e51ffda16ea34d8b44d9925de6c56b /www/scripts
parent3abcae19fefd11bbfba6cbf696b342ea72da6992 (diff)
url changes
Diffstat (limited to 'www/scripts')
-rw-r--r--www/scripts/elements/share.js27
-rw-r--r--www/scripts/scroll.js2
2 files changed, 27 insertions, 2 deletions
diff --git a/www/scripts/elements/share.js b/www/scripts/elements/share.js
new file mode 100644
index 0000000..d6813ba
--- /dev/null
+++ b/www/scripts/elements/share.js
@@ -0,0 +1,27 @@
+const shareBtn = document.getElementById("share-btn");
+
+shareBtn.addEventListener("click", () => {
+ share();
+});
+
+function share() {
+ const data = {
+ title: "altaf-creator",
+ text: document.title,
+ url: window.location,
+ };
+
+ iconChange();
+ navigator.clipboard.writeText(window.location);
+ navigator.share(data);
+}
+
+async function iconChange() {
+ shareBtn.firstChild.setAttribute("class", "fa-solid fa-copy");
+ await sleep(2000);
+ shareBtn.firstChild.setAttribute("class", "fa-solid fa-share-nodes");
+}
+
+function sleep(ms) {
+ return new Promise(resolve => setTimeout(resolve, ms));
+}
diff --git a/www/scripts/scroll.js b/www/scripts/scroll.js
index 6a61015..fca8c0a 100644
--- a/www/scripts/scroll.js
+++ b/www/scripts/scroll.js
@@ -16,8 +16,6 @@ function progress() {
});
const nodes = document.getElementsByClassName("node");
- console.log(sections);
-
if (nodes[0]) {
for (var i = 0; i < sections.length; i++) {
if (isInViewport(sections[i])) {