SC2Casts.com Adblock Nag Screen Remover

Removes the 'disable Adblock' nag screen.

当前为 2016-04-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name SC2Casts.com Adblock Nag Screen Remover
  3. // @namespace http://lazy.artifact
  4. // @version 0.21
  5. // @description Removes the 'disable Adblock' nag screen.
  6. // @author Lazy Artifact
  7. // @match http://sc2casts.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.  
  13. var divs = document.getElementsByTagName('div'),
  14. adBlockRegex = /AdBlock/i,
  15. showSignUpElements = document.querySelectorAll('[onclick="showSignUp()"]'),
  16. playAllElement,
  17. char,
  18. i,
  19. j,
  20. youTube =
  21. {
  22. url: 'https://www.youtube.com/watch_videos?video_ids=',
  23. videoIds: [],
  24. videoElements: document.querySelectorAll('iframe#ytplayer')
  25. };
  26.  
  27. //remove nag screen
  28. for(i = 0; i < divs.length; i++) {
  29.  
  30. if(adBlockRegex.test(divs[i].innerText)) {
  31.  
  32. divs[i].parentElement.removeChild(divs[i]);
  33. break;
  34.  
  35. }
  36.  
  37. }
  38.  
  39.  
  40. if(youTube.videoElements.length < 1) {
  41. return;
  42. }
  43.  
  44. //get YouTube video Ids
  45. for(i = 0; i < youTube.videoElements.length; i++) {
  46. youTube.videoIds[i] = '';
  47.  
  48. for(j = youTube.videoElements[i].src.lastIndexOf('/') + 1, char = youTube.videoElements[i].src[j]; char !== '?'; j++, char = youTube.videoElements[i].src[j]) {
  49.  
  50. youTube.videoIds[i] += char;
  51.  
  52. }
  53.  
  54.  
  55. }
  56.  
  57. //remove signup popup listener and add a new play all click event
  58. for(i = 0; i < showSignUpElements.length; i++) {
  59.  
  60. if(showSignUpElements[i].textContent && showSignUpElements[i].textContent === 'Play all') {
  61.  
  62. playAllElement = showSignUpElements[i];
  63. playAllElement.removeAttribute('onclick');
  64. playAllElement.removeEventListener('click', showSignUp);
  65. break;
  66. }
  67.  
  68. }
  69.  
  70. youTube.url += youTube.videoIds.join(',');
  71.  
  72. playAllElement.addEventListener('click', function() {
  73. window.open(youTube.url, '_blank');
  74. }, false);
  75.  
  76. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址