Make collapsing feed article lists

This commit is contained in:
Andy Valencia 2017-01-28 21:13:19 -08:00
parent 0b2888d4a8
commit 124f6ac7ad
2 changed files with 14 additions and 2 deletions

View file

@ -260,8 +260,11 @@ App.prototype.populateList = function() {
var artidx = 0;
for (i = 0; i < byfeed.length; ++i) {
var feed = byfeed[i];
html_str += "<li>" + feed[0].feed_title;
html_str += "<ul>";
html_str += '<li><span' +
' onclick="return(toggleFeed(' + i.toString() + '));"' +
'>' + feed[0].feed_title + '</span>';
var feedid = '"feed' + i.toString() + '"';
html_str += '<ul id=' + feedid + ' style="display: none;">'
for (var j = 0; j < feed.length; ++j) {
article = ua[artidx];
html_str += "<li"+ (article.unread ?

View file

@ -8,6 +8,15 @@ function debug(obj) {
alert(obj)
}
function toggleFeed(feedid) {
var e = document.getElementById("feed" + feedid.toString());
if (e.style.display == "none") {
e.style.display = "";
} else {
e.style.display = "none";
}
}
function $(obj) {
if(typeof obj == "string") return document.querySelector(obj);
else return obj;