Skip to content

Commit

Permalink
match absolute and relative document URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
timcowlishaw committed Sep 17, 2024
1 parent 6414dca commit 53fb827
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ddlh/static/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ const setupTyping = () => {

const setupDocumentLinkHighlight = () => {
const container = document.getElementById("theme-summary-container");
const urlRegex = /^(https:\/\/learn\.distributeddesign\.eu)?\/documents\//;
if (container) {
const links = container.querySelectorAll("a");
links.forEach((link) => {
const href = link.getAttribute("href");
if (href && href.match(/^\/documents/)) {
const doc_id = href.replace("/documents/", "");
if (href && href.match(urlRegex)) {
const doc_id = href.replace(urlRegex, "");
link.addEventListener("mouseover", () => {
const elems = document.querySelectorAll(`.document-${doc_id}`);
elems.forEach((elem) => {
Expand Down

0 comments on commit 53fb827

Please # to comment.