Archived
1
0

update mod ui feed connection elements

This commit is contained in:
Jeff Becker 2016-03-12 10:13:17 -05:00
parent b2d46c9021
commit 93b452c497
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B

View File

@ -145,7 +145,36 @@ function nntpchan_delete() {
function createConnectionElement(j) {
var e = document.createElement("div");
e.setAttribute("class", "connection");
e.appendChild(document.createTextNode(JSON.stringify(j)));
var auth = document.createElement("span");
// authentication state
if (j.authed) {
auth.setAttribute("class", "authed");
auth.appendChild(document.createTextNode("authenticated"));
} else {
auth.appendChild(document.createTextNode("not authenticated"));
}
e.appendChild(auth);
// connection mode
var mode = document.createElement("span");
mode.appendChild(document.createTextNode("mode"));
mode.appendChild(document.createTextNode(j.mode));
e.appendChild(mode);
var pending = document.createElement("div");
pending.setAttribute("class", "pending");
// pending articles
var articles = Object.keys(j.pending);
for ( var idx = 0 ; idx < articles.length; idx ++ ) {
var msgid = articles[idx];
var state = j.pending[msgid];
var elem = document.createElement("div");
elem.appendChild(document.createTextNode(msgid + ": " + state));
elem.setAttribute("class", "pending_item "+state);
pending.appendChild(elem);
}
e.appendChild(pending);
// e.appendChild(document.createTextNode(JSON.stringify(j)));
return e;
}