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