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,
mailhopsAuthContainer: null,
resultListDataPane: null,
resultMeta: null,
isLoaded: false,
options: {'map':'goog','unit':'mi','api_url':'http://api.mailhops.com'},
appVersion: 'MailHops Postbox 0.8',
appVersion: 'MailHops Postbox 0.8.2',
message: {secure:[]},
client_location: null
}
@ -65,6 +64,7 @@ mailHops.init = function()
mailHops.launchMap(String(this.getAttribute("data-route")));
}
, false);
mailHops.resultDetailsLink.addEventListener("click", function () {
if(mailHops.resultContainerDetails.style.display=='none'){
mailHops.resultContainerDetails.style.display = 'block';
@ -87,6 +87,11 @@ mailHops.init = function()
window.openDialog("chrome://mailhops/content/preferences.xul","mailHopsPreferences",null,null);
}
, false);
document.getElementById("mailhopsDataPaneRefreshLink").addEventListener("click", function () {
mailHops.refreshCache();
}
, false);
};
mailHops.loadPref = function()
@ -563,7 +568,7 @@ mailHops.displayResult = function ( header_route, response, meta, lookup_url ){
mailHops.resultDetails.removeChild(mailHops.resultDetails.firstChild);
}
//append meta
//append meta
if(mailHops.options.show_meta){
document.getElementById('dataPaneMailHopsMetaContainer').style.display='';
while(mailHops.resultMeta.firstChild) {
@ -582,7 +587,7 @@ mailHops.displayResult = function ( header_route, response, meta, lookup_url ){
} else {
document.getElementById('dataPaneMailHopsMetaContainer').style.display='none';
}
}
if(response && response.route && response.route.length > 0){
@ -905,17 +910,6 @@ mailHops.lookupRoute = function(header_route){
//import nativeJSON
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);
if(mailHops.options.show_weather)
@ -923,12 +917,26 @@ mailHops.lookupRoute = function(header_route){
if(mailHops.options.client_location != '')
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.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
try{
var data = JSON.parse(xmlhttp.responseText);
if(data && data.meta.code==200){
var d = new Date();
data.meta.cached = d.toISOString();
//save the result
mailHops.saveResults(JSON.stringify(data));
//display the result
@ -973,7 +981,7 @@ mailHops.launchMap = function(route){
if(mailHops.options.show_weather)
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" );
};
mailHops.refreshCache = function(){
mailHops.saveResults('');
mailHops.getRoute();
};
addEventListener ( "messagepane-loaded" , mailHops.setupEventListener , true ) ;

View File

@ -10,7 +10,7 @@
title="MailHops Map"
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>
function loadMap(){

View File

@ -23,7 +23,8 @@
<hbox class="mailHopsLinkContainer">
<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="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 id="mailhopsDetailsContainer" class="mailhopsContainer">

View File

@ -169,25 +169,51 @@ function TestConnection(e){
}
function ResetLocation(e){
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_ip").value = '';
document.getElementById("mailhop.client_location_host").value = '';
document.getElementById("mailhop.client_location_whois").value = '';
mailHops.setClientLocation();
if(pref.getCharPref("mail.mailHops.client_location", '') != ''){
var response = JSON.parse(pref.getCharPref("mail.mailHops.client_location", ''));
var location = '';
if(response.route[0].city)
location+=response.route[0].city;
if(response.route[0].state)
location+=', '+response.route[0].state;
if(response.route[0].countryName)
location+=' ( '+response.route[0].countryName+' )';
//set location
document.getElementById("mailhop.client_location").value=location;
//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='';
//give the above process a few seconds
setTimeout(function(){
if(pref.getCharPref("mail.mailHops.client_location", '') != ''){
var response = JSON.parse(pref.getCharPref("mail.mailHops.client_location", ''));
var location = '';
if(response.route[0].city)
location+=response.route[0].city;
if(response.route[0].state)
location+=', '+response.route[0].state;
if(response.route[0].countryName)
location+=' ( '+response.route[0].countryName+' )';
else if(response.route[0].countryCode)
location+=' ( '+response.route[0].countryCode+' )';
//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(){

View File

@ -19,7 +19,7 @@
<tab label="Defaults"/>
<tab label="Display"/>
<tab label="Hosting"/>
<tab label="My Location"/>
<tab label="Current Location"/>
</tabs>
<tabpanels>
<tabpanel>
@ -74,21 +74,24 @@
<radio value="business" label="Business (Not-Free)"/>
</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);"/>
<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"/>
<label class="text-link act" onclick="TestConnection(this);" value="Test Connection" />
<label class="text-link act" onclick="ResetConnection();" value="Reset Connection" />
<label class="text-link plain act" onclick="TestConnection(this);" value="Test Connection" />
<label class="text-link plain act" onclick="ResetConnection();" value="Reset Connection" />
</groupbox>
</tabpanel>
<tabpanel>
<groupbox>
<caption label="My Location"/>
<caption label="Your Location"/>
<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>
<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>
</tabpanel>

View File

@ -7,7 +7,7 @@
<em:id>postbox@mailhops.com</em:id>
<em:type>2</em:type>
<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:iconURL>chrome://mailhops/content/images/mailhops32.png</em:iconURL>
<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.