aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/comments/frontend/parseall.js
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/comments/frontend/parseall.js')
-rw-r--r--bootstrap/comments/frontend/parseall.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/bootstrap/comments/frontend/parseall.js b/bootstrap/comments/frontend/parseall.js
new file mode 100644
index 0000000..eb6f907
--- /dev/null
+++ b/bootstrap/comments/frontend/parseall.js
@@ -0,0 +1,27 @@
+// Run all comments in array data through comments.parse function (parseall.js)
+HashOver.prototype.parseAll = function (comments, element, collapse, popular, sort, method)
+{
+ popular = popular || false;
+ sort = sort || false;
+ method = method || 'ascending';
+
+ // Comments HTML
+ var html = '';
+
+ // Parse every comment
+ for (var i = 0, il = comments.length; i < il; i++) {
+ html += this.comments.parse (comments[i], null, collapse, sort, method, popular);
+ }
+
+ // Add comments to element's innerHTML
+ if ('insertAdjacentHTML' in element) {
+ element.insertAdjacentHTML ('beforeend', html);
+ } else {
+ element.innerHTML = html;
+ }
+
+ // Add control events
+ for (var i = 0, il = comments.length; i < il; i++) {
+ this.addControls (comments[i]);
+ }
+};