fluoride: Use target=_blank for status links
authorr <r@freesoftwareextremist.com>
Sun, 21 Jun 2020 16:48:33 +0000 (16:48 +0000)
committerr <r@freesoftwareextremist.com>
Sun, 21 Jun 2020 17:14:05 +0000 (17:14 +0000)
static/fluoride.js

index 700d9807237a72f9182bc24a109e11b11041440f..a150b2b8c1ac3d5f3d9203a668017120ae80a5e2 100644 (file)
@@ -186,6 +186,12 @@ function handleReplyLink(div) {
        }
 }
 
+function handleStatusLink(a) {
+       if (a.classList.contains("mention"))
+               return;
+       a.target = "_blank";
+}
+
 document.addEventListener("DOMContentLoaded", function() { 
        var statuses = document.querySelectorAll(".status-container");
        for (var i = 0; i < statuses.length; i++) {
@@ -205,6 +211,11 @@ document.addEventListener("DOMContentLoaded", function() {
                for (var j = 0; j < replyLinks.length; j++) {
                        handleReplyLink(replyLinks[j]);
                }
+
+               var links = s.querySelectorAll(".status-content a");
+               for (var j = 0; j < links.length; j++) {
+                       handleStatusLink(links[j]);
+               }
        }
 });