Fossil SCM

Also fix URLs for non-filtered /timeline links opened from /finfo pages, plus some code and comment cleanups.

florian 2022-08-05 06:38 timeline-keyboard-navigation
Commit 3ae1390f1792683122cd605ec5328fadfca076138114a6cc67ee2631d7ad1d48
1 file changed +17 -23
+17 -23
--- src/graph.js
+++ src/graph.js
@@ -802,15 +802,11 @@
802802
}());
803803
804804
/*
805805
** Timeline keyboard navigation shortcuts:
806806
**
807
-** N - Select next (newer) entry.
808
-** M - Select previous (older) entry.
809
-** J - View timeline of selected entry.
810
-** K - View details of selected entry.
811
-** ESC - Disable keyboard navigation mode.
807
+** ### NOTE: The keyboard shortcuts are listed in /timeline help text. ###
812808
**
813809
** When navigating to a page with a timeline display, such as /timeline, /info,
814810
** or /finfo, keyboard navigation mode needs to be "activated" first, i.e. if no
815811
** timeline entry is focused yet, pressing any of the listed keys (except ESC)
816812
** sets the visual focus indicator to the highlighted or current (check-out)
@@ -842,13 +838,10 @@
842838
** the tooltip also gets this "wrong", but maybe that's acceptable, because
843839
** in order to be able to construct /file URLs, the information provided by
844840
** the timeline-data-N blocks would have to be extended).
845841
** o kFRST, kLAST: check if the previous/next page should be opened if focus is
846842
** already at the top/bottom.
847
-** o Tweak the focus indicator background color and opacity to be suitable for
848
-** the light-background skins, and override it for the dark-background skins
849
-** (Ardoise, Dark Mode, Eagle, Xekri).
850843
** o Improve scrolling the focused element into view for browsers without the
851844
** Element.scrollIntoViewIfNeeded() function, maybe with a Polyfill, or
852845
** something similar to the scrollToSelected() function in this source file.
853846
*/
854847
(function(){
@@ -897,16 +890,17 @@
897890
}
898891
function timelineGetRowInfo(id){
899892
var ti;
900893
for(var i=0; ti=timelineGetDataBlock(i); i++){
901894
for( var k=0; k<ti.rowinfo.length; k++ ){
902
- if( id=='m' + ti.rowinfo[k].id ) return {
903
- 'baseurl': ti.baseUrl,
904
- 'filediff': ti.fileDiff,
905
- 'hashdigits': ti.hashDigits,
906
- 'hash': ti.rowinfo[k].h,
907
- 'branch': ti.rowinfo[k].br };
895
+ if( id=='m' + ti.rowinfo[k].id ) return {
896
+ 'baseurl': ti.baseUrl,
897
+ 'filediff': ti.fileDiff,
898
+ 'hashdigits': ti.hashDigits,
899
+ 'hash': ti.rowinfo[k].h,
900
+ 'branch': ti.rowinfo[k].br
901
+ };
908902
}
909903
}
910904
return null;
911905
}
912906
function focusScrollToIntoViewTheFossilWay(e){
@@ -978,18 +972,18 @@
978972
switch( key ){
979973
case kFRST: dx = -2; break;
980974
case kNEXT: dx = -1; break;
981975
case kPREV: dx = +1; break;
982976
case kLAST: dx = +2; break;
983
- case kCYCL: break;
984
- case kTICK: break;
985
- case kUNTK: break;
986
- case kCPYH: break;
987
- case kCPYB: break;
988
- case kTMLN: break;
989
- case kTMLB: break;
990
- case kVIEW: break;
977
+ case kCYCL:
978
+ case kTICK:
979
+ case kUNTK:
980
+ case kCPYH:
981
+ case kCPYB:
982
+ case kTMLN:
983
+ case kTMLB:
984
+ case kVIEW:
991985
case kDONE: break;
992986
default: return;
993987
}
994988
if( key==kUNTK ){
995989
var tid = focusTickedId();
@@ -1041,11 +1035,11 @@
10411035
var hh = encodeURIComponent(ri.hash.slice(0,ri.hashdigits));
10421036
var br = encodeURIComponent(ri.branch);
10431037
var page;
10441038
switch( key ){
10451039
case kTMLN:
1046
- page = '/timeline?m&c=' + hh;
1040
+ page = '/timeline' + ( ri.filediff ? '?m&cf=' : '?m&c=' ) + hh;
10471041
break;
10481042
case kTMLB:
10491043
page = '/timeline?r=' + br +
10501044
( ri.filediff ? '&m&cf=' : '&m&c=' ) + hh;
10511045
break;
10521046
--- src/graph.js
+++ src/graph.js
@@ -802,15 +802,11 @@
802 }());
803
804 /*
805 ** Timeline keyboard navigation shortcuts:
806 **
807 ** N - Select next (newer) entry.
808 ** M - Select previous (older) entry.
809 ** J - View timeline of selected entry.
810 ** K - View details of selected entry.
811 ** ESC - Disable keyboard navigation mode.
812 **
813 ** When navigating to a page with a timeline display, such as /timeline, /info,
814 ** or /finfo, keyboard navigation mode needs to be "activated" first, i.e. if no
815 ** timeline entry is focused yet, pressing any of the listed keys (except ESC)
816 ** sets the visual focus indicator to the highlighted or current (check-out)
@@ -842,13 +838,10 @@
842 ** the tooltip also gets this "wrong", but maybe that's acceptable, because
843 ** in order to be able to construct /file URLs, the information provided by
844 ** the timeline-data-N blocks would have to be extended).
845 ** o kFRST, kLAST: check if the previous/next page should be opened if focus is
846 ** already at the top/bottom.
847 ** o Tweak the focus indicator background color and opacity to be suitable for
848 ** the light-background skins, and override it for the dark-background skins
849 ** (Ardoise, Dark Mode, Eagle, Xekri).
850 ** o Improve scrolling the focused element into view for browsers without the
851 ** Element.scrollIntoViewIfNeeded() function, maybe with a Polyfill, or
852 ** something similar to the scrollToSelected() function in this source file.
853 */
854 (function(){
@@ -897,16 +890,17 @@
897 }
898 function timelineGetRowInfo(id){
899 var ti;
900 for(var i=0; ti=timelineGetDataBlock(i); i++){
901 for( var k=0; k<ti.rowinfo.length; k++ ){
902 if( id=='m' + ti.rowinfo[k].id ) return {
903 'baseurl': ti.baseUrl,
904 'filediff': ti.fileDiff,
905 'hashdigits': ti.hashDigits,
906 'hash': ti.rowinfo[k].h,
907 'branch': ti.rowinfo[k].br };
 
908 }
909 }
910 return null;
911 }
912 function focusScrollToIntoViewTheFossilWay(e){
@@ -978,18 +972,18 @@
978 switch( key ){
979 case kFRST: dx = -2; break;
980 case kNEXT: dx = -1; break;
981 case kPREV: dx = +1; break;
982 case kLAST: dx = +2; break;
983 case kCYCL: break;
984 case kTICK: break;
985 case kUNTK: break;
986 case kCPYH: break;
987 case kCPYB: break;
988 case kTMLN: break;
989 case kTMLB: break;
990 case kVIEW: break;
991 case kDONE: break;
992 default: return;
993 }
994 if( key==kUNTK ){
995 var tid = focusTickedId();
@@ -1041,11 +1035,11 @@
1041 var hh = encodeURIComponent(ri.hash.slice(0,ri.hashdigits));
1042 var br = encodeURIComponent(ri.branch);
1043 var page;
1044 switch( key ){
1045 case kTMLN:
1046 page = '/timeline?m&c=' + hh;
1047 break;
1048 case kTMLB:
1049 page = '/timeline?r=' + br +
1050 ( ri.filediff ? '&m&cf=' : '&m&c=' ) + hh;
1051 break;
1052
--- src/graph.js
+++ src/graph.js
@@ -802,15 +802,11 @@
802 }());
803
804 /*
805 ** Timeline keyboard navigation shortcuts:
806 **
807 ** ### NOTE: The keyboard shortcuts are listed in /timeline help text. ###
 
 
 
 
808 **
809 ** When navigating to a page with a timeline display, such as /timeline, /info,
810 ** or /finfo, keyboard navigation mode needs to be "activated" first, i.e. if no
811 ** timeline entry is focused yet, pressing any of the listed keys (except ESC)
812 ** sets the visual focus indicator to the highlighted or current (check-out)
@@ -842,13 +838,10 @@
838 ** the tooltip also gets this "wrong", but maybe that's acceptable, because
839 ** in order to be able to construct /file URLs, the information provided by
840 ** the timeline-data-N blocks would have to be extended).
841 ** o kFRST, kLAST: check if the previous/next page should be opened if focus is
842 ** already at the top/bottom.
 
 
 
843 ** o Improve scrolling the focused element into view for browsers without the
844 ** Element.scrollIntoViewIfNeeded() function, maybe with a Polyfill, or
845 ** something similar to the scrollToSelected() function in this source file.
846 */
847 (function(){
@@ -897,16 +890,17 @@
890 }
891 function timelineGetRowInfo(id){
892 var ti;
893 for(var i=0; ti=timelineGetDataBlock(i); i++){
894 for( var k=0; k<ti.rowinfo.length; k++ ){
895 if( id=='m' + ti.rowinfo[k].id ) return {
896 'baseurl': ti.baseUrl,
897 'filediff': ti.fileDiff,
898 'hashdigits': ti.hashDigits,
899 'hash': ti.rowinfo[k].h,
900 'branch': ti.rowinfo[k].br
901 };
902 }
903 }
904 return null;
905 }
906 function focusScrollToIntoViewTheFossilWay(e){
@@ -978,18 +972,18 @@
972 switch( key ){
973 case kFRST: dx = -2; break;
974 case kNEXT: dx = -1; break;
975 case kPREV: dx = +1; break;
976 case kLAST: dx = +2; break;
977 case kCYCL:
978 case kTICK:
979 case kUNTK:
980 case kCPYH:
981 case kCPYB:
982 case kTMLN:
983 case kTMLB:
984 case kVIEW:
985 case kDONE: break;
986 default: return;
987 }
988 if( key==kUNTK ){
989 var tid = focusTickedId();
@@ -1041,11 +1035,11 @@
1035 var hh = encodeURIComponent(ri.hash.slice(0,ri.hashdigits));
1036 var br = encodeURIComponent(ri.branch);
1037 var page;
1038 switch( key ){
1039 case kTMLN:
1040 page = '/timeline' + ( ri.filediff ? '?m&cf=' : '?m&c=' ) + hh;
1041 break;
1042 case kTMLB:
1043 page = '/timeline?r=' + br +
1044 ( ri.filediff ? '&m&cf=' : '&m&c=' ) + hh;
1045 break;
1046

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button