bgneal@12: $(document).ready(function() { bgneal@12: var submit = $('#shoutbox-submit'); bgneal@12: submit.click(function () { bgneal@12: var input = $('#shoutbox-smiley-input'); bgneal@12: var msg = input.val(); bgneal@12: msg = msg.replace(/^\s+/, ''); bgneal@12: msg = msg.replace(/\s+$/, ''); bgneal@12: if (msg.length == 0) { bgneal@12: return false; bgneal@12: } bgneal@12: submit.attr('disabled', 'disabled'); bgneal@12: $.post('/shout/shout/', { bgneal@12: msg: msg bgneal@12: }, bgneal@12: function (data, textStatus) { bgneal@12: input.val(''); bgneal@12: if (data != '') { bgneal@12: $('#shoutbox-shout-container').prepend(data); bgneal@12: $('#shoutbox-shout-container p:first').fadeIn(2500); bgneal@12: } bgneal@12: submit.removeAttr('disabled'); bgneal@12: }, bgneal@12: 'html'); bgneal@12: return false; bgneal@12: }); bgneal@12: var smilies_loaded = false; bgneal@12: var smiley_frame = $('#shoutbox-smiley-frame'); bgneal@12: $('#shoutbox-smilies').click(function () { bgneal@12: smiley_frame.toggle(); bgneal@12: if (!smilies_loaded) { bgneal@12: smiley_frame.load('/smiley/farm/', function () { bgneal@12: $('#shoutbox-busy-icon').hide(); bgneal@12: smilies_loaded = true; bgneal@12: }); bgneal@12: } bgneal@12: }); bgneal@12: }); gremmie@1: gremmie@1: function sb_smiley_click(code) gremmie@1: { gremmie@1: var txt = document.getElementById("shoutbox-smiley-input"); gremmie@1: txt.value += code; gremmie@1: txt.focus(); gremmie@1: }