反巴哈姆特反反廣告的提示

反巴哈姆特(含動畫瘋)反反廣告的提示及反文章列表廣告

  1. // ==UserScript==
  2. // @name 反巴哈姆特反反廣告的提示
  3. // @description 反巴哈姆特(含動畫瘋)反反廣告的提示及反文章列表廣告
  4. // @namespace https://github.com/FlandreDaisuki
  5. // @author FlandreDaisuki
  6. // @include https://*gamer.com.tw/*
  7. // @version 2.1.2
  8. // @run-at document-start
  9. // @grant unsafeWindow
  10. // ==/UserScript==
  11. /* 可以讓已經包月的人不要看到這個嘛 森77 */
  12.  
  13. // 動畫瘋開頭跳出
  14. // alert('由於擋廣告插件會影響播放器運作,如果您有安裝,請您將 gamer.com.tw / bahamut.com.tw 網域加入白名單或考慮關閉插件,動畫瘋感謝您的支持!')
  15.  
  16. let BAHA_ANIME = {};
  17. const noop = () => {};
  18.  
  19. Object.defineProperty(window, 'BAHA_ANIME', {
  20. get() {
  21. return BAHA_ANIME;
  22. },
  23. set(a) {
  24. a.prototype.antiBlock = noop;
  25. BAHA_ANIME = a;
  26. },
  27. configurable: true,
  28. });
  29.  
  30. // https://greasyfork.org/forum/discussion/comment/85127/#Comment_85127
  31. if (GM && GM.info && GM.info.script) {
  32. // 無論如何外面的 alert 都會壞掉
  33. unsafeWindow.alert = noop;
  34. }
  35.  
  36. // 全站黃警告
  37. // 我們了解您不想看到廣告的心情⋯ 若您願意支持巴哈姆特永續經營,請將 gamer.com.tw 加入廣告阻擋工具的白名單中,謝謝 !【教學】
  38.  
  39. if (localStorage.admercyblocks) {
  40. localStorage.admercyblocks = Infinity;
  41. }
  42.  
  43. document.addEventListener('readystatechange', () => {
  44. if (document.readyState === 'interactive') {
  45. const a = document.querySelector('.alert-close');
  46. if (a) {
  47. a.parentElement.remove();
  48. }
  49. }
  50. });
  51.  
  52. // 文章列表廣告
  53. // 巴哈你也太硬來了吧wwww 廢到笑
  54.  
  55. document.addEventListener('readystatechange', () => {
  56. if (document.readyState === 'interactive') {
  57. [...document.querySelectorAll('.b-list_ad')]
  58. .forEach((ad) => ad.parentElement.remove());
  59. }
  60. });