]> BookStack Code Mirror - hacks/commitdiff
Fixed bad link in new tab code
authorDan Brown <redacted>
Sat, 13 May 2023 15:15:32 +0000 (16:15 +0100)
committerDan Brown <redacted>
Sat, 13 May 2023 15:15:32 +0000 (16:15 +0100)
Updated to module instead of using dom ready.

content/force-page-links-new-tab/head.html

index 4f251e2310657ef717c6ce693b0adaea6f484b23..7d8cc30d3d32a757fc864d4b24fa54d3513f52bc 100644 (file)
@@ -1,8 +1,6 @@
-<script>
-document.addEventListener('DOMContentLoaded', function() {
+<script type="module">
     const links = document.querySelectorAll('.page-content a');
     for (const link of links) {
-        links[i].target = '_blank';
+        link.target = '_blank';
     }
-});
 </script>
\ No newline at end of file