annotate media/js/shoutbox_app.js @ 201:bc958bc3c6eb

Futzing with CSS side blocks
author Brian Neal <bgneal@gmail.com>
date Mon, 12 Apr 2010 02:56:31 +0000
parents b43e1288ff80
children
rev   line source
gremmie@1 1 $(document).ready(function() {
gremmie@1 2 $('div.shoutbox-history table tr:odd').addClass('odd');
gremmie@1 3 $('.edit').editable('/shout/edit/', {
gremmie@1 4 loadurl : '/shout/text/',
gremmie@1 5 indicator : 'Saving...',
gremmie@1 6 tooltip : 'Click to edit your shout...',
gremmie@1 7 submit : 'OK',
gremmie@1 8 cancel : 'Cancel'
gremmie@1 9 });
bgneal@13 10 $('a.shout-del').click(function () {
gremmie@1 11 if (confirm('Really delete this shout?')) {
gremmie@1 12 var id = this.id;
bgneal@13 13 if (id.match(/^shout-del-(\d+)/)) {
bgneal@150 14 $.ajax({
bgneal@150 15 url: '/shout/delete/',
bgneal@150 16 type: 'POST',
bgneal@150 17 data: { id : RegExp.$1 },
bgneal@150 18 dataType: 'text',
bgneal@150 19 success: function (id) {
gremmie@1 20 var id = '#shout-del-' + id;
gremmie@1 21 $(id).parents('tr').fadeOut(1500, function () {
gremmie@1 22 $('div.shoutbox-history table tr:visible:even').removeClass('odd');
gremmie@1 23 $('div.shoutbox-history table tr:visible:odd').addClass('odd');
gremmie@1 24 });
bgneal@150 25 },
bgneal@150 26 error: function (xhr, textStatus, ex) {
bgneal@150 27 alert('Oops, an error occurred. ' + xhr.statusText + ' - ' +
bgneal@150 28 xhr.responseText);
bgneal@150 29 }
bgneal@150 30 });
gremmie@1 31 }
gremmie@1 32 }
gremmie@1 33 return false;
gremmie@1 34 });
bgneal@13 35 $('.shout-flag').click(function () {
bgneal@13 36 var id = this.id;
bgneal@13 37 if (id.match(/^shout-flag-(\d+)/)) {
bgneal@13 38 id = RegExp.$1;
bgneal@13 39 if (confirm('Only flag a shout if you feel it is spam, abuse, violates site rules, ' +
bgneal@13 40 'or is not appropriate. ' +
bgneal@13 41 'A moderator will be notified and will review the shout. ' +
bgneal@13 42 'Are you sure you want to flag this shout?')) {
bgneal@150 43 $.ajax({
bgneal@150 44 url: '/shout/flag/',
bgneal@150 45 type: 'POST',
bgneal@150 46 data: { id : id },
bgneal@150 47 dataType: 'text',
bgneal@150 48 success: function(response) {
bgneal@150 49 alert(response);
bgneal@150 50 },
bgneal@150 51 error: function (xhr, textStatus, ex) {
bgneal@150 52 alert('Oops, an error occurred. ' + xhr.statusText + ' - ' +
bgneal@150 53 xhr.responseText);
bgneal@150 54 }
bgneal@150 55 });
bgneal@13 56 }
bgneal@13 57 }
bgneal@13 58 return false;
bgneal@13 59 });
bgneal@150 60 });