From a8cc84b2f31e880cdc468c61fa3664474636fcb9 Mon Sep 17 00:00:00 2001 From: Andrew Van Tassel Date: Sat, 7 Jan 2017 10:28:56 -0700 Subject: [PATCH] Fixed open state of MailHops bar closes #11 --- chrome/content/mailhops.js | 6 +++--- chrome/content/msgNotificationBar.js | 16 ++++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/chrome/content/mailhops.js b/chrome/content/mailhops.js index 9a58dfb..bcee3ff 100644 --- a/chrome/content/mailhops.js +++ b/chrome/content/mailhops.js @@ -54,7 +54,7 @@ mailHops.init = function() { }; -mailHops.loadPref = function() +mailHops.loadPref = function(reload) { mailHops.LOG('load MailHops prefs'); //get preferences @@ -86,7 +86,7 @@ mailHops.loadPref = function() mailHops.options.country_filter = mailHops.getCharPref('mail.mailHops.country_filter',[]); //init display - mailHopsDisplay.init( mailHops.options ); + mailHopsDisplay.init( mailHops.options, reload ); }; mailHops.StreamListener = @@ -330,7 +330,7 @@ mailHops.unregisterObserver = function(){ mailHops.observe = function ( aSubject , aTopic , aData ) { if ( aTopic == "nsPref:changed" ) - mailHops.loadPref(); + mailHops.loadPref(true); }; mailHops.getCharPref = function ( strName , strDefault ){ diff --git a/chrome/content/msgNotificationBar.js b/chrome/content/msgNotificationBar.js index 8e35548..5577aa5 100644 --- a/chrome/content/msgNotificationBar.js +++ b/chrome/content/msgNotificationBar.js @@ -10,12 +10,13 @@ var mailHopsDisplay = mailhopsDataPaneDNSBL: null, mailhopsResultWeather: null, mailhopsUnsubscribe: null, + mhBox: null, options: null, - init: function(options){ + init: function(options, reload){ this.options = options; - + this.mhBox = document.getElementById("mailhopsNoficationBox"); this.container = document.getElementById("mailhopsBox"); this.resultBox = document.getElementById("mailhopsResult"); this.resultText = document.getElementById("mailhopsResultText"); @@ -28,6 +29,9 @@ var mailHopsDisplay = this.mailhopsDataPaneMailer = document.getElementById("mailhopsDataPaneMailer"); this.mailhopsDataPaneDNSBL = document.getElementById("mailhopsDataPaneDNSBL"); + //wait for message to be selected before showing + if(!reload) + this.mhBox.style.display = 'none'; //event listner for route click to launch map this.mailhopsDataPaneDNSBL.addEventListener("click", function () { @@ -44,12 +48,12 @@ var mailHopsDisplay = }); if(!!options.bar_color) - document.getElementById("mailhopsNoficationBox").style.background = options.bar_color; + this.mhBox.style.background = options.bar_color; else - document.getElementById("mailhopsNoficationBox").style.background = ''; + this.mhBox.style.background = ''; if(!!options.font_size) - document.getElementById("mailhopsNoficationBox").style.fontSize = options.font_size; + this.mhBox.style.fontSize = options.font_size; if(!!options.font_color){ this.resultText.style.color = options.font_color; @@ -192,7 +196,7 @@ var mailHopsDisplay = }, clear: function(no_ips){ - + this.mhBox.style.display = ''; this.mailhopsDataPaneDNSBL.style.display = 'none'; this.mailhopsResultWeather.style.display = 'none'; this.resultText.removeAttribute('data-route');