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

Changed event handler to addEventListener

This commit is contained in:
Andrew Van Tassel 2016-06-24 15:08:20 -06:00
parent 0b2535050b
commit f95ccb11c1
6 changed files with 27 additions and 14 deletions

View File

@ -8,7 +8,7 @@ var mailHops =
{ {
msgURI: null msgURI: null
, isLoaded: false , isLoaded: false
, options: {'version':'MailHops Plugin 1.0.9','lan':'en','unit':'mi','api_url':'https://api.mailhops.com','debug':false} , options: {'version':'MailHops Plugin 1.0.12','lan':'en','unit':'mi','api_url':'https://api.mailhops.com','debug':false}
, message: { secure:[] } , message: { secure:[] }
, client_location: null , client_location: null
}; };

View File

@ -310,6 +310,8 @@ var mailHopsDisplay =
} }
var label = document.createElement('label'); var label = document.createElement('label');
label.setAttribute('data-ip',response.route[i].ip);
if(response.route[i].countryCode) if(response.route[i].countryCode)
label.style.backgroundImage = 'url(chrome://mailhops/content/images/flags/'+response.route[i].countryCode.toLowerCase()+'.png)'; label.style.backgroundImage = 'url(chrome://mailhops/content/images/flags/'+response.route[i].countryCode.toLowerCase()+'.png)';
else else
@ -318,15 +320,21 @@ var mailHopsDisplay =
if(response.route[i].city && response.route[i].state){ if(response.route[i].city && response.route[i].state){
label.setAttribute('value','Hop #'+(i+1)+' '+response.route[i].city+', '+response.route[i].state); label.setAttribute('value','Hop #'+(i+1)+' '+response.route[i].city+', '+response.route[i].state);
label.setAttribute('onclick','mailHopsUtils.launchWhoIs("'+response.route[i].ip+'");'); label.addEventListener("click", function (e) {
mailHopsUtils.launchWhoIs(this.getAttribute('data-ip'));
}, false);
} }
else if(response.route[i].city){ else if(response.route[i].city){
label.setAttribute('value','Hop #'+(i+1)+' '+response.route[i].city+', '+response.route[i].countryCode); label.setAttribute('value','Hop #'+(i+1)+' '+response.route[i].city+', '+response.route[i].countryCode);
label.setAttribute('onclick','mailHopsUtils.launchWhoIs("'+response.route[i].ip+'");'); label.addEventListener("click", function () {
mailHopsUtils.launchWhoIs(this.getAttribute('data-ip'));
}, false);
} }
else if(response.route[i].countryName){ else if(response.route[i].countryName){
label.setAttribute('value','Hop #'+(i+1)+' '+response.route[i].countryName); label.setAttribute('value','Hop #'+(i+1)+' '+response.route[i].countryName);
label.setAttribute('onclick','mailHopsUtils.launchWhoIs("'+response.route[i].ip+'");'); label.addEventListener("click", function () {
mailHopsUtils.launchWhoIs(this.getAttribute('data-ip'));
}, false);
} }
else else
label.setAttribute('value','Hop #'+(i+1)+' Private'); label.setAttribute('value','Hop #'+(i+1)+' Private');
@ -397,9 +405,12 @@ var mailHopsDisplay =
if(response.route[i].w3w){ if(response.route[i].w3w){
var w3w = document.createElement('label'); var w3w = document.createElement('label');
w3w.setAttribute('data-w3w',response.route[i].w3w.url);
w3w.setAttribute('class','dataPaneAddressitem mailhopsW3w'); w3w.setAttribute('class','dataPaneAddressitem mailhopsW3w');
w3w.setAttribute('value',response.route[i].w3w.words.join('.')); w3w.setAttribute('value',response.route[i].w3w.words.join('.'));
w3w.setAttribute('onclick','mailHopsUtils.launchExternalURL("'+response.route[i].w3w.url+'");'); w3w.addEventListener("click", function () {
mailHopsUtils.launchExternalURL(this.getAttribute('data-w3w'));
});
this.resultDetails.appendChild(w3w); this.resultDetails.appendChild(w3w);
} }
} }

View File

@ -127,7 +127,7 @@ launchExternalURL: function(url){
messenger.launchExternalURL(url); messenger.launchExternalURL(url);
}, },
launchWhoIs: function(ip){ launchWhoIs: function(ip){
this.launchExternalURL('https://www.mailhops.com/whois/' + ip); this.launchExternalURL('https://www.mailhops.com/whois/' + ip);
}, },

View File

@ -101,13 +101,13 @@ button {
font-size: 14px; font-size: 14px;
} }
textbox { #mailHopsPreferences textbox {
font-size: 14px; font-size: 14px;
padding: 5px; padding: 5px;
color: #777; color: #777;
} }
tab { #mailHopsPreferences tab {
font-size: 14px; font-size: 14px;
padding: 5px; padding: 5px;
color: #333; color: #333;
@ -123,12 +123,14 @@ tab {
color: rgba(255,0,0,1); color: rgba(255,0,0,1);
} }
button { .mailHopsLinkContainer button, #mailHopsPreferences button{
height: 35px; height: 35px;
color: #333;
} }
button.navButton { .mailHopsLinkContainer button.navButton, button.navButton {
height: 25px; height: 25px;
width: 10px; width: 10px;
text-align: center; text-align: center;
color: #333;
} }

View File

@ -15,18 +15,18 @@
font-size: 14px; font-size: 14px;
} }
textbox { #mailHopsPreferences textbox {
font-size: 14px; font-size: 14px;
padding: 5px; padding: 5px;
color: #777; color: #777;
} }
tab { #mailHopsPreferences tab {
font-size: 14px; font-size: 14px;
padding: 5px; padding: 5px;
color: #333; color: #333;
} }
#mailhopsResult label { #mailhopsResult label {
margin-top: 8px; margin-top: 8px;
} }

View File

@ -5,7 +5,7 @@
<Description about="urn:mozilla:install-manifest"> <Description about="urn:mozilla:install-manifest">
<em:type>2</em:type> <em:type>2</em:type>
<em:id>thunderbird@mailhops.com</em:id> <em:id>thunderbird@mailhops.com</em:id>
<em:version>1.0.9</em:version> <em:version>1.0.12</em:version>
<em:name>MailHops</em:name> <em:name>MailHops</em:name>
<em:description>MailHops maps the route an email took to get to you. Displaying the senders location, weather, user-agent and authentication used.</em:description> <em:description>MailHops maps the route an email took to get to you. Displaying the senders location, weather, user-agent and authentication used.</em:description>