From 9db8ef59c0c346737059b4450eb8c17543f4a09a Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Sat, 7 Nov 2020 16:30:15 +0000 Subject: [PATCH] Open all item links in new tab --- views/static/feed-item.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/views/static/feed-item.js b/views/static/feed-item.js index 3d81434..5db2b29 100644 --- a/views/static/feed-item.js +++ b/views/static/feed-item.js @@ -56,6 +56,10 @@ class FeedItem extends HTMLElement { .then(item => { template.innerHTML += item.Content || item.Description; this.shadowRoot.appendChild(template.content.cloneNode(true)); + [...this.shadowRoot.querySelectorAll('a[href^=http]')].forEach(a => { + a.setAttribute("target", "_blank"); + a.setAttribute("rel", "noopener"); + }) }) }