« get me outta code hell

content, css: linkTemplate: new linkless slot - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-10-23 13:48:47 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-23 13:49:06 -0300
commit63075c650bf990407e9eefe3e9f135b2425a2ded (patch)
tree01c81658932d61e50ce915aa0a00d7f3ffd3a407 /src
parenta42078aed0805209ecb4724ea55a35e3909541dc (diff)
content, css: linkTemplate: new linkless slot
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/linkTemplate.js35
-rw-r--r--src/content/dependencies/linkThing.js2
-rw-r--r--src/static/site5.css8
3 files changed, 30 insertions, 15 deletions
diff --git a/src/content/dependencies/linkTemplate.js b/src/content/dependencies/linkTemplate.js
index 7206e960..d9af726c 100644
--- a/src/content/dependencies/linkTemplate.js
+++ b/src/content/dependencies/linkTemplate.js
@@ -15,6 +15,7 @@ export default {
     href: {type: 'string'},
     path: {validate: v => v.validateArrayItems(v.isString)},
     hash: {type: 'string'},
+    linkless: {type: 'boolean', default: false},
 
     tooltip: {type: 'string'},
     attributes: {validate: v => v.isAttributes},
@@ -33,25 +34,29 @@ export default {
     let style;
     let title;
 
-    if (slots.href) {
-      href = encodeURI(slots.href);
-    } else if (!empty(slots.path)) {
-      href = to(...slots.path);
+    if (slots.linkless) {
+      href = null;
     } else {
-      href = '';
-    }
+      if (slots.href) {
+        href = encodeURI(slots.href);
+      } else if (!empty(slots.path)) {
+        href = to(...slots.path);
+      } else {
+        href = '';
+      }
 
-    if (appendIndexHTML) {
-      if (
-        /^(?!https?:\/\/).+\/$/.test(href) &&
-        href.endsWith('/')
-      ) {
-        href += 'index.html';
+      if (appendIndexHTML) {
+        if (
+          /^(?!https?:\/\/).+\/$/.test(href) &&
+          href.endsWith('/')
+        ) {
+          href += 'index.html';
+        }
       }
-    }
 
-    if (slots.hash) {
-      href += (slots.hash.startsWith('#') ? '' : '#') + slots.hash;
+      if (slots.hash) {
+        href += (slots.hash.startsWith('#') ? '' : '#') + slots.hash;
+      }
     }
 
     if (slots.color) {
diff --git a/src/content/dependencies/linkThing.js b/src/content/dependencies/linkThing.js
index e661ca7c..b20b132b 100644
--- a/src/content/dependencies/linkThing.js
+++ b/src/content/dependencies/linkThing.js
@@ -36,6 +36,7 @@ export default {
     },
 
     anchor: {type: 'boolean', default: false},
+    linkless: {type: 'boolean', default: false},
 
     attributes: {validate: v => v.isAttributes},
     hash: {type: 'string'},
@@ -78,6 +79,7 @@ export default {
 
         attributes: slots.attributes,
         hash: slots.hash,
+        linkless: slots.linkless,
       });
   },
 }
diff --git a/src/static/site5.css b/src/static/site5.css
index 6076228b..d50d4623 100644
--- a/src/static/site5.css
+++ b/src/static/site5.css
@@ -439,6 +439,14 @@ a.current {
   font-weight: 800;
 }
 
+a:not([href]) {
+  cursor: default;
+}
+
+a:not([href]):hover {
+  text-decoration: none;
+}
+
 .nav-main-links > span > span {
   white-space: nowrap;
 }