Skip to content

Commit

Permalink
Added wait for <html> load before observing for homepage ads (adamlui…
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Oct 30, 2024
1 parent aaf9fa0 commit ac3b19f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions greasemonkey/youtube-classic.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes)
// @version 2024.10.30
// @version 2024.10.30.1
// @author Adam Lui, Magma_Craft, Anarios, JRWR, Fuim & hoothin
// @namespace https://github.com/adamlui
// @description Reverts YouTube to its classic design (before all the rounded corners & hidden dislikes) + redirects YouTube Shorts
Expand Down Expand Up @@ -1987,13 +1987,13 @@
const adObserver = new MutationObserver(() => {
if (location.pathname != locationPath) { // page changed, re-observe
locationPath = location.pathname ; adObserver.disconnect()
adObserver.observe(document.documentElement, adObsConfig)
waitForElm('html').then(() => adObserver.observe(document.documentElement, adObsConfig))
} else if (locationPath == '/') { // remove homepage stuff
const adSlot = document.querySelector('ytd-ad-slot-renderer'),
richSection = document.querySelector('ytd-rich-section-renderer')
adSlot?.closest('[rendered-from-rich-grid]')?.remove() ; richSection?.remove()
}
})
adObserver.observe(document.documentElement, adObsConfig)
waitForElm('html').then(() => adObserver.observe(document.documentElement, adObsConfig))

})()

0 comments on commit ac3b19f

Please sign in to comment.