var mailHopsDisplay = { resultBox: null, resultText: null, resultDetails: null, container: null, mapLink: null, mailhopsDataPaneSPF: null, mailhopsDataPaneDKIM: null, mailhopsDataPaneMailer: null, mailhopsDataPaneDNSBL: null, mailhopsResultWeather: null, options: null, init: function(options){ this.options = options; this.container = document.getElementById ( "mailhopsBox" ) ; this.resultBox = document.getElementById ( "mailhopsResult" ) ; this.resultText = document.getElementById ( "mailhopsResultText" ) ; this.mailhopsResultWeather = document.getElementById ( "mailhopsResultWeather" ) ; this.resultDetails = document.getElementById ( "mailhopsDataPaneDetails"); this.mapLink = document.getElementById ( "mailhopsMapLink"); //auth this.mailhopsDataPaneSPF = document.getElementById ( "mailhopsDataPaneSPF"); this.mailhopsDataPaneDKIM = document.getElementById ( "mailhopsDataPaneDKIM"); this.mailhopsDataPaneMailer = document.getElementById ( "mailhopsDataPaneMailer"); this.mailhopsDataPaneDNSBL = document.getElementById ( "mailhopsDataPaneDNSBL"); //event listner for route click to launch map this.mailhopsDataPaneDNSBL.addEventListener("click", function () { if(this.hasAttribute('data-ip')) mailHopsUtils.launchSpamHausURL( this.getAttribute('data-ip') ); }); this.mapLink.addEventListener("click", function () { if(this.hasAttribute('data-route')) mailHopsUtils.launchMap( String(this.getAttribute('data-route')), options ); }); }, lists: function( header_unsubscribe ){ }, auth: function( header_xmailer, header_useragent, header_xmimeole, header_auth, header_spf ){ //SPF if(header_spf){ header_spf=header_spf.replace(/^\s+/,""); var headerSPFArr=header_spf.split(' '); this.mailhopsDataPaneSPF.setAttribute('value','SPF: '+headerSPFArr[0]); this.mailhopsDataPaneSPF.style.backgroundImage = 'url(chrome://mailhops/content/images/auth/'+headerSPFArr[0]+'.png)'; this.mailhopsDataPaneSPF.setAttribute('tooltiptext',header_spf+'\n'+mailHopsUtils.spf(headerSPFArr[0])); this.mailhopsDataPaneSPF.style.display='block'; } else { this.mailhopsDataPaneSPF.style.display='none'; } //Authentication-Results //http://tools.ietf.org/html/rfc5451 if(header_auth){ var headerAuthArr=header_auth.split(';'); var dkim_result; var spf_result; for(var h=0;h 0){ if(this.options.client_location){ var client_location = JSON.parse(this.options.client_location); if(response.route[response.route.length-1].ip != client_location.route[0].ip) response.route.push(client_location.route[0]); } for(var i=0; i 0){ if(this.options.unit=='mi') distanceText =' ( '+mailHopsUtils.addCommas(Math.round(response.distance.miles))+' mi traveled )'; else distanceText =' ( '+mailHopsUtils.addCommas(Math.round(response.distance.kilometers))+' km traveled )'; } else if(displayText=='') displayText = ' Local message.'; } if(header_route) this.mapLink.setAttribute("data-route", header_route); else this.mapLink.removeAttribute("data-route"); this.resultText.setAttribute('value', displayText+' '+distanceText); this.resultText.style.backgroundImage = 'url('+image+')'; }//end route };