annotate media/js/shoutbox.js @ 20:c0d0779b266f

Created a template tag for the latest weblinks: latest_weblinks. This necessitated adding a get_absolute_url function for the Link model along with a new view for it.
author Brian Neal <bgneal@gmail.com>
date Sun, 19 Apr 2009 20:41:37 +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 }