diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-08-07 02:53:59 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-08-07 02:53:59 -0700 |
commit | edff5b5289f80be89e4fc6b072ccd84812960349 (patch) | |
tree | 6801eaba13fdc5b0558771f8a344e9c3693d3c99 /view/jot-header.tpl | |
parent | 4a7643b3ec532a211ec284dc1c57b0686403730d (diff) | |
download | volse-hubzilla-edff5b5289f80be89e4fc6b072ccd84812960349.tar.gz volse-hubzilla-edff5b5289f80be89e4fc6b072ccd84812960349.tar.bz2 volse-hubzilla-edff5b5289f80be89e4fc6b072ccd84812960349.zip |
character counter
Diffstat (limited to 'view/jot-header.tpl')
-rw-r--r-- | view/jot-header.tpl | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/view/jot-header.tpl b/view/jot-header.tpl index 6402d5db6..e2b196dc3 100644 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -18,7 +18,31 @@ tinyMCE.init({ add_unload_trigger : false, remove_linebreaks : false, convert_urls: false, - content_css: "$baseurl/view/custom_tinymce.css" + content_css: "$baseurl/view/custom_tinymce.css", + //Character count + theme_advanced_path : false, + setup : function(ed) { + ed.onKeyUp.add(function(ed, e) { + var txt = tinyMCE.activeEditor.getContent(); + var text = txt.length; + if(txt.length <= 140) { + $('#character-counter').removeClass('red'); + $('#character-counter').removeClass('orange'); + $('#character-counter').addClass('grey'); + } + if((txt.length > 140) && (txt .length <= 420)) { + $('#character-counter').removeClass('grey'); + $('#character-counter').removeClass('red'); + $('#character-counter').addClass('orange'); + } + if(txt.length > 420) { + $('#character-counter').removeClass('grey'); + $('#character-counter').removeClass('orange'); + $('#character-counter').addClass('red'); + } + $('#character-counter').text(text); + }); + } }); </script> |