(function() { var global = this; var lib = global.pastebin = { urlRoot : '/', autoHideFlashes : function() { var flashes = $('p.flash:visible').hide(); if (flashes.length) { flashes.slideDown('fast'); window.setTimeout(function() { flashes.slideUp('slow'); }, 5000); } }, flash : function(message) { $('
') .append(message) .hide() .insertAfter('ul.nav') .slideDown('fast'); }, onNewReply : function(reply, type) { var pasteDescription = ''; if (type == 'user') { pasteDescription = 'your paste #' + reply.paste_id + ''; } else { pasteDescription = 'this paste'; } var msg = $('New reply to ' + pasteDescription + ': #' + reply.reply_id + ''); if (reply.author) msg.append($('').text(' ' + reply.author)) lib.flash(msg); } }; $(function() { /* animate the server side flashes a bit */ lib.autoHideFlashes(); }); })();