Switch520广告去除。

去除Switch520广告。

  1. // ==UserScript==
  2. // @name Switch520广告去除。
  3. // @description 去除Switch520广告。
  4. // @version 1.0.2
  5. // @namespace Switch520广告去除
  6. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  7. // @author 会说话的鱼
  8. // @include *www.gamer520*
  9. // @require https://cdn.bootcdn.net/ajax/libs/jquery/1.9.1/jquery.min.js
  10. // @run-at document-start
  11. // @grant none
  12. // @rewritten_script_code javascript
  13. // @license GPLv3
  14. // ==/UserScript==
  15.  
  16. (function () {
  17. 'use strict';
  18. $(function () {
  19. init();
  20. });
  21. })();
  22.  
  23. function removeHtmlTags(str) {
  24. return str.replace(/(<([^>]+)>)/gi, "");
  25. }
  26.  
  27. function extractUrls(str) {
  28. const urlRegex = /'(?<url>https?:\/\/[^']+)/g;
  29. let match;
  30. const urls = [];
  31.  
  32. while ((match = urlRegex.exec(str))) {
  33. urls.push(match.groups.url);
  34. }
  35.  
  36. return urls;
  37. }
  38.  
  39. function init() {
  40. $.each($('.lazyload'), function(index, val) {
  41. console.log(index, val);
  42. var obj = $(this);
  43. var src = obj.data('src');
  44.  
  45. obj.attr('src', src);
  46. obj.removeClass('lazyload');
  47. });
  48.  
  49. var pay_btn = $('.pay-box');
  50. var pay_obj = pay_btn.find('a');
  51. var pay_id = pay_obj.data('id');
  52.  
  53. pay_obj.attr('href', 'https://www.gamer520.blog/go?post_id='+ pay_id);
  54.  
  55. /*
  56. pay_obj.click(function(){
  57. // 标准ajax
  58. $.ajax({
  59. // 提交数据的类型 POST GET
  60. type: "POST",
  61. // 提交的网址
  62. url: "/wp-admin/admin-ajax.php",
  63. // 提交的数据
  64. data: {
  65. action: 'user_down_ajax',
  66. post_id: pay_id,
  67. },
  68. //返回数据的格式
  69. dataType: "json", //"xml", "html", "script", "json", "jsonp", "text".
  70. // true:默认异步请求 false:同步请求
  71. // async:true,
  72. // 请求前
  73. beforeSend: function () {
  74. },
  75. // 成功返回之后调用的函数
  76. success: function(data) {
  77. // pay_obj.attr('href', 'https://www.gamer520.blog/go?post_id='+ pay_id);
  78.  
  79. window.open(data.msg, '_blank');
  80. },
  81. // 请求完成
  82. complete: function () {
  83. },
  84. // 调用出错执行的函数
  85. error: function() {
  86. //请求出错处理
  87. console.log('Ajax Error');
  88. }
  89. });
  90. });
  91. */
  92.  
  93. var str = removeHtmlTags($('html').html());
  94. var prefix = "window.location";
  95.  
  96. if(str.startsWith(prefix)) {
  97. var url = extractUrls(str);
  98. // console.log(extractUrls(str));
  99. window.location.href=url[0];
  100. }
  101. }

QingJ © 2025

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