mirror of
				https://github.com/nkanaev/yarr.git
				synced 2025-10-30 22:43:29 +00:00 
			
		
		
		
	article scroll keybindings
This commit is contained in:
		| @@ -390,8 +390,8 @@ | |||||||
|                 <table class="table table-borderless table-sm table-compact m-0"> |                 <table class="table table-borderless table-sm table-compact m-0"> | ||||||
|                     <tr> |                     <tr> | ||||||
|                         <td> |                         <td> | ||||||
|                             <kbd>1</kbd> / |                             <kbd>1</kbd> | ||||||
|                             <kbd>2</kbd> / |                             <kbd>2</kbd> | ||||||
|                             <kbd>3</kbd> |                             <kbd>3</kbd> | ||||||
|                         </td> |                         </td> | ||||||
|                         <td>show unread / starred / all feeds</td> |                         <td>show unread / starred / all feeds</td> | ||||||
| @@ -436,6 +436,13 @@ | |||||||
|                         <td><kbd>o</kbd></td> |                         <td><kbd>o</kbd></td> | ||||||
|                         <td>open an article's link</td> |                         <td>open an article's link</td> | ||||||
|                     </tr> |                     </tr> | ||||||
|  |                     <tr> | ||||||
|  |                         <td> | ||||||
|  |                             <kbd>f</kbd> | ||||||
|  |                             <kbd>b</kbd> | ||||||
|  |                         </td> | ||||||
|  |                         <td>scroll an article forward / backward</td> | ||||||
|  |                     </tr> | ||||||
|                 </table> |                 </table> | ||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|   | |||||||
| @@ -73,6 +73,15 @@ var helperFunctions = { | |||||||
|  |  | ||||||
|       if (target && scroll) scrollto(target, scroll) |       if (target && scroll) scrollto(target, scroll) | ||||||
|     }) |     }) | ||||||
|  |   }, | ||||||
|  |   scrollContent: function(direction) { | ||||||
|  |     var padding = 40 | ||||||
|  |     var scroll = document.querySelector('.content') | ||||||
|  |     if (!scroll) return | ||||||
|  |  | ||||||
|  |     var height = scroll.getBoundingClientRect().height | ||||||
|  |  | ||||||
|  |     scroll.scrollTop += (height - padding) * direction | ||||||
|   } |   } | ||||||
| } | } | ||||||
| var shortcutFunctions = { | var shortcutFunctions = { | ||||||
| @@ -112,6 +121,12 @@ var shortcutFunctions = { | |||||||
|   previousFeed() { |   previousFeed() { | ||||||
|     helperFunctions.navigateToFeed(-1) |     helperFunctions.navigateToFeed(-1) | ||||||
|   }, |   }, | ||||||
|  |   scrollForward: function() { | ||||||
|  |     helperFunctions.scrollContent(+1) | ||||||
|  |   }, | ||||||
|  |   scrollBackward: function() { | ||||||
|  |     helperFunctions.scrollContent(-1) | ||||||
|  |   }, | ||||||
|   showAll() { |   showAll() { | ||||||
|     vm.filterSelected = '' |     vm.filterSelected = '' | ||||||
|   }, |   }, | ||||||
| @@ -134,6 +149,8 @@ var keybindings = { | |||||||
|   "k": shortcutFunctions.previousItem, |   "k": shortcutFunctions.previousItem, | ||||||
|   "l": shortcutFunctions.nextFeed, |   "l": shortcutFunctions.nextFeed, | ||||||
|   "h": shortcutFunctions.previousFeed, |   "h": shortcutFunctions.previousFeed, | ||||||
|  |   "f": shortcutFunctions.scrollForward, | ||||||
|  |   "b": shortcutFunctions.scrollBackward, | ||||||
|   "1": shortcutFunctions.showUnread, |   "1": shortcutFunctions.showUnread, | ||||||
|   "2": shortcutFunctions.showStarred, |   "2": shortcutFunctions.showStarred, | ||||||
|   "3": shortcutFunctions.showAll, |   "3": shortcutFunctions.showAll, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user