Minor Javascript fixes

This commit is contained in:
Frederic Guillot 2016-07-28 21:26:32 -04:00
parent c4a5d4a7bc
commit ac1eda8adf
No known key found for this signature in database
GPG Key ID: 92D77191BA7FBC99
3 changed files with 11 additions and 10 deletions

18
assets/js/all.min.js vendored
View File

@ -8,13 +8,13 @@ c.open("POST","?action=mark-item-unread&id="+e,!0);c.send()}var u=[],t=!1,l=func
j:function(c){var e=d(c),b="1"===c.getAttribute("data-item-bookmark")?"0":"1",w=new XMLHttpRequest;w.onload=function(){var e=document.querySelector("section.page");v.b()&&"bookmarks"===e.getAttribute("data-item-page")?(k(c),n()):(c.setAttribute("data-item-bookmark",b),a(c.querySelector(".bookmark-icon")))};w.open("POST","?action=bookmark&id="+e+"&value="+b,!0);w.send()},L:function(a){var c=a.getAttribute("data-item-status");"read"===c?p(a):"unread"===c&&q(a)},I:function(a){(a=a.querySelector("a.show"))&&
b(a)},F:function(a){(a=a.querySelector("a.original"))&&b(a)},i:function(a){var c=document.getElementById("download-item");if(c){c.innerHTML=" "+c.getAttribute("data-before-message");c.className="loading-icon";var b=new XMLHttpRequest;b.onload=function(){var a=JSON.parse(b.responseText);c.className="";if(a.result){var d=document.getElementById("item-content");d&&(d.innerHTML=a.content);c.innerHTML=c.getAttribute("data-after-message")}else c.innerHTML=c.getAttribute("data-failure-message")};a=d(a);
b.open("POST","?action=download-item&id="+a,!0);b.send()}},C:function(a){var b=new XMLHttpRequest;b.onload=function(){for(var a=document.getElementsByTagName("article"),b=0,d=a.length;b<d;b++)c(a[b]);l=this.responseText;n()};b.open("POST","?action=mark-feed-as-read&feed_id="+a,!0);b.send()},M:function(){for(var a=["#current-item h1","#item-content","#listing #current-item h2","#listing #current-item .preview","#listing #current-item .preview-full-content"],c=0;c<a.length;c++){var b=document.querySelector(a[c]);
b&&(b.dir=""==b.dir?"rtl":"")}},N:function(){return t},a:function(){if(!document.hidden||!t){var a=new XMLHttpRequest;a.onload=function(){var a=0===u.length,c=!1,b=JSON.parse(this.responseText),d;for(d in b.feeds){var k=b.feeds[d];if(!u.hasOwnProperty(d)||k.time>u[d])u[d]=k.time,"unread"===k.status&&(c=!0)}document.hidden||b.nbUnread===l&&!t?document.hidden&&!a&&c&&(t=!0,document.title="\u21bb "+document.title):(t=!1,l=b.nbUnread,n())};a.open("POST","?action=latest-feeds-items",!0);a.send()}}}}(),
m=function(){function b(a){if(63!==a.keyCode&&63!==a.which&&(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 d=[];return{c:"",u:function(){document.onclick=function(a){a.target.hasAttribute("data-action")&&"original"!==a.target.className&&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 c=a.target.getAttribute("data-action");
if(c){m.c="mouse";var b;a:{for(element=a.target;element&&element.parentNode;)if(element=element.parentNode,element.tagName&&"article"===element.tagName.toLowerCase()){b=element;break a}b=void 0}switch(c){case "refresh-all":h.m(a.target.getAttribute("data-concurrent-requests"));break;case "refresh-feed":b&&h.l(b);break;case "mark-read":b&&f.w(b);break;case "mark-unread":b&&f.B(b);break;case "mark-removed":b&&f.A(b);break;case "bookmark":b&&f.j(b);break;case "download-item":b&&f.i(b);break;case "mark-feed-read":a=
document.getElementById("listing").getAttribute("data-feed-id");f.C(a);break;case "close-help":v.h();break;case "show-search":v.K()}}}}},s:function(){document.onkeypress=function(a){if(!b(a))if(m.c="keyboard",d.push(a.key||a.which),"g"===d[0]||103===d[0])switch(d[1]){case void 0:break;case "u":case 117:window.location.href="?action=unread";d=[];break;case "b":case 98:window.location.href="?action=bookmarks";d=[];break;case "h":case 104:window.location.href="?action=history";d=[];break;case "s":case 115:window.location.href=
"?action=feeds";d=[];break;case "p":case 112:window.location.href="?action=config";d=[];break;default:d=[]}else{d=[];var c=document.getElementById("current-item");switch(a.key||a.which){case "d":case 100:c&&f.i(c);break;case "p":case 112:case "k":case 107:v.g();break;case "n":case 110:case "j":case 106:v.f();break;case "v":case 118:c&&f.F(c);break;case "o":case 111:c&&f.I(c);break;case "m":case 109:c&&f.L(c);break;case "f":case 102:c&&f.j(c);break;case "h":case 104:v.G();break;case "l":case 108:v.D();
break;case "r":case 114:h.m();break;case "?":case 63:v.J();break;case "Q":case 81:case "q":case 113:v.h();break;case "z":case 122:f.M()}}};document.onkeydown=function(a){if(!b(a))switch(m.c="keyboard",a.key||a.which){case "ArrowLeft":case "Left":case 37:v.g();break;case "ArrowRight":case "Right":case 39:v.f()}}},v:function(){document.addEventListener("visibilitychange",function(){!document.hidden&&f.N()&&f.a()})}}}(),v=function(){function b(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 d(){return document.getElementById("listing")?!0:!1}return{D:function(){var a=document.getElementById("next-page");a&&a.click()},G:function(){var a=document.getElementById("previous-page");a&&a.click()},f: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,k=a.length;c<k;c++){if("current-item"===a[c].id){c+1<k&&(a[c].id="item-"+a[c].getAttribute("data-item-id"),a[c+1].id="current-item",b(a[c+1]));break}}else a[0].id="current-item",b(a[0])},g:function(){var a=document.getElementById("previous-item");if(a)a.click();else if(d())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=a.length-1;0<=c;c--){if("current-item"===a[c].id){0<=c-1&&(a[c].id="item-"+a[c].getAttribute("data-item-id"),a[c-1].id="current-item",
b(a[c-1]));break}}else a[a.length-1].id="current-item",b(a[a.length-1])},J:function(){document.getElementById("help-layer").removeAttribute("class")},h:function(){document.getElementById("help-layer").setAttribute("class","hide")},K:function(){document.getElementById("search-opener").setAttribute("class","hide");document.getElementById("search-form").removeAttribute("class")},b:d}}();
b&&(b.dir=""==b.dir?"rtl":"")}},N:function(){return t},a:function(){if(!document.hidden||!t){var a=new XMLHttpRequest;a.onload=function(){var a=0===u.length,c=!1,b=JSON.parse(this.responseText),d;for(d in b.feeds){var k=b.feeds[d];d=parseInt(d,10);if(!u.hasOwnProperty(d)||k.time>u[d])u[d]=k.time,"unread"===k.status&&(c=!0)}document.hidden||b.nbUnread===l&&!t?document.hidden&&!a&&c&&(t=!0,document.title="\u21bb "+document.title):(t=!1,l=b.nbUnread,n())};a.open("POST","?action=latest-feeds-items",!0);
a.send()}}}}(),m=function(){function b(a){if(63!==a.keyCode&&63!==a.which&&(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 d=[];return{c:"",u:function(){document.onclick=function(a){a.target.hasAttribute("data-action")&&"original"!==a.target.className&&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 c=
a.target.getAttribute("data-action");if(c){m.c="mouse";var b;a:{for(element=a.target;element&&element.parentNode;)if(element=element.parentNode,element.tagName&&"article"===element.tagName.toLowerCase()){b=element;break a}b=void 0}switch(c){case "refresh-all":h.m(a.target.getAttribute("data-concurrent-requests"));break;case "refresh-feed":b&&h.l(b);break;case "mark-read":b&&f.w(b);break;case "mark-unread":b&&f.B(b);break;case "mark-removed":b&&f.A(b);break;case "bookmark":b&&f.j(b);break;case "download-item":b&&
f.i(b);break;case "mark-feed-read":a=document.getElementById("listing").getAttribute("data-feed-id");f.C(a);break;case "close-help":v.h();break;case "show-search":v.K()}}}}},s:function(){document.onkeypress=function(a){if(!b(a))if(m.c="keyboard",d.push(a.key||a.which),"g"===d[0]||103===d[0])switch(d[1]){case void 0:break;case "u":case 117:window.location.href="?action=unread";d=[];break;case "b":case 98:window.location.href="?action=bookmarks";d=[];break;case "h":case 104:window.location.href="?action=history";
d=[];break;case "s":case 115:window.location.href="?action=feeds";d=[];break;case "p":case 112:window.location.href="?action=config";d=[];break;default:d=[]}else{d=[];var c=document.getElementById("current-item");switch(a.key||a.which){case "d":case 100:c&&f.i(c);break;case "p":case 112:case "k":case 107:v.g();break;case "n":case 110:case "j":case 106:v.f();break;case "v":case 118:c&&f.F(c);break;case "o":case 111:c&&f.I(c);break;case "m":case 109:c&&f.L(c);break;case "f":case 102:c&&f.j(c);break;
case "h":case 104:v.G();break;case "l":case 108:v.D();break;case "r":case 114:h.m();break;case "?":case 63:v.J();break;case "Q":case 81:case "q":case 113:v.h();break;case "z":case 122:f.M()}}};document.onkeydown=function(a){if(!b(a))switch(m.c="keyboard",a.key||a.which){case "ArrowLeft":case "Left":case 37:v.g();break;case "ArrowRight":case "Right":case 39:v.f()}}},v:function(){document.addEventListener("visibilitychange",function(){!document.hidden&&f.N()&&f.a()})}}}(),v=function(){function b(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 d(){return document.getElementById("listing")?!0:!1}return{D:function(){var a=document.getElementById("next-page");a&&a.click()},G:function(){var a=document.getElementById("previous-page");a&&a.click()},f: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,k=a.length;c<k;c++){if("current-item"===a[c].id){c+1<k&&(a[c].id="item-"+a[c].getAttribute("data-item-id"),a[c+1].id="current-item",b(a[c+1]));break}}else a[0].id="current-item",b(a[0])},g:function(){var a=document.getElementById("previous-item");if(a)a.click();else if(d())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=a.length-1;0<=c;c--){if("current-item"===a[c].id){0<=c-1&&(a[c].id="item-"+a[c].getAttribute("data-item-id"),
a[c-1].id="current-item",b(a[c-1]));break}}else a[a.length-1].id="current-item",b(a[a.length-1])},J:function(){document.getElementById("help-layer").removeAttribute("class")},h:function(){document.getElementById("help-layer").setAttribute("class","hide")},K:function(){document.getElementById("search-opener").setAttribute("class","hide");document.getElementById("search-form").removeAttribute("class")},b:d}}();
({O:function(){},H:function(){m.s();m.u();m.v();this.o()},o:function(){var b=new XMLHttpRequest;b.onload=function(){var b=JSON.parse(this.responseText);0<b.frontend_updatecheck_interval&&(f.a(),setInterval(function(){f.a()},6E4*b.frontend_updatecheck_interval))};b.open("POST","?action=get-config",!0);b.send(JSON.stringify(["frontend_updatecheck_interval"]))}}).H();

View File

@ -189,7 +189,7 @@ Miniflux.Event = (function() {
case 'h':
case 104:
Miniflux.Nav.OpenPreviousPage();
break
break;
case 'l':
case 108:
Miniflux.Nav.OpenNextPage();

View File

@ -343,6 +343,7 @@ Miniflux.Item = (function() {
for (var feed_id in response['feeds']) {
var current_feed = response['feeds'][feed_id];
var feed_id = parseInt(feed_id, 10);
if (! latest_feeds_items.hasOwnProperty(feed_id) || current_feed.time > latest_feeds_items[feed_id]) {
Miniflux.App.Log('feed ' + feed_id + ': New item(s)');