view media/js/shoutbox.js @ 23:a5f27f25fa52

Added a latest_downloads template tag. Made the comments view the details view for a download. Changed get_absolute_url to point to this new view.
author Brian Neal <bgneal@gmail.com>
date Sun, 19 Apr 2009 21:16:59 +0000
parents f408971657b9
children 03144b0d470d
line wrap: on
line source
$(document).ready(function() {
   var submit = $('#shoutbox-submit');
   submit.click(function () {
      var input = $('#shoutbox-smiley-input');
      var msg = input.val();
      msg = msg.replace(/^\s+/, '');
      msg = msg.replace(/\s+$/, '');
      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();
            smilies_loaded = true;
         });
      }
   });
});

function sb_smiley_click(code)
{
    var txt = document.getElementById("shoutbox-smiley-input");
    txt.value += code;
    txt.focus();
}