Greasy Fork is available in English.

ABEMA NextProgramInfo Blocker

ABEMAビデオで次のエピソードへ勝手に移動するのをブロックします

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         ABEMA NextProgramInfo Blocker
// @namespace    https://greatest.deepsurf.us/ja/scripts/405272
// @version      1
// @description  ABEMAビデオで次のエピソードへ勝手に移動するのをブロックします
// @include      https://abema.tv/*
// @grant        none
// ==/UserScript==

(() => {
  'use strict';

  const sid = 'NPIBlocker',
    timer = {
      init: 0
    };

  //「次のエピソード」が表示されたらすぐに閉じる・移動をキャンセルする
  const closeNextProgramInfo = () => {
    if (/^https:\/\/abema\.tv\/video\/episode\//.test(location.href)) {
      const cb = document.querySelector('.com-vod-VODNextProgramInfo__close-button'),
        cnpb = document.querySelector('.com-vod-VODScreenOverlayForMiniPlayer__cancel-next-program-button');
      if (cb && cb.hasAttribute('tabindex') && cb.getAttribute('tabindex') !== '-1') {
        cb.click();
      } else if (cnpb) cnpb.click();
    }
  };

  //ページを開いたときに1度だけ実行
  const init = () => {
    const main = document.getElementById('main');
    if (main && !main.classList.contains(sid)) {
      main.classList.add(sid);
      observerM.observe(main, { childList: true, subtree: true });
    }
  };

  const observerM = new MutationObserver(closeNextProgramInfo);
  clearInterval(timer.init);
  timer.init = setInterval(() => {
    if (document.getElementById('main')) {
      clearInterval(timer.init);
      init();
    }
  }, 1000);

})();