From 2c22d98421ce05b71a8f3b510fcc6deeece579e2 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 4 Jul 2018 01:16:18 +0300 Subject: [PATCH] code cosmetics; old typo fixup --- content/install-hook-userstyles.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/content/install-hook-userstyles.js b/content/install-hook-userstyles.js index 13428915..d7560a23 100644 --- a/content/install-hook-userstyles.js +++ b/content/install-hook-userstyles.js @@ -10,8 +10,7 @@ chrome.runtime.onMessage.addListener(onMessage); - document.addEventListener('DOMContentLoaded', function _() { - document.removeEventListener('DOMContentLoaded', _); + onDOMready().then(() => { window.postMessage({ direction: 'from-content-script', message: 'StylishInstalled', @@ -42,7 +41,6 @@ sendEvent(sendEvent.lastEvent); }); }); - return; } } @@ -324,9 +322,8 @@ // In Chrome content script is orphaned on an extension update/reload // so we need to detach event listeners window.removeEventListener(chrome.runtime.id + '-install', orphanCheck, true); - ['Update', 'Install'].forEach(type => - ['', 'Chrome', 'Opera'].forEach(browser => - document.addEventListener('stylish' + type + browser, onClick))); + document.removeEventListener('stylishInstallChrome', onClick); + document.removeEventListener('stylishUpdateChrome', onClick); try { chrome.runtime.onMessage.removeListener(onMessage); } catch (e) {}