Character-limit *OLD*

Stops and tells you when past the chat limit

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);