Mercurial > public > sg101
annotate media/js/shoutbox.js @ 144:49b713bca29d
Podcast: un-inlined the channel items from the channel. That would be too bulky and too much info on one admin screen.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 06 Dec 2009 21:44:22 +0000 |
parents | 3ae999b0c53b |
children | b43e1288ff80 |
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@123 | 31 var txt = $("#shoutbox-smiley-input")[0]; |
bgneal@123 | 32 $('#shoutbox-smiley-frame img').click(function() { |
bgneal@123 | 33 txt.value += ' ' + this.alt + ' '; |
bgneal@123 | 34 txt.focus(); |
bgneal@123 | 35 }); |
bgneal@12 | 36 smilies_loaded = true; |
bgneal@12 | 37 }); |
bgneal@12 | 38 } |
bgneal@12 | 39 }); |
bgneal@12 | 40 }); |