1
0
mirror of https://github.com/MailHops/mailhops-plugin.git synced 2025-05-17 06:40:08 -07:00

Added Display option to hide the MailHops bar when CompactHeaders

This commit is contained in:
Andrew Van Tassel 2017-01-12 22:55:43 -07:00
parent b55542877b
commit 2b071c7617
3 changed files with 22 additions and 13 deletions

View File

@ -15,6 +15,7 @@ var mailHops =
'api_http':'https://', 'api_http':'https://',
'api_host':'api.mailhops.com', 'api_host':'api.mailhops.com',
'debug':false, 'debug':false,
'hide_compact':false,
'bar_color': '#5E7A9B', 'bar_color': '#5E7A9B',
'font_color': '#FFF', 'font_color': '#FFF',
'font_size': '14px', 'font_size': '14px',
@ -71,6 +72,8 @@ mailHops.loadPref = function(reload)
mailHops.options.debug = mailHops.getCharPref('mail.mailHops.debug','false')=='true'?true:false; mailHops.options.debug = mailHops.getCharPref('mail.mailHops.debug','false')=='true'?true:false;
mailHops.options.hide_compact = mailHops.getCharPref('mail.mailHops.hide_compact','false')=='true'?true:false;
mailHops.options.api_host = mailHops.getCharPref('mail.mailHops.api_host','api.mailhops.com'); mailHops.options.api_host = mailHops.getCharPref('mail.mailHops.api_host','api.mailhops.com');
mailHops.options.api_http = mailHops.getCharPref('mail.mailHops.api_http','https://'); mailHops.options.api_http = mailHops.getCharPref('mail.mailHops.api_http','https://');
@ -135,14 +138,16 @@ mailHops.StreamListener =
*/ */
mailHops.loadHeaderData = function() { mailHops.loadHeaderData = function() {
// CompactHeader toggle header logic if(!!mailHops.options.hide_compact){
var compactHeadersView = document.getElementById('CompactHeader_collapsedHeaderView'); // CompactHeader toggle header logic
if(!!compactHeadersView){ var compactHeadersView = document.getElementById('CompactHeader_collapsedHeaderView');
if(compactHeadersView.collapsed===true){ if(!!compactHeadersView){
mailHopsDisplay.toggleMailHopsBar(true); if(compactHeadersView.collapsed===true){
} else if(compactHeadersView.collapsed===false){ mailHopsDisplay.toggleMailHopsBar(true);
mailHopsDisplay.toggleMailHopsBar(false); } else if(compactHeadersView.collapsed===false){
return; mailHopsDisplay.toggleMailHopsBar(false);
return;
}
} }
} }

View File

@ -82,6 +82,11 @@ var mailHopPreferences = {
else else
document.getElementById("mailhop.travel_time_junk").checked = true; document.getElementById("mailhop.travel_time_junk").checked = true;
if(pref.getCharPref("mail.mailHops.hide_compact",'false')=='false')
document.getElementById("mailhop.hide_compact").checked = false;
else
document.getElementById("mailhop.hide_compact").checked = true;
document.getElementById("mailhops-membership-link").addEventListener("click", function () { document.getElementById("mailhops-membership-link").addEventListener("click", function () {
mailHopsUtils.launchExternalURL(this.getAttribute('data-account-url')); mailHopsUtils.launchExternalURL(this.getAttribute('data-account-url'));
}); });
@ -99,10 +104,6 @@ var mailHopPreferences = {
document.getElementById("mailhop.font_size").addEventListener("input", function () { document.getElementById("mailhop.font_size").addEventListener("input", function () {
self.previewBar.style.fontSize = this.value; self.previewBar.style.fontSize = this.value;
}); });
document.getElementById("randomColorHue").addEventListener("change", function () {
self.RandomColor(this.value);
});
}, },
savePreferences: function() { savePreferences: function() {
pref.setCharPref("mail.mailHops.lang", document.getElementById("mailhop.lang").selectedItem.value); pref.setCharPref("mail.mailHops.lang", document.getElementById("mailhop.lang").selectedItem.value);
@ -112,6 +113,7 @@ var mailHopPreferences = {
pref.setCharPref("mail.mailHops.font_color", String(document.getElementById("mailhop.font_color").value)); pref.setCharPref("mail.mailHops.font_color", String(document.getElementById("mailhop.font_color").value));
pref.setCharPref("mail.mailHops.font_size", String(document.getElementById("mailhop.font_size").value)); pref.setCharPref("mail.mailHops.font_size", String(document.getElementById("mailhop.font_size").value));
pref.setCharPref("mail.mailHops.debug", String(document.getElementById("mailhop.debug").checked)); pref.setCharPref("mail.mailHops.debug", String(document.getElementById("mailhop.debug").checked));
pref.setCharPref("mail.mailHops.hide_compact", String(document.getElementById("mailhop.hide_compact").checked));
//API vars //API vars
if(!this.valid_api_key) if(!this.valid_api_key)
@ -249,7 +251,7 @@ var mailHopPreferences = {
if(font.indexOf('rgb(')===0) if(font.indexOf('rgb(')===0)
document.getElementById("mailhop.font_color").value = this.rgb2hex(font); document.getElementById("mailhop.font_color").value = this.rgb2hex(font);
else else
document.getElementById("mailhop.font_color").value = font; document.getElementById("mailhop.font_color").value = font;
} }
if(size) document.getElementById("mailhop.font_size").value = size; if(size) document.getElementById("mailhop.font_size").value = size;
this.previewBar.style.background = document.getElementById("mailhop.bar_color").value; this.previewBar.style.background = document.getElementById("mailhop.bar_color").value;

View File

@ -560,6 +560,8 @@
</rows> </rows>
</grid> </grid>
<checkbox id="mailhop.hide_compact" label="Hide MailHops Bar when CompactHeaders" checked="false"/>
</groupbox> </groupbox>
</tabpanel> </tabpanel>