Fossil SCM

Coding style fixes and comment updates.

florian 2022-08-07 08:12 timeline-keyboard-navigation
Commit ae932acdd23980124ca6d892cd126d7c6dde7febd664b5d13904bdfaa09844bc
1 file changed +8 -15
+8 -15
--- src/graph.js
+++ src/graph.js
@@ -802,11 +802,11 @@
802802
}());
803803
804804
/*
805805
** Timeline keyboard navigation shortcuts:
806806
**
807
-** ### NOTE: The keyboard shortcuts are listed in /timeline help text. ###
807
+** ### NOTE: The keyboard shortcuts are listed in the /timeline help screen. ###
808808
**
809809
** When navigating to a page with a timeline display, such as /timeline, /info,
810810
** or /finfo, keyboard navigation mode needs to be "activated" first, i.e. if no
811811
** timeline entry is focused yet, pressing any of the listed keys (except ESC)
812812
** sets the visual focus indicator to the highlighted or current (check-out)
@@ -813,11 +813,11 @@
813813
** entry if available, or to the topmost entry otherwise. A session cookie[0] is
814814
** used to direct pages loaded in the future to enable keyboard navigation mode
815815
** and automatically set the focus indicator to the highlighted, current, or
816816
** topmost entry. Pressing N and M on the /timeline page while the topmost or
817817
** bottommost entry is focused loads the next or previous page if available,
818
-** similar to the [↑ More] and [↓ More] links. Pressing L disables keyboard
818
+** similar to the [↑ More] and [↓ More] links. Pressing ESC disables keyboard
819819
** navigation, i.e. removes the focus indicator and deletes the session cookie.
820820
** When navigating backwards or forwards in browser history, the focused entry
821821
** is restored using a hidden[1] input field.
822822
**
823823
** [0]: The lifetime and values of cookies can be tracked on the /cookies page.
@@ -838,13 +838,10 @@
838838
** the tooltip also gets this "wrong", but maybe that's acceptable, because
839839
** in order to be able to construct /file URLs, the information provided by
840840
** the timeline-data-N blocks would have to be extended).
841841
** o kFRST, kLAST: check if the previous/next page should be opened if focus is
842842
** 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.
846843
*/
847844
(function(){
848845
window.addEventListener('load',function(){
849846
function focusDefaultId(){
850847
var tn = document.querySelector(
@@ -892,20 +889,20 @@
892889
var ti;
893890
for(var i=0; ti=timelineGetDataBlock(i); i++){
894891
for( var k=0; k<ti.rowinfo.length; k++ ){
895892
if( id=='m' + ti.rowinfo[k].id ) return {
896893
'baseurl': ti.baseUrl,
897
- 'filediff': ti.fileDiff,
894
+ 'filehash': ti.fileDiff,
898895
'hashdigits': ti.hashDigits,
899896
'hash': ti.rowinfo[k].h,
900897
'branch': ti.rowinfo[k].br
901898
};
902899
}
903900
}
904901
return null;
905902
}
906
- function focusScrollToIntoViewTheFossilWay(e){
903
+ function fossilScrollIntoView(e){
907904
var y = 0;
908905
do{
909906
y += e.offsetTop;
910907
}while( e = e.offsetParent );
911908
window.scrollTo(0,y-window.innerHeight/2);
@@ -917,15 +914,11 @@
917914
var tn = document.getElementById(id);
918915
if( tn ){
919916
td = tn.parentElement.nextElementSibling;
920917
if( td ) {
921918
td.classList.add('timelineFocused');
922
- if( scroll ){
923
- focusScrollToIntoViewTheFossilWay(td);
924
- //if( td.scrollIntoViewIfNeeded ) td.scrollIntoViewIfNeeded();
925
- //else td.scrollIntoView(false);
926
- }
919
+ if( scroll ) fossilScrollIntoView(td);
927920
return true;
928921
}
929922
}
930923
return false;
931924
}
@@ -987,11 +980,11 @@
987980
case kDONE: break;
988981
default: return;
989982
}
990983
if( key==kSCRL ){
991984
var td = document.querySelector('.timelineFocused');
992
- if( td ) focusScrollToIntoViewTheFossilWay(td);
985
+ if( td ) fossilScrollIntoView(td);
993986
return;
994987
}
995988
else if( key==kUNTK ){
996989
var tid = focusTickedId();
997990
if( tid ){
@@ -1042,15 +1035,15 @@
10421035
var hh = encodeURIComponent(ri.hash.slice(0,ri.hashdigits));
10431036
var br = encodeURIComponent(ri.branch);
10441037
var page;
10451038
switch( key ){
10461039
case kTMLN:
1047
- page = '/timeline' + ( ri.filediff ? '?m&cf=' : '?m&c=' ) + hh;
1040
+ page = '/timeline' + ( ri.filehash ? '?m&cf=' : '?m&c=' ) + hh;
10481041
break;
10491042
case kTMLB:
10501043
page = '/timeline?r=' + br +
1051
- ( ri.filediff ? '&m&cf=' : '&m&c=' ) + hh;
1044
+ ( ri.filehash ? '&m&cf=' : '&m&c=' ) + hh;
10521045
break;
10531046
case kVIEW:
10541047
page = '/info/' + hh;
10551048
break;
10561049
}
10571050
--- src/graph.js
+++ src/graph.js
@@ -802,11 +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)
@@ -813,11 +813,11 @@
813 ** entry if available, or to the topmost entry otherwise. A session cookie[0] is
814 ** used to direct pages loaded in the future to enable keyboard navigation mode
815 ** and automatically set the focus indicator to the highlighted, current, or
816 ** topmost entry. Pressing N and M on the /timeline page while the topmost or
817 ** bottommost entry is focused loads the next or previous page if available,
818 ** similar to the [↑ More] and [↓ More] links. Pressing L disables keyboard
819 ** navigation, i.e. removes the focus indicator and deletes the session cookie.
820 ** When navigating backwards or forwards in browser history, the focused entry
821 ** is restored using a hidden[1] input field.
822 **
823 ** [0]: The lifetime and values of cookies can be tracked on the /cookies page.
@@ -838,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(){
848 window.addEventListener('load',function(){
849 function focusDefaultId(){
850 var tn = document.querySelector(
@@ -892,20 +889,20 @@
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){
907 var y = 0;
908 do{
909 y += e.offsetTop;
910 }while( e = e.offsetParent );
911 window.scrollTo(0,y-window.innerHeight/2);
@@ -917,15 +914,11 @@
917 var tn = document.getElementById(id);
918 if( tn ){
919 td = tn.parentElement.nextElementSibling;
920 if( td ) {
921 td.classList.add('timelineFocused');
922 if( scroll ){
923 focusScrollToIntoViewTheFossilWay(td);
924 //if( td.scrollIntoViewIfNeeded ) td.scrollIntoViewIfNeeded();
925 //else td.scrollIntoView(false);
926 }
927 return true;
928 }
929 }
930 return false;
931 }
@@ -987,11 +980,11 @@
987 case kDONE: break;
988 default: return;
989 }
990 if( key==kSCRL ){
991 var td = document.querySelector('.timelineFocused');
992 if( td ) focusScrollToIntoViewTheFossilWay(td);
993 return;
994 }
995 else if( key==kUNTK ){
996 var tid = focusTickedId();
997 if( tid ){
@@ -1042,15 +1035,15 @@
1042 var hh = encodeURIComponent(ri.hash.slice(0,ri.hashdigits));
1043 var br = encodeURIComponent(ri.branch);
1044 var page;
1045 switch( key ){
1046 case kTMLN:
1047 page = '/timeline' + ( ri.filediff ? '?m&cf=' : '?m&c=' ) + hh;
1048 break;
1049 case kTMLB:
1050 page = '/timeline?r=' + br +
1051 ( ri.filediff ? '&m&cf=' : '&m&c=' ) + hh;
1052 break;
1053 case kVIEW:
1054 page = '/info/' + hh;
1055 break;
1056 }
1057
--- src/graph.js
+++ src/graph.js
@@ -802,11 +802,11 @@
802 }());
803
804 /*
805 ** Timeline keyboard navigation shortcuts:
806 **
807 ** ### NOTE: The keyboard shortcuts are listed in the /timeline help screen. ###
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)
@@ -813,11 +813,11 @@
813 ** entry if available, or to the topmost entry otherwise. A session cookie[0] is
814 ** used to direct pages loaded in the future to enable keyboard navigation mode
815 ** and automatically set the focus indicator to the highlighted, current, or
816 ** topmost entry. Pressing N and M on the /timeline page while the topmost or
817 ** bottommost entry is focused loads the next or previous page if available,
818 ** similar to the [↑ More] and [↓ More] links. Pressing ESC disables keyboard
819 ** navigation, i.e. removes the focus indicator and deletes the session cookie.
820 ** When navigating backwards or forwards in browser history, the focused entry
821 ** is restored using a hidden[1] input field.
822 **
823 ** [0]: The lifetime and values of cookies can be tracked on the /cookies page.
@@ -838,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 */
844 (function(){
845 window.addEventListener('load',function(){
846 function focusDefaultId(){
847 var tn = document.querySelector(
@@ -892,20 +889,20 @@
889 var ti;
890 for(var i=0; ti=timelineGetDataBlock(i); i++){
891 for( var k=0; k<ti.rowinfo.length; k++ ){
892 if( id=='m' + ti.rowinfo[k].id ) return {
893 'baseurl': ti.baseUrl,
894 'filehash': ti.fileDiff,
895 'hashdigits': ti.hashDigits,
896 'hash': ti.rowinfo[k].h,
897 'branch': ti.rowinfo[k].br
898 };
899 }
900 }
901 return null;
902 }
903 function fossilScrollIntoView(e){
904 var y = 0;
905 do{
906 y += e.offsetTop;
907 }while( e = e.offsetParent );
908 window.scrollTo(0,y-window.innerHeight/2);
@@ -917,15 +914,11 @@
914 var tn = document.getElementById(id);
915 if( tn ){
916 td = tn.parentElement.nextElementSibling;
917 if( td ) {
918 td.classList.add('timelineFocused');
919 if( scroll ) fossilScrollIntoView(td);
 
 
 
 
920 return true;
921 }
922 }
923 return false;
924 }
@@ -987,11 +980,11 @@
980 case kDONE: break;
981 default: return;
982 }
983 if( key==kSCRL ){
984 var td = document.querySelector('.timelineFocused');
985 if( td ) fossilScrollIntoView(td);
986 return;
987 }
988 else if( key==kUNTK ){
989 var tid = focusTickedId();
990 if( tid ){
@@ -1042,15 +1035,15 @@
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.filehash ? '?m&cf=' : '?m&c=' ) + hh;
1041 break;
1042 case kTMLB:
1043 page = '/timeline?r=' + br +
1044 ( ri.filehash ? '&m&cf=' : '&m&c=' ) + hh;
1045 break;
1046 case kVIEW:
1047 page = '/info/' + hh;
1048 break;
1049 }
1050

Keyboard Shortcuts

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