Skip to content

Instantly share code, notes, and snippets.

@insin
Last active February 23, 2026 03:43
Show Gist options
  • Select an option

  • Save insin/14ae1639d46ed2c86708836c8d79be8e to your computer and use it in GitHub Desktop.

Select an option

Save insin/14ae1639d46ed2c86708836c8d79be8e to your computer and use it in GitHub Desktop.
"Experiencing interruptions?" fixer for YouTube userscript - click "Raw" to install in your userscript manager
// ==UserScript==
// @name "Experiencing interruptions?" fixer for YouTube
// @version 2
// @match https://www.youtube.com/*
// @run-at document-start
// ==/UserScript==
function observe(target, callbackFn, options = {childList: true}) {
return new Promise((resolve) => {
function callback(mutations, observer) {
let value = callbackFn(mutations, observer)
if (value != null) {
observer.disconnect()
resolve(value)
}
}
let observer = new MutationObserver(callback)
observer.observe(target, options)
callback([], observer)
})
}
void async function() {
let popupContainer = await observe(
document.body || document.documentElement,
() => document.querySelector('ytd-popup-container'),
{childList: true, subtree: true}
)
let notificationRenderer = await observe(
popupContainer,
() => popupContainer.querySelector('yt-notification-action-renderer')
)
let toast = await observe(
notificationRenderer,
() => notificationRenderer.querySelector('tp-yt-paper-toast')
)
observe(toast, () => {
if (toast.getAttribute('aria-hidden') == 'true') return
let text = toast.querySelector('#text-container #text')
let link = toast.querySelector('#action-button a[href^="https://support.google.com/youtube/answer/3037019"]')
if (!(link && text)) return
text.textContent = 'Successfully blocked pre-roll ads!'
let linkText = link.querySelector('[role="text"]')
if (linkText) linkText.textContent = 'Good job'
}, {
attributes: true,
attributeFilter: ['aria-hidden'] ,
childList: true,
})
}()
@maxgamer134
Copy link

Doesnt work in youtube playlists

@williams407
Copy link

You're my savior, I logged on here just to say a huge thank you!

@jasonrafe95-boop
Copy link

still had the stupid popup you liar, please goddamn fix it!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment