parse_runtime_info(runtime_info);
- if (getInitParam("feeds_sort_by_unread") == 1) {
- resort_feedlist();
- }
+ if (feedsSortByUnread()) {
+ resort_feedlist();
+ }
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
}
}
+function get_feed_entry_name(elem) {
+ var id = elem.id.replace("FEEDR-", "");
+ return getFeedName(id);
+}
+
+
function resort_category(node) {
debug("resort_category: " + node);
+ var by_unread = feedsSortByUnread();
+
if (node.hasChildNodes() && node.firstChild.nextSibling != false) {
for (i = 0; i < node.childNodes.length; i++) {
if (node.childNodes[i].nodeName != "LI") { continue; }
var tmp_val = get_feed_entry_unread(node.childNodes[i]);
var cur_val = get_feed_entry_unread(node.childNodes[j]);
- if (cur_val > tmp_val) {
+ var tmp_name = get_feed_entry_name(node.childNodes[i]);
+ var cur_name = get_feed_entry_name(node.childNodes[j]);
+
+ if ((by_unread && (cur_val > tmp_val)) || (!by_unread && (cur_name < tmp_name))) {
tempnode_i = node.childNodes[i].cloneNode(true);
tempnode_j = node.childNodes[j].cloneNode(true);
node.replaceChild(tempnode_i, node.childNodes[j]);
<tr><td class='n'>f a</td><td><?php echo __("(Un)hide read feeds") ?></td></tr>
<tr><td class='n'>f s</td><td><?php echo __("Subscribe to feed") ?></td></tr>
<tr><td class='n'>f e</td><td><?php echo __("Edit feed") ?></td></tr>
+ <tr><td class='n'>f w</td><td><?php echo __("Sort by name or unread count") ?></td></tr>
<tr><td class='n'>q</td><td><?php echo __("Mark feed as read") ?></td></tr>
<tr><td class='n'>Q</td><td><?php echo __("Mark all feeds as read") ?></td></tr>
</table>
var init_params = new Object();
var ver_offset = 0;
var hor_offset = 0;
+var feeds_sort_by_unread = false;
function tagsAreDisplayed() {
return display_tags;
daemon_enabled = getInitParam("daemon_enabled") == 1;
daemon_refresh_only = getInitParam("daemon_refresh_only") == 1;
+ feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
setTimeout('updateFeedList(false, false)', 50);
}
if (keycode == 87) { // w
+ feeds_sort_by_unread = !feeds_sort_by_unread;
return resort_feedlist();
}
exception_error("hotkey_handler", e);
}
}
+
+function feedsSortByUnread() {
+ return feeds_sort_by_unread;
+}