Character-limit *OLD*

Stops and tells you when past the chat limit

Stan na 01-04-2016. Zobacz najnowsza wersja.

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

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

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           Character-limit *OLD*
// @namespace      tag://kongregate
// @description    Stops and tells you when past the chat limit
// @include        http://www.kongregate.com/games/*
// @version        1.5.2
// @date           12.11.10
// @author         Ventero
// require        http://kong.ventero.de/updates/48979.js
// ==/UserScript==

// Written by Ventero (http://www.kongregate.com/accounts/Ventero) 05/12/09

var dom = (typeof unsafeWindow === "undefined" ? window : unsafeWindow);

function init_characterLimitVent(){

	var CDialogue = dom.ChatDialogue;

	if(CDialogue){
		CDialogue.prototype = dom.CDprototype||dom.ChatDialogue.prototype;

		if(!CDialogue.prototype.oldKeyPressLimit){
			CDialogue.prototype.oldKeyPressLimit = CDialogue.prototype.onKeyPress;
			CDialogue.prototype.onKeyPress = function (a) {
				var node = (this._input_node.wrappedJSObject || this._input_node);
				this.oldKeyPressLimit(a);
				if (node.getValue().length > 249) {
					z = node.getValue();
					var y = "";
					if (n=z.match(/^(\/\S+\s+\S*\s*)(.*)/)){
						y=n[2];
						if (y.length>249){
							node.setValue(n[1]+y.substr(0, 249))
						}
					}else{
						node.setValue(node.getValue().substr(0, 249))
					}
				}
			}
		}
	};
};

function check(){
	dom.injectScript = dom.injectScript||(document.getElementById("injectScriptDiv")?document.getElementById("injectScriptDiv").onclick():0);
	if(dom.injectScript){
		dom.injectScript(init_characterLimitVent, 0);
	} else if(!dom._promptedFramework && !/Chrome/i.test(navigator.appVersion)){
		if(confirm("You don't have the latest version of the framework-script!\n" +
		           "Please install it, otherwise the scripts won't work.\n" +
		           "Clicking ok will open a new tab where you can install the script"))
			window.open("https://greasyfork.org/scripts/17703", "_blank");
		dom._promptedFramework = true;
	}
}

setTimeout(check, 0);