const replacements = new Map(); replacements.set(/([^<]*)/g, function (content) { return `${content}`; }); replacements.set(/([^<]*)/g, function (content) { return `${content}`; }); replacements.set(//g, function (_content) { return "
"; }); replacements.set(/([^<]*)/g, function (content) { return `${content}`; }); replacements.set(/([^<]*)/g, function (content) { return `${content}`; }); $.ajax({ url: "https://cdn.jsdelivr.net/gh/Ellpeck/ActuallyAdditions@1.12.2/src/main/resources/assets/actuallyadditions/lang/en_US.lang", cache: false, success: populateManual }); function populateManual(lang) { let startIndex = lang.indexOf("#Booklet Chapters"); let data = lang.substring(startIndex + 18); let entries = $("#entries"); let sidebar = $("#sidebar"); for (let topic of data.split("\n\n")) { let lines = topic.split("\n"); let t = '
'; // first line is name let name = lines[0].substring(lines[0].indexOf("=") + 1); let id = lines[0].match(/chapter\.([^\.]*)\.name/)[1]; sidebar.append(`${name}`); t += ``; t += `

${name}

`; // following lines are content for (let i = 1; i < lines.length; i++) { let text = lines[i].substring(lines[i].indexOf("=") + 1); t += `

${replaceFormatting(text)}

`; } t += "
"; entries.append(t); } sidebar.append("
"); sidebar.append(`Main Site`); sidebar.append(`Impressum`); sidebar.append(`Privacy`); sidebar.append(`© Ellpeck`); sidebar.append("
"); forceToAnchor(); } function replaceFormatting(text) { for (let [k, v] of replacements.entries()) { const finalV = v; text = text.replace(k, function (_substring, group) { return finalV(group); }); } return text; }