Hide a Comment List

Hide also a list of comments when you press the hide comments button on ニコニコ生放送

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name           Hide a Comment List
// @name:ja        コメント一覧も非表示
// @namespace      https://greasyfork.org/users/19523
// @version        0.1
// @description    Hide also a list of comments when you press the hide comments button on ニコニコ生放送
// @description:ja ニコニコ生放送でコメント非表示にするとコメント一覧も非表示にします
// @match          https://live2.nicovideo.jp/watch/*
// @grant          none
// ==/UserScript==

document.querySelector('button[class*="comment-button"]').addEventListener('click', function () {
  var button, panel;
  if (!button) {
    button = document.querySelector('button[class*="comment-button"]');
    panel = document.querySelector('div[class*="comment-panel"]');
  }
  if (button.dataset.toggleState.toLowerCase() === 'true') {
    panel.style.visibility = 'hidden';
  } else {
    panel.style.visibility = '';
  }
});