NoADGle

avgle无广告纯净播放 avgle not adgle!!!

  1. // ==UserScript==
  2. // @name NoADGle
  3. // @namespace https://greasyfork.org/zh-CN/users/14853
  4. // @author bibubi
  5. // @description avgle无广告纯净播放 avgle not adgle!!!
  6. // @match *://avgle.com/*
  7. // @require http://cdn.bootcss.com/jquery/1.8.3/jquery.min.js
  8. // @version 1.0.4
  9. // @grant GM_addStyle
  10. // ==/UserScript==
  11. function checkCloseBtn() {
  12. var closeBtn = document.getElementById('iframe').contentWindow.document.getElementById('player_3x2_close');
  13. if(closeBtn !== null){
  14. closeBtn.click();
  15. }
  16. }
  17.  
  18. (function() {
  19. 'use strict';
  20. console.log(window.location.href);
  21. var url = window.location.href;
  22.  
  23. var reg = /https:\/\/*.avgle.com\/video\/[0-9]{0,100}/;
  24.  
  25.  
  26. var substr = url.match(reg);
  27. var adblock = url.match('adblock_detected');
  28.  
  29. if(substr !== null && adblock ===null){
  30. window.location = substr + '/?adblock_detected';
  31. }else if(substr !== null && adblock !==null){
  32. const embed = document.getElementsByTagName('head')[0].innerHTML.match('https://avgle.com/embed/[^"]+')[0];
  33. $("head").remove();
  34. $("body").remove();
  35. $("html").css("background","black");
  36. $("html").append( '<center><iframe id="iframe" width="1280" height="640" src="' + embed + '" frameborder="0" allowfullscreen></iframe></center>');
  37. }
  38. window.setInterval(checkCloseBtn,200);
  39.  
  40. })();