From a1b8c5b160b5c7c0165f7fa0d0b822b4a60cb56b Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Mon, 10 Nov 2014 17:19:08 +0100 Subject: [PATCH] do not deselect the current item if no successor/predecessors exists When using the previous shortcut with the first article selected, the selection is removed and no article is the current-item. Using the shortcut again, the last article is the current-item (as expected on a new loaded page). The same applies to the combination of last article and next shortcut. --- assets/js/all.min.js | 4 ++-- assets/js/nav.js | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/assets/js/all.min.js b/assets/js/all.min.js index 2fcad6e..df73b29 100644 --- a/assets/js/all.min.js +++ b/assets/js/all.min.js @@ -15,5 +15,5 @@ break;case "mark-feed-read":c.preventDefault(),Miniflux.Item.MarkListingAsRead(" [];break;case 98:window.location.href="?action=bookmarks";e=[];break;case 104:window.location.href="?action=history";e=[];break;case 115:window.location.href="?action=feeds";e=[];break;case 112:window.location.href="?action=config";e=[];break;default:e=[]}else switch(e=[],b=document.getElementById("current-item"),c.keyCode||c.which){case 100:Miniflux.Item.DownloadContent(b);break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();break;case 110:case 106:Miniflux.Nav.SelectNextItem();break;case 118:Miniflux.Item.OpenOriginal(b); break;case 111:Miniflux.Item.Show(b);break;case 109:Miniflux.Item.SwitchStatus(b);break;case 102:Miniflux.Item.SwitchBookmark(b);break;case 104:Miniflux.Nav.OpenPreviousPage();break;case 108:Miniflux.Nav.OpenNextPage();break;case 114:Miniflux.Feed.UpdateAll();break;case 63:Miniflux.Nav.ShowHelp()}}}}}}(); Miniflux.Nav=function(){function e(b){var a=pageYOffset+document.documentElement.clientHeight;(0>a-(b.offsetTop+b.offsetHeight)||a-b.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,b.offsetTop-10)}function c(){return document.getElementById("listing")?!0:!1}return{OpenNextPage:function(){var b=document.getElementById("next-page");b&&b.click()},OpenPreviousPage:function(){var b=document.getElementById("previous-page");b&&b.click()},SelectNextItem:function(){var b=document.getElementById("next-item"); -if(b)b.click();else if(c())if(b=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var a=0,g=b.length;a= 0; i--) { - if (items[i].id == "current-item") { - - items[i].id = "item-" + items[i].getAttribute("data-item-id"); + if (items[i].id === "current-item") { if (i - 1 >= 0) { + items[i].id = "item-" + items[i].getAttribute("data-item-id"); items[i - 1].id = "current-item"; scrollPageTo(items[i - 1]); }