From e1c12b02f2f9c72ff540058c20c3ab42ffb169fc Mon Sep 17 00:00:00 2001 From: MatMoul Date: Fri, 29 Sep 2017 23:00:59 +0200 Subject: [PATCH] Bug correction : load page is white when firefox start --- src/js/background.js | 1 - src/js/dial.js | 20 ++++++++------------ src/manifest.json | 4 ++-- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index 333de77..19b838d 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -41,7 +41,6 @@ core.Settings.load = function(){ // Load settings and call core.init }).then(function(obj){ app.settings = obj; core._init(); - browser.runtime.sendMessage({ command: 'appReady'}).then(function(){}, function(){}); },function(){}); } core.Settings.save = function(){ // Save settings diff --git a/src/js/dial.js b/src/js/dial.js index a2a026d..3354e65 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -5,13 +5,17 @@ var dial = { maxpage: 1 }; -browser.runtime.getBackgroundPage().then(function(page){ app = page.app; }, function(){}); -window.onload = function(){ if(app.settings) dial.initUI(); } +window.onload = function(){ + browser.runtime.getBackgroundPage().then(function(page){ + app = page.app; + dial.initUI(); + }, function(){}); +} window.onresize = function(){ - if(app.settings) dial.updateGridLayout(dial.Grid, app.settings.grid, dial.styles.grid); + if(app && app.settings) dial.updateGridLayout(dial.Grid, app.settings.grid, dial.styles.grid); } window.onwheel = function(ev){ - if(app.settings){ + if(app && app.settings){ if(ev.deltaY > 0){ if(dial.page < dial.maxpage){ dial.page += 1; @@ -30,10 +34,6 @@ browser.runtime.onMessage.addListener(function(request, sender, sendResponse){ case 'gridNodesSynced': if(app.settings) dial.populateGrid(dial.Grid, app.settings.grid, dial.Node); break; - case 'appReady': - browser.runtime.getBackgroundPage().then(function(page){ app = page.app; }, function(){}); - dial.initUI(); - break; } }); @@ -48,10 +48,6 @@ dial.initUI = function(){ dial.Grid = dial.initGrid('Grid', app.settings.grid, dial.Body); var url = new URL(window.location); dial.path = url.searchParams.get('path'); - /* - if(url.searchParams.get('path')) dial.Node = app.getNode(app.settings.grid.node, dial.path + '/'); - else dial.Node = app.getNode(app.settings.grid.node, '/'); - */ if(url.searchParams.get('path')) { dial.Node = app.getNode(app.settings.grid.node, dial.path + '/'); } else { diff --git a/src/manifest.json b/src/manifest.json index fbdec02..1edfc9f 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_extensionName__", - "version": "0.0.2", + "version": "0.0.3", "description": "__MSG_extensionDescription__", @@ -33,7 +33,7 @@ "applications": { "gecko": { - "id": "mat@matmoul.com_quickdial_test_3", + "id": "quickdial@matmoul.com", "strict_min_version": "52.0" } },