diff --git a/script.js b/script.js index aaf47b4..4202ffd 100644 --- a/script.js +++ b/script.js @@ -1,6 +1,13 @@ // CoBiE Time System Implementation // Using Unix TAI epoch (January 1, 1970, 00:00:00 TAI) // Note: TAI differs from UTC by leap seconds (37 seconds as of 2025) + +(function() { +if (!window.Cobie) { + console.error('cobie.js not loaded'); + return; +} + const { COBIE_EPOCH, COBIE_UNITS, @@ -794,6 +801,7 @@ function commitInput() { span.addEventListener('click', enterEdit); } +function init() { // Timezone change handler document.getElementById('timezone').addEventListener('change', (e) => { currentTimezone = e.target.value; @@ -923,3 +931,15 @@ function wheelNavigate(e) { } document.addEventListener('wheel', wheelNavigate); + +} + +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', init); +} else { + init(); +} + +window.navigatePeriod = navigatePeriod; +window.goToNow = goToNow; +})();