Fix broken keyboard shortcut to display the help

This commit is contained in:
Frédéric Guillot 2014-11-23 10:23:28 -05:00
parent 6314a509c4
commit f398694a45
2 changed files with 20 additions and 20 deletions

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

@ -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");f||(f=setInterval(Miniflux.App.BlinkIcon,500))}function c(){for(var d=document.getElementsByTagName("a"),g=0,b=d.length;g<b;g++){var c=d[g].getAttribute("data-feed-id");c&&a.push(parseInt(c))}}var a=[],b=[],f;return{Update:function(d,a){e(d);var b=new XMLHttpRequest;b.onload=function(){var b=document.getElementById("loading-feed-"+
d);b&&(b.innerHTML="");if(b=document.getElementById("last-checked-feed-"+d))b.innerHTML=b.getAttribute("data-after-update");try{var c=JSON.parse(this.responseText);if(c.result){var h=c.items_count,e=document.getElementById("items-count-"+d);e&&(e.innerHTML="("+h.items_unread+"/"+h.items_total+")")}a&&a(c)}catch(f){}};b.open("POST","?action=refresh-feed&feed_id="+d,!0);b.send()},UpdateAll:function(){c();var d=setInterval(function(){for(;0<a.length&&5>b.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;f<m;f++)c.push(e(a[f]));a=new XMLHttpRequest;a.onload=function(){window.location.href=b};a.open("POST","?action=mark-items-as-read",!0);a.send(JSON.stringify(c))}}}();
Miniflux.Event=function(){var e=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(c){var a=c.target.getAttribute("data-action");if(a){Miniflux.Event.lastEventType="mouse";var b;a:{for(element=c.target;element&&element.parentNode;)if(element=element.parentNode,element.tagName&&"article"===element.tagName.toLowerCase()){b=element;break a}b=null}switch(a){case "refresh-all":c.preventDefault();Miniflux.Feed.UpdateAll();break;case "refresh-feed":c.preventDefault();Miniflux.Feed.Update(c.target.getAttribute("data-feed-id"));
break;case "mark-read":c.preventDefault();Miniflux.Item.MarkAsRead(b);break;case "mark-unread":c.preventDefault();Miniflux.Item.MarkAsUnread(b);break;case "mark-removed":c.preventDefault();Miniflux.Item.MarkAsRemoved(b);break;case "bookmark":c.preventDefault();Miniflux.Item.SwitchBookmark(b);break;case "download-item":c.preventDefault();Miniflux.Item.DownloadContent(b);break;case "original-link":c.preventDefault();Miniflux.Item.OpenOriginal(b);break;case "mark-all-read":c.preventDefault();Miniflux.Item.MarkListingAsRead("?action=unread");
break;case "mark-feed-read":c.preventDefault(),Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+c.target.getAttribute("data-feed-id"))}}}},ListenKeyboardEvents:function(){document.onkeypress=function(c){if(!(c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)){var a=c.target||c.srcElement;if("INPUT"!=a.tagName&&"TEXTAREA"!=a.tagName)if(Miniflux.Event.lastEventType="keyboard",e.push(c.keyCode||c.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 switch(e=[],a=document.getElementById("current-item"),c.keyCode||c.which){case 100:Miniflux.Item.DownloadContent(a);break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();break;case 110:case 106:Miniflux.Nav.SelectNextItem();break;case 118:Miniflux.Item.OpenOriginal(a);
break;case 111:Miniflux.Item.Show(a);break;case 109:Miniflux.Item.SwitchStatus(a);break;case 102:Miniflux.Item.SwitchBookmark(a);break;case 104:Miniflux.Nav.OpenPreviousPage();break;case 108:Miniflux.Nav.OpenNextPage();break;case 114:Miniflux.Feed.UpdateAll();break;case 63:Miniflux.Nav.ShowHelp()}}}}}}();
Miniflux.Nav=function(){function e(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 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<f;b++){if("current-item"===a[b].id){b+1<f&&(a[b].id="item-"+a[b].getAttribute("data-item-id"),a[b+1].id="current-item",e(a[b+1]));break}}else a[0].id="current-item",e(a[0])},SelectPreviousItem:function(){var a=document.getElementById("previous-item");if(a)a.click();else if(c())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",e(a[b-1]));break}}else a[a.length-1].id="current-item",e(a[a.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:c}}();Miniflux.App.Run();
var Miniflux={};Miniflux.App=function(){return{BlinkIcon:function(){var e=document.querySelectorAll(".loading-icon");[].forEach.call(e,function(a){a.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");f||(f=setInterval(Miniflux.App.BlinkIcon,500))}function a(){for(var d=document.getElementsByTagName("a"),l=0,c=d.length;l<c;l++){var a=d[l].getAttribute("data-feed-id");a&&b.push(parseInt(a))}}var b=[],c=[],f;return{Update:function(d,b){e(d);var a=new XMLHttpRequest;a.onload=function(){var a=document.getElementById("loading-feed-"+
d);a&&(a.innerHTML="");if(a=document.getElementById("last-checked-feed-"+d))a.innerHTML=a.getAttribute("data-after-update");try{var c=JSON.parse(this.responseText);if(c.result){var g=c.items_count,e=document.getElementById("items-count-"+d);e&&(e.innerHTML="("+g.items_unread+"/"+g.items_total+")")}b&&b(c)}catch(f){}};a.open("POST","?action=refresh-feed&feed_id="+d,!0);a.send()},UpdateAll:function(){a();var d=setInterval(function(){for(;0<b.length&&5>c.length;){var a=b.shift();c.push(a);Miniflux.Feed.Update(a,
function(a){a=c.indexOf(a.feed_id);0<=a&&c.splice(a,1);0==b.length&&0==c.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 a(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 c(d){var c=e(d),g=new XMLHttpRequest;g.onload=function(){if(Miniflux.Nav.IsListing())if(d.getAttribute("data-hide"))b(d);else{d.setAttribute("data-item-status",
"read");var c=d.querySelector("a.mark");a(c);(c=d.querySelector("a.mark"))&&c.setAttribute("data-action","mark-unread")}};g.open("POST","?action=mark-item-read&id="+c,!0);g.send()}function f(d){var c=e(d),g=new XMLHttpRequest;g.onload=function(){if(Miniflux.Nav.IsListing())if(d.getAttribute("data-hide"))b(d);else{d.setAttribute("data-item-status","unread");var c=d.querySelector("a.mark");a(c);(c=d.querySelector("a.mark"))&&c.setAttribute("data-action","mark-read")}};g.open("POST","?action=mark-item-unread&id="+
c,!0);g.send()}return{MarkAsRead:c,MarkAsUnread:f,MarkAsRemoved:function(d){var a=e(d),c=new XMLHttpRequest;c.onload=function(){Miniflux.Nav.IsListing()&&b(d)};c.open("POST","?action=mark-item-removed&id="+a,!0);c.send()},SwitchBookmark:function(d){var c=e(d),g="1"===d.getAttribute("data-item-bookmark")?"0":"1",h=new XMLHttpRequest;h.onload=function(){if(Miniflux.Nav.IsListing()&&"bookmarks"===d.getAttribute("data-item-page"))b(d);else if(d.setAttribute("data-item-bookmark",g),Miniflux.Nav.IsListing()){var c=
d.querySelector("a.bookmark");a(c)}};h.open("POST","?action=bookmark&id="+c+"&value="+g,!0);h.send()},SwitchStatus:function(d){var b=d.getAttribute("data-item-status");"read"===b?f(d):"unread"===b&&c(d)},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){b=
e(b);var c=a.getAttribute("data-before-message"),h=document.createElement("span");h.appendChild(document.createTextNode("\u2600"));h.className="loading-icon";a.innerHTML="";a.className="downloading";a.appendChild(h);a.appendChild(document.createTextNode(" "+c));var f=setInterval(Miniflux.App.BlinkIcon,250),k=new XMLHttpRequest;k.onload=function(){var b=JSON.parse(k.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)))};k.open("POST","?action=download-item&id="+b,!0);k.send()}},MarkListingAsRead:function(b){for(var a=document.getElementsByTagName("article"),c=[],f=0,m=a.length;f<m;f++)c.push(e(a[f]));a=new XMLHttpRequest;a.onload=function(){window.location.href=b};a.open("POST","?action=mark-items-as-read",!0);a.send(JSON.stringify(c))}}}();
Miniflux.Event=function(){var e=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(a){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":a.preventDefault();Miniflux.Feed.UpdateAll();break;case "refresh-feed":a.preventDefault();Miniflux.Feed.Update(a.target.getAttribute("data-feed-id"));
break;case "mark-read":a.preventDefault();Miniflux.Item.MarkAsRead(c);break;case "mark-unread":a.preventDefault();Miniflux.Item.MarkAsUnread(c);break;case "mark-removed":a.preventDefault();Miniflux.Item.MarkAsRemoved(c);break;case "bookmark":a.preventDefault();Miniflux.Item.SwitchBookmark(c);break;case "download-item":a.preventDefault();Miniflux.Item.DownloadContent(c);break;case "original-link":a.preventDefault();Miniflux.Item.OpenOriginal(c);break;case "mark-all-read":a.preventDefault();Miniflux.Item.MarkListingAsRead("?action=unread");
break;case "mark-feed-read":a.preventDefault(),Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+a.target.getAttribute("data-feed-id"))}}}},ListenKeyboardEvents:function(){document.onkeypress=function(a){if(63==a.keyCode||!(a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)){var b=a.target||a.srcElement;if("INPUT"!=b.tagName&&"TEXTAREA"!=b.tagName)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 switch(e=[],b=document.getElementById("current-item"),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()}}}}}}();
Miniflux.Nav=function(){function e(a){var c=pageYOffset+document.documentElement.clientHeight;(0>c-(a.offsetTop+a.offsetHeight)||c-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function a(){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 b=document.getElementById("next-item");
if(b)b.click();else if(a())if(b=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=0,f=b.length;c<f;c++){if("current-item"===b[c].id){c+1<f&&(b[c].id="item-"+b[c].getAttribute("data-item-id"),b[c+1].id="current-item",e(b[c+1]));break}}else b[0].id="current-item",e(b[0])},SelectPreviousItem:function(){var b=document.getElementById("previous-item");if(b)b.click();else if(a())if(b=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=
b.length-1;0<=c;c--){if("current-item"===b[c].id){0<=c-1&&(b[c].id="item-"+b[c].getAttribute("data-item-id"),b[c-1].id="current-item",e(b[c-1]));break}}else b[b.length-1].id="current-item",e(b[b.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:a}}();Miniflux.App.Run();

View File

@ -76,7 +76,7 @@ Miniflux.Event = (function() {
document.onkeypress = function(e) {
if (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) {
if (e.keyCode != 63 && (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey)) {
return;
}