var Miniflux={};Miniflux.App=function(){return{Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()}}}(); Miniflux.Feed=function(){var b=[];return{Update:function(e,a){var d=e.querySelector("span.items-count");if(d){var b=e.getAttribute("data-feed-id"),l=e.querySelector("h2:first-of-type");l.className="loading-icon";var g=new XMLHttpRequest;g.onload=function(){l.className="";var b=e.querySelector(".feed-last-checked");b&&(b.innerHTML=b.getAttribute("data-after-update"));if(b=e.querySelector(".feed-parsing-error"))b.innerHTML="";var c=JSON.parse(this.responseText);c.result?d.innerHTML=c.items_count.items_unread+ "/"+c.items_count.items_total:b&&(b.innerHTML=b.getAttribute("data-after-error"));a&&a(c)};g.open("POST","?action=refresh-feed&feed_id="+b,!0);g.send()}},UpdateAll:function(){var e=Array.prototype.slice.call(document.querySelectorAll("article:not([data-feed-disabled])")),a=setInterval(function(){for(;0b.length;){var d=e.shift();b.push(parseInt(d.getAttribute("data-feed-id")));Miniflux.Feed.Update(d,function(d){d=b.indexOf(d.feed_id);0<=d&&b.splice(d,1);0===e.length&&0===b.length&&(clearInterval(a), window.location.href="?action=unread")})}},100)}}}(); Miniflux.Item=function(){function b(c){return item_id=c.getAttribute("data-item-id")}function e(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);m--}function d(){0===m&&window.location.reload();var c=document.getElementById("page-counter");c.textContent=m||"";document.getElementById("nav-counter").textContent= g||"";switch(document.querySelector("section.page").getAttribute("data-item-page")){case "unread":document.title="Miniflux ("+g+")";break;case "feed-items":document.title="("+m+") "+c.parentNode.firstChild.nodeValue;break;default:document.title=c.parentNode.firstChild.nodeValue+" ("+m+")"}}function h(c){var k=b(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"); e(b);(b=c.querySelector("a.mark"))&&b.setAttribute("data-action","mark-unread")}g--;d()}};f.open("POST","?action=mark-item-read&id="+k,!0);f.send()}function l(c){var k=b(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");e(b);(b=c.querySelector("a.mark"))&&b.setAttribute("data-action","mark-read")}g++;d()}};f.open("POST","?action=mark-item-unread&id="+k,!0);f.send()} var g=function(){var c=document.getElementById("nav-counter");if(c)return counter=parseInt(c.textContent,10)||0}(),m=function(){var c=document.getElementById("page-counter");if(c)return counter=parseInt(c.textContent,10)||0}();return{MarkAsRead:h,MarkAsUnread:l,MarkAsRemoved:function(c){var e=b(c),f=new XMLHttpRequest;f.onload=function(){Miniflux.Nav.IsListing()&&(a(c),"unread"===c.getAttribute("data-item-status")&&g--,d())};f.open("POST","?action=mark-item-removed&id="+e,!0);f.send()},SwitchBookmark:function(c){var k= b(c),f="1"===c.getAttribute("data-item-bookmark")?"0":"1",n=new XMLHttpRequest;n.onload=function(){var b=document.querySelector("section.page");if(Miniflux.Nav.IsListing()&&"bookmarks"===b.getAttribute("data-item-page"))a(c),d();else if(c.setAttribute("data-item-bookmark",f),Miniflux.Nav.IsListing())b=c.querySelector("a.bookmark"),e(b);else if((b=c.querySelector("a.bookmark-icon"))&&b.hasAttribute("data-reverse-title")){var k=b.getAttribute("title");b.setAttribute("title",b.getAttribute("data-reverse-title")); b.setAttribute("data-reverse-title",k)}};n.open("POST","?action=bookmark&id="+k+"&value="+f,!0);n.send()},SwitchStatus:function(c){var a=c.getAttribute("data-item-status");"read"===a?l(c):"unread"===a&&h(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")&&h(c),a.removeAttribute("data-action"),"mouse"!==Miniflux.Event.lastEventType&&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 d=new XMLHttpRequest;d.onload=function(){var c=JSON.parse(d.responseText);a.className="";if(c.result){var b=document.getElementById("item-content");b&&(b.innerHTML=c.content);a.innerHTML=a.getAttribute("data-after-message")}else a.innerHTML=a.getAttribute("data-failure-message")};c=b(c);d.open("POST","?action=download-item&id="+c,!0);d.send()}},MarkListingAsRead:function(a){for(var d= document.getElementsByTagName("article"),e=[],g=0,h=d.length;gb-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function e(){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(e())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var d=0,h=a.length;d