From edff5b5289f80be89e4fc6b072ccd84812960349 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Sat, 7 Aug 2010 02:53:59 -0700 Subject: [PATCH] character counter --- view/jot-header.tpl | 26 +++++++++++++++++++++++++- view/jot.tpl | 8 +++++--- view/photo_item.tpl | 22 ++++++++++++++++++++++ view/style.css | 26 ++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 view/photo_item.tpl 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); + }); + } }); diff --git a/view/jot.tpl b/view/jot.tpl index 9e9ab6468..718277210 100644 --- a/view/jot.tpl +++ b/view/jot.tpl @@ -1,8 +1,10 @@
-

-What's on your mind? -

+
+
What's on your mind?
+
+
+
diff --git a/view/photo_item.tpl b/view/photo_item.tpl new file mode 100644 index 000000000..ca9ead592 --- /dev/null +++ b/view/photo_item.tpl @@ -0,0 +1,22 @@ +
+
+ + $name +
+ +
+ $name +
$ago
+
+
+
$title
+
$body
+
+ $drop +
+
+ $comment +
+ +
+ diff --git a/view/style.css b/view/style.css index fa7fa58c0..4fa962033 100644 --- a/view/style.css +++ b/view/style.css @@ -1282,4 +1282,30 @@ input#dfrn-url { #photos-upload-no-java-message { margin-bottom: 15px; +} + +#profile-jot-desc { + float: left; + width: 480px; + margin-top: 10px; + margin-bottom: 10px; +} +#character-counter { + float: left; + font-size: 120%; +} + +#character-counter.grey { + color: #888888; +} + +#character-counter.orange { + color: orange; +} +#character-counter.red { + color: red; +} + +#profile-jot-banner-end { + clear: both; } \ No newline at end of file