add hotkey f w: resort feedlist by name or unread count
This commit is contained in:
parent
60ea23775a
commit
61a20560f2
17
functions.js
17
functions.js
|
@ -618,8 +618,8 @@ function parse_counters_reply(transport, scheduled_call) {
|
|||
|
||||
parse_runtime_info(runtime_info);
|
||||
|
||||
if (getInitParam("feeds_sort_by_unread") == 1) {
|
||||
resort_feedlist();
|
||||
if (feedsSortByUnread()) {
|
||||
resort_feedlist();
|
||||
}
|
||||
|
||||
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
|
||||
|
@ -661,9 +661,17 @@ function get_feed_entry_unread(elem) {
|
|||
}
|
||||
}
|
||||
|
||||
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; }
|
||||
|
@ -678,7 +686,10 @@ function resort_category(node) {
|
|||
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]);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<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>
|
||||
|
|
|
@ -17,6 +17,7 @@ var hotkey_prefix = false;
|
|||
var init_params = new Object();
|
||||
var ver_offset = 0;
|
||||
var hor_offset = 0;
|
||||
var feeds_sort_by_unread = false;
|
||||
|
||||
function tagsAreDisplayed() {
|
||||
return display_tags;
|
||||
|
@ -451,6 +452,7 @@ function init_second_stage() {
|
|||
|
||||
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);
|
||||
|
||||
|
@ -1220,6 +1222,7 @@ function hotkey_handler(e) {
|
|||
}
|
||||
|
||||
if (keycode == 87) { // w
|
||||
feeds_sort_by_unread = !feeds_sort_by_unread;
|
||||
return resort_feedlist();
|
||||
}
|
||||
|
||||
|
@ -1288,3 +1291,7 @@ function hotkey_handler(e) {
|
|||
exception_error("hotkey_handler", e);
|
||||
}
|
||||
}
|
||||
|
||||
function feedsSortByUnread() {
|
||||
return feeds_sort_by_unread;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue