Merge branch 'upstream' of https://github.com/mkresin/miniflux
This commit is contained in:
commit
b04b2104f1
@ -449,10 +449,6 @@ nav .active a {
|
|||||||
padding-top: 30px;
|
padding-top: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-feed-disabled] * {
|
|
||||||
color: #aaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feed-last-checked {
|
.feed-last-checked {
|
||||||
color: brown;
|
color: brown;
|
||||||
font-size: 0.7em;
|
font-size: 0.7em;
|
||||||
@ -460,6 +456,11 @@ nav .active a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.feed-parsing-error {
|
.feed-parsing-error {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items article[data-feed-error] .feed-parsing-error {
|
||||||
|
visibility: visible;
|
||||||
color: #000;
|
color: #000;
|
||||||
font-size: 0.7em;
|
font-size: 0.7em;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
@ -473,6 +474,15 @@ nav .active a {
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.items article[data-feed-error] {
|
||||||
|
background-color: #fcf8e3;
|
||||||
|
border-color: #fcf8e3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items article[data-feed-disabled] * {
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
|
|
||||||
.items h2 {
|
.items h2 {
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
34
assets/js/all.min.js
vendored
34
assets/js/all.min.js
vendored
@ -1,21 +1,21 @@
|
|||||||
var Miniflux={};Miniflux.App=function(){return{Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()}}}();
|
var Miniflux={};Miniflux.App=function(){return{Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()}}}();
|
||||||
Miniflux.Feed=function(){var g=[];return{Update:function(e,a){var b=e.querySelector("span.items-count");if(b){var c=e.getAttribute("data-feed-id"),g=e.querySelector("h2:first-of-type");g.className="loading-icon";var h=new XMLHttpRequest;h.onload=function(){g.className="";var c=e.querySelector(".feed-last-checked");c&&(c.innerHTML=c.getAttribute("data-after-update"));if(c=e.querySelector(".feed-parsing-error"))c.innerHTML="";var f=JSON.parse(this.responseText);f.result?b.innerHTML=f.items_count.items_unread+
|
Miniflux.Feed=function(){var f=[];return{Update:function(e,a){var b=e.querySelector("span.items-count");if(b){var c=e.getAttribute("data-feed-id"),f=e.querySelector("h2:first-of-type");f.className="loading-icon";var h=new XMLHttpRequest;h.onload=function(){f.className="";e.removeAttribute("data-feed-error");var c=e.querySelector(".feed-last-checked");c&&(c.innerHTML=c.getAttribute("data-after-update"));c=JSON.parse(this.responseText);c.result?b.innerHTML=c.items_count.items_unread+"/"+c.items_count.items_total:
|
||||||
"/"+f.items_count.items_total:c&&(c.innerHTML=c.getAttribute("data-after-error"));a&&a(f)};h.open("POST","?action=refresh-feed&feed_id="+c,!0);h.send()}},UpdateAll:function(){var e=Array.prototype.slice.call(document.querySelectorAll("article:not([data-feed-disabled])")),a=setInterval(function(){for(;0<e.length&&5>g.length;){var b=e.shift();g.push(parseInt(b.getAttribute("data-feed-id")));Miniflux.Feed.Update(b,function(b){b=g.indexOf(b.feed_id);0<=b&&g.splice(b,1);0===e.length&&0===g.length&&(clearInterval(a),
|
e.setAttribute("data-feed-error","1");a&&a(c)};h.open("POST","?action=refresh-feed&feed_id="+c,!0);h.send()}},UpdateAll:function(){var e=Array.prototype.slice.call(document.querySelectorAll("article:not([data-feed-disabled])")),a=setInterval(function(){for(;0<e.length&&5>f.length;){var b=e.shift();f.push(parseInt(b.getAttribute("data-feed-id")));Miniflux.Feed.Update(b,function(b){b=f.indexOf(b.feed_id);0<=b&&f.splice(b,1);0===e.length&&0===f.length&&(clearInterval(a),window.location.href="?action=unread")})}},
|
||||||
window.location.href="?action=unread")})}},100)}}}();
|
100)}}}();
|
||||||
Miniflux.Item=function(){function g(a){return item_id=a.getAttribute("data-item-id")}function e(a){if(a&&a.hasAttribute("data-reverse-label")){var b=a.innerHTML;a.innerHTML=a.getAttribute("data-reverse-label");a.setAttribute("data-reverse-label",b)}}function a(a){"mouse"!==Miniflux.Event.lastEventType&&Miniflux.Nav.SelectNextItem();a.parentNode.removeChild(a);k--}function b(){0===k&&window.location.reload();var a=document.getElementById("page-counter");a.textContent=k||"";document.getElementById("nav-counter").textContent=
|
Miniflux.Item=function(){function f(a){return item_id=a.getAttribute("data-item-id")}function e(a){if(a&&a.hasAttribute("data-reverse-label")){var b=a.innerHTML;a.innerHTML=a.getAttribute("data-reverse-label");a.setAttribute("data-reverse-label",b)}}function a(a){"mouse"!==Miniflux.Event.lastEventType&&Miniflux.Nav.SelectNextItem();a.parentNode.removeChild(a);k--}function b(){0===k&&window.location.reload();var a=document.getElementById("page-counter");a.textContent=k||"";document.getElementById("nav-counter").textContent=h||
|
||||||
h||"";switch(document.querySelector("section.page").getAttribute("data-item-page")){case "unread":document.title="Miniflux ("+h+")";break;case "feed-items":document.title="("+k+") "+a.parentNode.firstChild.nodeValue;break;default:document.title=a.parentNode.firstChild.nodeValue+" ("+k+")"}}function c(f){var d=g(f),c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){if(f.getAttribute("data-hide"))a(f);else{f.setAttribute("data-item-status","read");var d=f.querySelector("a.mark");
|
"";switch(document.querySelector("section.page").getAttribute("data-item-page")){case "unread":document.title="Miniflux ("+h+")";break;case "feed-items":document.title="("+k+") "+a.parentNode.firstChild.nodeValue;break;default:document.title=a.parentNode.firstChild.nodeValue+" ("+k+")"}}function c(g){var d=f(g),c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){if(g.getAttribute("data-hide"))a(g);else{g.setAttribute("data-item-status","read");var d=g.querySelector("a.mark");e(d);
|
||||||
e(d);(d=f.querySelector("a.mark"))&&d.setAttribute("data-action","mark-unread")}h--;b()}};c.open("POST","?action=mark-item-read&id="+d,!0);c.send()}function m(f){var d=g(f),c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){if(f.getAttribute("data-hide"))a(f);else{f.setAttribute("data-item-status","unread");var d=f.querySelector("a.mark");e(d);(d=f.querySelector("a.mark"))&&d.setAttribute("data-action","mark-read")}h++;b()}};c.open("POST","?action=mark-item-unread&id="+d,!0);c.send()}
|
(d=g.querySelector("a.mark"))&&d.setAttribute("data-action","mark-unread")}h--;b()}};c.open("POST","?action=mark-item-read&id="+d,!0);c.send()}function m(g){var d=f(g),c=new XMLHttpRequest;c.onload=function(){if(Miniflux.Nav.IsListing()){if(g.getAttribute("data-hide"))a(g);else{g.setAttribute("data-item-status","unread");var d=g.querySelector("a.mark");e(d);(d=g.querySelector("a.mark"))&&d.setAttribute("data-action","mark-read")}h++;b()}};c.open("POST","?action=mark-item-unread&id="+d,!0);c.send()}
|
||||||
var h=function(){var a=document.getElementById("nav-counter");if(a)return counter=parseInt(a.textContent,10)||0}(),k=function(){var a=document.getElementById("page-counter");if(a)return counter=parseInt(a.textContent,10)||0}();return{MarkAsRead:c,MarkAsUnread:m,MarkAsRemoved:function(f){var d=g(f),c=new XMLHttpRequest;c.onload=function(){Miniflux.Nav.IsListing()&&(a(f),"unread"===f.getAttribute("data-item-status")&&h--,b())};c.open("POST","?action=mark-item-removed&id="+d,!0);c.send()},SwitchBookmark:function(f){var d=
|
var h=function(){var a=document.getElementById("nav-counter");if(a)return counter=parseInt(a.textContent,10)||0}(),k=function(){var a=document.getElementById("page-counter");if(a)return counter=parseInt(a.textContent,10)||0}();return{MarkAsRead:c,MarkAsUnread:m,MarkAsRemoved:function(g){var d=f(g),c=new XMLHttpRequest;c.onload=function(){Miniflux.Nav.IsListing()&&(a(g),"unread"===g.getAttribute("data-item-status")&&h--,b())};c.open("POST","?action=mark-item-removed&id="+d,!0);c.send()},SwitchBookmark:function(g){var d=
|
||||||
g(f),c="1"===f.getAttribute("data-item-bookmark")?"0":"1",l=new XMLHttpRequest;l.onload=function(){var d=document.querySelector("section.page");if(Miniflux.Nav.IsListing()&&"bookmarks"===d.getAttribute("data-item-page"))a(f),b();else if(f.setAttribute("data-item-bookmark",c),Miniflux.Nav.IsListing())d=f.querySelector("a.bookmark"),e(d);else if((d=f.querySelector("a.bookmark-icon"))&&d.hasAttribute("data-reverse-title")){var g=d.getAttribute("title");d.setAttribute("title",d.getAttribute("data-reverse-title"));
|
f(g),c="1"===g.getAttribute("data-item-bookmark")?"0":"1",l=new XMLHttpRequest;l.onload=function(){var d=document.querySelector("section.page");if(Miniflux.Nav.IsListing()&&"bookmarks"===d.getAttribute("data-item-page"))a(g),b();else if(g.setAttribute("data-item-bookmark",c),Miniflux.Nav.IsListing())d=g.querySelector("a.bookmark"),e(d);else if((d=g.querySelector("a.bookmark-icon"))&&d.hasAttribute("data-reverse-title")){var f=d.getAttribute("title");d.setAttribute("title",d.getAttribute("data-reverse-title"));
|
||||||
d.setAttribute("data-reverse-title",g)}};l.open("POST","?action=bookmark&id="+d+"&value="+c,!0);l.send()},SwitchStatus:function(a){var d=a.getAttribute("data-item-status");"read"===d?m(a):"unread"===d&&c(a)},Show:function(a){(a=a.querySelector("a.show"))&&a.click()},OpenOriginal:function(a){var d=a.querySelector("a.original");d&&("unread"===a.getAttribute("data-item-status")&&c(a),d.removeAttribute("data-action"),"mouse"!==Miniflux.Event.lastEventType&&d.click())},DownloadContent:function(a){var d=
|
d.setAttribute("data-reverse-title",f)}};l.open("POST","?action=bookmark&id="+d+"&value="+c,!0);l.send()},SwitchStatus:function(a){var d=a.getAttribute("data-item-status");"read"===d?m(a):"unread"===d&&c(a)},Show:function(a){(a=a.querySelector("a.show"))&&a.click()},OpenOriginal:function(a){var d=a.querySelector("a.original");d&&("unread"===a.getAttribute("data-item-status")&&c(a),d.removeAttribute("data-action"),"mouse"!==Miniflux.Event.lastEventType&&d.click())},DownloadContent:function(a){var d=
|
||||||
document.getElementById("download-item");if(d){d.innerHTML=" "+d.getAttribute("data-before-message");d.className="loading-icon";var b=new XMLHttpRequest;b.onload=function(){var a=JSON.parse(b.responseText);d.className="";if(a.result){var c=document.getElementById("item-content");c&&(c.innerHTML=a.content);d.innerHTML=d.getAttribute("data-after-message")}else d.innerHTML=d.getAttribute("data-failure-message")};a=g(a);b.open("POST","?action=download-item&id="+a,!0);b.send()}},MarkListingAsRead:function(a){for(var b=
|
document.getElementById("download-item");if(d){d.innerHTML=" "+d.getAttribute("data-before-message");d.className="loading-icon";var b=new XMLHttpRequest;b.onload=function(){var a=JSON.parse(b.responseText);d.className="";if(a.result){var c=document.getElementById("item-content");c&&(c.innerHTML=a.content);d.innerHTML=d.getAttribute("data-after-message")}else d.innerHTML=d.getAttribute("data-failure-message")};a=f(a);b.open("POST","?action=download-item&id="+a,!0);b.send()}},MarkListingAsRead:function(a){for(var b=
|
||||||
document.getElementsByTagName("article"),c=[],e=0,h=b.length;e<h;e++)c.push(g(b[e]));b=new XMLHttpRequest;b.onload=function(){window.location.href=a};b.open("POST","?action=mark-items-as-read",!0);b.send(JSON.stringify(c))},ToggleRTLMode:function(){for(var a=["#current-item h1","#item-content","#listing #current-item h2","#listing #current-item .preview"],b=0;b<a.length;b++){var c=document.querySelector(a[b]);c&&(c.dir=""==c.dir?"rtl":"")}}}}();
|
document.getElementsByTagName("article"),c=[],e=0,h=b.length;e<h;e++)c.push(f(b[e]));b=new XMLHttpRequest;b.onload=function(){window.location.href=a};b.open("POST","?action=mark-items-as-read",!0);b.send(JSON.stringify(c))},ToggleRTLMode:function(){for(var a=["#current-item h1","#item-content","#listing #current-item h2","#listing #current-item .preview"],b=0;b<a.length;b++){var c=document.querySelector(a[b]);c&&(c.dir=""==c.dir?"rtl":"")}}}}();
|
||||||
Miniflux.Event=function(){function g(a){if(63!==a.keyCode&&(a.ctrlKey||a.shiftKey||a.altKey||a.metaKey))return!0;a=a.target||a.srcElement;return"INPUT"===a.tagName||"TEXTAREA"===a.tagName?!0:!1}var e=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(a){var b=a.target.getAttribute("data-action");b&&"original-link"!==b&&a.preventDefault()};document.onmouseup=function(a){if(2!==a.button)if("INPUT"===a.target.nodeName&&"auto-select"===a.target.className)a.target.select();
|
Miniflux.Event=function(){function f(a){if(63!==a.keyCode&&(a.ctrlKey||a.shiftKey||a.altKey||a.metaKey))return!0;a=a.target||a.srcElement;return"INPUT"===a.tagName||"TEXTAREA"===a.tagName?!0:!1}var e=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(a){var b=a.target.getAttribute("data-action");b&&"original-link"!==b&&a.preventDefault()};document.onmouseup=function(a){if(2!==a.button)if("INPUT"===a.target.nodeName&&"auto-select"===a.target.className)a.target.select();
|
||||||
else{var b=a.target.getAttribute("data-action");if(b){Miniflux.Event.lastEventType="mouse";var c;a:{for(element=a.target;element&&element.parentNode;)if(element=element.parentNode,element.tagName&&"article"===element.tagName.toLowerCase()){c=element;break a}c=null}switch(b){case "refresh-all":Miniflux.Feed.UpdateAll();break;case "refresh-feed":Miniflux.Feed.Update(c);break;case "mark-read":Miniflux.Item.MarkAsRead(c);break;case "mark-unread":Miniflux.Item.MarkAsUnread(c);break;case "mark-removed":Miniflux.Item.MarkAsRemoved(c);
|
else{var b=a.target.getAttribute("data-action");if(b){Miniflux.Event.lastEventType="mouse";var c;a:{for(element=a.target;element&&element.parentNode;)if(element=element.parentNode,element.tagName&&"article"===element.tagName.toLowerCase()){c=element;break a}c=null}switch(b){case "refresh-all":Miniflux.Feed.UpdateAll();break;case "refresh-feed":Miniflux.Feed.Update(c);break;case "mark-read":Miniflux.Item.MarkAsRead(c);break;case "mark-unread":Miniflux.Item.MarkAsUnread(c);break;case "mark-removed":Miniflux.Item.MarkAsRemoved(c);
|
||||||
break;case "bookmark":Miniflux.Item.SwitchBookmark(c);break;case "download-item":Miniflux.Item.DownloadContent(c);break;case "original-link":Miniflux.Item.OpenOriginal(c);break;case "mark-all-read":Miniflux.Item.MarkListingAsRead("?action=unread");break;case "mark-feed-read":Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+a.target.getAttribute("data-feed-id"))}}}}},ListenKeyboardEvents:function(){document.onkeypress=function(a){if(!g(a))if(Miniflux.Event.lastEventType="keyboard",e.push(a.keyCode||
|
break;case "bookmark":Miniflux.Item.SwitchBookmark(c);break;case "download-item":Miniflux.Item.DownloadContent(c);break;case "original-link":Miniflux.Item.OpenOriginal(c);break;case "mark-all-read":Miniflux.Item.MarkListingAsRead("?action=unread");break;case "mark-feed-read":Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+a.target.getAttribute("data-feed-id"))}}}}},ListenKeyboardEvents:function(){document.onkeypress=function(a){if(!f(a))if(Miniflux.Event.lastEventType="keyboard",e.push(a.keyCode||
|
||||||
a.which),103===e[0])switch(e[1]){case void 0:break;case 117:window.location.href="?action=unread";e=[];break;case 98:window.location.href="?action=bookmarks";e=[];break;case 104:window.location.href="?action=history";e=[];break;case 115:window.location.href="?action=feeds";e=[];break;case 112:window.location.href="?action=config";e=[];break;default:e=[]}else{e=[];var b=document.getElementById("current-item");switch(a.keyCode||a.which){case 100:Miniflux.Item.DownloadContent(b);break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();
|
a.which),103===e[0])switch(e[1]){case void 0:break;case 117:window.location.href="?action=unread";e=[];break;case 98:window.location.href="?action=bookmarks";e=[];break;case 104:window.location.href="?action=history";e=[];break;case 115:window.location.href="?action=feeds";e=[];break;case 112:window.location.href="?action=config";e=[];break;default:e=[]}else{e=[];var b=document.getElementById("current-item");switch(a.keyCode||a.which){case 100:Miniflux.Item.DownloadContent(b);break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();
|
||||||
break;case 110:case 106:Miniflux.Nav.SelectNextItem();break;case 118:Miniflux.Item.OpenOriginal(b);break;case 111:Miniflux.Item.Show(b);break;case 109:Miniflux.Item.SwitchStatus(b);break;case 102:Miniflux.Item.SwitchBookmark(b);break;case 104:Miniflux.Nav.OpenPreviousPage();break;case 108:Miniflux.Nav.OpenNextPage();break;case 114:Miniflux.Feed.UpdateAll();break;case 63:Miniflux.Nav.ShowHelp();break;case 122:Miniflux.Item.ToggleRTLMode()}}};document.onkeydown=function(a){if(!g(a))switch(Miniflux.Event.lastEventType=
|
break;case 110:case 106:Miniflux.Nav.SelectNextItem();break;case 118:Miniflux.Item.OpenOriginal(b);break;case 111:Miniflux.Item.Show(b);break;case 109:Miniflux.Item.SwitchStatus(b);break;case 102:Miniflux.Item.SwitchBookmark(b);break;case 104:Miniflux.Nav.OpenPreviousPage();break;case 108:Miniflux.Nav.OpenNextPage();break;case 114:Miniflux.Feed.UpdateAll();break;case 63:Miniflux.Nav.ShowHelp();break;case 122:Miniflux.Item.ToggleRTLMode()}}};document.onkeydown=function(a){if(!f(a))switch(Miniflux.Event.lastEventType=
|
||||||
"keyboard",a.keyCode||a.which){case 37:Miniflux.Nav.SelectPreviousItem();break;case 39:Miniflux.Nav.SelectNextItem()}}}}}();
|
"keyboard",a.keyCode||a.which){case 37:Miniflux.Nav.SelectPreviousItem();break;case 39:Miniflux.Nav.SelectNextItem()}}}}}();
|
||||||
Miniflux.Nav=function(){function g(a){var b=pageYOffset+document.documentElement.clientHeight;(0>b-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function e(){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");
|
Miniflux.Nav=function(){function f(a){var b=pageYOffset+document.documentElement.clientHeight;(0>b-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function e(){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(e())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var b=0,c=a.length;b<c;b++){if("current-item"===a[b].id){b+1<c&&(a[b].id="item-"+a[b].getAttribute("data-item-id"),a[b+1].id="current-item",g(a[b+1]));break}}else a[0].id="current-item",g(a[0])},SelectPreviousItem:function(){var a=document.getElementById("previous-item");if(a)a.click();else if(e())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var b=
|
if(a)a.click();else if(e())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var b=0,c=a.length;b<c;b++){if("current-item"===a[b].id){b+1<c&&(a[b].id="item-"+a[b].getAttribute("data-item-id"),a[b+1].id="current-item",f(a[b+1]));break}}else a[0].id="current-item",f(a[0])},SelectPreviousItem:function(){var a=document.getElementById("previous-item");if(a)a.click();else if(e())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var b=
|
||||||
a.length-1;0<=b;b--){if("current-item"===a[b].id){0<=b-1&&(a[b].id="item-"+a[b].getAttribute("data-item-id"),a[b-1].id="current-item",g(a[b-1]));break}}else a[a.length-1].id="current-item",g(a[a.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:e}}();Miniflux.App.Run();
|
a.length-1;0<=b;b--){if("current-item"===a[b].id){0<=b-1&&(a[b].id="item-"+a[b].getAttribute("data-item-id"),a[b-1].id="current-item",f(a[b-1]));break}}else a[a.length-1].id="current-item",f(a[a.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:e}}();Miniflux.App.Run();
|
||||||
|
@ -22,18 +22,16 @@ Miniflux.Feed = (function() {
|
|||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
request.onload = function() {
|
request.onload = function() {
|
||||||
heading.className = "";
|
heading.className = "";
|
||||||
|
feed.removeAttribute("data-feed-error");
|
||||||
|
|
||||||
var lastChecked = feed.querySelector(".feed-last-checked");
|
var lastChecked = feed.querySelector(".feed-last-checked");
|
||||||
if (lastChecked) lastChecked.innerHTML = lastChecked.getAttribute("data-after-update");
|
if (lastChecked) lastChecked.innerHTML = lastChecked.getAttribute("data-after-update");
|
||||||
|
|
||||||
var feedParsingError = feed.querySelector(".feed-parsing-error");
|
|
||||||
if (feedParsingError) feedParsingError.innerHTML = "";
|
|
||||||
|
|
||||||
var response = JSON.parse(this.responseText);
|
var response = JSON.parse(this.responseText);
|
||||||
if (response.result) {
|
if (response.result) {
|
||||||
itemsCounter.innerHTML = response.items_count["items_unread"] + "/" + response.items_count['items_total'];
|
itemsCounter.innerHTML = response.items_count["items_unread"] + "/" + response.items_count['items_total'];
|
||||||
} else {
|
} else {
|
||||||
if (feedParsingError) feedParsingError.innerHTML = feedParsingError.getAttribute("data-after-error");
|
feed.setAttribute("data-feed-error", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callback) callback(response);
|
if (callback) callback(response);
|
||||||
|
@ -108,33 +108,12 @@ Router\post_action('refresh-feed', function() {
|
|||||||
// Display all feeds
|
// Display all feeds
|
||||||
Router\get_action('feeds', function() {
|
Router\get_action('feeds', function() {
|
||||||
|
|
||||||
if (! Request\int_param('disable_empty_feeds_check')) {
|
|
||||||
|
|
||||||
$empty_feeds = Model\Feed\get_all_empty();
|
|
||||||
|
|
||||||
if (! empty($empty_feeds)) {
|
|
||||||
|
|
||||||
$listing = array();
|
|
||||||
|
|
||||||
foreach ($empty_feeds as &$feed) {
|
|
||||||
$listing[] = '"'.$feed['title'].'"';
|
|
||||||
}
|
|
||||||
|
|
||||||
$message = t(
|
|
||||||
'There are %d empty feeds, there is maybe an error: %s...',
|
|
||||||
count($empty_feeds),
|
|
||||||
implode(', ', array_slice($listing, 0, 5))
|
|
||||||
);
|
|
||||||
|
|
||||||
Session\flash_error($message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Response\html(Template\layout('feeds', array(
|
Response\html(Template\layout('feeds', array(
|
||||||
'favicons' => Model\Feed\get_all_favicons(),
|
'favicons' => Model\Feed\get_all_favicons(),
|
||||||
'feeds' => Model\Feed\get_all_item_counts(),
|
'feeds' => Model\Feed\get_all_item_counts(),
|
||||||
'nothing_to_read' => Request\int_param('nothing_to_read'),
|
'nothing_to_read' => Request\int_param('nothing_to_read'),
|
||||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||||
|
'nb_failed_feeds' => Model\Feed\count_failed_feeds(),
|
||||||
'menu' => 'feeds',
|
'menu' => 'feeds',
|
||||||
'title' => t('Subscriptions')
|
'title' => t('Subscriptions')
|
||||||
)));
|
)));
|
||||||
@ -219,7 +198,7 @@ Router\post_action('import', function() {
|
|||||||
if (Model\Feed\import_opml(Request\file_content('file'))) {
|
if (Model\Feed\import_opml(Request\file_content('file'))) {
|
||||||
|
|
||||||
Session\flash(t('Your feeds have been imported.'));
|
Session\flash(t('Your feeds have been imported.'));
|
||||||
Response\redirect('?action=feeds&disable_empty_feeds_check=1');
|
Response\redirect('?action=feeds');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@ return array(
|
|||||||
'download content' => 'stáhnout obsah',
|
'download content' => 'stáhnout obsah',
|
||||||
'Help' => 'Nápověda',
|
'Help' => 'Nápověda',
|
||||||
'Theme' => 'Vzhled',
|
'Theme' => 'Vzhled',
|
||||||
'There are %d empty feeds, there is maybe an error: %s...' => 'K dispozici je %d prázdné kanály, je možná chyba: %s...',
|
|
||||||
'Items per page' => 'Článků na stránku',
|
'Items per page' => 'Článků na stránku',
|
||||||
'Previous page' => 'Předchozí stránka',
|
'Previous page' => 'Předchozí stránka',
|
||||||
'Next page' => 'Další stránka',
|
'Next page' => 'Další stránka',
|
||||||
@ -231,4 +230,5 @@ return array(
|
|||||||
// 'Avoid mixed content warnings with HTTPS' => '',
|
// 'Avoid mixed content warnings with HTTPS' => '',
|
||||||
// 'Download favicons' => '',
|
// 'Download favicons' => '',
|
||||||
// 'general' => '',
|
// 'general' => '',
|
||||||
|
// 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => '',
|
||||||
);
|
);
|
||||||
|
@ -56,7 +56,6 @@ return array(
|
|||||||
'download content' => 'Inhalt herunterladen',
|
'download content' => 'Inhalt herunterladen',
|
||||||
'Help' => 'Hilfe',
|
'Help' => 'Hilfe',
|
||||||
'Theme' => 'Theme',
|
'Theme' => 'Theme',
|
||||||
'There are %d empty feeds, there is maybe an error: %s...' => 'Es gibt %d leere Feeds, vielleicht gibt es einen Fehler: %s...',
|
|
||||||
'Items per page' => 'Einträge pro Seite',
|
'Items per page' => 'Einträge pro Seite',
|
||||||
'Previous page' => 'vorherige Seite',
|
'Previous page' => 'vorherige Seite',
|
||||||
'Next page' => 'nächste Seite',
|
'Next page' => 'nächste Seite',
|
||||||
@ -231,4 +230,5 @@ return array(
|
|||||||
'Avoid mixed content warnings with HTTPS' => 'Vermeidet Warnungen wegen gemischtem Inhalt bei HTTPS',
|
'Avoid mixed content warnings with HTTPS' => 'Vermeidet Warnungen wegen gemischtem Inhalt bei HTTPS',
|
||||||
'Download favicons' => 'Favicons herunterladen',
|
'Download favicons' => 'Favicons herunterladen',
|
||||||
'general' => 'allgemein',
|
'general' => 'allgemein',
|
||||||
|
'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Fehler bei der letzten Aktualisierung. Aktualisiere den Feed manuell und prüfe die %sKonsole%s anschließend auf Fehler!',
|
||||||
);
|
);
|
||||||
|
@ -56,7 +56,6 @@ return array(
|
|||||||
'download content' => 'descargar contenido',
|
'download content' => 'descargar contenido',
|
||||||
'Help' => 'Ayuda',
|
'Help' => 'Ayuda',
|
||||||
'Theme' => 'Tema',
|
'Theme' => 'Tema',
|
||||||
'There are %d empty feeds, there is maybe an error: %s...' => 'Hay %d suscripciones vacías, tal vez haya un problema: %s...',
|
|
||||||
'Items per page' => 'Ítems por página',
|
'Items per page' => 'Ítems por página',
|
||||||
'Previous page' => 'Página anterior',
|
'Previous page' => 'Página anterior',
|
||||||
'Next page' => 'Página siguiente',
|
'Next page' => 'Página siguiente',
|
||||||
@ -231,4 +230,5 @@ return array(
|
|||||||
// 'Avoid mixed content warnings with HTTPS' => '',
|
// 'Avoid mixed content warnings with HTTPS' => '',
|
||||||
// 'Download favicons' => '',
|
// 'Download favicons' => '',
|
||||||
// 'general' => '',
|
// 'general' => '',
|
||||||
|
// 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => '',
|
||||||
);
|
);
|
||||||
|
@ -56,7 +56,6 @@ return array(
|
|||||||
'download content' => 'télécharger le contenu',
|
'download content' => 'télécharger le contenu',
|
||||||
'Help' => 'Aide',
|
'Help' => 'Aide',
|
||||||
'Theme' => 'Thème',
|
'Theme' => 'Thème',
|
||||||
'There are %d empty feeds, there is maybe an error: %s...' => 'Il y a %d abonnements vides, il y a peut-être un problème : %s...',
|
|
||||||
'Items per page' => 'Nombre d\'éléments par page',
|
'Items per page' => 'Nombre d\'éléments par page',
|
||||||
'Previous page' => 'Page précédente',
|
'Previous page' => 'Page précédente',
|
||||||
'Next page' => 'Page suivante',
|
'Next page' => 'Page suivante',
|
||||||
@ -231,4 +230,5 @@ return array(
|
|||||||
'Avoid mixed content warnings with HTTPS' => 'Évite les alertes du navigateur web en HTTPS',
|
'Avoid mixed content warnings with HTTPS' => 'Évite les alertes du navigateur web en HTTPS',
|
||||||
'Download favicons' => 'Télécharger les icônes des sites web',
|
'Download favicons' => 'Télécharger les icônes des sites web',
|
||||||
'general' => 'general',
|
'general' => 'general',
|
||||||
|
'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!',
|
||||||
);
|
);
|
||||||
|
@ -56,7 +56,6 @@ return array(
|
|||||||
// 'download content' => '',
|
// 'download content' => '',
|
||||||
'Help' => 'Aiuto',
|
'Help' => 'Aiuto',
|
||||||
'Theme' => 'Tema',
|
'Theme' => 'Tema',
|
||||||
// 'There are %d empty feeds, there is maybe an error: %s...' => '',
|
|
||||||
'Items per page' => 'Articoli per pagina',
|
'Items per page' => 'Articoli per pagina',
|
||||||
'Previous page' => 'Pagina precedente',
|
'Previous page' => 'Pagina precedente',
|
||||||
'Next page' => 'Pagina successiva',
|
'Next page' => 'Pagina successiva',
|
||||||
@ -231,4 +230,5 @@ return array(
|
|||||||
// 'Avoid mixed content warnings with HTTPS' => '',
|
// 'Avoid mixed content warnings with HTTPS' => '',
|
||||||
// 'Download favicons' => '',
|
// 'Download favicons' => '',
|
||||||
// 'general' => '',
|
// 'general' => '',
|
||||||
|
// 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => '',
|
||||||
);
|
);
|
||||||
|
@ -56,7 +56,6 @@ return array(
|
|||||||
'download content' => 'download conteúdo',
|
'download content' => 'download conteúdo',
|
||||||
'Help' => 'Ajuda',
|
'Help' => 'Ajuda',
|
||||||
'Theme' => 'Tema',
|
'Theme' => 'Tema',
|
||||||
'There are %d empty feeds, there is maybe an error: %s...' => 'Existem %d feeds vazios, talvez haja um erro: %s...',
|
|
||||||
'Items per page' => 'Itens por página',
|
'Items per page' => 'Itens por página',
|
||||||
'Previous page' => 'Página anterior',
|
'Previous page' => 'Página anterior',
|
||||||
'Next page' => 'Proxima página',
|
'Next page' => 'Proxima página',
|
||||||
@ -231,4 +230,5 @@ return array(
|
|||||||
'Avoid mixed content warnings with HTTPS' => 'Evita alertas de mistura de conteúdo HTTPS',
|
'Avoid mixed content warnings with HTTPS' => 'Evita alertas de mistura de conteúdo HTTPS',
|
||||||
'Download favicons' => 'Download favicon',
|
'Download favicons' => 'Download favicon',
|
||||||
// 'general' => '',
|
// 'general' => '',
|
||||||
|
// 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => '',
|
||||||
);
|
);
|
||||||
|
@ -56,7 +56,6 @@ return array(
|
|||||||
// 'download content' => '',
|
// 'download content' => '',
|
||||||
'Help' => '帮助',
|
'Help' => '帮助',
|
||||||
// 'Theme' => '',
|
// 'Theme' => '',
|
||||||
// 'There are %d empty feeds, there is maybe an error: %s...' => '',
|
|
||||||
'Items per page' => '每页条目数',
|
'Items per page' => '每页条目数',
|
||||||
'Previous page' => '上一页',
|
'Previous page' => '上一页',
|
||||||
'Next page' => '下一页',
|
'Next page' => '下一页',
|
||||||
@ -231,4 +230,5 @@ return array(
|
|||||||
// 'Avoid mixed content warnings with HTTPS' => '',
|
// 'Avoid mixed content warnings with HTTPS' => '',
|
||||||
// 'Download favicons' => '',
|
// 'Download favicons' => '',
|
||||||
// 'general' => '',
|
// 'general' => '',
|
||||||
|
// 'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => '',
|
||||||
);
|
);
|
||||||
|
@ -293,24 +293,13 @@ function get_ids($limit = LIMIT_ALL)
|
|||||||
return $query->listing('id', 'id');
|
return $query->listing('id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get feeds with no item
|
// get number of feeds with errors
|
||||||
function get_all_empty()
|
function count_failed_feeds()
|
||||||
{
|
{
|
||||||
$feeds = Database::get('db')
|
return Database::get('db')
|
||||||
->table('feeds')
|
->table('feeds')
|
||||||
->columns('feeds.id', 'feeds.title', 'COUNT(items.id) AS nb_items')
|
->eq('parsing_error', '1')
|
||||||
->join('items', 'feed_id', 'id')
|
->count();
|
||||||
->isNull('feeds.last_checked')
|
|
||||||
->groupBy('feeds.id')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
foreach ($feeds as $key => &$feed) {
|
|
||||||
if ($feed['nb_items'] > 0) {
|
|
||||||
unset($feeds[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $feeds;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all feeds
|
// Get all feeds
|
||||||
@ -322,53 +311,22 @@ function get_all()
|
|||||||
->findAll();
|
->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all feeds with the number unread/total items
|
// Get all feeds with the number unread/total items in the order failed, working, disabled
|
||||||
function get_all_item_counts()
|
function get_all_item_counts()
|
||||||
{
|
{
|
||||||
$counts = Database::get('db')
|
return Database::get('db')
|
||||||
->table('items')
|
|
||||||
->columns('feed_id', 'status', 'count(*) as item_count')
|
|
||||||
->in('status', array('read', 'unread'))
|
|
||||||
->groupBy('feed_id', 'status')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
$feeds = Database::get('db')
|
|
||||||
->table('feeds')
|
->table('feeds')
|
||||||
->asc('title')
|
->columns(
|
||||||
|
'feeds.*',
|
||||||
|
'SUM(CASE WHEN items.status IN ("unread") THEN 1 ELSE 0 END) as "items_unread"',
|
||||||
|
'SUM(CASE WHEN items.status IN ("read", "unread") THEN 1 ELSE 0 END) as "items_total"'
|
||||||
|
)
|
||||||
|
->join('items', 'feed_id', 'id')
|
||||||
|
->groupBy('feeds.id')
|
||||||
|
->desc('feeds.parsing_error')
|
||||||
|
->desc('feeds.enabled')
|
||||||
|
->asc('feeds.title')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
$item_counts = array();
|
|
||||||
|
|
||||||
foreach ($counts as &$count) {
|
|
||||||
|
|
||||||
if (! isset($item_counts[$count['feed_id']])) {
|
|
||||||
$item_counts[$count['feed_id']] = array(
|
|
||||||
'items_unread' => 0,
|
|
||||||
'items_total' => 0,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$item_counts[$count['feed_id']]['items_total'] += $count['item_count'];
|
|
||||||
|
|
||||||
if ($count['status'] === 'unread') {
|
|
||||||
$item_counts[$count['feed_id']]['items_unread'] = $count['item_count'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($feeds as &$feed) {
|
|
||||||
|
|
||||||
if (isset($item_counts[$feed['id']])) {
|
|
||||||
$feed += $item_counts[$feed['id']];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$feed += array(
|
|
||||||
'items_unread' => 0,
|
|
||||||
'items_total' => 0,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $feeds;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get unread/total count for one feed
|
// Get unread/total count for one feed
|
||||||
|
@ -19,6 +19,12 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if ($feed['parsing_error']): ?>
|
||||||
|
<p class="alert alert-warning">
|
||||||
|
<?= tne('An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!','<a href="?action=console">','</a>') ?>
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<section class="items" id="listing">
|
<section class="items" id="listing">
|
||||||
<?php foreach ($items as $item): ?>
|
<?php foreach ($items as $item): ?>
|
||||||
<?= \PicoFarad\Template\load('item', array(
|
<?= \PicoFarad\Template\load('item', array(
|
||||||
|
@ -17,13 +17,15 @@
|
|||||||
|
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|
||||||
<?php if ($nothing_to_read): ?>
|
<?php if ($nb_failed_feeds > 0): ?>
|
||||||
|
<p class="alert alert-warning"><?= tne('An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!','<a href="?action=console">','</a>') ?></p>
|
||||||
|
<?php elseif ($nothing_to_read): ?>
|
||||||
<p class="alert"><?= tne('Nothing to read, do you want to <a href="?action=refresh-all" data-action="refresh-all">update your subscriptions?</a>') ?></p>
|
<p class="alert"><?= tne('Nothing to read, do you want to <a href="?action=refresh-all" data-action="refresh-all">update your subscriptions?</a>') ?></p>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<section class="items">
|
<section class="items">
|
||||||
<?php foreach ($feeds as $feed): ?>
|
<?php foreach ($feeds as $feed): ?>
|
||||||
<article data-feed-id="<?= $feed['id'] ?>" <?= (! $feed['enabled']) ? 'data-feed-disabled="1"' : '' ?>>
|
<article data-feed-id="<?= $feed['id'] ?>" <?= (! $feed['enabled']) ? 'data-feed-disabled="1"' : '' ?> <?= ($feed['parsing_error']) ? 'data-feed-error="1"' : '' ?>>
|
||||||
<h2>
|
<h2>
|
||||||
<?php if (! $feed['enabled']): ?>
|
<?php if (! $feed['enabled']): ?>
|
||||||
<span title="<?= t('Subscription disabled') ?>">✖</span>
|
<span title="<?= t('Subscription disabled') ?>">✖</span>
|
||||||
@ -48,10 +50,8 @@
|
|||||||
</span>
|
</span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<span class="feed-parsing-error" data-after-error="<?= t('(error occurred during the last check)') ?>">
|
<span class="feed-parsing-error">
|
||||||
<?php if ($feed['parsing_error']): ?>
|
|
||||||
<?= t('(error occurred during the last check)') ?>
|
<?= t('(error occurred during the last check)') ?>
|
||||||
<?php endif ?>
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user