From 22a95820d39592e961c3da676c9eee5feede5c6b Mon Sep 17 00:00:00 2001 From: lukas91 Date: Sun, 5 Jan 2025 04:05:18 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20LE:=20Delete=20NoPopular=20Video.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LE: Delete NoPopular Video.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 LE: Delete NoPopular Video.js diff --git a/LE: Delete NoPopular Video.js b/LE: Delete NoPopular Video.js new file mode 100644 index 0000000..40b77f4 --- /dev/null +++ b/LE: Delete NoPopular Video.js @@ -0,0 +1,31 @@ +// ==UserScript== +// @name LE: Delete NoPopular Video +// @namespace http://tampermonkey.net/ +// @version 2025-01-04 +// @description try to take over the world! +// @author LE +// @match https://www.youtube.com/watch?v=* +// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com +// @grant none +// @run-at document-end +// ==/UserScript== + +(function() { + + document.querySelectorAll(`span.inline-metadata-item.style-scope.ytd-video-meta-block`).forEach(span => { + const text = span.textContent.trim(); + // Проверяем, соответствует ли текст нужному шаблону + if (/^\d+\sпросмотр*/.test(text)) { + let parent = span; + // Поднимаемся по дереву, пока не найдем + while (parent && parent.tagName !== 'YTD-COMPACT-VIDEO-RENDERER') { + parent = parent.parentElement; + } + // Удаляем найденный элемент + if (parent) { + parent.remove(); + } + } + }); + +})(); \ No newline at end of file