diff --git a/internal/glance/static/js/page.js b/internal/glance/static/js/page.js index 0212a4f..50a93ab 100644 --- a/internal/glance/static/js/page.js +++ b/internal/glance/static/js/page.js @@ -270,7 +270,7 @@ function setupGroups() { return; } - openURLInNewTab(title.dataset.titleUrl, false); + openURLInNewTab(title.dataset.titleUrl, false, title.dataset.titleTarget); event.preventDefault(); }); } @@ -278,7 +278,7 @@ function setupGroups() { title.addEventListener("click", () => { if (t == current) { if (title.dataset.titleUrl !== undefined) { - openURLInNewTab(title.dataset.titleUrl); + openURLInNewTab(title.dataset.titleUrl, undefined, title.dataset.titleTarget); } return; diff --git a/internal/glance/static/js/utils.js b/internal/glance/static/js/utils.js index a82f97a..864b538 100644 --- a/internal/glance/static/js/utils.js +++ b/internal/glance/static/js/utils.js @@ -31,8 +31,8 @@ export function clamp(value, min, max) { // NOTE: inconsistent behavior between browsers when it comes to // whether the newly opened tab gets focused or not, potentially // depending on the event that this function is called from -export function openURLInNewTab(url, focus = true) { - const newWindow = window.open(url, '_blank', 'noopener,noreferrer'); +export function openURLInNewTab(url, focus = true, target = '_blank') { + const newWindow = window.open(url, target, 'noopener,noreferrer'); if (focus && newWindow != null) newWindow.focus(); } diff --git a/internal/glance/templates/change-detection.html b/internal/glance/templates/change-detection.html index 22b7a18..9685d36 100644 --- a/internal/glance/templates/change-detection.html +++ b/internal/glance/templates/change-detection.html @@ -4,10 +4,10 @@