From 4de76dbfd9afbb09a295357a0e092083dfe7c2c4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 13 Sep 2026 19:04:48 +0200 Subject: [PATCH] feat: a share link pasted into an open tab is handled like a fresh arrival Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU --- public/js/app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/js/app.js b/public/js/app.js index beed47db..5cdf78cb 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -495,6 +495,15 @@ document.addEventListener('DOMContentLoaded', function() { // Expose activateTab globally so auth.js can call it after login window.activateTab = activateTab; + // A share link pasted into a tab that is already open changes only the hash, + // so nothing reloads. Treat it like a fresh arrival: note the token, open My + // Resources, and let it ask whether to add the resource. + window.addEventListener('hashchange', function() { + var wanted = null; + try { wanted = openTabFromHash(window, document, window.localStorage); } catch (e) {} + if (wanted && window.CURRENT_USER) activateTab(wanted); + }); + document.querySelectorAll('.tab-btn').forEach(function(btn) { btn.addEventListener('click', function() { activateTab(btn.getAttribute('data-tab'));