Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Some code readability and function naming tweaks. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | timeline-keyboard-navigation |
| Files: | files | file ages | folders |
| SHA3-256: |
89a0438f8f3bf6e9263290869526032b |
| User & Date: | florian 2022-08-01 09:21:00.000 |
Context
|
2022-08-01
| ||
| 09:30 | Update the comments about back/forward caching. ... (check-in: e62b171dbc user: florian tags: timeline-keyboard-navigation) | |
| 09:21 | Some code readability and function naming tweaks. ... (check-in: 89a0438f8f user: florian tags: timeline-keyboard-navigation) | |
|
2022-07-31
| ||
| 08:56 | Take note of a possible TODO point. ... (check-in: 4bc9aa3ca8 user: florian tags: timeline-keyboard-navigation) | |
Changes
Changes to src/graph.js.
| ︙ | ︙ | |||
850 851 852 853 854 855 856 |
document.querySelector('.timelineCurrent .tl-nodemark');
return tn ? tn.id : 'm1';
}
function focusNextId(id,dx){
var m = /^m(\d+)$/.exec(id);
return m!==null ? 'm' + (parseInt(m[1]) + dx) : null;
}
| | | | | | | | | < | 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 |
document.querySelector('.timelineCurrent .tl-nodemark');
return tn ? tn.id : 'm1';
}
function focusNextId(id,dx){
var m = /^m(\d+)$/.exec(id);
return m!==null ? 'm' + (parseInt(m[1]) + dx) : null;
}
function timelineGetDataBlock(i){
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, 'hash': ti.rowinfo[k].h };
}
}
return null;
}
function focusVisualize(id,scroll){
var td = document.querySelector('.timelineFocused');
if( td ) td.classList.remove('timelineFocused');
|
| ︙ | ︙ | |||
899 900 901 902 903 904 905 |
document.addEventListener('keydown',function(evt){
if( evt.target.tagName=='INPUT' ) return;
var
kNEXT = 78 /* N */,
kPREV = 77 /* M */,
kTMLN = 74 /* J */,
kVIEW = 75 /* K */,
| | < | > | | 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 |
document.addEventListener('keydown',function(evt){
if( evt.target.tagName=='INPUT' ) return;
var
kNEXT = 78 /* N */,
kPREV = 77 /* M */,
kTMLN = 74 /* J */,
kVIEW = 75 /* K */,
kDONE = 76 /* L */,
mod = evt.altKey<<15 | evt.ctrlKey<<14 | evt.shiftKey<<13,
key = ( evt.which || evt.keyCode ) | mod;
var dx = 0;
if( key==kPREV ) dx++;
else if( key==kNEXT ) dx--;
else if( key!=kTMLN && key!=kVIEW && key!=kDONE ) return;
var kf = document.getElementById('timeline-kbfocus');
if( key==kDONE ){
kf.value = '';
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 = kf.value;
if( id && dx==0 ){
var ri = timelineGetRowInfo(id);
if( ri ){
var page = key==kVIEW ? '/info/' : '/timeline?c=';
var href = ri.baseurl + page + encodeURIComponent(ri.hash);
if( href!=location.href.slice(-href.length) ){
location.href = href;
return;
}
|
| ︙ | ︙ |