Fossil

Check-in [57baac30d6]
Login

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

Overview
Comment:Don't use magic numbers, and also improve readability for adjacent lines.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | timeline-keyboard-navigation
Files: files | file ages | folders
SHA3-256: 57baac30d679d436d27b8eaefc6a73fa87d99545e732c368be19e63550400197
User & Date: florian 2022-07-29 11:37:00.000
Context
2022-07-31
07:58
Replace the tooltip 'unload' handler with 'pageshow' and 'pagehide' handlers so that restoring the focused entry on back/forward navigation also works with FF. ... (check-in: 5e545a9f07 user: florian tags: timeline-keyboard-navigation)
2022-07-29
11:37
Don't use magic numbers, and also improve readability for adjacent lines. ... (check-in: 57baac30d6 user: florian tags: timeline-keyboard-navigation)
10:27
Drop a redundant check. ... (check-in: d145d92d14 user: florian tags: timeline-keyboard-navigation)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/graph.js.
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
    function focusRowinfoFromId(id){
      for(var i=0; true; i++){
        var td = document.getElementById('timeline-data-' + i);
        if( !td ) break;
        var ti = JSON.parse(td.textContent || td.innerText);
        for( var k=0; k<ti.rowinfo.length; k++ ){
          if( id=='m' + ti.rowinfo[k].id ) return {
            'b': ti.baseUrl, 'h': ti.rowinfo[k].h
          };
        }
      }
      return null;
    }
    function focusVisualize(id,scroll){
      var td = document.querySelector('.timelineFocused');







|







856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
    function focusRowinfoFromId(id){
      for(var i=0; true; i++){
        var td = document.getElementById('timeline-data-' + i);
        if( !td ) break;
        var ti = JSON.parse(td.textContent || td.innerText);
        for( var k=0; k<ti.rowinfo.length; k++ ){
          if( id=='m' + ti.rowinfo[k].id ) return {
            'baseurl': ti.baseUrl, 'hash': ti.rowinfo[k].h
          };
        }
      }
      return null;
    }
    function focusVisualize(id,scroll){
      var td = document.querySelector('.timelineFocused');
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
        return;
      }
      document.cookie = 'fossil_timeline_kbnav=1;path=/';
      var id = kf.value;
      if( id && dx==0 ){
        var ri = focusRowinfoFromId(id);
        if( ri ){
          var page = ( key==75/*K*/ ) ? '/info/' : '/timeline?c=';
          var href = ri.b + page + ri.h;
          if( href!=location.href.slice(-href.length) ){
            location.href = href;
            return;
          }
        }
      }
      else if ( id && dx!=0 ){







|
|







916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
        return;
      }
      document.cookie = 'fossil_timeline_kbnav=1;path=/';
      var id = kf.value;
      if( id && dx==0 ){
        var ri = focusRowinfoFromId(id);
        if( ri ){
          var page = key==kVIEW ? '/info/' : '/timeline?c=';
          var href = ri.baseurl + page + ri.hash;
          if( href!=location.href.slice(-href.length) ){
            location.href = href;
            return;
          }
        }
      }
      else if ( id && dx!=0 ){