Dodaje przycisk ukrywania filmów na miniaturkach
// ==UserScript==
// @name XNXX - Hide Videos Button
// @namespace https://xnxx.com/
// @version 1.0
// @description Dodaje przycisk ukrywania filmów na miniaturkach
// @match https://www.xnxx.com/*
// @grant GM_addStyle
// ==/UserScript==
(function () {
'use strict';
const STORAGE_KEY = 'xh-hidden-videos';
// Wczytaj ukryte filmy
const hiddenVideos = new Set(
JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]')
);
// Style
GM_addStyle(`
.thumb-block {
position: relative;
}
.xh-hide-btn {
position: absolute;
top: 6px;
right: 6px;
z-index: 9999;
background: rgba(0,0,0,0.75);
color: white;
border: none;
border-radius: 4px;
padding: 4px 7px;
cursor: pointer;
font-size: 12px;
line-height: 1;
transition: 0.2s;
}
.xh-hide-btn:hover {
background: rgba(255,0,0,0.9);
}
.xh-hidden {
display: none !important;
}
`);
function saveHiddenVideos() {
localStorage.setItem(
STORAGE_KEY,
JSON.stringify([...hiddenVideos])
);
}
function getVideoId(link) {
try {
return new URL(link.href).pathname;
} catch {
return link.href;
}
}
function processThumbs() {
document.querySelectorAll('.thumb-block').forEach(block => {
if (block.querySelector('.xh-hide-btn')) return;
const link = block.querySelector('.thumb a');
if (!link) return;
const videoId = getVideoId(link);
// Ukryj jeśli już zapisany
if (hiddenVideos.has(videoId)) {
block.classList.add('xh-hidden');
}
const btn = document.createElement('button');
btn.className = 'xh-hide-btn';
btn.textContent = '✕';
btn.addEventListener('click', (e) => {
e.preventDefault();
e.stopPropagation();
hiddenVideos.add(videoId);
saveHiddenVideos();
block.classList.add('xh-hidden');
});
block.appendChild(btn);
});
}
// Start
processThumbs();
// Obsługa dynamicznego ładowania
const observer = new MutationObserver(() => {
processThumbs();
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();