assets/includes/fileread.html in jekyll-obsidian-1.0.9 vs assets/includes/fileread.html in jekyll-obsidian-1.0.10

- old
+ new

@@ -103,11 +103,10 @@ } function mapBacklinksToJson(backlinks_json) { FILEREAD.querySelectorAll('.backlink').forEach(button => { button.addEventListener('click', (event) => { - console.log("click textContent: " + event.target.textContent); for (const parsedFilePath in backlinks_json) { let _filePath = parsedFilePath.replace("/:|", "'"); if (_filePath.endsWith('/')) _filePath = _filePath.slice(0, -1); const fileName = extractFilenameFromPath(_filePath); if (!button.dataset.value) { @@ -281,24 +280,23 @@ } </script> <!-- ---------------------- File read event handlers ----------------------- --> <script> - let BACKLINKS_JSON; + let BACKLINKS; document.addEventListener('DOMContentLoaded', () => { const homepage = '{{ site.obsidian_homepage | escape }}' let backlinks_enabled = '{{ site.obsidian_backlinks | escape }}'; if (backlinks_enabled === null || backlinks_enabled === '' || backlinks_enabled === undefined) backlinks_enabled = "true"; console.info("backlinks enabled? " + backlinks_enabled); if (backlinks_enabled === "true") { - const backlinks = - '{{ site.data.obsidian.backlinks | escape }}'; try { - BACKLINKS_JSON = JSON.parse(backlinks.replace(/&quot;/g, '"')); - console.info("backlinks parsed: " + Object.keys(BACKLINKS_JSON).length); + BACKLINKS = + JSON.parse('{{ site.data.obsidian.backlinks | escape }}'.replace(/&quot;/g, '"')); + console.info("backlinks parsed: " + Object.keys(BACKLINKS).length); } catch (e) { console.error("Error parsing backlinks:", e); } } if (homepage) switchPage(homepage); \ No newline at end of file