Fastfwd vg-ads

Fast forwards vg-tv ads

当前为 2023-11-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Fastfwd vg-ads
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.3
  5. // @description Fast forwards vg-tv ads
  6. // @author kimhegg
  7. // @match https://tv.vg.no/*
  8. // @match https://www.tv2.no/video/*
  9. // @match https://www.dagbladet.no/video/*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=vg.no
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function()
  15. {
  16. //
  17. // Config
  18. //
  19.  
  20. // Enable The Adblocker
  21. const adblocker = true;
  22.  
  23. // Enable debug messages into the console
  24. const debug = true;
  25.  
  26. //
  27. // CODE
  28. //
  29.  
  30. if (debug) console.log("FastFwd ads: Script started");
  31.  
  32. if(adblocker) addblocker();
  33. function addblocker()
  34. {
  35. setInterval(() =>
  36. {
  37. const vg_ad = [...document.querySelectorAll('.vgp-ad-layout')][0];
  38. const vg_mainContainer = document.getElementById('player');
  39. const vg_sidAd = document.querySelector('vgp-ad-layout');
  40. if(vg_ad){
  41. const video = document.querySelector('video');
  42. video.playbackRate = 10;
  43. video.volume = 0;
  44. }
  45. const tv2_ads= document.getElementById('ad-container');
  46. const db_ads = document.getElementsByClassName('videoAdUi');
  47. if(tv2_ads || db_ads){
  48. document.querySelector('iframe')?.remove();
  49. document.getElementById('videoAdUi')?.remove();
  50. console.log("Other ads removed");
  51. }
  52. }
  53. , 50)
  54. }
  55. })();