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