diff --git a/edit.js b/edit.js index dbaca5ba..3ea0dcf0 100644 --- a/edit.js +++ b/edit.js @@ -1113,8 +1113,8 @@ function init() { section[CssToProperty[i]] = [params[i]]; } } - onload = () => { - onload = null; + window.onload = () => { + window.onload = null; addSection(null, section); // default to enabled document.getElementById("enabled").checked = true @@ -1132,12 +1132,12 @@ function init() { } styleId = style.id; setStyleMeta(style); - onload = () => { - onload = null; + window.onload = () => { + window.onload = null; initWithStyle({style}); }; if (document.readyState != 'loading') { - onload(); + window.onload(); } }); } diff --git a/manage.js b/manage.js index 5c40de81..c4a3309a 100644 --- a/manage.js +++ b/manage.js @@ -70,7 +70,7 @@ function showStyles(styles = []) { const sorted = styles .map(style => ({name: style.name.toLocaleLowerCase(), style})) .sort((a, b) => (a.name < b.name ? -1 : a.name == b.name ? 0 : 1)); - const shouldRenderAll = history.state && history.state.scrollY > innerHeight; + const shouldRenderAll = (history.state || {}).scrollY > window.innerHeight; const renderBin = document.createDocumentFragment(); tDocLoader.stop(); renderStyles(0); @@ -477,7 +477,7 @@ function searchStyles({immediately, container}) { function rememberScrollPosition() { - history.replaceState({scrollY}, document.title); + history.replaceState({scrollY: window.scrollY}, document.title); }