diff --git a/web/app/counter.js b/web/app/counter.js index bd81c8dd..70cd8f0f 100644 --- a/web/app/counter.js +++ b/web/app/counter.js @@ -2,7 +2,7 @@ import { COUNTER_NODE_CLASSNAME } from './common/constants' import api from 'common/api'; -if (document.readyState !== 'interactive') { +if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); diff --git a/web/app/embed.js b/web/app/embed.js index 1e4ab8e4..60bd56e0 100644 --- a/web/app/embed.js +++ b/web/app/embed.js @@ -1,6 +1,6 @@ import { BASE_URL, NODE_ID } from 'common/constants'; -if (document.readyState !== 'interactive') { +if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); diff --git a/web/app/last-comments.js b/web/app/last-comments.js index 1fc1ee72..b8880ca5 100644 --- a/web/app/last-comments.js +++ b/web/app/last-comments.js @@ -6,7 +6,7 @@ import api from 'common/api'; import ListComments from 'components/list-comments'; -if (document.readyState !== 'interactive') { +if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); diff --git a/web/app/remark.js b/web/app/remark.js index 0b28667a..5e504410 100644 --- a/web/app/remark.js +++ b/web/app/remark.js @@ -9,7 +9,11 @@ import { NODE_ID } from './common/constants'; require('./components/document'); -init(); +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', init); +} else { + init(); +} function init() { const node = document.getElementById(NODE_ID);