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