sunrise-cms/public-typescript/main.js

29 lines
1.0 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
(() => {
const highlightMap = (mapContainerElement, mapKey, contextualClass) => {
let svgId = mapKey;
let svgElementToHighlight;
while (true) {
svgElementToHighlight = mapContainerElement.querySelector("#" + svgId);
if (svgElementToHighlight || !svgId.includes("-")) {
break;
}
svgId = svgId.slice(0, Math.max(0, svgId.lastIndexOf("-")));
console.log(svgId);
}
if (svgElementToHighlight) {
svgElementToHighlight.style.fill = null;
svgElementToHighlight.classList.add("highlight", "is-" + contextualClass);
const childPathElements = svgElementToHighlight.querySelectorAll("path");
for (const pathElement of childPathElements) {
pathElement.style.fill = null;
}
}
};
const los = {
highlightMap
};
exports.los = los;
})();