🏠 Home 

Greasy Fork is available in English.

Reload on YouTube Error

Reload the page if a YouTube adblock error occurs


Installer dette script?
  1. // ==UserScript==
  2. // @name Reload on YouTube Error
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @license MIT
  6. // @description Reload the page if a YouTube adblock error occurs
  7. // @author TallTacoTristan
  8. // @match *://www.youtube.com/*
  9. // @grant none
  10. // ==/UserScript==
  11. (function() {
  12. 'use strict';
  13. const observer = new MutationObserver(() => {
  14. const errorElement = document.querySelector('.ytp-error');
  15. if (errorElement && errorElement.style.display!== 'none') {
  16. window.location.reload();
  17. }
  18. });
  19. observer.observe(document.body, { childList: true, subtree: true });
  20. })();