Dlaczego w obszarze powiadomień na YT się powielają? Tzn. jeśli scrolluję w dół, widzę powiadomienie X, to dalej znów to samo, cofa się ta lista.
Nie ma tak: 1 dzień temu, 2, 3, 4, 5 itd. tylko niższe powiadomienia odwołują się do późniejszych…
Ktoś coś?
Mam taki CSS do Stylusa, wygenerowany przez ChatGPT:
Prędzej musiałby być to skrypt do Tampermonkey (lub innej małpy/kota przepisanej na Manifest V3), który porówna URL/nazwę (nawet CSS4 tego nie oferuje, bo nie znamy URL do użycia „div:has(~ div a[href*="wideo"]):has(> * a[href*="wideo"])”).
Pewnie do dalszych poprawek/optymalizacji (do Tampermonkey nie Stylusa):
// ==UserScript==
// @name Hide Duplicated Notifications on YouTube
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hide duplicated notifications on YouTube when URL is unknown
// @author You
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Function to check if the notification is a duplicate
function isDuplicate(notification, seenNotifications) {
const notificationText = notification.textContent.trim();
return seenNotifications.has(notificationText);
}
// Function to hide duplicates
function hideDuplicatedNotifications() {
const notificationList = document.querySelectorAll('ytd-compact-video-renderer, ytd-notification-renderer');
const seenNotifications = new Set();
notificationList.forEach(notification => {
if (isDuplicate(notification, seenNotifications)) {
notification.style.display = 'none'; // Hide duplicate
} else {
seenNotifications.add(notification.textContent.trim()); // Mark this notification as seen
}
});
}
// Run the function periodically to check for new notifications
setInterval(hideDuplicatedNotifications, 2000); // Every 2 seconds
})();
inna wersja, gdy film ma to samo „ID” — nie jest to jakiś reupload (a bardziej powiadomienie po premierze dla plebsu, gdy ty jesteś płatnym patronem):
// ==UserScript==
// @name Hide Duplicated Notifications on YouTube (Stable URL)
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Hide duplicated notifications on YouTube when URL is known and stable
// @author You
// @match https://www.youtube.com/
// @match https://www.youtube.com/watch*
// @match https://www.youtube.com/feed/subscriptions
// @match https://www.youtube.com/channel/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Function to check if the notification is a duplicate
function isDuplicate(notification, seenNotifications) {
const notificationText = notification.textContent.trim();
return seenNotifications.has(notificationText);
}
// Function to hide duplicates
function hideDuplicatedNotifications() {
const notificationList = document.querySelectorAll('ytd-compact-video-renderer, ytd-notification-renderer');
const seenNotifications = new Set();
notificationList.forEach(notification => {
if (isDuplicate(notification, seenNotifications)) {
notification.style.display = 'none'; // Hide duplicate
} else {
seenNotifications.add(notification.textContent.trim()); // Mark this notification as seen
}
});
}
// Run the function periodically to check for new notifications
setInterval(hideDuplicatedNotifications, 2000); // Every 2 seconds
})();
Może wyższe są na temat ripost do twojego komentarza pod filmem.