Do not handle keyboard events for form fields
This commit is contained in:
parent
6efd1ff538
commit
c0ce32094e
6
assets/js/all.min.js
vendored
6
assets/js/all.min.js
vendored
@ -16,9 +16,9 @@ a.innerHTML="",a.appendChild(document.createTextNode(" "+b)))}else a&&(b=a.getAt
|
|||||||
Miniflux.Event=function(){var d=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(b){var a=b.target.getAttribute("data-action");if(a)switch(Miniflux.Event.lastEventType="mouse",a){case "refresh-all":b.preventDefault();Miniflux.Feed.UpdateAll();break;case "refresh-feed":b.preventDefault();Miniflux.Feed.Update(b.target.getAttribute("data-feed-id"));break;case "mark-read":b.preventDefault();Miniflux.Item.MarkAsRead(b.target.getAttribute("data-item-id"));break;case "mark-unread":b.preventDefault();
|
Miniflux.Event=function(){var d=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(b){var a=b.target.getAttribute("data-action");if(a)switch(Miniflux.Event.lastEventType="mouse",a){case "refresh-all":b.preventDefault();Miniflux.Feed.UpdateAll();break;case "refresh-feed":b.preventDefault();Miniflux.Feed.Update(b.target.getAttribute("data-feed-id"));break;case "mark-read":b.preventDefault();Miniflux.Item.MarkAsRead(b.target.getAttribute("data-item-id"));break;case "mark-unread":b.preventDefault();
|
||||||
Miniflux.Item.MarkAsUnread(b.target.getAttribute("data-item-id"));break;case "mark-removed":b.preventDefault();Miniflux.Item.MarkAsRemoved(b.target.getAttribute("data-item-id"));break;case "bookmark":b.preventDefault();Miniflux.Item.SwitchBookmark(Miniflux.Item.Get(b.target.getAttribute("data-item-id")));break;case "download-item":b.preventDefault();Miniflux.Item.DownloadContent();break;case "original-link":b.preventDefault();Miniflux.Item.OpenOriginal(b.target.getAttribute("data-item-id"));break;
|
Miniflux.Item.MarkAsUnread(b.target.getAttribute("data-item-id"));break;case "mark-removed":b.preventDefault();Miniflux.Item.MarkAsRemoved(b.target.getAttribute("data-item-id"));break;case "bookmark":b.preventDefault();Miniflux.Item.SwitchBookmark(Miniflux.Item.Get(b.target.getAttribute("data-item-id")));break;case "download-item":b.preventDefault();Miniflux.Item.DownloadContent();break;case "original-link":b.preventDefault();Miniflux.Item.OpenOriginal(b.target.getAttribute("data-item-id"));break;
|
||||||
case "mark-all-read":b.preventDefault();Miniflux.Item.MarkListingAsRead("?action=unread");break;case "mark-feed-read":b.preventDefault();Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+b.target.getAttribute("data-feed-id"));break;case "mozilla-login":b.preventDefault();Miniflux.App.MozillaAuth("mozilla-auth");break;case "mozilla-link":b.preventDefault(),Miniflux.App.MozillaAuth("mozilla-link")}}},ListenKeyboardEvents:function(){document.onkeypress=function(b){if(!(b.ctrlKey||b.shiftKey||
|
case "mark-all-read":b.preventDefault();Miniflux.Item.MarkListingAsRead("?action=unread");break;case "mark-feed-read":b.preventDefault();Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+b.target.getAttribute("data-feed-id"));break;case "mozilla-login":b.preventDefault();Miniflux.App.MozillaAuth("mozilla-auth");break;case "mozilla-link":b.preventDefault(),Miniflux.App.MozillaAuth("mozilla-link")}}},ListenKeyboardEvents:function(){document.onkeypress=function(b){if(!(b.ctrlKey||b.shiftKey||
|
||||||
b.altKey||b.metaKey))if(Miniflux.Event.lastEventType="keyboard",d.push(b.keyCode||b.which),103==d[0])switch(d[1]){case void 0:break;case 117:window.location.href="?action=unread";d=[];break;case 98:window.location.href="?action=bookmarks";d=[];break;case 104:window.location.href="?action=history";d=[];break;case 115:window.location.href="?action=feeds";d=[];break;case 112:window.location.href="?action=config";d=[];break;default:d=[]}else switch(d=[],b.keyCode||b.which){case 100:Miniflux.Item.DownloadContent(Miniflux.Nav.GetCurrentItemId());
|
b.altKey||b.metaKey)){var a=b.target||b.srcElement;if("INPUT"!=a.tagName&&"TEXTAREA"!=a.tagName)if(Miniflux.Event.lastEventType="keyboard",d.push(b.keyCode||b.which),103==d[0])switch(d[1]){case void 0:break;case 117:window.location.href="?action=unread";d=[];break;case 98:window.location.href="?action=bookmarks";d=[];break;case 104:window.location.href="?action=history";d=[];break;case 115:window.location.href="?action=feeds";d=[];break;case 112:window.location.href="?action=config";d=[];break;default:d=
|
||||||
break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();break;case 110:case 106:Miniflux.Nav.SelectNextItem();break;case 118:Miniflux.Item.OpenOriginal(Miniflux.Nav.GetCurrentItemId());break;case 111:Miniflux.Item.Show(Miniflux.Nav.GetCurrentItemId());break;case 109:Miniflux.Item.SwitchStatus(Miniflux.Nav.GetCurrentItem());break;case 102:Miniflux.Item.SwitchBookmark(Miniflux.Nav.GetCurrentItem());break;case 104:Miniflux.Nav.OpenPreviousPage();break;case 108:Miniflux.Nav.OpenNextPage();break;case 114:Miniflux.Feed.UpdateAll();
|
[]}else switch(d=[],b.keyCode||b.which){case 100:Miniflux.Item.DownloadContent(Miniflux.Nav.GetCurrentItemId());break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();break;case 110:case 106:Miniflux.Nav.SelectNextItem();break;case 118:Miniflux.Item.OpenOriginal(Miniflux.Nav.GetCurrentItemId());break;case 111:Miniflux.Item.Show(Miniflux.Nav.GetCurrentItemId());break;case 109:Miniflux.Item.SwitchStatus(Miniflux.Nav.GetCurrentItem());break;case 102:Miniflux.Item.SwitchBookmark(Miniflux.Nav.GetCurrentItem());
|
||||||
break;case 63:Miniflux.Nav.ShowHelp()}}}}}();
|
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 d(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 b(){return document.getElementById("listing")?!0:!1}return{GetCurrentItem:function(){return document.getElementById("current-item")},GetCurrentItemId:function(){var a=Miniflux.Nav.GetCurrentItem();return a?a.getAttribute("data-item-id"):null},OpenNextPage:function(){var a=document.getElementById("next-page");
|
Miniflux.Nav=function(){function d(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 b(){return document.getElementById("listing")?!0:!1}return{GetCurrentItem:function(){return document.getElementById("current-item")},GetCurrentItemId:function(){var a=Miniflux.Nav.GetCurrentItem();return a?a.getAttribute("data-item-id"):null},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(b())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=0,f=a.length;c<f;c++){if("current-item"==a[c].id){a[c].id="item-"+a[c].getAttribute("data-item-id");c+1<f&&(a[c+1].id="current-item",d(a[c+1]));break}}else a[0].id="current-item",d(a[0])},SelectPreviousItem:function(){var a=
|
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(b())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=0,f=a.length;c<f;c++){if("current-item"==a[c].id){a[c].id="item-"+a[c].getAttribute("data-item-id");c+1<f&&(a[c+1].id="current-item",d(a[c+1]));break}}else a[0].id="current-item",d(a[0])},SelectPreviousItem:function(){var a=
|
||||||
document.getElementById("previous-item");if(a)a.click();else if(b())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=a.length-1;0<=c;c--){if("current-item"==a[c].id){a[c].id="item-"+a[c].getAttribute("data-item-id");0<=c-1&&(a[c-1].id="current-item",d(a[c-1]));break}}else a[a.length-1].id="current-item",d(a[a.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:b}}();
|
document.getElementById("previous-item");if(a)a.click();else if(b())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=a.length-1;0<=c;c--){if("current-item"==a[c].id){a[c].id="item-"+a[c].getAttribute("data-item-id");0<=c-1&&(a[c-1].id="current-item",d(a[c-1]));break}}else a[a.length-1].id="current-item",d(a[a.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:b}}();
|
||||||
|
@ -71,7 +71,15 @@ Miniflux.Event = (function() {
|
|||||||
|
|
||||||
document.onkeypress = function(e) {
|
document.onkeypress = function(e) {
|
||||||
|
|
||||||
if (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
|
if (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not handle events when there is a focus in form fields
|
||||||
|
var target = e.target || e.srcElement;
|
||||||
|
if (target.tagName == 'INPUT' || target.tagName == 'TEXTAREA') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Miniflux.Event.lastEventType = "keyboard";
|
Miniflux.Event.lastEventType = "keyboard";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user