yt-hide-live/script.user.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

2024-01-12 14:36:56 +01:00
// ==UserScript==
2024-06-02 17:00:02 +02:00
// @name YouTube: Hide LIVE Videos
// @version 1.3
// @license CC0
2024-01-12 14:36:56 +01:00
// @description Hide LIVE videos on YouTube's pages
// @author Wim Godden <wim@wimgodden.be>
// @author Dym Sohin <re@dym.sh>
2024-06-02 17:00:02 +02:00
// @match https://youtube.com/*
2024-01-12 14:36:56 +01:00
// @match https://*.youtube.com/*
// @grant none
// @namespace https://greasyfork.org/users/48886
2024-06-02 17:00:02 +02:00
// @namespace https://source.garden
// @noframes
// @downloadURL https://https://source.garden/scripts/yt-hide-live/raw/branch/latest/script.user.js
// @updateURL https://https://source.garden/scripts/yt-hide-live/raw/branch/latest/script.meta.js
2024-01-12 14:36:56 +01:00
// ==/UserScript==
2024-06-02 17:00:02 +02:00
2024-01-12 14:36:56 +01:00
(function() {
'use strict'
2024-06-02 17:00:02 +02:00
2024-01-12 14:36:56 +01:00
function removeLiveVideos(){
document
.querySelectorAll( `ytd-item-section-renderer` )
.forEach( e =>
{
2024-01-12 14:41:33 +01:00
const is_live = e.querySelector( `.badge-style-type-live-now-alternate` )
2024-01-12 14:36:56 +01:00
if( is_live )
{
e.style.display = 'none'
}
})
}
2024-06-02 17:00:02 +02:00
2024-01-12 14:36:56 +01:00
const observer = new MutationObserver(removeLiveVideos)
observer.observe(
document.querySelector('#page-manager')
, { childList:true, subtree:true }
)
})()