1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Displays reply form (replytocomment.js)
HashOver.prototype.replyToComment = function (permalink)
{
// Reference to this object
var hashover = this;
// Get reply link element
var link = this.elements.get ('reply-link-' + permalink, true);
// Get file
var file = this.permalinks.getFile (permalink);
// Create reply form element
var form = this.elements.create ('form', {
id: 'hashover-reply-' + permalink,
className: 'hashover-reply-form',
action: '/formactions',
method: 'post'
});
// Place reply fields into form
form.innerHTML = hashover.strings.parseTemplate (hashover.ui['reply-form'], {
permalink: permalink,
file: file
});
// Prevent input submission
this.preventSubmit (form);
// Add form to page
var replyForm = this.elements.get ('placeholder-reply-form-' + permalink, true);
replyForm.appendChild (form);
// Change "Reply" link to "Cancel" link
this.cancelSwitcher ('reply', link, replyForm, permalink);
// Attach event listeners to "Post Reply" button
var postReply = this.elements.get ('reply-post-' + permalink, true);
// Get the element of comment being replied to
var destination = this.elements.get (permalink, true);
// Attach click event to formatting revealer hyperlink
this.formattingOnclick ('reply', permalink);
// Set onclick and onsubmit event handlers
this.elements.duplicateProperties (postReply, [ 'onclick', 'onsubmit' ], function () {
return hashover.postComment (destination, form, this, hashover.AJAXPost, 'reply', permalink, link.onclick, true, false);
});
// Focus comment field
form.comment.focus ();
return true;
};
|