This commit is contained in:
2026-09-11 23:26:20 +02:00
parent 4b615428de
commit 3dda406954
6 changed files with 25 additions and 49 deletions
+14 -3
View File
@@ -25,13 +25,19 @@
const isMobile = /Mobi/i.test(navigator.userAgent);
function isItemPage() {
if (document.body?.classList.contains('scroller-active') ||
document.getElementById('scroller-feed') ||
/^\/scroller(\/|$)/.test(window.location.pathname)) {
return false;
}
// Fast DOM check: item view or primary media element present
if (document.getElementById('my-video') || document.querySelector('#main.item-view, .item-view, .item-layout-container, .item-main-content')) {
return true;
}
const path = window.location.pathname;
const isForbidden = /^\/(s|b|t|ca|a|login|register|settings|about|terms|rules|api|logout|auth|admin|mod|comments|notifications|feed|upload|tags|halls|ranking|abyss|random)(\/|$)/.test(path);
const isForbidden = /^\/(s|b|t|ca|a|login|register|settings|about|terms|rules|api|logout|auth|admin|mod|comments|notifications|feed|upload|tags|halls|ranking|abyss|random|scroller)(\/|$)/.test(path);
if (isForbidden) return false;
const segments = path.split('/').filter(Boolean);
@@ -356,8 +362,8 @@
function setupVideo(video) {
if (!video) return;
// Ignore sidebar sticker / emoji preview / modal videos
if (video.closest && video.closest('.sidebar-activity, .global-sidebar-right, .emoji-preview, .modal')) {
// Ignore sidebar sticker / emoji preview / modal videos or scroller feed
if (video.closest && video.closest('.sidebar-activity, .global-sidebar-right, .emoji-preview, .modal, #scroller-feed, .scroll-slide')) {
return;
}
@@ -712,6 +718,11 @@
hotkeyAttached = true;
document.addEventListener('keydown', (e) => {
if (document.body?.classList.contains('scroller-active') ||
document.getElementById('scroller-feed') ||
/^\/scroller(\/|$)/.test(window.location.pathname)) {
return;
}
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || !isItemPage()) return;
if (e.key.toLowerCase() !== 's') return;