jellyfin: copy logo link to clipboard on mobile app with toast
Some checks failed
CI / update (push) Failing after 0s
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:
@@ -244,6 +244,27 @@ progress[value]::-moz-progress-bar {
|
|||||||
filter: brightness(0) saturate(100%) invert(61%) sepia(52%) saturate(212%) hue-rotate(169deg) brightness(92%) contrast(94%);
|
filter: brightness(0) saturate(100%) invert(61%) sepia(52%) saturate(212%) hue-rotate(169deg) brightness(92%) contrast(94%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Toast notification */
|
||||||
|
.bocken-toast {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 2rem;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: rgba(20, 20, 20, 0.9);
|
||||||
|
color: white;
|
||||||
|
padding: 0.6rem 1.2rem;
|
||||||
|
border-radius: 100px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
z-index: 9999;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
|
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 400ms;
|
||||||
|
}
|
||||||
|
.bocken-toast-hide {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════
|
/* ═══════════════════════════════════════════
|
||||||
VIDEO DETAIL PAGE
|
VIDEO DETAIL PAGE
|
||||||
═══════════════════════════════════════════ */
|
═══════════════════════════════════════════ */
|
||||||
|
|||||||
@@ -143,10 +143,25 @@
|
|||||||
if (!logo || logo.dataset.bockenLinked) return;
|
if (!logo || logo.dataset.bockenLinked) return;
|
||||||
logo.dataset.bockenLinked = '1';
|
logo.dataset.bockenLinked = '1';
|
||||||
|
|
||||||
|
var isMobileApp = /wv\)|Jellyfin Mobile/.test(navigator.userAgent);
|
||||||
|
|
||||||
var link = document.createElement('a');
|
var link = document.createElement('a');
|
||||||
link.href = 'https://bocken.org';
|
link.href = 'https://bocken.org';
|
||||||
link.className = 'bocken-logo-link';
|
link.className = 'bocken-logo-link';
|
||||||
link.title = 'bocken.org';
|
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);
|
logo.parentNode.insertBefore(link, logo);
|
||||||
link.appendChild(logo);
|
link.appendChild(logo);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user