17 lines
666 B
JavaScript
17 lines
666 B
JavaScript
|
$(document).ready(function () {
|
||
|
const headers = $(".mind-post_content h2, .mind-post_content h3").toArray();
|
||
|
const sidebar = $("#mind-post_sidebar-left");
|
||
|
|
||
|
for (let i = 0; i < headers.length; i++) {
|
||
|
const currentHeader = headers[i];
|
||
|
const headerText = $(currentHeader).text();
|
||
|
const headerId = $(currentHeader).attr("id");
|
||
|
const headerType = $(currentHeader).prop("nodeName").toLowerCase();
|
||
|
|
||
|
// <h2> <a href="header-linke"> Header Name </a> </h2>
|
||
|
const newLine = "<" + headerType + "> <a href=\"#" + headerId + "\">" + headerText + "</a> </" + headerType + ">";
|
||
|
sidebar.append(newLine);
|
||
|
}
|
||
|
});
|
||
|
|