Reload the page if a YouTube adblock error occurs
// ==UserScript==
// @name Reload on YouTube Error
// @namespace http://tampermonkey.net/
// @version 0.1
// @license MIT
// @description Reload the page if a YouTube adblock error occurs
// @author TallTacoTristan
// @match *://www.youtube.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const observer = new MutationObserver(() => {
const errorElement = document.querySelector('.ytp-error');
if (errorElement && errorElement.style.display!== 'none') {
window.location.reload();
}
});
observer.observe(document.body, { childList: true, subtree: true });
})();