var Miniflux={};Miniflux.App=function(){return{Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()}}}(); Miniflux.Feed=function(){var e=[],d=[];return{Update:function(a,d){var e=document.getElementById("items-count-"+a);if(e){e.parentNode.className="loading-icon";var c=new XMLHttpRequest;c.onload=function(){e.parentNode.className="";var c=JSON.parse(this.responseText);if(c.result){var f=c.items_count,g=document.getElementById("items-count-"+a);g&&(g.innerHTML=f.items_unread+"/"+f.items_total)}d&&d(c)};c.open("POST","?action=refresh-feed&feed_id="+a,!0);c.send()}},UpdateAll:function(){for(var a=document.getElementsByTagName("a"), b=0,h=a.length;bd.length;){var c=e.shift();d.push(c);Miniflux.Feed.Update(c,function(c){c=d.indexOf(c.feed_id);0<=c&&d.splice(c,1);0===e.length&&0===d.length&&(clearInterval(k),window.location.href="?action=unread")})}},100)}}}(); Miniflux.Item=function(){function e(c){return item_id=c.getAttribute("data-item-id")}function d(c){if(c&&c.hasAttribute("data-reverse-label")){var a=c.innerHTML;c.innerHTML=c.getAttribute("data-reverse-label");c.setAttribute("data-reverse-label",a)}}function a(c){"mouse"!==Miniflux.Event.lastEventType&&Miniflux.Nav.SelectNextItem();c.parentNode.removeChild(c);var a=document.getElementById("page-counter");if(a){c=c.getAttribute("data-item-page");var d=parseInt(a.textContent,10)-1,b=document.getElementsByTagName("article"); if(0===d||0===b.length)window.location=location.href;a.textContent=d;switch(c){case "unread":document.title="Miniflux ("+d+")";document.getElementById("nav-counter").textContent=d;break;case "feed-items":document.title="("+d+") "+a.parentNode.firstChild.nodeValue;break;default:document.title=a.parentNode.firstChild.nodeValue+" ("+d+")"}}}function b(c){var b=e(c),f=new XMLHttpRequest;f.onload=function(){if(Miniflux.Nav.IsListing())if(c.getAttribute("data-hide"))a(c);else{c.setAttribute("data-item-status", "read");var b=c.querySelector("a.mark");d(b);(b=c.querySelector("a.mark"))&&b.setAttribute("data-action","mark-unread")}};f.open("POST","?action=mark-item-read&id="+b,!0);f.send()}function h(c){var b=e(c),f=new XMLHttpRequest;f.onload=function(){if(Miniflux.Nav.IsListing())if(c.getAttribute("data-hide"))a(c);else{c.setAttribute("data-item-status","unread");var b=c.querySelector("a.mark");d(b);(b=c.querySelector("a.mark"))&&b.setAttribute("data-action","mark-read")}};f.open("POST","?action=mark-item-unread&id="+ b,!0);f.send()}return{MarkAsRead:b,MarkAsUnread:h,MarkAsRemoved:function(c){var b=e(c),d=new XMLHttpRequest;d.onload=function(){Miniflux.Nav.IsListing()&&a(c)};d.open("POST","?action=mark-item-removed&id="+b,!0);d.send()},SwitchBookmark:function(c){var b=e(c),f="1"===c.getAttribute("data-item-bookmark")?"0":"1",g=new XMLHttpRequest;g.onload=function(){if(Miniflux.Nav.IsListing()&&"bookmarks"===c.getAttribute("data-item-page"))a(c);else if(c.setAttribute("data-item-bookmark",f),Miniflux.Nav.IsListing()){var b= c.querySelector("a.bookmark");d(b)}else if((b=c.querySelector("a.bookmark-icon"))&&b.hasAttribute("data-reverse-title")){var e=b.getAttribute("title");b.setAttribute("title",b.getAttribute("data-reverse-title"));b.setAttribute("data-reverse-title",e)}};g.open("POST","?action=bookmark&id="+b+"&value="+f,!0);g.send()},SwitchStatus:function(c){var a=c.getAttribute("data-item-status");"read"===a?h(c):"unread"===a&&b(c)},Show:function(c){(c=c.querySelector("a.show"))&&c.click()},OpenOriginal:function(c){var a= c.querySelector("a.original");a&&("unread"===c.getAttribute("data-item-status")&&b(c),a.removeAttribute("data-action"),a.click())},DownloadContent:function(c){var a=document.getElementById("download-item");if(a){a.innerHTML=" "+a.getAttribute("data-before-message");a.className="loading-icon";var b=new XMLHttpRequest;b.onload=function(){var c=JSON.parse(b.responseText);a.className="";if(c.result){var d=document.getElementById("item-content");d&&(d.innerHTML=c.content);a.innerHTML=a.getAttribute("data-after-message")}else a.innerHTML= a.getAttribute("data-failure-message")};c=e(c);b.open("POST","?action=download-item&id="+c,!0);b.send()}},MarkListingAsRead:function(a){for(var b=document.getElementsByTagName("article"),d=[],g=0,h=b.length;gb-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function d(){return document.getElementById("listing")?!0:!1}return{OpenNextPage:function(){var a=document.getElementById("next-page");a&&a.click()},OpenPreviousPage:function(){var a=document.getElementById("previous-page");a&&a.click()},SelectNextItem:function(){var a=document.getElementById("next-item"); if(a)a.click();else if(d())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var b=0,h=a.length;b