aboutsummaryrefslogtreecommitdiff
path: root/mod/thewire
diff options
context:
space:
mode:
Diffstat (limited to 'mod/thewire')
-rw-r--r--mod/thewire/start.php4
-rw-r--r--mod/thewire/views/default/forms/thewire/add.php36
2 files changed, 6 insertions, 34 deletions
diff --git a/mod/thewire/start.php b/mod/thewire/start.php
index 1724a33a9..c2006ddb0 100644
--- a/mod/thewire/start.php
+++ b/mod/thewire/start.php
@@ -20,6 +20,8 @@ function thewire_init() {
if (!update_subtype('object', 'thewire', 'ElggWire')) {
add_subtype('object', 'thewire', 'ElggWire');
}
+
+ elgg_register_js('elgg.thewire', 'mod/thewire/js/thewire.js', 'footer');
// add a site navigation item
$item = new ElggMenuItem('thewire', elgg_echo('thewire'), 'thewire/all');
@@ -261,7 +263,7 @@ function thewire_save_post($text, $userid, $access_id, $parent_guid = 0, $method
if ($parent_guid) {
$post->addRelationship($parent_guid, 'parent');
- // name conversation threads by guid of first post (works even if first post deleted)
+ // name conversation threads by guid of first post (works even if first post deleted)
$parent_post = get_entity($parent_guid);
$post->wire_thread = $parent_post->wire_thread;
} else {
diff --git a/mod/thewire/views/default/forms/thewire/add.php b/mod/thewire/views/default/forms/thewire/add.php
index 956ec7c27..67585b0df 100644
--- a/mod/thewire/views/default/forms/thewire/add.php
+++ b/mod/thewire/views/default/forms/thewire/add.php
@@ -5,6 +5,8 @@
* @uses $vars['post']
*/
+elgg_load_js('elgg.thewire');
+
$post = elgg_extract('post', $vars);
$text = elgg_echo('post');
@@ -30,37 +32,5 @@ echo elgg_view('input/submit', array(
'value' => $text,
'id' => 'thewire-submit-button',
));
-
?>
-</div>
-<script type="text/javascript">
-
-$(document).ready(function() {
- $("#thewire-textarea").bind('keydown', function() {
- textCounter(this, $("#thewire-characters-remaining span"), 140);
- });
- $("#thewire-textarea").bind('keyup', function() {
- textCounter(this, $("#thewire-characters-remaining span"), 140);
- });
-});
-
-function textCounter(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").css('background', '#999999');
- $("#thewire-submit-button").css('border-color', '#999999');
- $("#thewire-submit-button").css('cursor', 'default');
- } else {
- status.parent().css("color", "");
- $("#thewire-submit-button").removeAttr('disabled', 'disabled');
- $("#thewire-submit-button").css('background', '#4690d6');
- $("#thewire-submit-button").css('border-color', '#4690d6');
- $("#thewire-submit-button").css('cursor', 'pointer');
- }
-}
-</script>
+</div> \ No newline at end of file