Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 1x 7x 7x 7x 7x 7x 7x 3x 3x 3x 3x 1x 1x 1x 1x 7x 7x 7x 7x 7x 2x 2x 7x 1x 1x 7x 1x 1x 7x 6x 6x 1x 7x 7x | import { truncateString } from "../../../libs/truncate-string";
const truncateSummary = (selector) => {
const summaryEl = document.querySelector(selector);
Eif (summaryEl) {
const showMoreEl = summaryEl.querySelector("[data-js='summary-read-more']");
const summaryContentEl = summaryEl.querySelector(
"[data-js='summary-content']"
);
const summary = summaryEl.getAttribute("data-summary");
if (summary.length > 103) {
const truncatedSummary = truncateString(summary, 103);
summaryContentEl.textContent = truncatedSummary;
showMoreEl.classList.remove("u-hide");
showMoreEl.addEventListener("click", (e) => {
e.preventDefault();
showMoreEl.classList.add("u-hide");
summaryContentEl.textContent = summary;
});
}
}
};
const handleTopology = () => {
const topologyInfoPanel = document.querySelector("[data-js='topology-info']");
const topologyModal = document.querySelector("[data-js='topology-modal']");
Eif (topologyInfoPanel && topologyModal) {
const closeModalButton = topologyModal.querySelector(
"[aria-controls='modal']"
);
topologyInfoPanel.addEventListener("click", (e) => {
e.preventDefault();
topologyModal.classList.remove("u-hide");
});
closeModalButton.addEventListener("click", (e) => {
e.preventDefault();
topologyModal.classList.add("u-hide");
});
closeModalButton.addEventListener("click", (e) => {
e.preventDefault();
topologyModal.classList.add("u-hide");
});
document.addEventListener("keydown", function (e) {
Eif (e.key == "Escape") {
topologyModal.classList.add("u-hide");
}
});
}
};
const init = () => {
truncateSummary("[data-js='summary']");
handleTopology();
};
export { init };
|