1
0
mirror of https://github.com/MailHops/mailhops-plugin.git synced 2025-05-18 15:20:08 -07:00

removed xpi files

This commit is contained in:
Andrew Van Tassel 2013-08-23 11:25:14 -06:00
parent 2f534a44ce
commit 7e96333074
29 changed files with 87 additions and 44 deletions

View File

@ -21,12 +21,11 @@ var mailHops =
mailhopsListContainer: null, mailhopsListContainer: null,
mailhopsAuthContainer: null, mailhopsAuthContainer: null,
resultListDataPane: null, resultListDataPane: null,
resultMeta: null, resultMeta: null,
isLoaded: false, isLoaded: false,
options: {'map':'goog','unit':'mi','api_url':'http://api.mailhops.com'}, options: {'map':'goog','unit':'mi','api_url':'http://api.mailhops.com'},
appVersion: 'MailHops Postbox 0.8', appVersion: 'MailHops Postbox 0.8.2',
message: {secure:[]}, message: {secure:[]},
client_location: null client_location: null
} }
@ -65,6 +64,7 @@ mailHops.init = function()
mailHops.launchMap(String(this.getAttribute("data-route"))); mailHops.launchMap(String(this.getAttribute("data-route")));
} }
, false); , false);
mailHops.resultDetailsLink.addEventListener("click", function () { mailHops.resultDetailsLink.addEventListener("click", function () {
if(mailHops.resultContainerDetails.style.display=='none'){ if(mailHops.resultContainerDetails.style.display=='none'){
mailHops.resultContainerDetails.style.display = 'block'; mailHops.resultContainerDetails.style.display = 'block';
@ -87,6 +87,11 @@ mailHops.init = function()
window.openDialog("chrome://mailhops/content/preferences.xul","mailHopsPreferences",null,null); window.openDialog("chrome://mailhops/content/preferences.xul","mailHopsPreferences",null,null);
} }
, false); , false);
document.getElementById("mailhopsDataPaneRefreshLink").addEventListener("click", function () {
mailHops.refreshCache();
}
, false);
}; };
mailHops.loadPref = function() mailHops.loadPref = function()
@ -563,7 +568,7 @@ mailHops.displayResult = function ( header_route, response, meta, lookup_url ){
mailHops.resultDetails.removeChild(mailHops.resultDetails.firstChild); mailHops.resultDetails.removeChild(mailHops.resultDetails.firstChild);
} }
//append meta //append meta
if(mailHops.options.show_meta){ if(mailHops.options.show_meta){
document.getElementById('dataPaneMailHopsMetaContainer').style.display=''; document.getElementById('dataPaneMailHopsMetaContainer').style.display='';
while(mailHops.resultMeta.firstChild) { while(mailHops.resultMeta.firstChild) {
@ -582,7 +587,7 @@ mailHops.displayResult = function ( header_route, response, meta, lookup_url ){
} else { } else {
document.getElementById('dataPaneMailHopsMetaContainer').style.display='none'; document.getElementById('dataPaneMailHopsMetaContainer').style.display='none';
} }
if(response && response.route && response.route.length > 0){ if(response && response.route && response.route.length > 0){
@ -904,24 +909,25 @@ mailHops.lookupRoute = function(header_route){
//import nativeJSON //import nativeJSON
var nativeJSON = Components.classes["@mozilla.org/dom/json;1"].createInstance(Components.interfaces.nsIJSON); var nativeJSON = Components.classes["@mozilla.org/dom/json;1"].createInstance(Components.interfaces.nsIJSON);
//check for cache
var cached_results=mailHops.getResults();
if(cached_results){
cached_results = JSON.parse(cached_results);
mailHops.displayResult(header_route,cached_results.response);
return;
}
//call mailhops api for lookup
var xmlhttp = new XMLHttpRequest();
var lookupURL=mailHops.options.api_url+'/v1/lookup/?pb&app='+mailHops.appVersion+'&r='+String(header_route); var lookupURL=mailHops.options.api_url+'/v1/lookup/?pb&app='+mailHops.appVersion+'&r='+String(header_route);
if(mailHops.options.show_weather) if(mailHops.options.show_weather)
lookupURL+='&w=1'; lookupURL+='&w=1';
if(mailHops.options.client_location != '') if(mailHops.options.client_location != '')
lookupURL+='&c=0'; lookupURL+='&c=0';
//check for cache
var cached_results=mailHops.getResults();
if(cached_results){
cached_results = JSON.parse(cached_results);
mailHops.displayResult(header_route, cached_results.response, cached_results.meta, lookupURL);
return;
}
//call mailhops api for lookup
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", lookupURL ,true); xmlhttp.open("GET", lookupURL ,true);
xmlhttp.onreadystatechange=function() { xmlhttp.onreadystatechange=function() {
@ -929,6 +935,8 @@ mailHops.lookupRoute = function(header_route){
try{ try{
var data = JSON.parse(xmlhttp.responseText); var data = JSON.parse(xmlhttp.responseText);
if(data && data.meta.code==200){ if(data && data.meta.code==200){
var d = new Date();
data.meta.cached = d.toISOString();
//save the result //save the result
mailHops.saveResults(JSON.stringify(data)); mailHops.saveResults(JSON.stringify(data));
//display the result //display the result
@ -973,7 +981,7 @@ mailHops.launchMap = function(route){
if(mailHops.options.show_weather) if(mailHops.options.show_weather)
lookupURL+='&w=1'; lookupURL+='&w=1';
window.openDialog("chrome://mailhops/content/mailhopsMap.xul","MailHops",'toolbar=no,location=no,directories=no,menubar=yes,scrollbars=yes,close=yes,width=742,height=385', {src: lookupURL}); window.openDialog("chrome://mailhops/content/mailhopsMap.xul","MailHops",'toolbar=no,location=no,directories=no,menubar=yes,scrollbars=yes,close=yes,width=742,height=385,resizable=yes', {src: lookupURL});
} }
}; };
@ -1006,4 +1014,9 @@ mailHops.getResults = function(){
return msgHdr.getStringProperty( "MH-Route" ); return msgHdr.getStringProperty( "MH-Route" );
}; };
mailHops.refreshCache = function(){
mailHops.saveResults('');
mailHops.getRoute();
};
addEventListener ( "messagepane-loaded" , mailHops.setupEventListener , true ) ; addEventListener ( "messagepane-loaded" , mailHops.setupEventListener , true ) ;

View File

@ -10,7 +10,7 @@
title="MailHops Map" title="MailHops Map"
buttonlabelcancel="Close"> buttonlabelcancel="Close">
<iframe id="mailhops_iframe" flex="1" width="732" height="332" style="overflow:hidden;"/> <iframe id="mailhops_iframe" flex="1" width="732" height="332" style="overflow:hidden;" type="content"/>
<script> <script>
function loadMap(){ function loadMap(){

View File

@ -23,7 +23,8 @@
<hbox class="mailHopsLinkContainer"> <hbox class="mailHopsLinkContainer">
<vbox><label id="mailhopsDataPaneMapLink" class="text-link dataPaneMoreLink" value="map" tooltiptext="Show Route Map"></label></vbox> <vbox><label id="mailhopsDataPaneMapLink" class="text-link dataPaneMoreLink" value="map" tooltiptext="Show Route Map"></label></vbox>
<vbox><label id="mailhopsDataPaneDetailsLink" class="text-link dataPaneMoreLink" value="details" tooltiptext="Show Route Details"></label></vbox> <vbox><label id="mailhopsDataPaneDetailsLink" class="text-link dataPaneMoreLink" value="details" tooltiptext="Show Route Details"></label></vbox>
<vbox><label id="mailhopsDataPanePrefsLink" class="text-link dataPaneMoreLink" value="Options" tooltiptext="MailHops Preferences"></label></vbox> <vbox><label id="mailhopsDataPaneRefreshLink" class="text-link dataPaneMoreLink" value="refresh" tooltiptext="Refresh Cache"></label></vbox>
<vbox><label id="mailhopsDataPanePrefsLink" class="text-link dataPaneMoreLink" value="options" tooltiptext="MailHops Preferences"></label></vbox>
</hbox> </hbox>
<hbox id="mailhopsDetailsContainer" class="mailhopsContainer"> <hbox id="mailhopsDetailsContainer" class="mailhopsContainer">

View File

@ -169,25 +169,51 @@ function TestConnection(e){
} }
function ResetLocation(e){ function ResetLocation(e){
e.style.backgroundImage = 'url(chrome://mailhops/content/images/loader.gif)'; e.style.backgroundImage = 'url(chrome://mailhops/content/images/loader.gif)';
//clear the location
document.getElementById("mailhop.client_location").value='Getting your location...'; document.getElementById("mailhop.client_location").value='Getting your location...';
document.getElementById("mailhop.client_location_ip").value = '';
document.getElementById("mailhop.client_location_host").value = '';
document.getElementById("mailhop.client_location_whois").value = '';
mailHops.setClientLocation(); mailHops.setClientLocation();
if(pref.getCharPref("mail.mailHops.client_location", '') != ''){ //give the above process a few seconds
var response = JSON.parse(pref.getCharPref("mail.mailHops.client_location", '')); setTimeout(function(){
var location = '';
if(response.route[0].city) if(pref.getCharPref("mail.mailHops.client_location", '') != ''){
location+=response.route[0].city; var response = JSON.parse(pref.getCharPref("mail.mailHops.client_location", ''));
if(response.route[0].state) var location = '';
location+=', '+response.route[0].state; if(response.route[0].city)
if(response.route[0].countryName) location+=response.route[0].city;
location+=' ( '+response.route[0].countryName+' )'; if(response.route[0].state)
//set location location+=', '+response.route[0].state;
document.getElementById("mailhop.client_location").value=location; if(response.route[0].countryName)
//set country flag location+=' ( '+response.route[0].countryName+' )';
if(response.route[0].countryCode) else if(response.route[0].countryCode)
document.getElementById("mailhop.client_location").style.backgroundImage='url(chrome://mailhops/content/images/flags/'+response.route[0].countryCode.toLowerCase()+'.png)'; location+=' ( '+response.route[0].countryCode+' )';
}
e.style.backgroundImage=''; //set location
document.getElementById("mailhop.client_location").value=location;
//set ip
document.getElementById("mailhop.client_location_ip").value='IP: '+response.route[0].ip;
//set host
if(response.route[0].host)
document.getElementById("mailhop.client_location_host").value='Host: '+response.route[0].host;
document.getElementById("mailhop.client_location_whois").value = 'whois';
document.getElementById("mailhop.client_location_whois").setAttribute('href', 'http://www.mailhops.com/whois/'+response.route[0].ip);
//set country flag
if(response.route[0].countryCode)
document.getElementById("mailhop.client_location").style.backgroundImage='url(chrome://mailhops/content/images/flags/'+response.route[0].countryCode.toLowerCase()+'.png)';
}
e.style.backgroundImage='';
}, 1000);
} }
function ResetConnection(){ function ResetConnection(){

View File

@ -19,7 +19,7 @@
<tab label="Defaults"/> <tab label="Defaults"/>
<tab label="Display"/> <tab label="Display"/>
<tab label="Hosting"/> <tab label="Hosting"/>
<tab label="My Location"/> <tab label="Current Location"/>
</tabs> </tabs>
<tabpanels> <tabpanels>
<tabpanel> <tabpanel>
@ -74,21 +74,24 @@
<radio value="business" label="Business (Not-Free)"/> <radio value="business" label="Business (Not-Free)"/>
</radiogroup> </radiogroup>
<checkbox id="mailhop.use_private" label="Yes, I Agree to MailHops terms of use for hosting my own MailHops API." checked="false" oncommand="ChangePrivate(this);"/> <checkbox id="mailhop.use_private" label="Yes, I Agree to MailHops terms of use for hosting my own MailHops API." checked="false" oncommand="ChangePrivate(this);"/>
<label class="text-link" value="MailHops Terms of Use" href="http://www.mailhops.com/terms"/> <label class="text-link plain" value="MailHops Terms of Use" href="http://www.mailhops.com/terms"/>
<textbox id="mailhop.api_url" value="http://api.mailhops.com" disabled="true"/> <textbox id="mailhop.api_url" value="http://api.mailhops.com" disabled="true"/>
<label class="text-link act" onclick="TestConnection(this);" value="Test Connection" /> <label class="text-link plain act" onclick="TestConnection(this);" value="Test Connection" />
<label class="text-link act" onclick="ResetConnection();" value="Reset Connection" /> <label class="text-link plain act" onclick="ResetConnection();" value="Reset Connection" />
</groupbox> </groupbox>
</tabpanel> </tabpanel>
<tabpanel> <tabpanel>
<groupbox> <groupbox>
<caption label="My Location"/> <caption label="Your Location"/>
<description> <description>
Your location is cached to reduce the number of lookups by one. Is cached on startup and clicking refresh below to reduce the number of lookups by one.
</description> </description>
<label id="mailhop.client_location" class="act" value="Not Set" /> <label id="mailhop.client_location" class="act" value="Not Set" />
<label id="mailhop.refresh_location" class="text-link act" onclick="ResetLocation(this);" value="Refresh your location" /> <label id="mailhop.client_location_ip" class="plain act" value="" />
<label id="mailhop.client_location_host" class="plain act" value="" />
<label id="mailhop.client_location_whois" class="text-link plain act" value="whois" tooltiptext="Click for whois" />
<label id="mailhop.refresh_location" class="text-link plain act" onclick="ResetLocation(this);" value="Refresh your location" />
</groupbox> </groupbox>
</tabpanel> </tabpanel>

View File

@ -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.8</em:version> <em:version>0.8.2</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>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.