Fossil

Check-in [3ae1390f17]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Also fix URLs for non-filtered /timeline links opened from /finfo pages, plus some code and comment cleanups.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | timeline-keyboard-navigation
Files: files | file ages | folders
SHA3-256: 3ae1390f1792683122cd605ec5328fadfca076138114a6cc67ee2631d7ad1d48
User & Date: florian 2022-08-05 06:39:00.000
Context
2022-08-07
08:09
Shortcut SHIFT+H to scroll to the focused entry without moving focus. This may be handy in conjunction with scrolling by arrow keys or PgUp/Dn. ... (check-in: 8d1edb8206 user: florian tags: timeline-keyboard-navigation)
2022-08-05
06:39
Also fix URLs for non-filtered /timeline links opened from /finfo pages, plus some code and comment cleanups. ... (check-in: 3ae1390f17 user: florian tags: timeline-keyboard-navigation)
06:22
Shortcut SHIFT+J to view the timeline of the focused entry filtered by branch. Add the 'm' query parameter to /timeline links. ... (check-in: 7bbd1b9918 user: florian tags: timeline-keyboard-navigation)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/graph.js.
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
    TimelineGraph(tx);
  }
}());

/*
** Timeline keyboard navigation shortcuts:
**
** N - Select next (newer) entry.
** M - Select previous (older) entry.
** J - View timeline of selected entry.
** K - View details of selected entry.
** ESC - Disable keyboard navigation mode.
**
** When navigating to a page with a timeline display, such as /timeline, /info,
** or /finfo, keyboard navigation mode needs to be "activated" first, i.e. if no
** timeline entry is focused yet, pressing any of the listed keys (except ESC)
** sets the visual focus indicator to the highlighted or current (check-out)
** entry if available, or to the topmost entry otherwise. A session cookie[0] is
** used to direct pages loaded in the future to enable keyboard navigation mode







<
<
<
<
|







800
801
802
803
804
805
806




807
808
809
810
811
812
813
814
    TimelineGraph(tx);
  }
}());

/*
** Timeline keyboard navigation shortcuts:
**




** ### NOTE: The keyboard shortcuts are listed in /timeline help text. ###
**
** When navigating to a page with a timeline display, such as /timeline, /info,
** or /finfo, keyboard navigation mode needs to be "activated" first, i.e. if no
** timeline entry is focused yet, pressing any of the listed keys (except ESC)
** sets the visual focus indicator to the highlighted or current (check-out)
** entry if available, or to the topmost entry otherwise. A session cookie[0] is
** used to direct pages loaded in the future to enable keyboard navigation mode
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
**
**  o kTMLN: ensure the correct page is opened when used from /finfo (it seems
**    the tooltip also gets this "wrong", but maybe that's acceptable, because
**    in order to be able to construct /file URLs, the information provided by
**    the timeline-data-N blocks would have to be extended).
**  o kFRST, kLAST: check if the previous/next page should be opened if focus is
**    already at the top/bottom.
**  o Tweak the focus indicator background color and opacity to be suitable for
**    the light-background skins, and override it for the dark-background skins
**    (Ardoise, Dark Mode, Eagle, Xekri).
**  o Improve scrolling the focused element into view for browsers without the
**    Element.scrollIntoViewIfNeeded() function, maybe with a Polyfill, or
**    something similar to the scrollToSelected() function in this source file.
*/
(function(){
  window.addEventListener('load',function(){
    function focusDefaultId(){







<
<
<







836
837
838
839
840
841
842



843
844
845
846
847
848
849
**
**  o kTMLN: ensure the correct page is opened when used from /finfo (it seems
**    the tooltip also gets this "wrong", but maybe that's acceptable, because
**    in order to be able to construct /file URLs, the information provided by
**    the timeline-data-N blocks would have to be extended).
**  o kFRST, kLAST: check if the previous/next page should be opened if focus is
**    already at the top/bottom.



**  o Improve scrolling the focused element into view for browsers without the
**    Element.scrollIntoViewIfNeeded() function, maybe with a Polyfill, or
**    something similar to the scrollToSelected() function in this source file.
*/
(function(){
  window.addEventListener('load',function(){
    function focusDefaultId(){
895
896
897
898
899
900
901
902
903
904
905
906
907

908
909
910
911
912
913
914
      var tb = document.getElementById('timeline-data-' + i);
      return tb ? JSON.parse(tb.textContent || tb.innerText) : null;
    }
    function timelineGetRowInfo(id){
      var ti;
      for(var i=0; ti=timelineGetDataBlock(i); i++){
        for( var k=0; k<ti.rowinfo.length; k++ ){
        if( id=='m' + ti.rowinfo[k].id ) return {
          'baseurl': ti.baseUrl,
          'filediff': ti.fileDiff,
          'hashdigits': ti.hashDigits,
          'hash': ti.rowinfo[k].h,
          'branch': ti.rowinfo[k].br };

        }
      }
      return null;
    }
    function focusScrollToIntoViewTheFossilWay(e){
      var y = 0;
      do{







|
|
|
|
|
|
>







888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
      var tb = document.getElementById('timeline-data-' + i);
      return tb ? JSON.parse(tb.textContent || tb.innerText) : null;
    }
    function timelineGetRowInfo(id){
      var ti;
      for(var i=0; ti=timelineGetDataBlock(i); i++){
        for( var k=0; k<ti.rowinfo.length; k++ ){
          if( id=='m' + ti.rowinfo[k].id ) return {
            'baseurl': ti.baseUrl,
            'filediff': ti.fileDiff,
            'hashdigits': ti.hashDigits,
            'hash': ti.rowinfo[k].h,
            'branch': ti.rowinfo[k].br
          };
        }
      }
      return null;
    }
    function focusScrollToIntoViewTheFossilWay(e){
      var y = 0;
      do{
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
        key = ( evt.which || evt.keyCode ) | mod;
      var dx = 0;
      switch( key ){
        case kFRST: dx = -2; break;
        case kNEXT: dx = -1; break;
        case kPREV: dx = +1; break;
        case kLAST: dx = +2; break;
        case kCYCL: break;
        case kTICK: break;
        case kUNTK: break;
        case kCPYH: break;
        case kCPYB: break;
        case kTMLN: break;
        case kTMLB: break;
        case kVIEW: break;
        case kDONE: break;
        default: return;
      }
      if( key==kUNTK ){
        var tid = focusTickedId();
        if( tid ){
          var gn = document.getElementById('tln'+tid.slice(1));







|
|
|
|
|
|
|
|







970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
        key = ( evt.which || evt.keyCode ) | mod;
      var dx = 0;
      switch( key ){
        case kFRST: dx = -2; break;
        case kNEXT: dx = -1; break;
        case kPREV: dx = +1; break;
        case kLAST: dx = +2; break;
        case kCYCL:
        case kTICK:
        case kUNTK:
        case kCPYH:
        case kCPYB:
        case kTMLN:
        case kTMLB:
        case kVIEW:
        case kDONE: break;
        default: return;
      }
      if( key==kUNTK ){
        var tid = focusTickedId();
        if( tid ){
          var gn = document.getElementById('tln'+tid.slice(1));
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
          var ri = timelineGetRowInfo(id);
          if( ri ){
            var hh = encodeURIComponent(ri.hash.slice(0,ri.hashdigits));
            var br = encodeURIComponent(ri.branch);
            var page;
            switch( key ){
              case kTMLN:
                page = '/timeline?m&c=' + hh;
                break;
              case kTMLB:
                page = '/timeline?r=' + br +
                  ( ri.filediff ? '&m&cf=' : '&m&c=' ) + hh;
                break;
              case kVIEW:
                page = '/info/' + hh;







|







1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
          var ri = timelineGetRowInfo(id);
          if( ri ){
            var hh = encodeURIComponent(ri.hash.slice(0,ri.hashdigits));
            var br = encodeURIComponent(ri.branch);
            var page;
            switch( key ){
              case kTMLN:
                page = '/timeline' + ( ri.filediff ? '?m&cf=' : '?m&c=' ) + hh;
                break;
              case kTMLB:
                page = '/timeline?r=' + br +
                  ( ri.filediff ? '&m&cf=' : '&m&c=' ) + hh;
                break;
              case kVIEW:
                page = '/info/' + hh;