2022-07-01 21:03:52 +03:00
|
|
|
|
|
|
|
function addTitleToCodeBlocks() {
|
2022-12-29 18:43:41 +03:00
|
|
|
const els = document.getElementsByClassName("highlight");
|
|
|
|
for (let i = 0; i < els.length; i++) {
|
|
|
|
try {
|
|
|
|
if (els[i].title.length) {
|
|
|
|
let div = document.createElement("div");
|
|
|
|
if (els[i].getElementsByClassName("code-title").length) continue;
|
|
|
|
div.textContent = els[i].title;
|
|
|
|
div.classList.add("code-title")
|
|
|
|
els[i].insertBefore(div, els[i].firstChild);
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.debug(error);
|
2022-07-01 21:03:52 +03:00
|
|
|
}
|
|
|
|
}
|
2022-12-29 18:43:41 +03:00
|
|
|
}
|