From c3b3d51365d3d50398d4d31fc02a4d6b6d2f9844 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Mon, 10 Nov 2014 18:36:15 +0100 Subject: [PATCH] Bookmark page: hide article if bookmark is removed As i can't imagine any other site than the bookmarks page where an article needs to be hidden based on the bookmark status, I've hardwired it into the javascript function. --- assets/js/all.min.js | 36 ++++++++++++++++++------------------ assets/js/item.js | 12 ++++++++++-- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/assets/js/all.min.js b/assets/js/all.min.js index df73b29..a6b2db9 100644 --- a/assets/js/all.min.js +++ b/assets/js/all.min.js @@ -1,19 +1,19 @@ var Miniflux={};Miniflux.App=function(){return{BlinkIcon:function(){var e=document.querySelectorAll(".loading-icon");[].forEach.call(e,function(c){c.classList.toggle("loading-icon-blink")})},Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()}}}(); -Miniflux.Feed=function(){function e(d){if(d=document.getElementById("loading-feed-"+d))d.appendChild(document.createTextNode("\u2600")),d.classList.add("loading-icon-blink");g||(g=setInterval(Miniflux.App.BlinkIcon,500))}function c(){for(var d=document.getElementsByTagName("a"),h=0,a=d.length;ha.length;){var h=b.shift();a.push(h);Miniflux.Feed.Update(h, -function(h){h=a.indexOf(h.feed_id);0<=h&&a.splice(h,1);0==b.length&&0==a.length&&(clearInterval(d),clearInterval(g),window.location.href="?action=unread")})}},100)}}}(); -Miniflux.Item=function(){function e(d){return item_id=d.getAttribute("data-item-id")}function c(d){if(d&&d.hasAttribute("data-reverse-label")){var b=d.innerHTML;d.innerHTML=d.getAttribute("data-reverse-label");d.setAttribute("data-reverse-label",b)}}function b(d){"mouse"!==Miniflux.Event.lastEventType&&Miniflux.Nav.SelectNextItem();d.parentNode.removeChild(d);var b=document.getElementById("page-counter");if(b){d=d.getAttribute("data-item-page");var a=parseInt(b.textContent,10)-1,c=document.getElementsByTagName("article"); -if(0===a||0===c.length)window.location=location.href;b.textContent=a;switch(d){case "unread":document.title="Miniflux ("+a+")";document.getElementById("nav-counter").textContent=a;break;case "feed-items":document.title="("+a+") "+b.parentNode.firstChild.nodeValue;break;default:document.title=b.parentNode.firstChild.nodeValue+" ("+a+")"}}}function a(d){var a=e(d),f=new XMLHttpRequest;f.onload=function(){if(Miniflux.Nav.IsListing())if(d.getAttribute("data-hide"))b(d);else{d.setAttribute("data-item-status", -"read");var a=d.querySelector("a.mark");c(a);(a=d.querySelector("a.mark"))&&a.setAttribute("data-action","mark-unread")}};f.open("POST","?action=mark-item-read&id="+a,!0);f.send()}function g(d){var a=e(d),f=new XMLHttpRequest;f.onload=function(){if(Miniflux.Nav.IsListing())if(d.getAttribute("data-hide"))b(d);else{d.setAttribute("data-item-status","unread");var a=d.querySelector("a.mark");c(a);(a=d.querySelector("a.mark"))&&a.setAttribute("data-action","mark-read")}};f.open("POST","?action=mark-item-unread&id="+ -a,!0);f.send()}return{MarkAsRead:a,MarkAsUnread:g,MarkAsRemoved:function(a){var c=e(a),f=new XMLHttpRequest;f.onload=function(){Miniflux.Nav.IsListing()&&b(a)};f.open("POST","?action=mark-item-removed&id="+c,!0);f.send()},SwitchBookmark:function(a){var b=e(a),f="1"===a.getAttribute("data-item-bookmark")?"0":"1",k=new XMLHttpRequest;k.onload=function(){a.setAttribute("data-item-bookmark",f);if(Miniflux.Nav.IsListing()){var b=a.querySelector("a.bookmark");c(b)}};k.open("POST","?action=bookmark&id="+ -b+"&value="+f,!0);k.send()},SwitchStatus:function(b){var c=b.getAttribute("data-item-status");"read"===c?g(b):"unread"===c&&a(b)},Show:function(a){(a=a.querySelector("a.show"))&&a.click()},OpenOriginal:function(b){var c=b.querySelector("a.original");c&&("unread"===b.getAttribute("data-item-status")&&a(b),c.removeAttribute("data-action"),c.click())},DownloadContent:function(a){var b=document.getElementById("download-item");if(b){a=e(a);var c=b.getAttribute("data-before-message"),k=document.createElement("span"); -k.appendChild(document.createTextNode("\u2600"));k.className="loading-icon";b.innerHTML="";b.className="downloading";b.appendChild(k);b.appendChild(document.createTextNode(" "+c));var g=setInterval(Miniflux.App.BlinkIcon,250),l=new XMLHttpRequest;l.onload=function(){var a=JSON.parse(l.responseText);clearInterval(g);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)))};l.open("POST","?action=download-item&id="+a,!0);l.send()}},MarkListingAsRead:function(b){for(var a=document.getElementsByTagName("article"),c=[],g=0,m=a.length;ga-(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,g=b.length;ab.length;){var g=a.shift();b.push(g);Miniflux.Feed.Update(g, +function(g){g=b.indexOf(g.feed_id);0<=g&&b.splice(g,1);0==a.length&&0==b.length&&(clearInterval(d),clearInterval(f),window.location.href="?action=unread")})}},100)}}}(); +Miniflux.Item=function(){function e(d){return item_id=d.getAttribute("data-item-id")}function c(d){if(d&&d.hasAttribute("data-reverse-label")){var a=d.innerHTML;d.innerHTML=d.getAttribute("data-reverse-label");d.setAttribute("data-reverse-label",a)}}function a(d){"mouse"!==Miniflux.Event.lastEventType&&Miniflux.Nav.SelectNextItem();d.parentNode.removeChild(d);var a=document.getElementById("page-counter");if(a){d=d.getAttribute("data-item-page");var b=parseInt(a.textContent,10)-1,c=document.getElementsByTagName("article"); +if(0===b||0===c.length)window.location=location.href;a.textContent=b;switch(d){case "unread":document.title="Miniflux ("+b+")";document.getElementById("nav-counter").textContent=b;break;case "feed-items":document.title="("+b+") "+a.parentNode.firstChild.nodeValue;break;default:document.title=a.parentNode.firstChild.nodeValue+" ("+b+")"}}}function b(d){var b=e(d),h=new XMLHttpRequest;h.onload=function(){if(Miniflux.Nav.IsListing())if(d.getAttribute("data-hide"))a(d);else{d.setAttribute("data-item-status", +"read");var b=d.querySelector("a.mark");c(b);(b=d.querySelector("a.mark"))&&b.setAttribute("data-action","mark-unread")}};h.open("POST","?action=mark-item-read&id="+b,!0);h.send()}function f(d){var b=e(d),h=new XMLHttpRequest;h.onload=function(){if(Miniflux.Nav.IsListing())if(d.getAttribute("data-hide"))a(d);else{d.setAttribute("data-item-status","unread");var b=d.querySelector("a.mark");c(b);(b=d.querySelector("a.mark"))&&b.setAttribute("data-action","mark-read")}};h.open("POST","?action=mark-item-unread&id="+ +b,!0);h.send()}return{MarkAsRead:b,MarkAsUnread:f,MarkAsRemoved:function(d){var b=e(d),c=new XMLHttpRequest;c.onload=function(){Miniflux.Nav.IsListing()&&a(d)};c.open("POST","?action=mark-item-removed&id="+b,!0);c.send()},SwitchBookmark:function(b){var g=e(b),h="1"===b.getAttribute("data-item-bookmark")?"0":"1",k=new XMLHttpRequest;k.onload=function(){if(Miniflux.Nav.IsListing()&&"bookmarks"===b.getAttribute("data-item-page"))a(b);else if(b.setAttribute("data-item-bookmark",h),Miniflux.Nav.IsListing()){var g= +b.querySelector("a.bookmark");c(g)}};k.open("POST","?action=bookmark&id="+g+"&value="+h,!0);k.send()},SwitchStatus:function(a){var c=a.getAttribute("data-item-status");"read"===c?f(a):"unread"===c&&b(a)},Show:function(b){(b=b.querySelector("a.show"))&&b.click()},OpenOriginal:function(a){var c=a.querySelector("a.original");c&&("unread"===a.getAttribute("data-item-status")&&b(a),c.removeAttribute("data-action"),c.click())},DownloadContent:function(b){var a=document.getElementById("download-item");if(a){b= +e(b);var c=a.getAttribute("data-before-message"),k=document.createElement("span");k.appendChild(document.createTextNode("\u2600"));k.className="loading-icon";a.innerHTML="";a.className="downloading";a.appendChild(k);a.appendChild(document.createTextNode(" "+c));var f=setInterval(Miniflux.App.BlinkIcon,250),l=new XMLHttpRequest;l.onload=function(){var b=JSON.parse(l.responseText);clearInterval(f);if(b.result){var c=document.getElementById("item-content");c&&(c.innerHTML=b.content);a&&(b=a.getAttribute("data-after-message"), +a.innerHTML="",a.appendChild(document.createTextNode(" "+b)))}else a&&(b=a.getAttribute("data-failure-message"),a.innerHTML="",a.appendChild(document.createTextNode(" "+b)))};l.open("POST","?action=download-item&id="+b,!0);l.send()}},MarkListingAsRead:function(b){for(var a=document.getElementsByTagName("article"),c=[],f=0,m=a.length;fb-(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,f=a.length;b