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