twitcasting_collapse_comment

ツイキャスのコメント欄を非表示にする。

2020-01-01 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        twitcasting_collapse_comment
// @namespace   http://catherine.v0cyc1pp.com/twitcasting_collapse_comment.user.js
// @include     http://twitcasting.tv/*
// @include     https://twitcasting.tv/*
// @include     https://ssl.twitcasting.tv/*
// @exclude     https://twitcasting.tv/
// @exclude     https://twitcasting.tv/?*
// @version     1.7
// @require     http://code.jquery.com/jquery-3.4.1.min.js
// @grant       none
// @run-at      document-end
// @description ツイキャスのコメント欄を非表示にする。
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);


console.log("twitcasting_collapse_comment start");



function main() {
    //console.log("main() start");

    // すでに処理済ならなにもしない
    /*
    var tmp = $(".header_twitcasting_collapse_comment");
    console.log("tmp="+tmp);
    if (tmp != null) {
        return;
    }
    */
    if ( $(".header_twitcasting_collapse_comment").length ) {
        return;
    }


	// 隠すブロックの前に「コメントエリア (クリックで展開)」のヘッダをつける。
	$("div.tw-player-page__comment__list").before("<div class=\"header_twitcasting_collapse_comment\" style=\"text-align: center;cursor: hand; cursor: pointer;\"><span>コメントエリア (クリックで展開)</span>");

	// 隠すブロックをデフォルトで非表示にする。
	$("div.tw-player-page__comment__list").attr("style","display:none;clear:both;");

	$(".header_twitcasting_collapse_comment").click(function () {

		var $header = $(this);
		//getting the next element
		var $content = $header.next();
		//open up the content needed - toggle the slide- if visible, slide up, if not slidedown.


		$content.slideToggle(200);


		/* ヘッダのテキストを変更する場合
		$content.slideToggle(500, function () {
			//execute this after slideToggle is done
			//change text of header based on visibility of content div
			$header.text(function () {
				//change text based on condition
				return $content.is(":visible") ? "Collapse" : "Expand";
			});
		});
		*/
	});
}

var observer = new MutationObserver(function(mutations) {
    observer.disconnect();
    main();
    observer.observe( document, config);
});
 
var config = { attributes: false, childList: true, characterData: false, subtree:true };
 
observer.observe( document, config);