jellyfin: copy logo link to clipboard on mobile app with toast
Some checks failed
CI / update (push) Failing after 0s

WebView doesn't allow opening external browser, so on mobile app
the logo link copies URL to clipboard and shows a toast notification.
This commit is contained in:
2026-03-03 18:02:07 +01:00
parent b035abb061
commit 28d840636c
2 changed files with 36 additions and 0 deletions

View File

@@ -143,10 +143,25 @@
if (!logo || logo.dataset.bockenLinked) return;
logo.dataset.bockenLinked = '1';
var isMobileApp = /wv\)|Jellyfin Mobile/.test(navigator.userAgent);
var link = document.createElement('a');
link.href = 'https://bocken.org';
link.className = 'bocken-logo-link';
link.title = 'bocken.org';
if (isMobileApp) {
link.addEventListener('click', function (e) {
e.preventDefault();
navigator.clipboard.writeText('https://bocken.org').then(function () {
var toast = document.createElement('div');
toast.className = 'bocken-toast';
toast.textContent = 'Link copied — open in browser';
document.body.appendChild(toast);
setTimeout(function () { toast.classList.add('bocken-toast-hide'); }, 2000);
setTimeout(function () { toast.remove(); }, 2500);
});
});
}
logo.parentNode.insertBefore(link, logo);
link.appendChild(logo);
}