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

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        反巴哈姆特反反廣告的提示
// @description 反巴哈姆特(含動畫瘋)反反廣告的提示及反文章列表廣告
// @namespace   https://github.com/FlandreDaisuki
// @author      FlandreDaisuki
// @include     https://*gamer.com.tw/*
// @version     2.1.2
// @run-at      document-start
// @grant       unsafeWindow
// ==/UserScript==
/* 可以讓已經包月的人不要看到這個嘛 森77 */

// 動畫瘋開頭跳出
// alert('由於擋廣告插件會影響播放器運作,如果您有安裝,請您將 gamer.com.tw / bahamut.com.tw 網域加入白名單或考慮關閉插件,動畫瘋感謝您的支持!')

let BAHA_ANIME = {};
const noop = () => {};

Object.defineProperty(window, 'BAHA_ANIME', {
  get() {
    return BAHA_ANIME;
  },
  set(a) {
    a.prototype.antiBlock = noop;
    BAHA_ANIME = a;
  },
  configurable: true,
});

// https://greasyfork.org/forum/discussion/comment/85127/#Comment_85127
if (GM && GM.info && GM.info.script) {
  // 無論如何外面的 alert 都會壞掉
  unsafeWindow.alert = noop;
}

// 全站黃警告
// 我們了解您不想看到廣告的心情⋯ 若您願意支持巴哈姆特永續經營,請將 gamer.com.tw 加入廣告阻擋工具的白名單中,謝謝 !【教學】

if (localStorage.admercyblocks) {
  localStorage.admercyblocks = Infinity;
}

document.addEventListener('readystatechange', () => {
  if (document.readyState === 'interactive') {
    const a = document.querySelector('.alert-close');
    if (a) {
      a.parentElement.remove();
    }
  }
});

// 文章列表廣告
// 巴哈你也太硬來了吧wwww 廢到笑

document.addEventListener('readystatechange', () => {
  if (document.readyState === 'interactive') {
    [...document.querySelectorAll('.b-list_ad')]
      .forEach((ad) => ad.parentElement.remove());
  }
});