(function(window, undefined)
{
	
	window.Asc.plugin.init = function(text)
	{
		var words = (text.match(/\S+/g)) ? text.match(/\S+/g).length : 0;
		document.getElementById("charsNoSpaces").innerHTML = "Сharacters without spaces: " + text.replace(/\s+/g, '').length;
		document.getElementById("chars").innerHTML         = "Total characters: " + text.replace(/\r*\n/g, '').length;
		document.getElementById("words").innerHTML         = "Words count: " + words;
		document.getElementById("lines").innerHTML         = "Lines count: " + text.split(/\r*\n/).length;
		
	};


	window.Asc.plugin.button = function()
	{
		this.executeCommand("close", "");
	};

})(window, undefined);

@@ -70,16 +70,65 @@
 ext)%0A%09%7B%0A
+%09%09var chars = text.replace(/%5Cr*%5Cn/g, '').length;%0A
 %09%09var wo
@@ -187,16 +187,101 @@
 th : 0;%0A
+%09%09var lines = text.split(/%5Cr%5Cn/);%0A%09%09if (lines%5Blines.length-1%5D == %22%22) lines.length--;%0A
 %09%09docume
@@ -332,9 +332,9 @@
  = %22
-%D0%A1
+C
 hara
@@ -474,41 +474,13 @@
 %22 + 
-text.replace(/%5Cr*%5Cn/g, '').length
+chars
 ;%0A%09%09
@@ -634,27 +634,13 @@
 %22 + 
-text.split(/%5Cr*%5Cn/)
+lines
 .len

Fix bug #47733