Hide a Comment List

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

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 or Violentmonkey 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.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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           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 = '';
  }
});