@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add keyboard shortcuts to Pholio

Summary: Fixes T2657. Adds j/k for previous/next image. This is consistent with Differential. We could add left/right later but it needs a little work to make those available.

Test Plan: Mashed j/k, saw images switch.

Reviewers: chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T2657

Differential Revision: https://secure.phabricator.com/D5220

+38 -3
+2 -1
src/__celerity_resource_map__.php
··· 1891 1891 ), 1892 1892 'javelin-behavior-pholio-mock-view' => 1893 1893 array( 1894 - 'uri' => '/res/c2586731/rsrc/js/application/pholio/behavior-pholio-mock-view.js', 1894 + 'uri' => '/res/d993bd2b/rsrc/js/application/pholio/behavior-pholio-mock-view.js', 1895 1895 'type' => 'js', 1896 1896 'requires' => 1897 1897 array( ··· 1902 1902 4 => 'javelin-vector', 1903 1903 5 => 'javelin-magical-init', 1904 1904 6 => 'javelin-request', 1905 + 7 => 'phabricator-keyboard-shortcut', 1905 1906 ), 1906 1907 'disk' => '/rsrc/js/application/pholio/behavior-pholio-mock-view.js', 1907 1908 ),
+36 -2
webroot/rsrc/js/application/pholio/behavior-pholio-mock-view.js
··· 7 7 * javelin-vector 8 8 * javelin-magical-init 9 9 * javelin-request 10 + * phabricator-keyboard-shortcut 10 11 */ 11 12 JX.behavior('pholio-mock-view', function(config) { 12 13 var is_dragging = false; ··· 73 74 }; 74 75 })(); 75 76 76 - function get_image(id) { 77 + function get_image_index(id) { 77 78 for (var ii = 0; ii < config.images.length; ii++) { 78 79 if (config.images[ii].id == id) { 79 - return config.images[ii]; 80 + return ii; 80 81 } 81 82 } 82 83 return null; 83 84 } 84 85 86 + function get_image(id) { 87 + var idx = get_image_index(id); 88 + if (idx === null) { 89 + return idx; 90 + } 91 + return config.images[idx]; 92 + } 93 + 85 94 function onload_image(id) { 86 95 if (active_image.id != id) { 87 96 // The user has clicked another image before this one loaded, so just ··· 91 100 92 101 active_image.tag = this; 93 102 redraw_image(); 103 + } 104 + 105 + function switch_image(delta) { 106 + if (!active_image) { 107 + return; 108 + } 109 + var idx = get_image_index(active_image.id) 110 + JX.log(idx); 111 + idx = (idx + delta + config.images.length) % config.images.length; 112 + select_image(config.images[idx].id); 94 113 } 95 114 96 115 function redraw_image() { ··· 553 572 JX.Stratcom.listen('resize', null, redraw_image); 554 573 redraw_image(); 555 574 575 + 576 + /* -( Keyboard Shortcuts )------------------------------------------------ */ 577 + 578 + 579 + new JX.KeyboardShortcut('j', 'Show next image.') 580 + .setHandler(function() { 581 + switch_image(1); 582 + }) 583 + .register(); 584 + 585 + new JX.KeyboardShortcut('k', 'Show previous image.') 586 + .setHandler(function() { 587 + switch_image(-1); 588 + }) 589 + .register(); 556 590 });