aboutsummaryrefslogtreecommitdiff
path: root/mod/thewire/views/default/thewire/scripts/counter.js
diff options
context:
space:
mode:
Diffstat (limited to 'mod/thewire/views/default/thewire/scripts/counter.js')
-rw-r--r--mod/thewire/views/default/thewire/scripts/counter.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/mod/thewire/views/default/thewire/scripts/counter.js b/mod/thewire/views/default/thewire/scripts/counter.js
new file mode 100644
index 000000000..0d416fa9a
--- /dev/null
+++ b/mod/thewire/views/default/thewire/scripts/counter.js
@@ -0,0 +1,25 @@
+/**
+ * Elgg thewire text counter
+ *
+ * @package ElggTheWire
+ *
+ * @question - do we want users to be able to edit thewire?
+ *
+ * @uses $vars['entity'] Optionally, the note to view
+
+<!-- Dynamic Version by: Nannette Thacker -->
+<!-- http://www.shiningstar.net -->
+<!-- Original by : Ronnie T. Moore -->
+<!-- Web Site: The JavaScript Source -->
+<!-- Limit the number of characters per textarea -->
+*/
+
+function textCounter(field,cntfield,maxlimit) {
+ // if too long...trim it!
+ if (field.value.length > maxlimit) {
+ field.value = field.value.substring(0, maxlimit);
+ } else {
+ // otherwise, update 'characters left' counter
+ cntfield.value = maxlimit - field.value.length;
+ }
+}