Mercurial > public > sg101
annotate media/js/shoutbox.js @ 25:81e2449a5932
Center the text in the IRC status block.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 19 Apr 2009 21:58:47 +0000 |
parents | f408971657b9 |
children | 03144b0d470d |
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@12 | 5 var msg = input.val(); |
bgneal@12 | 6 msg = msg.replace(/^\s+/, ''); |
bgneal@12 | 7 msg = msg.replace(/\s+$/, ''); |
bgneal@12 | 8 if (msg.length == 0) { |
bgneal@12 | 9 return false; |
bgneal@12 | 10 } |
bgneal@12 | 11 submit.attr('disabled', 'disabled'); |
bgneal@12 | 12 $.post('/shout/shout/', { |
bgneal@12 | 13 msg: msg |
bgneal@12 | 14 }, |
bgneal@12 | 15 function (data, textStatus) { |
bgneal@12 | 16 input.val(''); |
bgneal@12 | 17 if (data != '') { |
bgneal@12 | 18 $('#shoutbox-shout-container').prepend(data); |
bgneal@12 | 19 $('#shoutbox-shout-container p:first').fadeIn(2500); |
bgneal@12 | 20 } |
bgneal@12 | 21 submit.removeAttr('disabled'); |
bgneal@12 | 22 }, |
bgneal@12 | 23 'html'); |
bgneal@12 | 24 return false; |
bgneal@12 | 25 }); |
bgneal@12 | 26 var smilies_loaded = false; |
bgneal@12 | 27 var smiley_frame = $('#shoutbox-smiley-frame'); |
bgneal@12 | 28 $('#shoutbox-smilies').click(function () { |
bgneal@12 | 29 smiley_frame.toggle(); |
bgneal@12 | 30 if (!smilies_loaded) { |
bgneal@12 | 31 smiley_frame.load('/smiley/farm/', function () { |
bgneal@12 | 32 $('#shoutbox-busy-icon').hide(); |
bgneal@12 | 33 smilies_loaded = true; |
bgneal@12 | 34 }); |
bgneal@12 | 35 } |
bgneal@12 | 36 }); |
bgneal@12 | 37 }); |
gremmie@1 | 38 |
gremmie@1 | 39 function sb_smiley_click(code) |
gremmie@1 | 40 { |
gremmie@1 | 41 var txt = document.getElementById("shoutbox-smiley-input"); |
gremmie@1 | 42 txt.value += code; |
gremmie@1 | 43 txt.focus(); |
gremmie@1 | 44 } |