diff options
| author | altaf-creator <dev@altafcreator.com> | 2026-06-26 12:06:38 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2026-06-26 12:06:38 +0800 |
| commit | 3abcae19fefd11bbfba6cbf696b342ea72da6992 (patch) | |
| tree | 37fe730ff6b1475ea24eb0f04df200ef923461c7 /www/scripts/onload.js | |
| parent | 1b14996290f228a329d83c164e50c27364cc0a22 (diff) | |
Diffstat (limited to 'www/scripts/onload.js')
| -rw-r--r-- | www/scripts/onload.js | 29 |
1 files changed, 21 insertions, 8 deletions
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() {
|
