Javascript Adblocker Vietnam - Firefox only

Remove pop-ups/ in-video ads : blogtruyen|vnsharing|hayhaytv|forum.bkav.com.vn

当前为 2014-10-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Javascript Adblocker Vietnam - Firefox only
  3. // @description Remove pop-ups/ in-video ads : blogtruyen|vnsharing|hayhaytv|forum.bkav.com.vn
  4. // @version 1.712
  5. // @run-at document-start
  6. // @namespace ...
  7. // @include *blogtruyen.com*
  8. // @include *hayhaytv.vn*
  9. // @include *vnsharing.net*
  10. // @include *vozforums.com*
  11. // @include *bkav.com.vn*
  12. // ==/UserScript==
  13.  
  14. var hostname = location.hostname;
  15. var fuck = 0;
  16. switch(hostname) {
  17. case "www.hayhaytv.vn":
  18. fuck = 1;
  19. checkForBadJavascripts ( [[ false, /vod\/info/, replaceJS ]] );
  20. window.addEventListener('load', function(){ $("#btn_xemngay").click() });
  21. break;
  22. case "jj.hayhaytv.vn":
  23. fuck = 2;
  24. checkForBadJavascripts ( [[ false, /vod\/info/, replaceJS ]] );
  25. window.addEventListener('load', function(){ $(".banner_player_img, .mh-player-info").css("display", "none"); startMainPlayer(); });
  26. break;
  27. case "blogtruyen.com":
  28. fuck = 3;
  29. checkForBadJavascripts ( [[ false, /popunder/, replaceJS ]] );
  30. break;
  31. case "vnsharing.net":
  32. fuck = 4;
  33. checkForBadJavascripts ( [[ false, /btpop/, replaceJS ]] );
  34. break;
  35. case "forum.bkav.com.vn":
  36. fuck = 5;
  37. checkForBadJavascripts ( [[ false, /jQuery\(document\)\.ready/, replaceJS ]] );
  38. break;
  39. default:
  40. break;
  41. }
  42.  
  43. function replaceJS (scriptNode) {
  44. var scriptSrc = scriptNode.textContent;
  45. switch(fuck) {
  46. case 1: scriptSrc = scriptSrc.replace ("vod", "shit"); break;
  47. case 3: scriptSrc = scriptSrc.replace ("pop", "shit"); break;
  48. case 4: scriptSrc = scriptSrc.replace ("pop", "shit"); break;
  49. case 5: scriptSrc = scriptSrc.replace ("doc", "shit"); break;
  50. default: break;
  51. }
  52. addJS_Node (scriptSrc)
  53. }
  54.  
  55. function checkForBadJavascripts (controlArray) {
  56. if ( ! controlArray.length) return null;
  57. checkForBadJavascripts = function (zEvent) {
  58. for (var J = controlArray.length - 1; J >= 0; --J) {
  59. var bSearchSrcAttr = controlArray[J][0];
  60. var identifyingRegex = controlArray[J][1];
  61. if (bSearchSrcAttr) {
  62. if (identifyingRegex.test (zEvent.target.src) ) {
  63. stopBadJavascript (J);
  64. return false;
  65. }
  66. }
  67. else {
  68. if (identifyingRegex.test (zEvent.target.textContent) ) {
  69. stopBadJavascript (J);
  70. return false;
  71. }
  72. }
  73. }
  74.  
  75. function stopBadJavascript (controlIndex) {
  76. zEvent.stopPropagation ();
  77. zEvent.preventDefault ();
  78.  
  79. var callbackFunction = controlArray[J][2];
  80. if (typeof callbackFunction == "function")
  81. callbackFunction (zEvent.target);
  82. zEvent.target.parentNode.removeChild (zEvent.target);
  83. controlArray.splice (J, 1);
  84. if ( ! controlArray.length) {
  85. window.removeEventListener (
  86. 'beforescriptexecute', checkForBadJavascripts, true
  87. );
  88. }
  89. }
  90. }
  91.  
  92. window.addEventListener ('beforescriptexecute', checkForBadJavascripts, true);
  93.  
  94. return checkForBadJavascripts;
  95. }
  96.  
  97. function addJS_Node (text, s_URL, funcToRun) {
  98. var D = document;
  99. var scriptNode = D.createElement ('script');
  100. scriptNode.type = "text/javascript";
  101. if (text) scriptNode.textContent = text;
  102. if (s_URL) scriptNode.src = s_URL;
  103. if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()';
  104.  
  105. var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
  106. targ.appendChild (scriptNode);
  107. }
  108.  
  109. /* Kéo dài alt2 cho vOz */
  110. addGlobalStyle('[style*=wrap] > STRONG {margin-right:100px}');
  111.  
  112. /* Autohide thanh trên cùng hh và jj */
  113. addGlobalStyle('.header:not(:hover), .mh-header-full:not(:hover) {opacity:0}');
  114.  
  115. function addGlobalStyle(css) {
  116. var head, style;
  117. head = document.getElementsByTagName('head')[0];
  118. if (!head) { return; }
  119. style = document.createElement('style');
  120. style.type = 'text/css';
  121. style.innerHTML = css;
  122. head.appendChild(style);
  123. }
  124.  
  125.  

QingJ © 2025

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