Warning: fopen(/www/sites/update.greasyfork.icu/index/store/forever/5fd6b0f6c0dec460290d85e9f23b51ba.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript==
// @name ニコニコ動画 コメント非表示
// @namespace ncode
// @match https://www.nicovideo.jp/watch/*
// @version 10
// @description ニコニコ動画のコメントをデフォルトで非表示にするスクリプトです
// @grant none
// @downloadURL none
// ==/UserScript==
let comment_close_timer;
let check_comment_close = function(){
let comment_close_count = 0;
comment_close_timer = setInterval(function(){
comment_close_count++;
if (comment_close_count > 5) {
clearInterval(comment_close_timer);
}
try {
let buttons = document.getElementsByClassName('cursor_pointer');
for(let i = 0;buttons.length;i++) {
if (buttons[i].getAttribute('aria-label') == 'コメントを非表示') {
buttons[i].click();
break;
}
}
} catch(e) {
}
}, 1000);
}
check_comment_close();
let comment_close_href = location.href;
let comment_close_observer = new MutationObserver(function(mutations) {
if(comment_close_href !== location.href) {
comment_close_href = location.href;
if (comment_close_timer) {
clearInterval(comment_close_timer);
}
check_comment_close();
}
});
comment_close_observer.observe(document, { childList: true, subtree: true });