FURSTREAM chat expander

Make the chat more compact on stream pages

当前为 2014-06-30 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        FURSTREAM chat expander
// @namespace   furstre.am
// @description Make the chat more compact on stream pages
// @include     https://furstre.am/stream/*
// @version     3
// @grant       none
// ==/UserScript==

function addGlobalStyle(css) {
    $("head").append($(document.createElement("style")).attr("type", "text/css").html(css));
}

var insertListener = function(e){
	if (e.animationName == "nodeInserted") {
		var avatar = $(e.target).children(".av").detach();
		var details = $(e.target).children(".content").children(".details").detach();
		$(e.target).children(".content").prepend(details);
		$(e.target).children(".content").prepend(avatar);
	}
}

$(window).load(function(){
	addGlobalStyle(".body.stream { margin: 0 !important; }")
	addGlobalStyle(".comunica #comunica-chat-pane .msg { margin: 0 !important; }")
	addGlobalStyle(".comunica #comunica-chat-pane .msg .content { margin: 0 !important; float: none !important; width: 100% !important; }")
	addGlobalStyle(".comunica #comunica-chat-pane .msg .content p { margin: 0 0 8px !important; }")
	addGlobalStyle(".comunica #comunica-chat-pane .msg .content .details { margin: 0 !important; }")
	addGlobalStyle(".comunica #comunica-chat-pane .msg .content:after { display: none; !important }")
	addGlobalStyle(".comunica #comunica-chat-pane .msg .content.pull-right:after { display: none !important; }")
	addGlobalStyle(".comunica #comunica-chat-pane .msg .av { position: static !important; float: left !important; }")
	addGlobalStyle("@keyframes nodeInserted {  from { opacity: 0.99; } to { opacity: 1; }  }")
	addGlobalStyle(".comunica #comunica-chat-pane .msg { animation-duration: 0.001s; animation-name: nodeInserted; }")
	document.addEventListener("animationstart", insertListener, false)
})