Greasy Fork 还支持 简体中文。

Tiny Customize

针对一些常用网站,例如 3DMGame、卡饭、巴哈姆特、Chiphell 等的反反广告检测、自动化、屏蔽网站功能等。

目前為 2016-06-30 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Tiny Customize
  3. // @description 针对一些常用网站,例如 3DMGame、卡饭、巴哈姆特、Chiphell 等的反反广告检测、自动化、屏蔽网站功能等。
  4. // @namespace https://greasyfork.org/zh-CN/scripts/19823-tiny-customize
  5. // @homepageURL https://greasyfork.org/zh-CN/scripts/19823-tiny-customize
  6. // @author nonoroazoro
  7. // @include /^https?\:\/\/(bbs)\.3dmgame\.com/
  8. // @include /^https?\:\/\/(bbs)\.kafan\.cn/
  9. // @include /^https?\:\/\/(forum)\.gamer\.com\.tw/
  10. // @include /^https?\:\/\/(www)\.chiphell\.com/
  11. // @version 1.0.6
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. if (typeof unsafeWindow == "undefined")
  16. {
  17. unsafeWindow = window;
  18. }
  19.  
  20. /**
  21. * 获取立即执行的操作。
  22. */
  23. const getInstantActions = function()
  24. {
  25. const host = unsafeWindow.location.host;
  26. const actions = [];
  27.  
  28. if (host === "forum.gamer.com.tw")
  29. {
  30. // 巴哈姆特。
  31.  
  32. // 反反广告检测。
  33. const action = function()
  34. {
  35. if (unsafeWindow.AntiAd)
  36. {
  37. unsafeWindow.AntiAd.check = function() {};
  38. }
  39. };
  40. actions.push(action);
  41. }
  42. else if (
  43. host === "bbs.kafan.cn" ||
  44. host === "bbs.3dmgame.com" ||
  45. host === "www.chiphell.com"
  46. )
  47. {
  48. // 卡饭、3DMGame、Chiphell 论坛(Discuz 驱动的论坛)。
  49.  
  50. // 屏蔽方向键翻页。
  51. const action = function()
  52. {
  53. if (unsafeWindow.keyPageScroll)
  54. {
  55. unsafeWindow.keyPageScroll = function() {};
  56. }
  57. };
  58. actions.push(action);
  59. }
  60.  
  61. return actions;
  62. };
  63.  
  64. /**
  65. * 获取延迟执行的操作。
  66. */
  67. const getLazyActions = function()
  68. {
  69. const host = unsafeWindow.location.host;
  70. const actions = [];
  71.  
  72. if (host === "forum.gamer.com.tw")
  73. {
  74. // 巴哈姆特。
  75.  
  76. // 自动开启图片。
  77. let action = function()
  78. {
  79. if (unsafeWindow.forumShowAllMedia)
  80. {
  81. unsafeWindow.forumShowAllMedia();
  82. }
  83. };
  84. actions.push(action);
  85. }
  86.  
  87. return actions;
  88. };
  89.  
  90. /**
  91. * 立即执行指定的操作。
  92. */
  93. const exec = function(p_actions)
  94. {
  95. if (p_actions)
  96. {
  97. p_actions.forEach(function(p_action)
  98. {
  99. p_action();
  100. });
  101. }
  102. };
  103.  
  104. // 1. 立即执行。
  105. exec(getInstantActions());
  106.  
  107.  
  108. // 2. 延迟执行。
  109. unsafeWindow.addEventListener("load", function()
  110. {
  111. exec(getLazyActions());
  112. }, true);