From f6dd46f6d7211ebb847221eb68a49ede623aa0b5 Mon Sep 17 00:00:00 2001 From: Dym Sohin Date: Sun, 2 Jun 2024 15:52:01 +0200 Subject: [PATCH] upd --- README.md | 2 -- LICENSE => license | 0 meta.kdl | 7 +++++++ readme.md | 9 +++++++++ script.meta.js | 13 +++++++++++++ script.user.js | 37 +++++++++++++++++++++++++++++++++++++ 6 files changed, 66 insertions(+), 2 deletions(-) delete mode 100644 README.md rename LICENSE => license (100%) create mode 100644 meta.kdl create mode 100644 readme.md create mode 100644 script.meta.js create mode 100644 script.user.js diff --git a/README.md b/README.md deleted file mode 100644 index 0f23fd7..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# yt-hide-long - diff --git a/LICENSE b/license similarity index 100% rename from LICENSE rename to license diff --git a/meta.kdl b/meta.kdl new file mode 100644 index 0000000..8dd55ab --- /dev/null +++ b/meta.kdl @@ -0,0 +1,7 @@ +title "yt-hide-long" +description "Hide LONG (over 2:00:00 – two hours) videos on YouTube's pages" +media-type "userscript" +tags "scripts" "js" "youtube" +license "CC0" +homepage "https://dym.sh/yt-hide-long/" +source "https://source.garden/scripts/yt-hide-long/" diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..37e2875 --- /dev/null +++ b/readme.md @@ -0,0 +1,9 @@ +# yt-hide-long + +> Hide LONG (over 2:00:00 – two hours) videos on YouTube's pages + +## install + +1. get [Tampermonkey](https://tampermonkey.net) +2. visit https://source.garden/scripts/yt-hide-long/raw/branch/latest/script.user.js +3. refresh the youtube page diff --git a/script.meta.js b/script.meta.js new file mode 100644 index 0000000..9b04425 --- /dev/null +++ b/script.meta.js @@ -0,0 +1,13 @@ +// ==UserScript== +// @name YouTube: Hide LONG Videos +// @namespace https://source.garden +// @version 1.0 +// @license CC0 +// @description Hide LONG (over 2:00:00 – two hours) videos on YouTube's pages +// @author Dym Sohin +// @match https://*.youtube.com/* +// @match https://youtube.com/* +// @noframes +// @downloadURL https://source.garden/scripts/yt-hide-long/raw/branch/latest/script.user.js +// @updateURL https://source.garden/scripts/yt-hide-long/raw/branch/latest/script.meta.js +// ==/UserScript== diff --git a/script.user.js b/script.user.js new file mode 100644 index 0000000..9250159 --- /dev/null +++ b/script.user.js @@ -0,0 +1,37 @@ +// ==UserScript== +// @name YouTube: Hide LONG Videos +// @namespace https://source.garden +// @version 1.0 +// @license CC0 +// @description Hide LONG (over 2:00:00 – two hours) videos on YouTube's pages +// @author Dym Sohin +// @match https://*.youtube.com/* +// @match https://youtube.com/* +// @noframes +// @downloadURL https://source.garden/scripts/yt-hide-long/raw/branch/latest/script.user.js +// @updateURL https://source.garden/scripts/yt-hide-long/raw/branch/latest/script.meta.js +// ==/UserScript== + +(function() { + 'use strict' + + function removeUpcomingVideos(){ + document + .querySelectorAll( `ytd-item-section-renderer` ) + .forEach( e => + { + const is_long = e.querySelector( `badge-shape[aria-label*="hours,"]` ) + if( is_long ) + { + e.style.display = 'none' + } + }) + } + + const observer = new MutationObserver(removeUpcomingVideos) + observer.observe( + document.querySelector('#page-manager') + , { childList:true, subtree:true } + ) + +})()