aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-14 23:55:06 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-14 23:55:06 +0000
commit002417221f727d93b20eebc40bb85509d1584880 (patch)
treee3a89e859455c3c539ca05eb7102ce1495a04d81 /mod
parent1e94b4e29b3d4989eff8d5344bf3415b3fb44b94 (diff)
downloadelgg-002417221f727d93b20eebc40bb85509d1584880.tar.gz
elgg-002417221f727d93b20eebc40bb85509d1584880.tar.bz2
Refs #3016: Why didn't you make it in last commit?
git-svn-id: http://code.elgg.org/elgg/trunk@8712 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r--mod/thewire/js/thewire.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/mod/thewire/js/thewire.js b/mod/thewire/js/thewire.js
new file mode 100644
index 000000000..61f29db81
--- /dev/null
+++ b/mod/thewire/js/thewire.js
@@ -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