mirror of
https://github.com/MailHops/mailhops-plugin.git
synced 2025-05-18 15:20:08 -07:00
Moved display to the inspector pane, added auto update link to dropbox
This commit is contained in:
parent
d12fe0bc21
commit
8500b667bb
@ -7,31 +7,31 @@
|
|||||||
|
|
||||||
var mailHops =
|
var mailHops =
|
||||||
{
|
{
|
||||||
resultBox: null,
|
resultTextDataPane: null,
|
||||||
resultImage: null,
|
resultTextDataPane2: null,
|
||||||
resultText: null,
|
resultContainerDataPane: null,
|
||||||
container: null,
|
isLoaded: false,
|
||||||
isLoaded: false,
|
map: 'goog',
|
||||||
map: 'goog',
|
unit: 'mi',
|
||||||
unit: 'mi',
|
appVersion: 'MailHops Postbox 0.4.7'
|
||||||
appVersion: 'MailHops Postbox 0.4.6'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mailHops.startLoading = function()
|
mailHops.startLoading = function()
|
||||||
{
|
{
|
||||||
mailHops.isLoaded = true;
|
mailHops.isLoaded = true;
|
||||||
mailHops.container = document.getElementById ( "mailhopsBox" ) ;
|
|
||||||
mailHops.resultBox = document.getElementById ( "mailhopsResult" ) ;
|
mailHops.resultContainerDataPane = document.getElementById ( "mailhopsDataPane");
|
||||||
mailHops.resultImage = document.getElementById ( "mailhopsResultImage" ) ;
|
mailHops.resultTextDataPane = document.getElementById ( "mailhopsDataPaneText");
|
||||||
mailHops.resultText = document.getElementById ( "mailhopsResultText" ) ;
|
mailHops.resultTextDataPane2 = document.getElementById ( "mailhopsDataPaneText2");
|
||||||
|
|
||||||
//get preferences
|
//get preferences
|
||||||
mailHops.map = mailHops.getCharPref('mail.mailHops.map','goog');
|
mailHops.map = mailHops.getCharPref('mail.mailHops.map','goog');
|
||||||
mailHops.unit = mailHops.getCharPref('mail.mailHops.unit','mi');
|
mailHops.unit = mailHops.getCharPref('mail.mailHops.unit','mi');
|
||||||
//event listner for route click to launch map
|
//event listner for route click to launch map
|
||||||
mailHops.container.addEventListener("click", function () {
|
mailHops.resultContainerDataPane.addEventListener("click", function () {
|
||||||
var route = this.getAttribute("route");
|
var route = this.getAttribute("route");
|
||||||
if(route)
|
if(route)
|
||||||
launchMap(String(route));
|
mailHops.launchMap(String(route));
|
||||||
}
|
}
|
||||||
, false);
|
, false);
|
||||||
} ;
|
} ;
|
||||||
@ -180,6 +180,7 @@ mailHops.testIP = function(ip,header){
|
|||||||
mailHops.displayResult = function ( image, distance, city, state, countryName, route )
|
mailHops.displayResult = function ( image, distance, city, state, countryName, route )
|
||||||
{
|
{
|
||||||
var displayText='';
|
var displayText='';
|
||||||
|
var distanceText='';
|
||||||
|
|
||||||
if(image.indexOf('error')!=-1) {
|
if(image.indexOf('error')!=-1) {
|
||||||
displayText = ' There was a problem connecting to MailHops.';
|
displayText = ' There was a problem connecting to MailHops.';
|
||||||
@ -194,22 +195,35 @@ mailHops.displayResult = function ( image, distance, city, state, countryName, r
|
|||||||
displayText = countryName;
|
displayText = countryName;
|
||||||
if(distance && distance.miles > 0){
|
if(distance && distance.miles > 0){
|
||||||
if(mailHops.unit=='mi')
|
if(mailHops.unit=='mi')
|
||||||
displayText +=' ( '+addCommas(Math.round(distance.miles))+' mi traveled )';
|
distanceText =' ( '+mailHops.addCommas(Math.round(distance.miles))+' mi traveled )';
|
||||||
else
|
else
|
||||||
displayText +=' ( '+addCommas(Math.round(distance.kilometers))+' km traveled )';
|
distanceText =' ( '+mailHops.addCommas(Math.round(distance.kilometers))+' km traveled )';
|
||||||
}
|
}
|
||||||
else if(displayText=='')
|
else if(displayText=='')
|
||||||
displayText = ' Local message.';
|
displayText = ' Local message.';
|
||||||
}
|
}
|
||||||
//add event for route api map
|
//add event for route api map
|
||||||
mailHops.container.setAttribute("route", route);
|
if(mailHops.resultContainerDataPane){
|
||||||
mailHops.resultText.textContent = displayText;
|
mailHops.resultContainerDataPane.setAttribute("route", route);
|
||||||
mailHops.resultImage.src=image;
|
mailHops.resultTextDataPane.style.backgroundImage = 'url('+image+')';
|
||||||
|
mailHops.resultTextDataPane.value = displayText;
|
||||||
|
mailHops.resultTextDataPane.setAttribute('tooltiptext',displayText+' '+distanceText);
|
||||||
|
|
||||||
|
mailHops.resultTextDataPane2.value = distanceText;
|
||||||
|
mailHops.resultTextDataPane2.setAttribute('tooltiptext',displayText+' '+distanceText);
|
||||||
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mailHops.clearRoute = function(){
|
mailHops.clearRoute = function(){
|
||||||
mailHops.resultImage.src='chrome://mailhops/content/images/loader.gif';
|
|
||||||
mailHops.resultText.textContent = ' Looking Up Route';
|
if(mailHops.resultContainerDataPane){
|
||||||
|
mailHops.resultTextDataPane.style.backgroundImage = 'url(chrome://mailhops/content/images/loader.gif)';
|
||||||
|
mailHops.resultTextDataPane.value = ' Looking Up Route';
|
||||||
|
mailHops.resultTextDataPane.setAttribute('tooltiptext','Looking Up Route');
|
||||||
|
|
||||||
|
mailHops.resultTextDataPane2.value = '';
|
||||||
|
mailHops.resultTextDataPane2.setAttribute('tooltiptext','');
|
||||||
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mailHops.setupEventListener = function()
|
mailHops.setupEventListener = function()
|
||||||
@ -318,7 +332,7 @@ mailHops.lookup = function(route){
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function addCommas(nStr)
|
mailHops.addCommas = function(nStr)
|
||||||
{
|
{
|
||||||
nStr += '';
|
nStr += '';
|
||||||
var x = nStr.split('.');
|
var x = nStr.split('.');
|
||||||
@ -329,13 +343,13 @@ function addCommas(nStr)
|
|||||||
x1 = x1.replace(rgx, '$1' + ',' + '$2');
|
x1 = x1.replace(rgx, '$1' + ',' + '$2');
|
||||||
}
|
}
|
||||||
return x1 + x2;
|
return x1 + x2;
|
||||||
}
|
};
|
||||||
|
|
||||||
function launchMap(route)
|
mailHops.launchMap = function(route)
|
||||||
{
|
{
|
||||||
//launch mailhops api map
|
//launch mailhops api map
|
||||||
var openwin = window.openDialog('http://api.mailhops.com/v1/map/?tb&app='+mailHops.appVersion+'&m='+mailHops.map+'&u='+mailHops.unit+'&r='+route,"MailHops",'toolbar=no,location=no,directories=no,menubar=yes,scrollbars=yes,close=yes,width=730,height=330');
|
var openwin = window.openDialog('http://api.mailhops.com/v1/map/?tb&app='+mailHops.appVersion+'&m='+mailHops.map+'&u='+mailHops.unit+'&r='+route,"MailHops",'toolbar=no,location=no,directories=no,menubar=yes,scrollbars=yes,close=yes,width=732,height=332');
|
||||||
openwin.focus();
|
openwin.focus();
|
||||||
}
|
};
|
||||||
|
|
||||||
addEventListener ( "messagepane-loaded" , mailHops.setupEventListener , true ) ;
|
addEventListener ( "messagepane-loaded" , mailHops.setupEventListener , true ) ;
|
||||||
|
@ -8,16 +8,17 @@
|
|||||||
|
|
||||||
<script type="application/x-javascript" src="chrome://mailhops/content/mailhops.js"/>
|
<script type="application/x-javascript" src="chrome://mailhops/content/mailhops.js"/>
|
||||||
|
|
||||||
<vbox id="headers">
|
<vbox id="dataPane2">
|
||||||
<hbox id="mailhopsBox" class="mailheader" collapsed="false" inminmode="true">
|
<vbox id="dataPaneMailHopsContainer" class="dataPaneBox">
|
||||||
<label id="mailhopsLabel" class="headerName plain" value="route: "/>
|
<hbox flex="1" pack="start" align="center">
|
||||||
<hbox flex="1">
|
<label class="dataPaneHeader" crop="right" value="Route"></label>
|
||||||
<mailheadervalue id="mailhopsResult" flex="1">
|
<separator class="dataPaneBoxSeparator" flex="1"></separator>
|
||||||
<image id="mailhopsResultImage" tooltiptext="Click to view the travel map of this message." width="16px" height="11px"/>
|
</hbox>
|
||||||
<hbox id="mailhopsResultText" class="headerValue plain"></hbox>
|
<vbox id="mailhopsDataPane" flex="1">
|
||||||
</mailheadervalue>
|
<label id="mailhopsDataPaneText" class="text-link dataPaneAddressitem" tooltiptext=""></label>
|
||||||
</hbox>
|
<label id="mailhopsDataPaneText2" class="text-link dataPaneAddressitem" tooltiptext=""></label>
|
||||||
</hbox>
|
</vbox>
|
||||||
</vbox>
|
</vbox>
|
||||||
|
</vbox>
|
||||||
|
|
||||||
</overlay>
|
</overlay>
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
<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.4.6</em:version>
|
<em:version>0.4.7</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>
|
||||||
<em:creator>Andrew Van Tassel</em:creator>
|
<em:creator>Andrew Van Tassel</em:creator>
|
||||||
<em:developer>Andrew Van Tassel</em:developer>
|
<em:developer>Andrew Van Tassel</em:developer>
|
||||||
<em:optionsURL>chrome://mailhops/content/preferences.xul</em:optionsURL>
|
<em:optionsURL>chrome://mailhops/content/preferences.xul</em:optionsURL>
|
||||||
<em:updateURL>https://www.asprocket.com/~asprocke/mailhops/plugins/postbox/update.rdf</em:updateURL>
|
<em:updateURL>https://dl.dropbox.com/u/1533417/mailhops_update.rdf</em:updateURL>
|
||||||
|
|
||||||
<em:targetApplication>
|
<em:targetApplication>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user