diff options
Diffstat (limited to 'bootstrap/comments/frontend/onready.js')
-rw-r--r-- | bootstrap/comments/frontend/onready.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bootstrap/comments/frontend/onready.js b/bootstrap/comments/frontend/onready.js new file mode 100644 index 0000000..f740f31 --- /dev/null +++ b/bootstrap/comments/frontend/onready.js @@ -0,0 +1,14 @@ +// Execute a callback when the page HTML is parsed and ready (onready.js) +HashOverConstructor.onReady = function (callback) +{ + // Check if document HTML has been parsed + if (document.readyState === 'interactive') { + // If so, execute callback immediately + callback (); + } else { + // If not, execute callback after the DOM is parsed + document.addEventListener ('DOMContentLoaded', function () { + callback (); + }, false); + } +}; |