Let pages opt in to the use of photo_clipboard's hotkeys.
This commit is contained in:
		
							parent
							
								
									cbde9488b8
								
							
						
					
					
						commit
						9c13220ac3
					
				
					 5 changed files with 23 additions and 4 deletions
				
			
		|  | @ -389,6 +389,15 @@ function on_storage_event() | ||||||
|     photo_clipboard.update_pagestate(); |     photo_clipboard.update_pagestate(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | photo_clipboard.register_hotkeys = | ||||||
|  | function register_hotkeys() | ||||||
|  | { | ||||||
|  |     hotkeys.register_hotkey("ctrl a", photo_clipboard.select_all_photos, "Select all photos."); | ||||||
|  |     hotkeys.register_hotkey("ctrl d", photo_clipboard.unselect_all_photos, "Deselect all photos."); | ||||||
|  |     hotkeys.register_hotkey("c", photo_clipboard.clipboard_tray_collapse_toggle, "Toggle clipboard tray."); | ||||||
|  |     hotkeys.register_hotkey("shift c", photo_clipboard.open_full_clipboard_tab, "Open full clipboard page."); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| photo_clipboard.update_pagestate = | photo_clipboard.update_pagestate = | ||||||
| function update_pagestate() | function update_pagestate() | ||||||
| { | { | ||||||
|  | @ -404,10 +413,6 @@ photo_clipboard.on_pageload = | ||||||
| function on_pageload() | function on_pageload() | ||||||
| { | { | ||||||
|     window.addEventListener("storage", photo_clipboard.on_storage_event, false); |     window.addEventListener("storage", photo_clipboard.on_storage_event, false); | ||||||
|     hotkeys.register_hotkey("ctrl a", photo_clipboard.select_all_photos, "Select all photos."); |  | ||||||
|     hotkeys.register_hotkey("ctrl d", photo_clipboard.unselect_all_photos, "Deselect all photos."); |  | ||||||
|     hotkeys.register_hotkey("c", photo_clipboard.clipboard_tray_collapse_toggle, "Toggle clipboard tray."); |  | ||||||
|     hotkeys.register_hotkey("shift c", photo_clipboard.open_full_clipboard_tab, "Open full clipboard page."); |  | ||||||
|     photo_clipboard.ingest_toolbox_items(); |     photo_clipboard.ingest_toolbox_items(); | ||||||
|     photo_clipboard.load_clipboard(); |     photo_clipboard.load_clipboard(); | ||||||
|     photo_clipboard.update_pagestate(); |     photo_clipboard.update_pagestate(); | ||||||
|  |  | ||||||
|  | @ -464,6 +464,7 @@ function add_photo_toolbox_entries() | ||||||
| } | } | ||||||
| function on_pageload() | function on_pageload() | ||||||
| { | { | ||||||
|  |     photo_clipboard.register_hotkeys(); | ||||||
|     add_photo_toolbox_entries(); |     add_photo_toolbox_entries(); | ||||||
| } | } | ||||||
| document.addEventListener("DOMContentLoaded", on_pageload); | document.addEventListener("DOMContentLoaded", on_pageload); | ||||||
|  |  | ||||||
|  | @ -400,5 +400,11 @@ function unset_searchhidden_form() | ||||||
|     const photo_ids = Array.from(photo_clipboard.clipboard); |     const photo_ids = Array.from(photo_clipboard.clipboard); | ||||||
|     api.photos.batch_unset_searchhidden(photo_ids, set_unset_searchhidden_callback); |     api.photos.batch_unset_searchhidden(photo_ids, set_unset_searchhidden_callback); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | function on_pageload() | ||||||
|  | { | ||||||
|  |     photo_clipboard.register_hotkeys(); | ||||||
|  | } | ||||||
|  | document.addEventListener("DOMContentLoaded", on_pageload); | ||||||
| </script> | </script> | ||||||
| </html> | </html> | ||||||
|  |  | ||||||
|  | @ -647,6 +647,7 @@ function on_pageload() | ||||||
| { | { | ||||||
|     autofocus_add_tag_box(); |     autofocus_add_tag_box(); | ||||||
|     photo_clipboard.apply_check(document.getElementById("clipboard_checkbox")); |     photo_clipboard.apply_check(document.getElementById("clipboard_checkbox")); | ||||||
|  |     photo_clipboard.register_hotkeys(); | ||||||
| } | } | ||||||
| document.addEventListener("DOMContentLoaded", on_pageload); | document.addEventListener("DOMContentLoaded", on_pageload); | ||||||
| </script> | </script> | ||||||
|  |  | ||||||
|  | @ -713,5 +713,11 @@ input_forbids.addEventListener("keyup", tag_input_hook_forbids); | ||||||
| common.bind_box_to_button(input_forbids, search_go_button, true); | common.bind_box_to_button(input_forbids, search_go_button, true); | ||||||
| 
 | 
 | ||||||
| common.bind_box_to_button(input_expression, search_go_button); | common.bind_box_to_button(input_expression, search_go_button); | ||||||
|  | 
 | ||||||
|  | function on_pageload() | ||||||
|  | { | ||||||
|  |     photo_clipboard.register_hotkeys(); | ||||||
|  | } | ||||||
|  | document.addEventListener("DOMContentLoaded", on_pageload); | ||||||
| </script> | </script> | ||||||
| </html> | </html> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue