Mercurial > public > sg101
view media/js/shoutbox.js @ 131:5b69d6e01fd4
Creating a common way to display the smiley and markdown help dialogs for a markItUp textarea input form. Converted gcalendar over to it as a trial.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 26 Nov 2009 22:47:17 +0000 |
parents | 3ae999b0c53b |
children | b43e1288ff80 |
line wrap: on
line source
$(document).ready(function() { var submit = $('#shoutbox-submit'); submit.click(function () { var input = $('#shoutbox-smiley-input'); var msg = $.trim(input.val()); if (msg.length == 0) { return false; } submit.attr('disabled', 'disabled'); $.post('/shout/shout/', { msg: msg }, function (data, textStatus) { input.val(''); if (data != '') { $('#shoutbox-shout-container').prepend(data); $('#shoutbox-shout-container p:first').fadeIn(2500); } submit.removeAttr('disabled'); }, 'html'); return false; }); var smilies_loaded = false; var smiley_frame = $('#shoutbox-smiley-frame'); $('#shoutbox-smilies').click(function () { smiley_frame.toggle(); if (!smilies_loaded) { smiley_frame.load('/smiley/farm/', function () { $('#shoutbox-busy-icon').hide(); var txt = $("#shoutbox-smiley-input")[0]; $('#shoutbox-smiley-frame img').click(function() { txt.value += ' ' + this.alt + ' '; txt.focus(); }); smilies_loaded = true; }); } }); });