annotate media/js/shoutbox_app.js @ 99:10d6182b9f6e
Forums: added error handling to the flagging of posts. Did the same with the comments function too.
author |
Brian Neal <bgneal@gmail.com> |
date |
Mon, 14 Sep 2009 00:06:08 +0000 |
parents |
777451a98f9d |
children |
b43e1288ff80 |
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+)/)) {
|
gremmie@1
|
14 $.post('/shout/delete/', { id : RegExp.$1 }, function (id) {
|
gremmie@1
|
15 var id = '#shout-del-' + id;
|
gremmie@1
|
16 $(id).parents('tr').fadeOut(1500, function () {
|
gremmie@1
|
17 $('div.shoutbox-history table tr:visible:even').removeClass('odd');
|
gremmie@1
|
18 $('div.shoutbox-history table tr:visible:odd').addClass('odd');
|
gremmie@1
|
19 });
|
gremmie@1
|
20 }, 'text');
|
gremmie@1
|
21 }
|
gremmie@1
|
22 }
|
gremmie@1
|
23 return false;
|
gremmie@1
|
24 });
|
bgneal@13
|
25 $('.shout-flag').click(function () {
|
bgneal@13
|
26 var id = this.id;
|
bgneal@13
|
27 if (id.match(/^shout-flag-(\d+)/)) {
|
bgneal@13
|
28 id = RegExp.$1;
|
bgneal@13
|
29 if (confirm('Only flag a shout if you feel it is spam, abuse, violates site rules, ' +
|
bgneal@13
|
30 'or is not appropriate. ' +
|
bgneal@13
|
31 'A moderator will be notified and will review the shout. ' +
|
bgneal@13
|
32 'Are you sure you want to flag this shout?')) {
|
bgneal@13
|
33 $.post('/shout/flag/', { id : id }, function(response) {
|
bgneal@13
|
34 alert(response);
|
bgneal@13
|
35 }, 'text');
|
bgneal@13
|
36 }
|
bgneal@13
|
37 }
|
bgneal@13
|
38 return false;
|
bgneal@13
|
39 });
|
gremmie@1
|
40 });
|