diff options
Diffstat (limited to 'bootstrap/comments/frontend/postcomment.js')
-rw-r--r-- | bootstrap/comments/frontend/postcomment.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bootstrap/comments/frontend/postcomment.js b/bootstrap/comments/frontend/postcomment.js new file mode 100644 index 0000000..9934af9 --- /dev/null +++ b/bootstrap/comments/frontend/postcomment.js @@ -0,0 +1,30 @@ +// For posting comments, both traditionally and via AJAX (postcomment.js) +HashOver.prototype.postComment = function (destination, form, button, callback, type, permalink, close, isReply, isEdit) +{ + type = type || 'main'; + permalink = permalink || ''; + isReply = isReply || false; + isEdit = isEdit || false; + + // Return false if comment is invalid + if (this.validateComment (false, form, type, permalink, isReply, isEdit) === false) { + return false; + } + + // Disable button + setTimeout (function () { + button.disabled = true; + }, 500); + + // Post by sending an AJAX request if enabled + if (this.postRequest) { + return this.postRequest.apply (this, arguments); + } + + // Re-enable button after 20 seconds + setTimeout (function () { + button.disabled = false; + }, 20000); + + return true; +}; |