Greasy Fork is available in English.

Turn off Nicomment LS

ニコニコ動画のコメントをデフォルトで非表示にする

// ==UserScript==
// @name         Turn off Nicomment LS
// @namespace    https://at.sachi-web.com/turn-off-nicomment-ls.html
// @version      1.0.190614
// @description  ニコニコ動画のコメントをデフォルトで非表示にする
// @author       うみのさち
// @match        https://www.nicovideo.jp/watch/*
// @grant        none
// @noframes
// ==/UserScript==

( ()=> {
'use strict';

const interval = 250;
const timeover = 10000;

const turnoff = {
	'html': ()=> {
		document.getElementsByClassName('CommentOnOffButton')[0].click();
	},
	'flash': ()=> {
		player.ext_setCommentVisible(false);
	}
};
let time = 0;

let player = document.getElementById('external_nicoplayer');
let type = player ? 'flash' : 'html';

let timer = setInterval( ()=> {
	try {
		time += interval;
		if( time <= timeover ) turnoff[type]();
		clearInterval(timer);
	} catch(e) {
		// player isn't ready
	}
}, interval);

})();