ABPVN AdsBlock

Script chặn quảng cáo,loại bỏ chờ đợi của ABPVN

Per 14-05-2015. Zie de nieuwste versie.

  1. // ==UserScript==
  2. // @name ABPVN AdsBlock
  3. // @namespace ABPVN
  4. // @author Hoàng Rio
  5. // @copyright ABPVN
  6. // @homepage http://abpvn.com
  7. // @icon http://abpvn.com/icon.png
  8. // @description Script chặn quảng cáo,loại bỏ chờ đợi của ABPVN
  9. // @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=donghoang.nguyen@gmail.com&item_name=ABPVN Donation
  10. // @run-at document-end
  11. // @include http://*
  12. // @include https://*
  13. // @version 1.6.2
  14. // @grant none
  15. // ==/UserScript==
  16. String.prototype.startWith = function strStart(str){
  17. return this.indexOf(str)===0;
  18. };
  19. String.prototype.ismatch = function (regex){
  20. return this.match(regex)!==null;
  21. };
  22. $.getcookie=function(cookiename){
  23. var value = "; " + document.cookie;
  24. var parts = value.split("; " + cookiename + "=");
  25. if (parts.length == 2) return parts.pop().split(";").shift();
  26. };
  27. function abpvn_onoff(){
  28. if($.getcookie('abpvn')==undefined){
  29. var now = new Date();
  30. var time = now.getTime();
  31. var expireTime = time + 365*24*3600*1000;
  32. now.setTime(expireTime);
  33. document.cookie='abpvn=0;expires='+now.toGMTString()+';';
  34. $("#abpvn").css("background-color","red");
  35. $("#abpvn").html("ABPVN Xóa chuyển hướng đang <u>Tắt</u>");
  36. $("#abpvn").attr("title","Bấm vào để Bật");
  37. }
  38. else{
  39. document.cookie='abpvn'+'=;expires=Thu,01-Jan-1970 00:00:01 GMT;';
  40. $("#abpvn").css("background-color","green");
  41. $("#abpvn").html("ABPVN Xóa chuyển hướng đang <u>Bật</u>");
  42. $("#abpvn").attr("title","Bấm vào để Tắt");
  43. }
  44. if(confirm("Bạn có muốn tải lại trang không?")){
  45. location.reload();
  46. }
  47. }
  48. function VNZ_MF(){
  49. var hit=0;
  50. $("a").each(function() {
  51. var old_href=$(this).attr("href");
  52. if(old_href!==undefined){
  53. if(old_href.startWith("http://www.mediafire.com")){
  54. $(this).attr("href","http://ref.abpvn.com/?"+old_href);
  55. $(this).html($(this).html()+'<img title="ABPVN: Đã xóa chuyển hướng từ VNZ sang Mediafire.com" src="https://www.webanh.tk/full/imgvn-5548db3600180.png" height="18" width="auto" style="vertical-align:middle;">');
  56. console.info("ABPVN: "+old_href+" -> "+$(this).attr("href"));
  57. hit++;
  58. }
  59. }
  60. });
  61. if(hit==0){
  62. console.info("ABPVN: Không có link mediafire nào trong topic");
  63. }
  64. else{
  65. console.info("ABPVN: Đã xử lý "+hit+" link mediafire trong topic");
  66. }
  67. }
  68.  
  69. function REMOVE_REF(ref_url,hostname){
  70. if($.getcookie('abpvn')==undefined){
  71. $(document.body).append('<div id="abpvn" style="font: 13px verdana,geneva,lucida,lucida grande,arial,helvetica,sans-serif; position: fixed; display:block; top: 97.2%; left: 0; width: 240px; height: auto; color: white; background-color: green; opacity: 0.7; cursor: pointer" title="Bấm vào để Tắt">ABPVN Xóa chuyển hướng đang <u>Bật</u></div>');
  72. var hit=0;
  73. $("a").each(function() {
  74. var old_href=$(this).attr("href");
  75. if(old_href!==undefined){
  76. if(old_href.startWith(ref_url+"http%3A%2F%2F")){
  77. old_href=old_href.replace(ref_url+"http%3A%2F%2F","");
  78. old_href=old_href.replace(/%2F/g,"/");
  79. $(this).attr("href","http://"+old_href);
  80. $(this).html($(this).html()+'<img title="ABPVN: Đã xóa chuyển hướng của '+hostname+'" src="https://www.webanh.tk/full/imgvn-5548db3600180.png" height="18" width="auto" style="vertical-align:middle;">');
  81. console.info("ABPVN: "+ref_url+"http%3A%2F%2F"+old_href+" -> "+$(this).attr("href"));
  82. hit++;
  83. }
  84. else{
  85. if(old_href.startWith(ref_url+"https%3A%2F%2F")){
  86. old_href=old_href.replace(ref_url+"https%3A%2F%2F","");
  87. old_href=old_href.replace(/%2F/g,"/");
  88. $(this).attr("href","https://"+old_href);
  89. $(this).html($(this).html()+'<img title="ABPVN: Đã xóa chuyển hướng của '+hostname+'" src="https://www.webanh.tk/full/imgvn-5548db3600180.png" height="18" width="auto" style="vertical-align:middle;">');
  90. console.info("ABPVN: "+ref_url+"https%3A%2F%2F"+old_href+" -> "+$(this).attr("href"));
  91. hit++;
  92. }
  93. }
  94. }
  95. });
  96. if(hit==0){
  97. console.info("ABPVN: Không có link chứa chuyển hướng nào trong topic");
  98. }
  99. else{
  100. console.info("ABPVN: Đã xử lý "+hit+" link chứa chuyển hướng trong topic");
  101. }
  102. }
  103. else{
  104. $(document.body).append('<div id="abpvn" style="font: 13px verdana,geneva,lucida,lucida grande,arial,helvetica,sans-serif; position: fixed; display:block; top: 97.2%; left: 0; width: 240px; height: auto; color: white; background-color: red; opacity: 0.7; cursor: pointer" title="Bấm vào để Bật">ABPVN Xóa chuyển hướng đang <u>Tắt</u></div>');
  105. }
  106. $("#abpvn").css("top",""+$(window).height()-$("#abpvn").height());
  107. $("#abpvn").css("left",""+$(window).width()-$("#abpvn").width());
  108. $(window).load(function (){
  109. $("#abpvn").css("top",""+$(window).height()-$("#abpvn").height());
  110. $("#abpvn").css("left",""+$(window).width()-$("#abpvn").width());
  111. });
  112. $(window).resize(function (){
  113. $("#abpvn").css("top",""+$(window).height()-$("#abpvn").height());
  114. $("#abpvn").css("left",""+$(window).width()-$("#abpvn").width());
  115. });
  116. $("#abpvn").click(abpvn_onoff);
  117. }
  118. function AntiHayhaytv(){
  119. $('head').append('<script src="https://cdn.hostjs.tk/hayhay_abpvn.js"></script>');
  120. }
  121. function FshareSkip() {
  122. var scripttext=$("script").text();
  123. var temp1=''+scripttext.match(/'.*'\n/);
  124. var temp2=temp1.replace("'","");
  125. var temp3=temp2.replace(/\n/g,"");
  126. var code=temp3.replace("'","");
  127. var speed = $(this).data('speed');
  128. var data = {
  129. speed: speed,
  130. fs_csrf: code
  131. };
  132. $.post('/download/index', data).done(function (data, statusText, xhr) {
  133. window.location = data.url;
  134. console.log("ABPVN: "+location.href+" -> "+data.url);
  135. }).fail(function(xhr, statusText, error){
  136. $.alert({success: false, message: "ABPVN: Đã có lỗi fshare hoặc file có password"});
  137. });
  138. }
  139. function cTitle() {
  140. document.title = document.title + " - ABPVN";
  141. }
  142. function ByPassOnivn() {
  143. var scripttext = $("script").text();
  144. var data = scripttext.match(/code=.*\b/);
  145. var domain = window.location.protocol + "//" + window.location.host + '/';
  146. var urls = $('input[name=linknexttop]').val();
  147. if (urls == 1) {
  148. url = '';
  149. $.ajax({
  150. type: "GET",
  151. url: domain + "click.html",
  152. data: "" + data + "",
  153. contentType: "application/json; charset=utf-8",
  154.  
  155. success: function (html) {
  156. $('input[name=linknexttop]').val(2);
  157. window.location = html;
  158. }
  159. })
  160. } else {
  161. console.info("ABPVN: Đây chắc là trang chủ oni.vn rồi. =))");
  162. }
  163. }
  164. (function ABPVNAdsBlock() {
  165. url=location.href;
  166. //Chặn popup quảng cáo không chặn được bằng ABP
  167. var popup_ar = ['http://blogtruyen.com'];
  168. for (var i = 0; i < popup_ar.length; i++) {
  169. if (url.startWith(popup_ar[i])) {
  170. cTitle();
  171. console.info("ABPVN: Đã chặn popup quảng cáo");
  172. document.body.onclick = null;
  173. }
  174. }
  175. //Chặn background quảng cáo 24h
  176. if (url.startWith('http://www.24h.com.vn')) {
  177. console.info("ABPVN: Đã xóa background quảng cáo");
  178. cTitle();
  179. document.body.style.background = "white";
  180. }
  181. if (url.startWith('http://www.oni.vn')) {
  182. cTitle();
  183. ByPassOnivn();
  184. }
  185. if (url.startWith('https://www.fshare.vn/file')) {
  186. $.alert({success: false, message: "ABPVN: Download fshare không cần đợi"});
  187. cTitle();
  188. FshareSkip();
  189. }
  190. if(url.startWith('http://www.hayhaytv.vn')){
  191. console.info('ABPVN: Anti hayhaytv.vn');
  192. cTitle();
  193. AntiHayhaytv();
  194. }
  195. if(url.ismatch('http://www.vn-zoom.com/f../.')||url.ismatch('http://www.vn-zoom.com/f.../.')){
  196. console.info("ABPVN: Xóa chuyển hướng Mediafire từ VNZ đã hoạt động");
  197. VNZ_MF();
  198. }
  199. if(url.startWith("http://sinhvienit.net/forum/")){
  200. console.info("ABPVN: Xóa redirect SVIT đã hoạt động");
  201. REMOVE_REF("http://sinhvienit.net/goto/?","SVIT");
  202. }
  203. if(url.startWith("http://vozforums.com/showthread.php")){
  204. console.info("ABPVN: Xóa redirect VOZ đã hoạt động");
  205. REMOVE_REF("/redirect/index.php?link=","VOZ");
  206. }
  207. })();