From 2ea5d7fdc852a7d58235820cca0332656380d0a6 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Fri, 29 Sep 2017 23:11:00 +0200 Subject: [PATCH] Bug correction : load page is white when firefox start --- src/js/dial.js | 27 ++++++++++++++++----------- src/manifest.json | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/js/dial.js b/src/js/dial.js index 3354e65..dab39c9 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -6,10 +6,22 @@ var dial = { }; window.onload = function(){ - browser.runtime.getBackgroundPage().then(function(page){ - app = page.app; - dial.initUI(); - }, function(){}); + function initPage(){ + browser.runtime.getBackgroundPage().then(function(page){ + if(page.app.settings){ + app = page.app; + dial.initUI(); + browser.runtime.onMessage.addListener(function(request, sender, sendResponse){ + switch(request.command){ + case 'gridNodesSynced': + if(app.settings) dial.populateGrid(dial.Grid, app.settings.grid, dial.Node); + break; + } + }); + } else initPage(); + }, function(){}); + } + initPage(); } window.onresize = function(){ if(app && app.settings) dial.updateGridLayout(dial.Grid, app.settings.grid, dial.styles.grid); @@ -29,13 +41,6 @@ window.onwheel = function(ev){ } } } -browser.runtime.onMessage.addListener(function(request, sender, sendResponse){ - switch(request.command){ - case 'gridNodesSynced': - if(app.settings) dial.populateGrid(dial.Grid, app.settings.grid, dial.Node); - break; - } -}); dial.initUI = function(){ diff --git a/src/manifest.json b/src/manifest.json index 1edfc9f..b4c74b1 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_extensionName__", - "version": "0.0.3", + "version": "0.0.4", "description": "__MSG_extensionDescription__",