]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/js/comment-reply.dev.js
Wordpress 2.9
[autoinstalls/wordpress.git] / wp-includes / js / comment-reply.dev.js
1
2 addComment = {
3         moveForm : function(commId, parentId, respondId, postId) {
4                 var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID');
5
6                 if ( ! comm || ! respond || ! cancel || ! parent )
7                         return;
8
9                 t.respondId = respondId;
10                 postId = postId || false;
11
12                 if ( ! t.I('wp-temp-form-div') ) {
13                         div = document.createElement('div');
14                         div.id = 'wp-temp-form-div';
15                         div.style.display = 'none';
16                         respond.parentNode.insertBefore(div, respond);
17                 }
18
19                 comm.parentNode.insertBefore(respond, comm.nextSibling);
20                 if ( post && postId )
21                         post.value = postId;
22                 parent.value = parentId;
23                 cancel.style.display = '';
24
25                 cancel.onclick = function() {
26                         var t = addComment, temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId);
27
28                         if ( ! temp || ! respond )
29                                 return;
30
31                         t.I('comment_parent').value = '0';
32                         temp.parentNode.insertBefore(respond, temp);
33                         temp.parentNode.removeChild(temp);
34                         this.style.display = 'none';
35                         this.onclick = null;
36                         return false;
37                 }
38
39                 try { t.I('comment').focus(); }
40                 catch(e) {}
41
42                 return false;
43         },
44
45         I : function(e) {
46                 return document.getElementById(e);
47         }
48 }