From db256f73f56f9d6dff05a963877adc34c4c63035 Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 2 Mar 2018 15:55:39 +0300 Subject: [PATCH] send style status to USO twice if #install_button reappears see #354 --- content/install-hook-userstyles.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/install-hook-userstyles.js b/content/install-hook-userstyles.js index 8e42db4e..d3b2ffbb 100644 --- a/content/install-hook-userstyles.js +++ b/content/install-hook-userstyles.js @@ -16,7 +16,7 @@ chrome.runtime.onMessage.addListener(onMessage); let gotBody = false; - new MutationObserver((mutations, observer) => { + new MutationObserver(function _(mutations, observer) { if (!gotBody) { if (!document.body) return; gotBody = true; @@ -29,11 +29,12 @@ return; } if (document.getElementById('install_button')) { - observer.disconnect(); + if (observer) observer.disconnect(); onDOMready().then(() => { requestAnimationFrame(() => { sendEvent(sendEvent.lastEvent); }); + setTimeout(_); }); return; }