bgneal@312: $(document).ready(function() { bgneal@312: $('div.shoutbox-history table tr:odd').addClass('odd'); bgneal@312: $('.edit').editable('/shout/edit/', { bgneal@312: loadurl : '/shout/text/', bgneal@312: indicator : 'Saving...', bgneal@312: tooltip : 'Click to edit your shout...', bgneal@312: submit : 'OK', bgneal@312: cancel : 'Cancel' bgneal@312: }); bgneal@312: $('a.shout-del').click(function () { bgneal@312: if (confirm('Really delete this shout?')) { bgneal@312: var id = this.id; bgneal@312: if (id.match(/^shout-del-(\d+)/)) { bgneal@312: $.ajax({ bgneal@312: url: '/shout/delete/', bgneal@312: type: 'POST', bgneal@312: data: { id : RegExp.$1 }, bgneal@312: dataType: 'text', bgneal@312: success: function (id) { bgneal@312: var id = '#shout-del-' + id; bgneal@312: $(id).parents('tr').fadeOut(1500, function () { bgneal@312: $('div.shoutbox-history table tr:visible:even').removeClass('odd'); bgneal@312: $('div.shoutbox-history table tr:visible:odd').addClass('odd'); bgneal@312: }); bgneal@312: }, bgneal@312: error: function (xhr, textStatus, ex) { bgneal@312: alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + bgneal@312: xhr.responseText); bgneal@312: } bgneal@312: }); bgneal@312: } bgneal@312: } bgneal@312: return false; bgneal@312: }); bgneal@312: $('.shout-flag').click(function () { bgneal@312: var id = this.id; bgneal@312: if (id.match(/^shout-flag-(\d+)/)) { bgneal@312: id = RegExp.$1; bgneal@312: if (confirm('Only flag a shout if you feel it is spam, abuse, violates site rules, ' + bgneal@312: 'or is not appropriate. ' + bgneal@312: 'A moderator will be notified and will review the shout. ' + bgneal@312: 'Are you sure you want to flag this shout?')) { bgneal@312: $.ajax({ bgneal@312: url: '/shout/flag/', bgneal@312: type: 'POST', bgneal@312: data: { id : id }, bgneal@312: dataType: 'text', bgneal@312: success: function(response) { bgneal@312: alert(response); bgneal@312: }, bgneal@312: error: function (xhr, textStatus, ex) { bgneal@312: alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + bgneal@312: xhr.responseText); bgneal@312: } bgneal@312: }); bgneal@312: } bgneal@312: } bgneal@312: return false; bgneal@312: }); bgneal@312: });