Chat Level

Shows average user level beside the room name

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name           Chat Level
// @namespace      arreloco
// @description    Shows average user level beside the room name
// @include        http://www.kongregate.com/games/*
// @version 0.0.1.20160322221006
// ==/UserScript==

function chupala(){
	var dom;

	try{
		if(unsafeWindow){
			dom = unsafeWindow;
		} else {
			dom = this;
		}
	}catch(e){
		dom = this;
	}

	var holodeck = dom.holodeck;
	actual_room = holodeck.chatWindow().activeRoom().name();
	userList = holodeck.chatWindow().activeRoom().users();
	var total_level = 0;
	var max_level = 0;
	for(var i=0;i<userList.length;i++){
		total_level += userList[i].variables.level;
	}
	var average_level = Math.round(total_level/userList.length*10)/10;
	var secondTab = document.getElementById("chat_tab_pane").lastElementChild.style.display;
	if(secondTab != "none"){		document.getElementById("chat_tab_pane").lastChild.firstElementChild.innerHTML = "Room: <span class='room_name'>"+actual_room+"</span><span style='float: right;'>Avg lvl: "+average_level+"</span>";
	}else{		document.getElementById("chat_tab_pane").lastChild.previousSibling.firstElementChild.innerHTML = "Room: <span class='room_name'>"+actual_room+"</span><span style='float: right;'>Avg lvl: "+average_level+"</span>";
	}
}
setInterval(chupala,15000);