From 59899b9395df42b54a46295b6da7c8918799d131 Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 3 Apr 2017 07:24:50 +0300 Subject: [PATCH] explicitly use 'window' when getting its properties --- edit.js | 10 +++++----- manage.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) 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); }