Diff
Not logged in

Differences From Artifact [135c254c4e]:

To Artifact [c7833314c4]:


800
801
802
803
804
805
806
807
808
809
810
811

812
813
814
815
816
817
818
800
801
802
803
804
805
806





807
808
809
810
811
812
813
814







-
-
-
-
-
+







    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.
** ### 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
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 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(){
895
896
897
898
899
900
901
902
903
904
905
906
907







908
909
910
911
912
913
914
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 };
          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
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: break;
        case kTICK: break;
        case kUNTK: break;
        case kCPYH: break;
        case kCPYB: break;
        case kTMLN: break;
        case kTMLB: break;
        case kVIEW: 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
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?m&c=' + hh;
                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;