CDA No Ads

Easy way to skip ads on cda.pl

  1. // ==UserScript==
  2. // @name CDA No Ads
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description Easy way to skip ads on cda.pl
  6. // @description:pl Prosty sposób na pozbycie się reklam z cda.pl
  7. // @author lxst-one
  8. // @match http*://www.cda.pl/video/*
  9. // @match http*://ebd.cda.pl/*
  10. // @icon https://scdn2.cda.pl/img/icon/fav/favicon-16x16.png
  11. // @grant none
  12. // @run-at document-idle
  13. // @license MIT
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. function skipAdPlayer() {
  20. const adPlayer = document.querySelector('video.pb-ad-video-player');
  21.  
  22. if(adPlayer === null || adPlayer.currentTime === 0 || adPlayer.duration === Infinity) {
  23. return;
  24. }
  25.  
  26. adPlayer.currentTime = adPlayer.duration;
  27. }
  28.  
  29. async function startAdsWatcher() {
  30. while(true) {
  31. skipAdPlayer();
  32. await new Promise(r => setTimeout(r, 100));
  33. }
  34. }
  35.  
  36. startAdsWatcher();
  37. })();