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