mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 19:46:23 +00:00
13 lines
422 B
JavaScript
13 lines
422 B
JavaScript
|
|
function addTitleToCodeBlocks() {
|
|
var els = document.getElementsByClassName("highlight");
|
|
for (var i = 0; i < els.length; i++) {
|
|
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);
|
|
}
|
|
}
|
|
};
|