mirror of
https://github.com/MailHops/mailhops-plugin.git
synced 2025-05-28 03:40:10 -07:00
js/mailhops_details.js: prepare to show local data even on error.
Currently, on error (rate limit, unable to reach Mailhops API), an error message is shown and all additional information is bypassed. This also means that the theme is not being applied. Change the code to show local data even in error cases, and also apply the theme option.
This commit is contained in:
parent
7835ac3e96
commit
9638412388
@ -47,10 +47,11 @@ function updateContent(msg, noauth) {
|
||||
document.getElementById('hop-message').classList.add('warning');
|
||||
document.getElementById('mh-map-button').style.display = 'none';
|
||||
document.getElementById('hop-message-header').innerHTML = msg.message.error;
|
||||
return;
|
||||
}
|
||||
document.getElementById('hop-message').classList.remove('warning');
|
||||
document.getElementById('mh-map-button').style.display = 'inline-block';
|
||||
else {
|
||||
document.getElementById('hop-message').classList.remove('warning');
|
||||
document.getElementById('mh-map-button').style.display = 'inline-block';
|
||||
}
|
||||
|
||||
const route = msg.response.route || [];
|
||||
const sender = msg.message.sender || null;
|
||||
@ -148,10 +149,13 @@ function updateContent(msg, noauth) {
|
||||
// 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
|
||||
document.getElementById('hop-message-header').innerHTML = `${route.length} Hops`;
|
||||
if (sender && client) {
|
||||
document.getElementById('hop-message-header').innerHTML += ' over '+MailHopsUtils.getDistance(sender, client, unit) + ' ' + unit;
|
||||
if (!msg.message.error) {
|
||||
document.getElementById('hop-message-header').innerHTML = `${route.length} Hops`;
|
||||
if (sender && client) {
|
||||
document.getElementById('hop-message-header').innerHTML += ' over '+MailHopsUtils.getDistance(sender, client, unit) + ' ' + unit;
|
||||
}
|
||||
}
|
||||
|
||||
// hop list
|
||||
|
Loading…
x
Reference in New Issue
Block a user