From 3abcae19fefd11bbfba6cbf696b342ea72da6992 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Fri, 26 Jun 2026 12:06:38 +0800 Subject: major changes to /about/, event reflections, project reflections, video reflections --- www/scripts/constants.js | 4 ++-- www/scripts/onload.js | 29 +++++++++++++++++++++-------- www/scripts/scroll.js | 6 +++++- 3 files changed, 28 insertions(+), 11 deletions(-) (limited to 'www/scripts') diff --git a/www/scripts/constants.js b/www/scripts/constants.js index b2b7894..1c2812e 100644 --- a/www/scripts/constants.js +++ b/www/scripts/constants.js @@ -1,2 +1,2 @@ -//const API_URL = "https://altafcreator.com/api" -const API_URL = "http://localhost:9091/api" +const API_URL = "https://altafcreator.com/api" +//const API_URL = "http://localhost:9091/api" diff --git a/www/scripts/onload.js b/www/scripts/onload.js index 3bc9cf3..539df36 100644 --- a/www/scripts/onload.js +++ b/www/scripts/onload.js @@ -1,22 +1,35 @@ function addNodes() { - const collection = document.getElementsByTagName("section"); - const container = document.getElementById("progressContainer"); + const collection = document.getElementsByTagName("section"); + const container = document.getElementById("progressContainer"); - for (var i = 0; i < collection.length; i++) { + for (var i = 0; i < collection.length; i++) { + if (collection.item(i).getAttribute('data-excluded') != null) { + continue; + } var node = document.createElement("a"); node.className = "node"; - container.appendChild(node); + container.appendChild(node); if (collection.item(i).getAttribute('id') == null) { - collection.item(i).setAttribute('id', `section-${i}`); + collection.item(i).setAttribute('id', `section-${i}`); } node.setAttribute('id', `node-${i}`) node.href = `#${collection.item(i).getAttribute('id')}` - } + } + + replaceExternalLinks(); +} + +function replaceExternalLinks() { + for (var links = document.links, i = 0, a; a = links[i]; i++) { + if (a.host !== location.host) { + a.target = '_blank'; + } + } } function blog(n) { - // addNodes is called in loadPost(n); - loadPost(n); + // addNodes is called in loadPost(n); + loadPost(n); } function index() { diff --git a/www/scripts/scroll.js b/www/scripts/scroll.js index d7ab5da..6a61015 100644 --- a/www/scripts/scroll.js +++ b/www/scripts/scroll.js @@ -11,9 +11,13 @@ nodeBigSize = "25px"; nodeDefaultSize = "16px"; function progress() { - const sections = document.getElementsByTagName("section"); + const sections = [...document.getElementsByTagName("section")].filter(e => { + return e.getAttribute("data-excluded") == null; + }); const nodes = document.getElementsByClassName("node"); + console.log(sections); + if (nodes[0]) { for (var i = 0; i < sections.length; i++) { if (isInViewport(sections[i])) { -- cgit v1.2.3