]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #3016: Why didn't you make it in last commit?
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 14 Mar 2011 23:55:06 +0000 (23:55 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 14 Mar 2011 23:55:06 +0000 (23:55 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8712 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/thewire/js/thewire.js [new file with mode: 0644]

diff --git a/mod/thewire/js/thewire.js b/mod/thewire/js/thewire.js
new file mode 100644 (file)
index 0000000..61f29db
--- /dev/null
@@ -0,0 +1,28 @@
+elgg.provide('elgg.thewire');
+
+elgg.thewire.init = function() {
+       $("#thewire-textarea").live('keydown', function() {
+               elgg.thewire.textCounter(this, $("#thewire-characters-remaining span"), 140);
+       });
+       $("#thewire-textarea").live('keyup', function() {
+               elgg.thewire.textCounter(this, $("#thewire-characters-remaining span"), 140);
+       });
+}
+
+elgg.thewire.textCounter = function(textarea, status, limit) {
+
+       var remaining_chars = limit - textarea.value.length;
+       status.html(remaining_chars);
+
+       if (remaining_chars < 0) {
+               status.parent().css("color", "#D40D12");
+               $("#thewire-submit-button").attr('disabled', 'disabled');
+               $("#thewire-submit-button").addClass('elgg-state-disabled');
+       } else {
+               status.parent().css("color", "");
+               $("#thewire-submit-button").removeAttr('disabled', 'disabled');
+               $("#thewire-submit-button").removeClass('elgg-state-disabled');
+       }
+}
+
+elgg.register_hook_handler('init', 'system', elgg.thewire.init);
\ No newline at end of file