diff options
Diffstat (limited to 'bootstrap/comments/frontend/getmainelement.js')
-rw-r--r-- | bootstrap/comments/frontend/getmainelement.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/bootstrap/comments/frontend/getmainelement.js b/bootstrap/comments/frontend/getmainelement.js new file mode 100644 index 0000000..58da468 --- /dev/null +++ b/bootstrap/comments/frontend/getmainelement.js @@ -0,0 +1,38 @@ +// Get main HashOver UI element (getmainelement.js) +HashOverConstructor.prototype.getMainElement = function (id) +{ + id = id || 'hashover'; + + // Attempt to get main HashOver element + var element = document.getElementById (id); + + // Check if the HashOver element exists + if (element === null) { + // If not, get HashOver script tag + var script = this.constructor.script; + + // Create div tag for HashOver comments to appear in + element = this.elements.create ('div', { id: id }); + + // Place the main HashOver element on the page + script.parentNode.insertBefore (element, script); + } + + // Add main HashOver class + this.classes.add (element, 'hashover'); + + // Check if HashOver is prepared + if (this.constructor.prepared === true) { + // If so, add class for differentiating desktop and mobile styling + this.classes.add (element, 'hashover-' + this.setup['device-type']); + + // And add class to indicate user login status + if (this.setup['user-is-logged-in'] === true) { + this.classes.add (element, 'hashover-logged-in'); + } else { + this.classes.add (element, 'hashover-logged-out'); + } + } + + return element; +}; |