Fix custom.js: architecture link inside IIFE
This commit is contained in:
+24
-20
@@ -1,23 +1,39 @@
|
|||||||
/* ATC Lakehouse — scanlines + noise only (tabs via settings.yaml) */
|
/* ATC Lakehouse — scanlines + noise + architecture link */
|
||||||
(function () {
|
(function () {
|
||||||
|
var ARCH_URL = 'http://atc-docker01.dell-atc.lan:8080/docs/architecture.html';
|
||||||
|
|
||||||
function injectOverlays() {
|
function injectOverlays() {
|
||||||
if (!document.querySelector('.palantir-scanline')) {
|
if (!document.querySelector('.palantir-scanline')) {
|
||||||
const scan = document.createElement('div');
|
var scan = document.createElement('div');
|
||||||
scan.className = 'palantir-scanline';
|
scan.className = 'palantir-scanline';
|
||||||
document.body.appendChild(scan);
|
document.body.appendChild(scan);
|
||||||
}
|
}
|
||||||
if (!document.querySelector('.palantir-noise')) {
|
if (!document.querySelector('.palantir-noise')) {
|
||||||
const noise = document.createElement('div');
|
var noise = document.createElement('div');
|
||||||
noise.className = 'palantir-noise';
|
noise.className = 'palantir-noise';
|
||||||
document.body.appendChild(noise);
|
document.body.appendChild(noise);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function linkLakehouseTitle() {
|
||||||
|
document.querySelectorAll('header h1, header p, .greeting, [class*="greeting"]').forEach(function (el) {
|
||||||
|
if (el.dataset.atcLinked) return;
|
||||||
|
if (/lakehouse/i.test(el.textContent || '')) {
|
||||||
|
el.style.cursor = 'pointer';
|
||||||
|
el.title = 'Open architecture diagram';
|
||||||
|
el.addEventListener('click', function () {
|
||||||
|
window.open(ARCH_URL, '_blank');
|
||||||
|
});
|
||||||
|
el.dataset.atcLinked = '1';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function applyServiceColors() {
|
function applyServiceColors() {
|
||||||
document.querySelectorAll('li.service').forEach(function (card) {
|
document.querySelectorAll('li.service').forEach(function (card) {
|
||||||
const desc = card.querySelector('.service-description');
|
var desc = card.querySelector('.service-description');
|
||||||
const text = desc ? desc.textContent : '';
|
var text = desc ? desc.textContent : '';
|
||||||
const link = card.querySelector('a[href^="http"]');
|
var link = card.querySelector('a[href^="http"]');
|
||||||
if (text.indexOf('Host:') >= 0 || text.indexOf('Port:') >= 0 || !link) {
|
if (text.indexOf('Host:') >= 0 || text.indexOf('Port:') >= 0 || !link) {
|
||||||
card.classList.add('atc-db-tile');
|
card.classList.add('atc-db-tile');
|
||||||
}
|
}
|
||||||
@@ -27,6 +43,8 @@
|
|||||||
function init() {
|
function init() {
|
||||||
injectOverlays();
|
injectOverlays();
|
||||||
applyServiceColors();
|
applyServiceColors();
|
||||||
|
linkLakehouseTitle();
|
||||||
|
new MutationObserver(linkLakehouseTitle).observe(document.body, { childList: true, subtree: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.readyState === 'loading') {
|
if (document.readyState === 'loading') {
|
||||||
@@ -35,17 +53,3 @@
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function linkLakehouseTitle() {
|
|
||||||
const ARCH = "http://atc-docker01.dell-atc.lan:8080/docs/architecture.html";
|
|
||||||
document.querySelectorAll("header h1, header p, .greeting, [class*=greeting]").forEach(function (el) {
|
|
||||||
if (el.dataset.atcLinked) return;
|
|
||||||
if (/lakehouse/i.test(el.textContent || "")) {
|
|
||||||
el.style.cursor = "pointer";
|
|
||||||
el.title = "Open architecture diagram";
|
|
||||||
el.addEventListener("click", function () { window.open(ARCH, "_blank"); });
|
|
||||||
el.dataset.atcLinked = "1";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user