Auto add skipper

Automatically skip add on screen

目前为 2020-06-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Auto add skipper
  3. // @version 0.1
  4. // @author Nesilar
  5. // @description Automatically skip add on screen
  6. // @match https://www.youtube.com/*
  7. // @match https://youtube.com/*
  8. // @license MIT
  9. // @grant none
  10. // @namespace https://greasyfork.org/users/597232
  11. // ==/UserScript==
  12.  
  13. let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  14. let skipping = false;
  15. let observer = new MutationObserver(e => {
  16. let ad = document.querySelector('button.ytp-ad-skip-button.ytp-button');
  17. if (ad && !skipping) {
  18. ad.click();
  19. }
  20. });
  21. observer.observe(document.body, {childList: true, subtree: true});