aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/comments/frontend/onready.js
blob: f740f318eabe369cda6131a8afe7b219b7930b86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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);
	}
};