From 34995df879457f03ad6f78e617294dc2dd040b7d Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 12 Aug 2010 12:47:07 -0700 Subject: TinyMCE: counter support (may not be 100% exact match to server-side count, but there's already discrepencies due to URL shortening) Fix for bad char conversions also, caused short text to not be saved in some cases. --- js/util.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/util.js b/js/util.js index 6a67da4bc..ad8a44c82 100644 --- a/js/util.js +++ b/js/util.js @@ -110,7 +110,7 @@ var SN = { // StatusNet return; } - var remaining = MaxLength - form.find('#'+SN.C.S.NoticeDataText).val().length; + var remaining = MaxLength - SN.U.CharacterCount(form); var counter = form.find('#'+SN.C.S.NoticeTextCount); if (remaining.toString() != counter.text()) { @@ -134,6 +134,10 @@ var SN = { // StatusNet } }, + CharacterCount: function(form) { + return form.find('#'+SN.C.S.NoticeDataText).val().length; + }, + ClearCounterBlackout: function(form) { // Allow keyup events to poke the counter again SN.C.I.CounterBlackout = false; -- cgit v1.2.3-54-g00ecf