mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-01 18:16:17 +00:00
22 lines
787 B
JavaScript
22 lines
787 B
JavaScript
// Convert relative blog extension (from .md to .html)
|
|
document.querySelectorAll("a").forEach((a) => {
|
|
const dotSepList = a.getAttribute("href").split(".");
|
|
if (dotSepList[0] == "") {
|
|
const hashSepList = dotSepList[dotSepList.length - 1].split("#")
|
|
if (hashSepList[0] == "md") {
|
|
let str = `.${dotSepList[1]}`;
|
|
for (let i = 2; i < dotSepList.length; i++) {
|
|
if (dotSepList[i].substring(0, 2) != "md") {
|
|
str += "." + dotSepList[i];
|
|
} else {
|
|
str += ".html";
|
|
break;
|
|
};
|
|
}
|
|
if (hashSepList[1]) {
|
|
str += "#" + hashSepList[1];
|
|
}
|
|
a.setAttribute("href", str);
|
|
}
|
|
}
|
|
}); |