mirror of
https://github.com/MailHops/mailhops-plugin.git
synced 2025-05-17 14:50:08 -07:00
Updated icons
Added List-Unsubscribe box with links
This commit is contained in:
parent
8fae5eef33
commit
1b8c098ddc
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.2 KiB |
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @author: Andrew Van Tassel
|
* @author: Andrew Van Tassel
|
||||||
* @email: andrew@andrewvantassel.com
|
* @email: andrew@andrewvantassel.com
|
||||||
* @website: http://mailhops.com*
|
* @website: http://mailhops.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var mailHops =
|
var mailHops =
|
||||||
@ -17,12 +17,14 @@ var mailHops =
|
|||||||
mailhopsDataPaneDKIM: null,
|
mailhopsDataPaneDKIM: null,
|
||||||
mailhopsDataPaneMailer: null,
|
mailhopsDataPaneMailer: null,
|
||||||
mailhopsDataPaneDNSBL: null,
|
mailhopsDataPaneDNSBL: null,
|
||||||
|
mailhopsListContainer: null,
|
||||||
|
resultListDataPane: null,
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
showDetails: false,
|
showDetails: false,
|
||||||
showWeather: false,
|
showWeather: false,
|
||||||
map: 'goog',
|
map: 'goog',
|
||||||
unit: 'mi',
|
unit: 'mi',
|
||||||
appVersion: 'MailHops Postbox 0.6.3'
|
appVersion: 'MailHops Postbox 0.6.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
mailHops.init = function()
|
mailHops.init = function()
|
||||||
@ -41,11 +43,14 @@ mailHops.init = function()
|
|||||||
mailHops.resultDetails = document.getElementById ( "mailhopsDataPaneDetails");
|
mailHops.resultDetails = document.getElementById ( "mailhopsDataPaneDetails");
|
||||||
|
|
||||||
mailHops.resultMapLink = document.getElementById ( "mailhopsDataPaneMapLink");
|
mailHops.resultMapLink = document.getElementById ( "mailhopsDataPaneMapLink");
|
||||||
|
//auth
|
||||||
mailHops.mailhopsDataPaneSPF = document.getElementById ( "mailhopsDataPaneSPF");
|
mailHops.mailhopsDataPaneSPF = document.getElementById ( "mailhopsDataPaneSPF");
|
||||||
mailHops.mailhopsDataPaneDKIM = document.getElementById ( "mailhopsDataPaneDKIM");
|
mailHops.mailhopsDataPaneDKIM = document.getElementById ( "mailhopsDataPaneDKIM");
|
||||||
mailHops.mailhopsDataPaneMailer = document.getElementById ( "mailhopsDataPaneMailer");
|
mailHops.mailhopsDataPaneMailer = document.getElementById ( "mailhopsDataPaneMailer");
|
||||||
mailHops.mailhopsDataPaneDNSBL = document.getElementById ( "mailhopsDataPaneDNSBL");
|
mailHops.mailhopsDataPaneDNSBL = document.getElementById ( "mailhopsDataPaneDNSBL");
|
||||||
|
//list
|
||||||
|
mailHops.mailhopsListContainer = document.getElementById ( "dataPaneMailHopsListContainer");
|
||||||
|
mailHops.resultListDataPane = document.getElementById ( "mailhopsListDataPane");
|
||||||
|
|
||||||
//event listner for route click to launch map
|
//event listner for route click to launch map
|
||||||
mailHops.resultMapLink.addEventListener("click", function () {
|
mailHops.resultMapLink.addEventListener("click", function () {
|
||||||
@ -159,8 +164,13 @@ var regexAllIp = /(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{
|
|||||||
var headReceivedSPF = mailHops.headers.extractHeader ( "Received-SPF" , false ) ;
|
var headReceivedSPF = mailHops.headers.extractHeader ( "Received-SPF" , false ) ;
|
||||||
var headAuth = mailHops.headers.extractHeader ( "Authentication-Results" , false ) ;
|
var headAuth = mailHops.headers.extractHeader ( "Authentication-Results" , false ) ;
|
||||||
|
|
||||||
|
var headListUnsubscribe = mailHops.headers.extractHeader ( "List-Unsubscribe" , false ) ;
|
||||||
|
|
||||||
//display auth
|
//display auth
|
||||||
mailHops.displayResultAuth(headXMailer,headUserAgent,headXMimeOLE,headAuth,headReceivedSPF);
|
mailHops.displayResultAuth(headXMailer,headUserAgent,headXMimeOLE,headAuth,headReceivedSPF);
|
||||||
|
//display unsubscribe link
|
||||||
|
if(headListUnsubscribe)
|
||||||
|
mailHops.displayResultLists(headListUnsubscribe);
|
||||||
|
|
||||||
var received_ips;
|
var received_ips;
|
||||||
var all_ips = new Array();
|
var all_ips = new Array();
|
||||||
@ -230,6 +240,32 @@ mailHops.testIP = function(ip,header){
|
|||||||
return retval;
|
return retval;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mailHops.displayResultLists = function( header_unsubscribe){
|
||||||
|
|
||||||
|
while(mailHops.resultListDataPane.firstChild) {
|
||||||
|
mailHops.resultListDataPane.removeChild(mailHops.resultListDataPane.firstChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
var listArr=header_unsubscribe.split(',');
|
||||||
|
var href='';
|
||||||
|
for(var h=0;h<listArr.length;h++){
|
||||||
|
href = listArr[h].replace('<','').replace('>','');
|
||||||
|
var link = document.createElement('a');
|
||||||
|
link.setAttribute('href',href);
|
||||||
|
if(href.indexOf('mailto:')!=-1)
|
||||||
|
link.innerHTML='Unsubscribe via Email';
|
||||||
|
else
|
||||||
|
link.innerHTML='Unsubscribe';
|
||||||
|
mailHops.resultListDataPane.appendChild(link);
|
||||||
|
}
|
||||||
|
if(!href)
|
||||||
|
mailHops.mailhopsListContainer.style.display='none';
|
||||||
|
else{
|
||||||
|
mailHops.mailhopsListContainer.style.display='block';
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
mailHops.displayResultAuth = function( header_xmailer, header_useragent, header_xmimeole, header_auth, header_spf ){
|
mailHops.displayResultAuth = function( header_xmailer, header_useragent, header_xmimeole, header_auth, header_spf ){
|
||||||
|
|
||||||
//SPF
|
//SPF
|
||||||
@ -483,10 +519,16 @@ mailHops.displayResult = function ( header_route, response ){
|
|||||||
else
|
else
|
||||||
label.setAttribute('value','Hop #'+(i+1)+' Private');
|
label.setAttribute('value','Hop #'+(i+1)+' Private');
|
||||||
|
|
||||||
|
//build tooltip
|
||||||
|
var tiptext = response.route[i].ip;
|
||||||
if(response.route[i].host)
|
if(response.route[i].host)
|
||||||
label.setAttribute('tooltiptext',response.route[i].ip+', '+response.route[i].host);
|
tiptext+=' '+response.route[i].host;
|
||||||
else
|
if(response.route[i].whois && response.route[i].whois.descr)
|
||||||
label.setAttribute('tooltiptext',response.route[i].ip);
|
tiptext+=' '+response.route[i].whois.descr;
|
||||||
|
if(response.route[i].whois && response.route[i].whois.netname)
|
||||||
|
tiptext+=' '+response.route[i].whois.netname;
|
||||||
|
|
||||||
|
label.setAttribute('tooltiptext',tiptext);
|
||||||
|
|
||||||
//append details
|
//append details
|
||||||
mailHops.resultDetails.appendChild(label);
|
mailHops.resultDetails.appendChild(label);
|
||||||
@ -543,7 +585,6 @@ mailHops.displayResult = function ( header_route, response ){
|
|||||||
displayText = ' Local message.';
|
displayText = ' Local message.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(header_route)
|
if(header_route)
|
||||||
mailHops.resultMapLink.setAttribute("route", header_route);
|
mailHops.resultMapLink.setAttribute("route", header_route);
|
||||||
else
|
else
|
||||||
@ -553,8 +594,13 @@ mailHops.displayResult = function ( header_route, response ){
|
|||||||
mailHops.resultTextDataPane.value = displayText;
|
mailHops.resultTextDataPane.value = displayText;
|
||||||
mailHops.resultTextDataPane.setAttribute('tooltiptext',displayText+' '+distanceText);
|
mailHops.resultTextDataPane.setAttribute('tooltiptext',displayText+' '+distanceText);
|
||||||
|
|
||||||
|
if(distanceText){
|
||||||
|
mailHops.resultTextDataPane2.style.display = 'block';
|
||||||
mailHops.resultTextDataPane2.value = distanceText;
|
mailHops.resultTextDataPane2.value = distanceText;
|
||||||
mailHops.resultTextDataPane2.setAttribute('tooltiptext',displayText+' '+distanceText);
|
mailHops.resultTextDataPane2.setAttribute('tooltiptext',displayText+' '+distanceText);
|
||||||
|
} else {
|
||||||
|
mailHops.resultTextDataPane2.style.display = 'none';
|
||||||
|
}
|
||||||
//show the detail link
|
//show the detail link
|
||||||
mailHops.resultDetailsLink.style.display = 'block';
|
mailHops.resultDetailsLink.style.display = 'block';
|
||||||
mailHops.resultMapLink.style.display = 'block';
|
mailHops.resultMapLink.style.display = 'block';
|
||||||
@ -577,19 +623,42 @@ mailHops.isDay = function(){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//display the connection error message
|
//display the connection error message
|
||||||
mailHops.displayError = function(){
|
mailHops.displayError = function(data){
|
||||||
mailHops.resultMapLink.removeAttribute("route");
|
mailHops.resultMapLink.removeAttribute("route");
|
||||||
|
if(data && data.meta.code==410)
|
||||||
|
mailHops.resultTextDataPane.style.backgroundImage = 'url(chrome://mailhops/content/images/info.png)';
|
||||||
|
else
|
||||||
mailHops.resultTextDataPane.style.backgroundImage = 'url(chrome://mailhops/content/images/auth/error.png)';
|
mailHops.resultTextDataPane.style.backgroundImage = 'url(chrome://mailhops/content/images/auth/error.png)';
|
||||||
mailHops.resultTextDataPane.value = ' MailHops Failed.';
|
|
||||||
mailHops.resultTextDataPane.setAttribute('tooltiptext',' Could not connect to MailHops.');
|
|
||||||
|
|
||||||
|
if(data.error){
|
||||||
|
mailHops.resultTextDataPane.value = mailHops.getErrorTitle(data.meta.code);
|
||||||
|
mailHops.resultTextDataPane.setAttribute('tooltiptext',data.error.message);
|
||||||
|
}else{
|
||||||
|
mailHops.resultTextDataPane.value = ' Service Unavailable.';
|
||||||
|
mailHops.resultTextDataPane.setAttribute('tooltiptext',' Could not connect to MailHops.');
|
||||||
|
}
|
||||||
|
mailHops.resultTextDataPane2.style.display = 'none';
|
||||||
mailHops.resultTextDataPane2.value = '';
|
mailHops.resultTextDataPane2.value = '';
|
||||||
mailHops.resultTextDataPane2.style.backgroundImage = '';
|
mailHops.resultTextDataPane2.style.backgroundImage = '';
|
||||||
mailHops.resultTextDataPane2.setAttribute('tooltiptext','');
|
mailHops.resultTextDataPane2.setAttribute('tooltiptext','');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mailHops.getErrorTitle = function(error_code){
|
||||||
|
switch(error_code){
|
||||||
|
case 400:
|
||||||
|
return 'Missing route parameter';
|
||||||
|
case 410:
|
||||||
|
return 'Down for Maintenance';
|
||||||
|
case 500:
|
||||||
|
return 'Server Error';
|
||||||
|
default:
|
||||||
|
return 'Service Unavailable';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
mailHops.clearRoute = function(){
|
mailHops.clearRoute = function(){
|
||||||
|
|
||||||
|
mailHops.resultTextDataPane2.style.display = 'none';
|
||||||
mailHops.resultContainerDetails.style.display = 'none';
|
mailHops.resultContainerDetails.style.display = 'none';
|
||||||
mailHops.resultDetailsLink.style.display = 'none';
|
mailHops.resultDetailsLink.style.display = 'none';
|
||||||
mailHops.resultMapLink.style.display = 'none';
|
mailHops.resultMapLink.style.display = 'none';
|
||||||
@ -691,7 +760,7 @@ mailHops.lookup = function(header_route){
|
|||||||
mailHops.displayResult(header_route,data.response);
|
mailHops.displayResult(header_route,data.response);
|
||||||
} else {
|
} else {
|
||||||
//display the error
|
//display the error
|
||||||
mailHops.displayError();
|
mailHops.displayError(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ex){
|
catch (ex){
|
||||||
|
@ -45,6 +45,19 @@
|
|||||||
<label id="mailhopsDataPaneDNSBL" class="text-link dataPaneAddressitem auth-item" value="" tooltiptext="DNSBL"></label>
|
<label id="mailhopsDataPaneDNSBL" class="text-link dataPaneAddressitem auth-item" value="" tooltiptext="DNSBL"></label>
|
||||||
</vbox>
|
</vbox>
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
||||||
|
<vbox id="dataPaneMailHopsListContainer" class="dataPaneBox">
|
||||||
|
<hbox flex="1" pack="start" align="center">
|
||||||
|
<label class="dataPaneHeader" crop="right" value="List Info"></label>
|
||||||
|
<separator class="dataPaneBoxSeparator" flex="1"></separator>
|
||||||
|
</hbox>
|
||||||
|
|
||||||
|
<vbox id="mailhopsListDataPane" flex="1">
|
||||||
|
|
||||||
|
</vbox>
|
||||||
|
|
||||||
|
</vbox>
|
||||||
|
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
||||||
</overlay>
|
</overlay>
|
||||||
|
@ -17,7 +17,7 @@ var mailHopPreferences =
|
|||||||
else
|
else
|
||||||
document.getElementById("mailhop.unit").selectedIndex = 1;
|
document.getElementById("mailhop.unit").selectedIndex = 1;
|
||||||
|
|
||||||
if(pref.getCharPref("mail.mailHops.show_details",'false')=='true')
|
if(pref.getCharPref("mail.mailHops.show_details",'true')=='true')
|
||||||
document.getElementById("mailhop.show_details").checked = true;
|
document.getElementById("mailhop.show_details").checked = true;
|
||||||
else
|
else
|
||||||
document.getElementById("mailhop.show_details").checked = false;
|
document.getElementById("mailhop.show_details").checked = false;
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
color: #FFF;
|
color: #FFF;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
background-color: #98a5b3;
|
background-color: #98a5b3;
|
||||||
-moz-border-radius: 20px;
|
-moz-border-radius: 10px;
|
||||||
-webkit-border-radius: 20px;
|
-webkit-border-radius: 10px;
|
||||||
-khtml-border-radius: 20px;
|
-khtml-border-radius: 10px;
|
||||||
border-radius: 20px;
|
border-radius: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-right: 14px;
|
padding-right: 14px;
|
||||||
}
|
}
|
||||||
@ -56,3 +56,7 @@
|
|||||||
.auth-item{
|
.auth-item{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#dataPaneMailHopsListContainer{
|
||||||
|
display: none;
|
||||||
|
}
|
@ -7,7 +7,7 @@
|
|||||||
<em:id>postbox@mailhops.com</em:id>
|
<em:id>postbox@mailhops.com</em:id>
|
||||||
<em:type>2</em:type>
|
<em:type>2</em:type>
|
||||||
<em:name>MailHops</em:name>
|
<em:name>MailHops</em:name>
|
||||||
<em:version>0.6.3</em:version>
|
<em:version>0.6.4</em:version>
|
||||||
<em:description>MailHops maps the route an email traveled to get to you. Using GeoIP it also displays distance traveled along with the location (city, state and country) of the sender.</em:description>
|
<em:description>MailHops maps the route an email traveled to get to you. Using GeoIP it also displays distance traveled along with the location (city, state and country) of the sender.</em:description>
|
||||||
<em:iconURL>chrome://mailhops/content/images/mailhops32.png</em:iconURL>
|
<em:iconURL>chrome://mailhops/content/images/mailhops32.png</em:iconURL>
|
||||||
<em:homepageURL>http://mailhops.com</em:homepageURL>
|
<em:homepageURL>http://mailhops.com</em:homepageURL>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user