var Miniflux={}; Miniflux.App=function(){return{BlinkIcon:function(){var e=document.querySelectorAll(".loading-icon");[].forEach.call(e,function(b){b.classList.toggle("loading-icon-blink")})},Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()},MozillaAuth:function(e){navigator.id.watch({onlogin:function(b){var a=new XMLHttpRequest;a.open("POST","?action="+e+"&token="+b,!0);a.setRequestHeader("Connection","close");a.onload=function(){window.location.href=this.responseText};a.send("token="+ b)},onlogout:function(){}});navigator.id.request()}}}(); Miniflux.Feed=function(){function e(a){if(a=document.getElementById("loading-feed-"+a))a.appendChild(document.createTextNode("\u2600")),a.classList.add("loading-icon-blink");f||(f=setInterval(Miniflux.App.BlinkIcon,500))}function b(){for(var b=document.getElementsByTagName("a"),d=0,c=b.length;dd.length;){var b=a.shift();d.push(b);Miniflux.Feed.Update(b, function(c){c=d.indexOf(c.feed_id);0<=c&&d.splice(c,1);0==a.length&&0==d.length&&(clearInterval(e),clearInterval(f),window.location.href="?action=unread")})}},100)}}}(); Miniflux.Item=function(){function e(c){var a=document.getElementById("item-"+c);a||(a=document.getElementById("current-item"),a.getAttribute("data-item-id")!=c&&(a=!1));return a}function b(c){if((c=document.getElementById("bookmark-"+c))&&c.getAttribute("data-reverse-label")){var a=c.innerHTML;c.innerHTML=c.getAttribute("data-reverse-label");c.setAttribute("data-reverse-label",a)}}function a(c){if(c=document.getElementById("status-"+c)){var a=c.innerHTML;c.innerHTML=c.getAttribute("data-reverse-label"); c.setAttribute("data-reverse-label",a)}}function d(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 b=parseInt(a.textContent,10)-1;if(0===b)switch(c){case "unread":window.location="?action=unread";break;case "history":window.location="?action=history"}a.textContent=b;"unread"===c?(document.title="Miniflux ("+b+")",document.getElementById("nav-counter").textContent= "("+b+")"):document.title=a.parentNode.innerText}}function f(c){var b=new XMLHttpRequest;b.onload=function(){if(Miniflux.Nav.IsListing()){var b=e(c);if(b)if(b.getAttribute("data-hide"))d(b);else{b.setAttribute("data-item-status","read");a(c);if(b=document.getElementById("show-"+c)){b.className="read";var g=document.createElement("span");g.id="read-icon-"+c;g.appendChild(document.createTextNode("\u2714 "));b.parentNode.insertBefore(g,b)}(b=document.getElementById("status-"+c))&&b.setAttribute("data-action", "mark-unread")}}};b.open("POST","?action=mark-item-read&id="+c,!0);b.send()}function h(c){var b=new XMLHttpRequest;b.onload=function(){if(Miniflux.Nav.IsListing()){var b=e(c);if(b)if(b.getAttribute("data-hide"))d(b);else{b.setAttribute("data-item-status","unread");a(c);if(b=document.getElementById("show-"+c))b.className="";(b=document.getElementById("read-icon-"+c))&&b.parentNode.removeChild(b);(b=document.getElementById("status-"+c))&&b.setAttribute("data-action","mark-read")}}};b.open("POST","?action=mark-item-unread&id="+ c,!0);b.send()}function m(c,a){var d=c.getAttribute("data-item-id"),e=new XMLHttpRequest;e.onload=function(){try{if(JSON.parse(this.responseText).result)if(c.setAttribute("data-item-bookmark",a),a)if(Miniflux.Nav.IsListing()){if(f=document.getElementById("show-"+d)){var e=document.createElement("span");e.id="bookmark-icon-"+d;e.appendChild(document.createTextNode("\u2605 "));f.parentNode.insertBefore(e,f)}b(d)}else{var f=document.getElementById("bookmark-"+d);f&&(f.innerHTML="\u2605")}else if(Miniflux.Nav.IsListing()){var l= document.getElementById("bookmark-icon-"+d);l&&l.parentNode.removeChild(l);b(d)}else{var n=document.getElementById("bookmark-"+d);n&&(n.innerHTML="\u2606")}}catch(h){}};e.open("POST","?action=bookmark&id="+d+"&value="+a,!0);e.send()}return{Get:e,MarkAsRead:f,MarkAsUnread:h,MarkAsRemoved:function(c){var a=new XMLHttpRequest;a.onload=function(){Miniflux.Nav.IsListing()&&d(e(c))};a.open("POST","?action=mark-item-removed&id="+c,!0);a.send()},SwitchBookmark:function(c){"1"==c.getAttribute("data-item-bookmark")? m(c,0):m(c,1)},SwitchStatus:function(c){var a=c.getAttribute("data-item-id");c=c.getAttribute("data-item-status");"read"==c?h(a):"unread"==c&&f(a)},ChangeStatus:function(c,a){switch(a){case "read":f(c);break;case "unread":h(c)}},Show:function(c){(c=document.getElementById("show-"+c))&&c.click()},OpenOriginal:function(c){var a=document.getElementById("original-"+c);a&&("unread"==e(c).getAttribute("data-item-status")&&f(c),a.removeAttribute("data-action"),a.click())},DownloadContent:function(){var c= document.getElementById("download-item");if(c){var a=c.getAttribute("data-item-id"),b=c.getAttribute("data-before-message"),d=document.createElement("span");d.appendChild(document.createTextNode("\u2600"));d.className="loading-icon";c.innerHTML="";c.className="downloading";c.appendChild(d);c.appendChild(document.createTextNode(" "+b));var e=setInterval(Miniflux.App.BlinkIcon,250),f=new XMLHttpRequest;f.onload=function(){var a=JSON.parse(f.responseText);clearInterval(e);if(a.result){var b=document.getElementById("item-content"); b&&(b.innerHTML=a.content);c&&(a=c.getAttribute("data-after-message"),c.innerHTML="",c.appendChild(document.createTextNode(" "+a)))}else c&&(a=c.getAttribute("data-failure-message"),c.innerHTML="",c.appendChild(document.createTextNode(" "+a)))};f.open("POST","?action=download-item&id="+a,!0);f.send()}},MarkListingAsRead:function(a){for(var b=document.getElementsByTagName("article"),d=[],e=0,f=b.length;eb-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function b(){return document.getElementById("listing")?!0:!1}return{GetCurrentItem:function(){return document.getElementById("current-item")},GetCurrentItemId:function(){var a=Miniflux.Nav.GetCurrentItem();return a?a.getAttribute("data-item-id"):null},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(b())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var d=0,f=a.length;d