diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-07-18 16:43:51 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-07-18 16:43:51 -0300 |
commit | 1381e5e954842a5d8a9d3080175dd17d2bd4cc5f (patch) | |
tree | 43750a001be24948ff3e951222e3b18935f832d8 | |
parent | d193a91a70ba02d46d60efaa0a160a8078fca2d2 (diff) |
content, css: generateIntrapageDotSwitcher: custom cue
-rw-r--r-- | src/content/dependencies/generateIntrapageDotSwitcher.js | 31 | ||||
-rw-r--r-- | src/static/css/site.css | 9 |
2 files changed, 35 insertions, 5 deletions
diff --git a/src/content/dependencies/generateIntrapageDotSwitcher.js b/src/content/dependencies/generateIntrapageDotSwitcher.js index 1d58367d..cd92b165 100644 --- a/src/content/dependencies/generateIntrapageDotSwitcher.js +++ b/src/content/dependencies/generateIntrapageDotSwitcher.js @@ -39,11 +39,32 @@ export default { stitchArrays({ title: slots.titles, targetID: slots.targetIDs, - }).map(({title, targetID}) => - html.tag('a', {href: '#'}, - {'data-target-id': targetID}, - {[html.onlyIfContent]: true}, + }).map(({title, targetID}) => { + const {content} = html.smush(title); - language.sanitize(title))), + const customCue = + content.find(item => + item?.tagName === 'span' && + item.attributes.has('class', 'dot-switcher-interaction-cue')); + + const cue = + (customCue && !html.isBlank(customCue) + ? customCue.content + : language.sanitize(title)); + + const a = + html.tag('a', {href: '#'}, + {'data-target-id': targetID}, + {[html.onlyIfContent]: true}, + + cue); + + if (customCue) { + content.splice(content.indexOf(customCue), 1, a); + return html.tags(content, {[html.joinChildren]: ''}); + } else { + return a; + } + }), }), }; diff --git a/src/static/css/site.css b/src/static/css/site.css index e721a532..d5f4e292 100644 --- a/src/static/css/site.css +++ b/src/static/css/site.css @@ -1116,7 +1116,16 @@ a .normal-content { font-weight: 800; } +.dot-switcher > span { + color: #ffffffcc; +} + .dot-switcher > span.current { + font-weight: normal; + color: white; +} + +.dot-switcher > span.current a { font-weight: 800; } |