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