bgneal@12: $(document).ready(function() { bgneal@12: var submit = $('#shoutbox-submit'); bgneal@12: submit.click(function () { bgneal@12: var input = $('#shoutbox-smiley-input'); bgneal@27: var msg = $.trim(input.val()); bgneal@12: if (msg.length == 0) { bgneal@12: return false; bgneal@12: } bgneal@12: submit.attr('disabled', 'disabled'); bgneal@150: $.ajax({ bgneal@150: url: '/shout/shout/', bgneal@150: type: 'POST', bgneal@150: data: { msg: msg }, bgneal@150: dataType: 'html', bgneal@150: success: 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@150: error: function (xhr, textStatus, ex) { bgneal@150: alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + bgneal@150: xhr.responseText); bgneal@150: } bgneal@150: }); 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@123: var txt = $("#shoutbox-smiley-input")[0]; bgneal@123: $('#shoutbox-smiley-frame img').click(function() { bgneal@123: txt.value += ' ' + this.alt + ' '; bgneal@123: txt.focus(); bgneal@123: }); bgneal@12: smilies_loaded = true; bgneal@12: }); bgneal@12: } bgneal@12: }); bgneal@12: });