${window.getIconByStatus('undermaintenance', '21', '21', '#007DB8')}
${strMaintenance}
`;
}
//The info icon has a text content that cant be removed by CSS but even
// if hidde it affects the width
function deleteInfoIconContent() {
const icons = Array.from(
document.querySelectorAll(".component-status.tool.tooltipstered")
);
if (icons.length === 0) {
return;
}
icons.forEach((i) => (i.innerText = ""));
}
function unsetBorderRadius() {
document
.querySelector("#second_column > div:nth-child(1)")
?.setAttribute("style", "border-radius: 0px !important");
document
.querySelector("#second_column > div:last-child")
?.setAttribute("style", "border-radius: 0px !important");
document
.querySelector("#first_column > div:nth-child(1)")
?.setAttribute("style", "border-radius: 0px !important");
document
.querySelector("#first_column > div:last-child")
?.setAttribute("style", "border-radius: 0px !important");
}
function setBackButtonText() {
//
var strViewHistory = "View History";
var strBackToCurrentStatus = "Back to current status";
//
const button = document.querySelector(".page-footer > a");
if (button) {
const href = button.getAttribute("href");
button.innerText = href.includes("history")
? strViewHistory
: strBackToCurrentStatus;
button.setAttribute(
"source-title",
href.includes("history") ? "View History" : "Back to current status"
);
}
}
function setAccordionStyle() {
// Get all groups elements (accordions)
const groups = Array.from(
document.querySelectorAll(".components-container .is-group")
);
if (groups.length === 0) {
return;
}
groups.forEach((el) => {
const classList = el
.querySelector(".component-inner-container")
?.className.split(" ");
const status = classList
.find((className) => className.includes("status"))
?.split("-")[1];
const icon = getIconByStatus(status, 21, 21);
const iconContainer = el.querySelector(".group-parent-indicator");
iconContainer.innerHTML = icon;
});
}
function fixChildComponents() {
const infoIcons = Array.from(
document.querySelectorAll(".tooltip-base.tool.tooltipstered")
);
if (infoIcons.length === 0) {
return;
}
infoIcons.forEach((iconElement) => {
const parentElement = iconElement.parentElement;
const tooltip = parentElement.querySelector(".tooltip-base.tool.tooltipstered");
if (!tooltip) return;
const ariaLabel = tooltip.getAttribute("aria-label");
const dataOriginalTitle = tooltip.getAttribute("data-original-title");
const decodedAriaLabel = decodeHtml(ariaLabel);
const decodedDataOriginalTitle = decodeHtml(dataOriginalTitle);
tooltip.setAttribute("aria-label", decodedAriaLabel);
tooltip.setAttribute("data-original-title", decodedDataOriginalTitle);
});
}
function addFavicon() {
const faviconHref = "https://s.pinimg.com/webapp/favicon-56d11a6a.png";
const faviconHTML = ``;
document
.querySelector("head")
.insertAdjacentHTML("afterbegin", faviconHTML);
document.querySelectorAll('[rel="shortcut icon"]').forEach((link) => {
link.setAttribute("href", faviconHref);
});
}
function translateSubscribeButton() {
const subscribeButton = document.querySelector("#show-updates-dropdown");
const changeButtonContent = () => {
if (window.innerWidth <= 768) {
subscribeButton?.setAttribute("data-value", strSubscribeButtonMobile);
subscribeButton?.setAttribute("source-title", "Subscribe");
} else {
subscribeButton?.setAttribute("data-value", strSubscribeButton);
subscribeButton?.setAttribute("source-title", "Subscribe To Updates");
}
};
//
var strSubscribeButton = "Subscribe To Updates";
var strSubscribeButtonMobile = "Subscribe";
//
changeButtonContent();
window.addEventListener("resize", () => {
changeButtonContent();
});
}
function createContainersColumns() {
const containersParent = document.querySelector(
"div.components-section > div.components-container.one-column"
);
const containers = Array.from(
document.querySelectorAll(
"div.components-section > div.components-container.one-column > div"
)
);
if (containers.length === 0) {
return;
}
let firstColumn = document.createElement("div");
firstColumn.id = "first_column";
let secondColumn = document.createElement("div");
secondColumn.id = "second_column";
const firstColumnLimit = Math.ceil(containers.length / 2);
containers.forEach((element, i) => {
if (firstColumnLimit > i) {
firstColumn.appendChild(element);
} else {
secondColumn.appendChild(element);
}
});
containersParent.innerHTML = "";
containersParent.appendChild(firstColumn);
if (secondColumn.children.length) {
containersParent.appendChild(secondColumn);
} else {
containersParent.style.gridTemplateColumns = "auto";
}
}
function dynamicIncidentsDateTranslationHistoryPage() {
const historyDates = Array.from(
document.querySelectorAll("div.secondary.font-small.color-secondary")
);
if (historyDates.length === 0) return;
//
var historyDateStr =
"{{data.month1}} {{data.day1}}, {{data.hour1}} - {{data.month2}} {{data.day2}} {{data.hour2}}";
var historyMonthList = {
sl_translate: "sl_all",
jan: "January",
feb: "February",
mar: "March",
apr: "April",
may: "May",
jun: "June",
jul: "July",
aug: "August",
sep: "September",
oct: "October",
nov: "November",
dec: "December",
};
//
// replace in month double curly brackets with triple ones to escape
// some special characters. Don't do it in the main historyDateStr
// variable because it creates an issue with some translated languages.
historyDateStr = historyDateStr.replace(
"{{data.month1}}",
"{{{data.month1}}}"
);
historyDateStr = historyDateStr.replace(
"{{data.month2}}",
"{{{data.month2}}}"
);
historyDates.forEach((element, i) => {
const textArr = element.innerText.split("-");
const text1 = textArr[0];
const text2 = textArr[1];
/* get each value of the texts*/
//Text1
const text1Splitted = text1.split(",");
const text1Month = text1Splitted[0].split(" ")[0];
const text1Day = text1Splitted[0].split(" ")[1];
const text1Hour = text1Splitted[1].split();
//Text2
const text2Splitted = text2.split(",");
const text2Month =
text2Splitted.length === 2 ? text2Splitted[0].split(" ")[0] : "";
const text2Day =
text2Splitted.length === 2 ? text2Splitted[0].split(" ")[2] : "";
const text2Hour =
text2Splitted.length === 2 ? text2Splitted[1] : text2Splitted[0];
const data = {
month1: historyMonthList[text1Month.toLowerCase()],
day1: text1Day,
hour1: text1Hour,
month2: text2Month ? historyMonthList[text2Month.toLowerCase()] : "",
day2: text2Day ? text2Day + ", " : "",
hour2: text2Hour,
};
const newText = Mustache.render(historyDateStr, { data });
historyDates[i].innerText = newText;
});
}
function dynamicIncidentsDateTranslation() {
//
var pastIncidentsDateStr = "{{data.month}} {{data.day}}, {{data.year}}";
var monthList = {
sl_translate: "sl_all",
january: "January",
february: "February",
march: "March",
april: "April",
may: "May",
june: "June",
july: "July",
august: "August",
september: "September",
october: "October",
november: "November",
december: "December",
};
//
const isArabic = window.location.host.split(".").includes("ar");
if (isArabic) {
pastIncidentsDateStr = "{{data.day}} {{data.month}} {{data.year}}";
}
let d = new Date();
var allDatesElements = Array.from(
document.querySelectorAll(".status-day .date")
);
if (allDatesElements.length === 0) {
return;
}
for (let index = 0; index < 15; index++) {
const calculatedDate = new Date();
calculatedDate.setDate(d.getDate() - index);
const monthIndex = calculatedDate.getMonth();
const day = calculatedDate.getDate();
const year = calculatedDate.getFullYear();
const data = {
month: Object.values(monthList)[monthIndex + 1],
day,
year,
};
const newText = Mustache.render(pastIncidentsDateStr, { data });
allDatesElements[index].innerText = newText;
allDatesElements[index]?.setAttribute("translate", "no");
}
}
function setLogo() {
//
var statusStr = "Status";
//
const isRTL = document.querySelector("html").getAttribute("dir") === "rtl";
const pathTransformRTL = isRTL ? "translate(0,0)" : "";
const text_x_RTL = isRTL ? "40" : "30";
const path_x_RTL = isRTL ? "50" : "0";
const svg = `