From 7c53643b194a98ed070272a6598d6a0a53deda2b Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 1 Apr 2015 00:35:06 +0300 Subject: [PATCH] Apply styles to own pages earlier to avoid flicker --- apply.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apply.js b/apply.js index 66d70bcf..3e34dba9 100644 --- a/apply.js +++ b/apply.js @@ -1,4 +1,9 @@ -chrome.extension.sendMessage({method: "getStyles", matchUrl: location.href, enabled: true, asHash: true}, applyStyles); +var request = {method: "getStyles", matchUrl: location.href, enabled: true, asHash: true}; +if (location.href.indexOf(chrome.extension.getURL("")) == 0) { + chrome.extension.getBackgroundPage().getStyles(request, applyStyles); +} else { + chrome.extension.sendMessage(request, applyStyles); +} chrome.extension.onMessage.addListener(function(request, sender, sendResponse) { switch (request.method) {