Greasy Fork

Greasy Fork is available in English.

ABEMA VIDEO NextInfoCloser

ABEMA VIDEOコンテンツの次の話に自動で飛ぶメニューを一度だけ閉じます。 TEST

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        ABEMA VIDEO NextInfoCloser
// @description ABEMA VIDEOコンテンツの次の話に自動で飛ぶメニューを一度だけ閉じます。 TEST
// @namespace http://greasyfork.icu/users/716748
// @match       https://abema.tv/video/*
// @grant       none
// @version     1.0.3
// @author      ykhr.m
// ==/UserScript==

//com-vod-VODNextProgramInfo com-vod-VODNextProgramInfo--is-show

const PERMISSION_CNT = 1; //閉じるを許可する回数
const closeBtnQueryStr = '.com-vod-VODPlayerNextContentRecommendBase__cancel-button';

function main(){
  const nextInfo = document.querySelector(".com-vod-VODPlayerNextContentRecommendBase");
  const nextinfoClassnameOnShow = 'com-vod-VODPlayerNextContentRecommendBase--is-show';
  const closebuttonnextInfo = document.querySelector(closeBtnQueryStr);
  let cnt_click = 0; //回数制限のためのカウンター
  nextInfo.addEventListener('transitionrun', function() {
    if(cnt_click < PERMISSION_CNT && nextInfo.classList.contains(nextinfoClassnameOnShow)){
      nextInfo.classList.remove(nextinfoClassnameOnShow);
      closebuttonnextInfo.click();
//      document.title = `click. ${cnt_click}`;
      cnt_click++;
    }
  });
}

function ini(){
  let obs_cnt = 0;
  let obs = setInterval(function(){
    if(document.querySelector(closeBtnQueryStr)){
      clearInterval(obs);
      main();
    };
    if(obs_cnt >= 20){
      clearInterval(obs);
    }
    obs_cnt++;
  }, 1000);
}

//他のページから変遷した場合にgreasemonkeyが実行されないために変遷したかを確認して初期化する
let oldhref = document.location.href;
function confirmURL(){
  if(oldhref != document.location.href) {
    oldhref = document.location.href;
    ini();    
  }
}

ini();
setInterval(confirmURL, 10000);