mirror of
				https://github.com/nkanaev/yarr.git
				synced 2025-10-31 06:53:30 +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"> | ||||
|                     <tr> | ||||
|                         <td> | ||||
|                             <kbd>1</kbd> / | ||||
|                             <kbd>2</kbd> / | ||||
|                             <kbd>1</kbd> | ||||
|                             <kbd>2</kbd> | ||||
|                             <kbd>3</kbd> | ||||
|                         </td> | ||||
|                         <td>show unread / starred / all feeds</td> | ||||
| @@ -436,6 +436,13 @@ | ||||
|                         <td><kbd>o</kbd></td> | ||||
|                         <td>open an article's link</td> | ||||
|                     </tr> | ||||
|                     <tr> | ||||
|                         <td> | ||||
|                             <kbd>f</kbd> | ||||
|                             <kbd>b</kbd> | ||||
|                         </td> | ||||
|                         <td>scroll an article forward / backward</td> | ||||
|                     </tr> | ||||
|                 </table> | ||||
|             </div> | ||||
|         </div> | ||||
|   | ||||
| @@ -73,6 +73,15 @@ var helperFunctions = { | ||||
|  | ||||
|       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 = { | ||||
| @@ -112,6 +121,12 @@ var shortcutFunctions = { | ||||
|   previousFeed() { | ||||
|     helperFunctions.navigateToFeed(-1) | ||||
|   }, | ||||
|   scrollForward: function() { | ||||
|     helperFunctions.scrollContent(+1) | ||||
|   }, | ||||
|   scrollBackward: function() { | ||||
|     helperFunctions.scrollContent(-1) | ||||
|   }, | ||||
|   showAll() { | ||||
|     vm.filterSelected = '' | ||||
|   }, | ||||
| @@ -134,6 +149,8 @@ var keybindings = { | ||||
|   "k": shortcutFunctions.previousItem, | ||||
|   "l": shortcutFunctions.nextFeed, | ||||
|   "h": shortcutFunctions.previousFeed, | ||||
|   "f": shortcutFunctions.scrollForward, | ||||
|   "b": shortcutFunctions.scrollBackward, | ||||
|   "1": shortcutFunctions.showUnread, | ||||
|   "2": shortcutFunctions.showStarred, | ||||
|   "3": shortcutFunctions.showAll, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user