From 9d31eb1a015307ebc7c24a557f089e5aa5e15079 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Wed, 31 Dec 2014 13:43:05 +0100 Subject: [PATCH] Fix feed-last-checked update after refresh-all I've dropped it accidentally with my last commit. Furthermore I moved the data-feed-id definition to the article element and dropped multiple references of the feed id. That's similar to what I've done before with the data-item-id in 3dae99ac. The article element holds the information whether a feed is disabled now. Now it is shown if a feed had errors while updating. --- assets/css/app.css | 7 ++- assets/js/all.min.js | 37 +++++++------- assets/js/event.js | 2 +- assets/js/feed.js | 50 +++++++++---------- templates/feeds.php | 21 ++++---- themes/bootstrap-light/css/app.css | 4 +- .../bootstrap-light/less/miniflux-base.less | 2 +- themes/bootswatch-cyborg/css/app.css | 4 +- .../bootswatch-cyborg/less/miniflux-base.less | 2 +- themes/hello/css/app.css | 4 +- themes/hello/scss/_core.scss | 2 +- 11 files changed, 68 insertions(+), 67 deletions(-) diff --git a/assets/css/app.css b/assets/css/app.css index 858b8c6..327d754 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -338,11 +338,11 @@ span#nav-counter:not(:empty):before, span#page-counter:not(:empty):before { content: " ("; } -span[id^="items-count-"]:before { +span.items-count:before { content: "("; } -span#nav-counter:not(:empty):after, span#page-counter:not(:empty):after, span[id^="items-count-"]:after { +span#nav-counter:not(:empty):after, span#page-counter:not(:empty):after, span.items-count:after { content: ")"; } @@ -448,8 +448,7 @@ nav .active a { padding-top: 30px; } -.feed-disabled, -.feed-disabled a { +[data-feed-disabled] * { color: #aaa; } diff --git a/assets/js/all.min.js b/assets/js/all.min.js index 049938b..a1d10a1 100644 --- a/assets/js/all.min.js +++ b/assets/js/all.min.js @@ -1,19 +1,20 @@ 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;cd.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 0 && queue.length < queue_length) { - var feed_id = feeds.shift(); - queue.push(feed_id); + var feed = feeds.shift(); + queue.push(parseInt(feed.getAttribute('data-feed-id'))); - Miniflux.Feed.Update(feed_id, function(response) { + Miniflux.Feed.Update(feed, function(response) { var index = queue.indexOf(response.feed_id); if (index >= 0) queue.splice(index, 1); diff --git a/templates/feeds.php b/templates/feeds.php index 2fbb55a..eb45bbc 100644 --- a/templates/feeds.php +++ b/templates/feeds.php @@ -20,35 +20,36 @@
-
-

> +
> +

- - +
-

@@ -59,7 +60,7 @@
  • - +
  • diff --git a/themes/bootstrap-light/css/app.css b/themes/bootstrap-light/css/app.css index 6961d45..dffd559 100644 --- a/themes/bootstrap-light/css/app.css +++ b/themes/bootstrap-light/css/app.css @@ -5083,10 +5083,10 @@ span#nav-counter:not(:empty):after, span#page-counter:not(:empty):after { content: ")"; } -span[id^="items-count-"]:before { +span.items-count:before { content: "("; } -span[id^="items-count-"]:after { +span.items-count:after { content: ")"; } .loading-icon:before { diff --git a/themes/bootstrap-light/less/miniflux-base.less b/themes/bootstrap-light/less/miniflux-base.less index 863fd35..6f47944 100644 --- a/themes/bootstrap-light/less/miniflux-base.less +++ b/themes/bootstrap-light/less/miniflux-base.less @@ -56,7 +56,7 @@ span { } } - &[id^="items-count-"] { + &.items-count { &:before { content: "@{icon-bracket-open}"; } diff --git a/themes/bootswatch-cyborg/css/app.css b/themes/bootswatch-cyborg/css/app.css index 0b974bc..9ca9a4b 100644 --- a/themes/bootswatch-cyborg/css/app.css +++ b/themes/bootswatch-cyborg/css/app.css @@ -5083,10 +5083,10 @@ span#nav-counter:not(:empty):after, span#page-counter:not(:empty):after { content: ")"; } -span[id^="items-count-"]:before { +span.items-count:before { content: "("; } -span[id^="items-count-"]:after { +span.items-count:after { content: ")"; } .loading-icon:before { diff --git a/themes/bootswatch-cyborg/less/miniflux-base.less b/themes/bootswatch-cyborg/less/miniflux-base.less index 863fd35..6f47944 100644 --- a/themes/bootswatch-cyborg/less/miniflux-base.less +++ b/themes/bootswatch-cyborg/less/miniflux-base.less @@ -56,7 +56,7 @@ span { } } - &[id^="items-count-"] { + &.items-count { &:before { content: "@{icon-bracket-open}"; } diff --git a/themes/hello/css/app.css b/themes/hello/css/app.css index 8cde9dc..4695c7f 100755 --- a/themes/hello/css/app.css +++ b/themes/hello/css/app.css @@ -231,9 +231,9 @@ span#nav-counter:not(:empty):before, span#page-counter:not(:empty):before { content: " ("; } span#nav-counter:not(:empty):after, span#page-counter:not(:empty):after { content: ")"; } -span[id^="items-count-"]:before { +span.items-count:before { content: "("; } -span[id^="items-count-"]:after { +span.items-count:after { content: ")"; } section.page { diff --git a/themes/hello/scss/_core.scss b/themes/hello/scss/_core.scss index 27c11b6..5277c87 100755 --- a/themes/hello/scss/_core.scss +++ b/themes/hello/scss/_core.scss @@ -135,7 +135,7 @@ span { } } - &[id^="items-count-"] { + &.items-count { &:before { content: $icon-bracket-open; }