Fossil

Check-in [cf38f5abb8]
Login

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

Overview
Comment:Refactorings to cookie handling.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | timeline-keyboard-navigation
Files: files | file ages | folders
SHA3-256: cf38f5abb8475e299b51ddccd867dfbdaa069d156b4afddcbcdb08625af1e263
User & Date: florian 2022-08-11 05:48:00.000
Context
2022-08-11
05:57
Shortcut "." (period) to set focus to the entry closest to the center of the viewport. (The keys need to be reassigned later, since non-letter keys don't produce the same characters with or without SHIFT pressed on all keyboard layouts.) Thanks @rouilj for the suggestion and the hint! ... (check-in: e1796f2df2 user: florian tags: timeline-keyboard-navigation)
05:48
Refactorings to cookie handling. ... (check-in: cf38f5abb8 user: florian tags: timeline-keyboard-navigation)
2022-08-07
08:12
Coding style fixes and comment updates. ... (check-in: ae932acdd2 user: florian tags: timeline-keyboard-navigation)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/graph.js.
937
938
939
940
941
942
943










944
945
946
947
948
949
950
      var e = document.getElementById('timeline-kbfocus');
      return e ? e.value : null;
    }
    function focusCacheSet(v){
      var e = document.getElementById('timeline-kbfocus');
      if( e ) e.value = v;
    }










    focusCacheInit();
    document.addEventListener('keydown',function(evt){
      if( evt.target.tagName=='INPUT' ) return;
      var
        mSHIFT = 1<<13,
        kFRST = mSHIFT | 78 /* SHIFT+N */,
        kNEXT = 78 /* N */,







>
>
>
>
>
>
>
>
>
>







937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
      var e = document.getElementById('timeline-kbfocus');
      return e ? e.value : null;
    }
    function focusCacheSet(v){
      var e = document.getElementById('timeline-kbfocus');
      if( e ) e.value = v;
    }
    function focusCookieInit(){
      document.cookie = 'fossil_timeline_kbnav=1;path=/';
    }
    function focusCookieClear(){
      document.cookie =
        'fossil_timeline_kbnav=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';
    }
    function focusCookieQuery(){
      return document.cookie.match(/fossil_timeline_kbnav=1/);
    }
    focusCacheInit();
    document.addEventListener('keydown',function(evt){
      if( evt.target.tagName=='INPUT' ) return;
      var
        mSHIFT = 1<<13,
        kFRST = mSHIFT | 78 /* SHIFT+N */,
        kNEXT = 78 /* N */,
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014

1015
1016
1017
1018
1019
1020
1021
          }
        }
        return;
      }
      else if( key==kDONE ){
        focusCacheSet(null);
        focusVisualize(null,false);
        document.cookie =
          'fossil_timeline_kbnav=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';
        return;
      }
      document.cookie = 'fossil_timeline_kbnav=1;path=/';

      var id = focusCacheGet();
      if( id && dx==0 ){
        if( key==kCYCL ){
          var sel = focusSelectedId();
          var sl2 = focus2ndSelectedId();
          var cur = focusCurrentId();
          var tik = focusTickedId();







|
<


<
>







1013
1014
1015
1016
1017
1018
1019
1020

1021
1022

1023
1024
1025
1026
1027
1028
1029
1030
          }
        }
        return;
      }
      else if( key==kDONE ){
        focusCacheSet(null);
        focusVisualize(null,false);
        focusCookieClear();

        return;
      }

      focusCookieInit();
      var id = focusCacheGet();
      if( id && dx==0 ){
        if( key==kCYCL ){
          var sel = focusSelectedId();
          var sl2 = focus2ndSelectedId();
          var cur = focusCurrentId();
          var tik = focusTickedId();
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
      else if ( !id ) id = focusDefaultId();
      focusCacheSet(id);
      focusVisualize(id,true);
    }/*,true*/);
    window.addEventListener('pageshow',function(evt){
      var id = focusCacheGet();
      if( !id || !focusVisualize(id,false) ){
        if( document.cookie.match(/fossil_timeline_kbnav=1/) ){
          id = focusDefaultId();
          focusCacheSet(id);
          focusVisualize(id,false);
        }
      }
    },false);
  },false);
}());







|








1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
      else if ( !id ) id = focusDefaultId();
      focusCacheSet(id);
      focusVisualize(id,true);
    }/*,true*/);
    window.addEventListener('pageshow',function(evt){
      var id = focusCacheGet();
      if( !id || !focusVisualize(id,false) ){
        if( focusCookieQuery() ){
          id = focusDefaultId();
          focusCacheSet(id);
          focusVisualize(id,false);
        }
      }
    },false);
  },false);
}());