mirror of
https://github.com/MailHops/mailhops-plugin.git
synced 2025-05-31 21:10:14 -07:00
Merge pull request #34 from Ionic/feature/debug-auth-data
Add debugging to auth data output.
This commit is contained in:
commit
75349a7922
@ -47,15 +47,17 @@ function updateContent(msg, noauth) {
|
|||||||
document.getElementById('hop-message').classList.add('warning');
|
document.getElementById('hop-message').classList.add('warning');
|
||||||
document.getElementById('mh-map-button').style.display = 'none';
|
document.getElementById('mh-map-button').style.display = 'none';
|
||||||
document.getElementById('hop-message-header').innerHTML = msg.message.error;
|
document.getElementById('hop-message-header').innerHTML = msg.message.error;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
document.getElementById('hop-message').classList.remove('warning');
|
else {
|
||||||
document.getElementById('mh-map-button').style.display = 'inline-block';
|
document.getElementById('hop-message').classList.remove('warning');
|
||||||
|
document.getElementById('mh-map-button').style.display = 'inline-block';
|
||||||
|
}
|
||||||
|
|
||||||
const route = msg.response.route || [];
|
const route = msg.response.route || [];
|
||||||
const sender = msg.message.sender || null;
|
const sender = msg.message.sender || null;
|
||||||
const unit = msg.options.unit || "mi";
|
const unit = msg.options.unit || "mi";
|
||||||
const theme = msg.options.theme || "light";
|
const theme = msg.options.theme || "light";
|
||||||
|
const debug = msg.options.debug || false;
|
||||||
let client = null;
|
let client = null;
|
||||||
let items = [];
|
let items = [];
|
||||||
|
|
||||||
@ -128,30 +130,43 @@ function updateContent(msg, noauth) {
|
|||||||
asn = '<br/>ASN Org: ' + MailHopsUtils.htmlEncode(route[i].asn.autonomous_system_organization);
|
asn = '<br/>ASN Org: ' + MailHopsUtils.htmlEncode(route[i].asn.autonomous_system_organization);
|
||||||
asn += ' (<a href="https://dnschecker.org/asn-whois-lookup.php?query='+route[i].asn.autonomous_system_number+'" target="_blank" title="ASN Lookup">' + route[i].asn.autonomous_system_number + '</a>)'
|
asn += ' (<a href="https://dnschecker.org/asn-whois-lookup.php?query='+route[i].asn.autonomous_system_number+'" target="_blank" title="ASN Lookup">' + route[i].asn.autonomous_system_number + '</a>)'
|
||||||
}
|
}
|
||||||
|
|
||||||
var auth = '';
|
// append child
|
||||||
if (!noauth && msg.message.auth.length) {
|
items.push('<div class="item"><div class="content"><div class="header"><img src="'+ icon + '" /> ' + header + weather +' <label class="ui circular label icon" style="float: right;">'+ (i + 1) +'</label></div><div class="description">'+ description + asn + '</div></div></div>');
|
||||||
for (var a = 0; a < msg.message.auth.length; a++){
|
}
|
||||||
if (msg.message.auth[a].icon) {
|
|
||||||
auth += '<label class="tiny ui label ' + msg.message.auth[a].color + '"><img src="' + msg.message.auth[a].icon + '"/>' + msg.message.auth[a].type + ' ' + msg.message.auth[a].copy + '</label>';
|
var auth = '';
|
||||||
|
if (!noauth && msg.message.auth.length) {
|
||||||
|
for (var a = 0; a < msg.message.auth.length; a++){
|
||||||
|
if (msg.message.auth[a].icon) {
|
||||||
|
var add = '<label class="tiny ui label ' + msg.message.auth[a].color + '"><img src="' + msg.message.auth[a].icon + '"/>' + msg.message.auth[a].type + ' ' + msg.message.auth[a].copy + '</label>';
|
||||||
|
if (debug) {
|
||||||
|
console.log("adding to auth (type icon): '" + add + "'");
|
||||||
}
|
}
|
||||||
else if (msg.message.auth[a].link) {
|
auth += add;
|
||||||
if (-1 !== msg.message.auth[a].link.indexOf(',')) {
|
}
|
||||||
auth += '<a class="tiny ui label ' + msg.message.auth[a].color + '" href="'+msg.message.auth[a].link.substr(0,msg.message.auth[a].link.indexOf(','))+'" target="_blank">' + msg.message.auth[a].type + '</a>';
|
else if (msg.message.auth[a].link) {
|
||||||
}
|
var add = '';
|
||||||
else {
|
if (-1 != msg.message.auth[a].link.indexOf(',')) {
|
||||||
auth += '<a class="tiny ui label ' + msg.message.auth[a].color + '" href="'+msg.message.auth[a].link+'" target="_blank">' + msg.message.auth[a].type + '</a>';
|
add = '<a class="tiny ui label ' + msg.message.auth[a].color + '" href="'+msg.message.auth[a].link.substr(0,msg.message.auth[a].link.indexOf(','))+'" target="_blank">' + msg.message.auth[a].type + '</a>';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
add = '<a class="tiny ui label ' + msg.message.auth[a].color + '" href="'+msg.message.auth[a].link+'" target="_blank">' + msg.message.auth[a].type + '</a>';
|
||||||
|
}
|
||||||
|
if (debug) {
|
||||||
|
console.log("adding to auth (type link): '" + add + "'");
|
||||||
|
}
|
||||||
|
auth += add;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// append child
|
|
||||||
items.push('<div class="item"><div class="content"><div class="header"><img src="'+ icon + '" /> ' + header + weather +' <label class="ui circular label icon" style="float: right;">'+ (i + 1) +'</label></div><div class="description">'+ description + asn + '</div></div></div>');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// header
|
// header
|
||||||
document.getElementById('hop-message-header').innerHTML = `${route.length} Hops`;
|
if (!msg.message.error) {
|
||||||
if (sender && client) {
|
document.getElementById('hop-message-header').innerHTML = `${route.length} Hops`;
|
||||||
document.getElementById('hop-message-header').innerHTML += ' over '+MailHopsUtils.getDistance(sender, client, unit) + ' ' + unit;
|
if (sender && client) {
|
||||||
|
document.getElementById('hop-message-header').innerHTML += ' over '+MailHopsUtils.getDistance(sender, client, unit) + ' ' + unit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hop list
|
// hop list
|
||||||
|
Loading…
x
Reference in New Issue
Block a user