Skip to content

Instantly share code, notes, and snippets.

@Frondor
Last active November 25, 2020 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Frondor/8a21db963ba72e7a3266279314b55281 to your computer and use it in GitHub Desktop.
Save Frondor/8a21db963ba72e7a3266279314b55281 to your computer and use it in GitHub Desktop.
Abrir una playlist > copypastear en Chrome Dev Tools > Sources > new Snippet y darle plaaay
(($adsContainer, skipBtnClass, addOverlayClass) => {
const handler = (mutationsList, observer) => {
mutationsList.some((mutation) => {
if (mutation.type !== 'childList') return;
const $btn = $adsContainer.querySelector(skipBtnClass);
if ($btn) {
$btn.click();
return true;
}
const $addOverlay = $adsContainer.querySelector(addOverlayClass);
if ($addOverlay) {
$addOverlay.remove();
return true;
}
});
};
const observer = new MutationObserver(handler);
observer.observe($adsContainer, {
childList: true,
subtree: true,
});
})($('.video-ads.ytp-ad-module'), '.ytp-ad-skip-button-slot', '.ytp-ad-overlay-slot');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment