diff options
Diffstat (limited to 'bootstrap/comments/api/frontends/latest/init.js')
-rw-r--r-- | bootstrap/comments/api/frontends/latest/init.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bootstrap/comments/api/frontends/latest/init.js b/bootstrap/comments/api/frontends/latest/init.js new file mode 100644 index 0000000..77185cd --- /dev/null +++ b/bootstrap/comments/api/frontends/latest/init.js @@ -0,0 +1,37 @@ +// HashOver latest comments UI initialization process (init.js) +HashOverLatest.prototype.init = function () +{ + // Shorthand + var comments = this.instance.comments.primary; + + // Initial comments HTML + var html = ''; + + // Append theme CSS if enabled + this.optionalMethod ('appendCSS', [ 'hashover-widget' ]); + + // Add main HashOver element to this HashOver instance + this.instance['main-element'] = this.getMainElement ('hashover-widget'); + + // Templatify UI HTML strings + for (var element in this.ui) { + this.ui[element] = this.strings.templatify (this.ui[element]); + } + + // Parse every comment + for (var i = 0, il = comments.length; i < il; i++) { + html += this.comments.parse (comments[i]); + } + + // Add comments to element's innerHTML + if ('insertAdjacentHTML' in this.instance['main-element']) { + this.instance['main-element'].insertAdjacentHTML ('beforeend', html); + } else { + this.instance['main-element'].innerHTML = html; + } + + // Add control events + for (var i = 0, il = comments.length; i < il; i++) { + this.addControls (comments[i]); + } +}; |