diff media/js/shoutbox_app.js @ 1:dbd703f7d63a

Initial import of sg101 stuff from private repository.
author gremmie
date Mon, 06 Apr 2009 02:43:12 +0000
parents
children 777451a98f9d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/media/js/shoutbox_app.js	Mon Apr 06 02:43:12 2009 +0000
@@ -0,0 +1,25 @@
+$(document).ready(function() {
+     $('div.shoutbox-history table tr:odd').addClass('odd');
+     $('.edit').editable('/shout/edit/', {
+         loadurl : '/shout/text/',
+         indicator : 'Saving...',
+         tooltip   : 'Click to edit your shout...',
+         submit : 'OK',
+         cancel : 'Cancel'
+     });
+     $('.shout-del').click(function () {
+         if (confirm('Really delete this shout?')) {
+             var id = this.id;
+             if (id.match(/shout-del-(\d+)/)) {
+                $.post('/shout/delete/', { id : RegExp.$1 }, function (id) {
+                    var id = '#shout-del-' + id;
+                    $(id).parents('tr').fadeOut(1500, function () {
+                        $('div.shoutbox-history table tr:visible:even').removeClass('odd');
+                        $('div.shoutbox-history table tr:visible:odd').addClass('odd');
+                        });
+                    }, 'text');
+             }            
+         }
+         return false;
+     });
+ });