From 1936044137c244b24d9a28853355fdf4d8685951 Mon Sep 17 00:00:00 2001 From: r Date: Sun, 21 Jun 2020 16:48:33 +0000 Subject: [PATCH] fluoride: Use target=_blank for status links --- static/fluoride.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/static/fluoride.js b/static/fluoride.js index 700d980..a150b2b 100644 --- a/static/fluoride.js +++ b/static/fluoride.js @@ -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]); + } } });