summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruvok cheetah2019-06-04 21:38:20 +0200
committeruvok cheetah2019-06-04 21:38:20 +0200
commit986b3e128cdc0cadaa988e5409d15b1763b502f8 (patch)
tree3973a7670f1ae6a7168b80b876b808b68277248e
parent37957ce65c8e92ed2853f575d790bc6da99ff1fb (diff)
Add js, but don't use it, to open all post links in new tab
-rw-r--r--_layouts/post.html2
-rw-r--r--assets/js/extLinks.js7
2 files changed, 9 insertions, 0 deletions
diff --git a/_layouts/post.html b/_layouts/post.html
index 8d39939..0fb067d 100644
--- a/_layouts/post.html
+++ b/_layouts/post.html
@@ -39,3 +39,5 @@ layout: default
</article>
{% include commentNotice.html %}
+
+<!-- <script src="/assets/js/extLinks.js"></script> -->
diff --git a/assets/js/extLinks.js b/assets/js/extLinks.js
new file mode 100644
index 0000000..f2ca231
--- /dev/null
+++ b/assets/js/extLinks.js
@@ -0,0 +1,7 @@
+var elems = document.getElementsByTagName("a");
+var extLinkElems = Array.prototype.filter.call(elems, (a) => a.classList.length == 0);
+extLinkElems.forEach(a => {
+ a.setAttribute("target", "_blank");
+ a.setAttribute("rel", "noreferrer");
+});
+