annotate media/js/shoutbox.js @ 81:e356ea79a7a2

More work on forums. Committing what we got so far.
author Brian Neal <bgneal@gmail.com>
date Sun, 23 Aug 2009 00:14:52 +0000
parents 03144b0d470d
children 3ae999b0c53b
rev   line source
bgneal@12 1 $(document).ready(function() {
bgneal@12 2 var submit = $('#shoutbox-submit');
bgneal@12 3 submit.click(function () {
bgneal@12 4 var input = $('#shoutbox-smiley-input');
bgneal@27 5 var msg = $.trim(input.val());
bgneal@12 6 if (msg.length == 0) {
bgneal@12 7 return false;
bgneal@12 8 }
bgneal@12 9 submit.attr('disabled', 'disabled');
bgneal@12 10 $.post('/shout/shout/', {
bgneal@12 11 msg: msg
bgneal@12 12 },
bgneal@12 13 function (data, textStatus) {
bgneal@12 14 input.val('');
bgneal@12 15 if (data != '') {
bgneal@12 16 $('#shoutbox-shout-container').prepend(data);
bgneal@12 17 $('#shoutbox-shout-container p:first').fadeIn(2500);
bgneal@12 18 }
bgneal@12 19 submit.removeAttr('disabled');
bgneal@12 20 },
bgneal@12 21 'html');
bgneal@12 22 return false;
bgneal@12 23 });
bgneal@12 24 var smilies_loaded = false;
bgneal@12 25 var smiley_frame = $('#shoutbox-smiley-frame');
bgneal@12 26 $('#shoutbox-smilies').click(function () {
bgneal@12 27 smiley_frame.toggle();
bgneal@12 28 if (!smilies_loaded) {
bgneal@12 29 smiley_frame.load('/smiley/farm/', function () {
bgneal@12 30 $('#shoutbox-busy-icon').hide();
bgneal@12 31 smilies_loaded = true;
bgneal@12 32 });
bgneal@12 33 }
bgneal@12 34 });
bgneal@12 35 });
gremmie@1 36
gremmie@1 37 function sb_smiley_click(code)
gremmie@1 38 {
gremmie@1 39 var txt = document.getElementById("shoutbox-smiley-input");
gremmie@1 40 txt.value += code;
gremmie@1 41 txt.focus();
gremmie@1 42 }