]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/js/edit-comments.js
Wordpress 2.3.2
[autoinstalls/wordpress.git] / wp-admin / js / edit-comments.js
1 addLoadEvent(function() {
2         theCommentList = new listMan('the-comment-list');
3         if ( !theCommentList )
4                 return false;
5
6         theExtraCommentList = new listMan('the-extra-comment-list');
7         if ( theExtraCommentList ) {
8                 theExtraCommentList.showLink = 0;
9                 theExtraCommentList.altOffset = 1;
10                 if ( theExtraCommentList.theList && theExtraCommentList.theList.childNodes )
11                         var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length;
12                 else
13                         var commentNum = 0;
14                 var urlQ   = document.location.href.split('?');
15                 var params = urlQ[1] ? urlQ[1].toQueryParams() : [];
16                 var search = params['s'] ? params['s'] : '';
17                 var page   = params['apage'] ? params['apage'] : 1;
18         }
19
20         theCommentList.dimComplete = function(what,id,dimClass) {
21                 var m = document.getElementById('awaitmod');
22                 if ( document.getElementById(what + '-' + id).className.match(dimClass) )
23                         m.innerHTML = parseInt(m.innerHTML,10) + 1;
24                 else
25                         m.innerHTML = parseInt(m.innerHTML,10) - 1;
26         }
27
28         theCommentList.delComplete = function(what,id) {
29                 var m = document.getElementById('awaitmod');
30                 what = what.split('-')[0];
31                 if ( document.getElementById(what + '-' + id).className.match('unapproved') )
32                         m.innerHTML = parseInt(m.innerHTML,10) - 1;
33                 if ( theExtraCommentList && commentNum ) {
34                         var theMover = theExtraCommentList.theList.childNodes[0];
35                         Element.removeClassName(theMover,'alternate');
36                         theCommentList.theList.appendChild(theMover);
37                         theExtraCommentList.inputData += '&page=' + page;
38                         if ( search )
39                                 theExtraCommentList.inputData += '&s=' + search; // trust the URL not the search box
40                         theExtraCommentList.addComplete = function() {
41                                 if ( theExtraCommentList.theList.childNodes )
42                                         var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length;
43                                 else
44                                         var commentNum = 0;
45                         }
46                         theExtraCommentList.ajaxAdder( 'comment', 'ajax-response' ); // Dummy Request
47                 }
48         }
49
50         if ( theList ) // the post list: edit.php
51                 theList.delComplete = function() {
52                         var comments = document.getElementById('comments');
53                         var commdel = encloseFunc(function(a){a.parentNode.removeChild(a);},comments);
54                         var listdel = encloseFunc(function(a){a.parentNode.removeChild(a);},theCommentList.theList);
55                         setTimeout(commdel,705);
56                         setTimeout(listdel,705);
57                 }
58 });
59