This commit is contained in:
Dym Sohin 2024-06-02 15:52:01 +02:00
parent 9c6e9f9daf
commit f6dd46f6d7
6 changed files with 66 additions and 2 deletions

View File

@ -1,2 +0,0 @@
# yt-hide-long

View File

7
meta.kdl Normal file
View File

@ -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/"

9
readme.md Normal file
View File

@ -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

13
script.meta.js Normal file
View File

@ -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 <re@dym.sh>
// @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==

37
script.user.js Normal file
View File

@ -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 <re@dym.sh>
// @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 }
)
})()