Fossil SCM
Link keyboard and mouse navigation and enable changing keyboard focus with Ctrl+Click.
Commit
29824137be667a39ba034c8ac7cbee13d82cdb085345fd7ea993f76a398a7ed0
Parent
3c929719962bd82…
2 files changed
+23
+2
+23
| --- src/graph.js | ||
| +++ src/graph.js | ||
| @@ -1149,10 +1149,33 @@ | ||
| 1149 | 1149 | } |
| 1150 | 1150 | else if ( !id ) id = focusDefaultId(); |
| 1151 | 1151 | focusCacheSet(id); |
| 1152 | 1152 | focusVisualize(id,true); |
| 1153 | 1153 | }/*,true*/); |
| 1154 | + // NOTE: To be able to override the default CTRL+CLICK behavior (to "select" | |
| 1155 | + // the elements, indicated by an outline) for normal (non-input) elements in | |
| 1156 | + // FF it's necessary to listen to `mousedown' instead of `click' events. | |
| 1157 | + window.addEventListener('mousedown',function(evt){ | |
| 1158 | + var | |
| 1159 | + bMAIN = 0, | |
| 1160 | + mCTRL = 1<<14, | |
| 1161 | + mod = evt.altKey<<15 | evt.ctrlKey<<14 | evt.shiftKey<<13; | |
| 1162 | + if( evt.target.tagName in { 'INPUT':1, 'SELECT':1, 'A':1 } || | |
| 1163 | + evt.button!=bMAIN || mod!=mCTRL ){ | |
| 1164 | + return; | |
| 1165 | + } | |
| 1166 | + var e = evt.target; | |
| 1167 | + while( e && !/\btimeline\w+Cell\b/.test(e.className) ){ | |
| 1168 | + e = e.parentElement; | |
| 1169 | + } | |
| 1170 | + if( e && (e = e.previousElementSibling.querySelector('.tl-nodemark')) ){ | |
| 1171 | + evt.preventDefault(); | |
| 1172 | + evt.stopPropagation(); | |
| 1173 | + focusCacheSet(e.id); | |
| 1174 | + focusVisualize(e.id,false); | |
| 1175 | + } | |
| 1176 | + },false); | |
| 1154 | 1177 | window.addEventListener('pageshow',function(evt){ |
| 1155 | 1178 | var id = focusCacheGet(); |
| 1156 | 1179 | if( !id || !focusVisualize(id,false) ){ |
| 1157 | 1180 | if( focusCookieQuery() ){ |
| 1158 | 1181 | id = focusDefaultId(); |
| 1159 | 1182 |
| --- src/graph.js | |
| +++ src/graph.js | |
| @@ -1149,10 +1149,33 @@ | |
| 1149 | } |
| 1150 | else if ( !id ) id = focusDefaultId(); |
| 1151 | focusCacheSet(id); |
| 1152 | focusVisualize(id,true); |
| 1153 | }/*,true*/); |
| 1154 | window.addEventListener('pageshow',function(evt){ |
| 1155 | var id = focusCacheGet(); |
| 1156 | if( !id || !focusVisualize(id,false) ){ |
| 1157 | if( focusCookieQuery() ){ |
| 1158 | id = focusDefaultId(); |
| 1159 |
| --- src/graph.js | |
| +++ src/graph.js | |
| @@ -1149,10 +1149,33 @@ | |
| 1149 | } |
| 1150 | else if ( !id ) id = focusDefaultId(); |
| 1151 | focusCacheSet(id); |
| 1152 | focusVisualize(id,true); |
| 1153 | }/*,true*/); |
| 1154 | // NOTE: To be able to override the default CTRL+CLICK behavior (to "select" |
| 1155 | // the elements, indicated by an outline) for normal (non-input) elements in |
| 1156 | // FF it's necessary to listen to `mousedown' instead of `click' events. |
| 1157 | window.addEventListener('mousedown',function(evt){ |
| 1158 | var |
| 1159 | bMAIN = 0, |
| 1160 | mCTRL = 1<<14, |
| 1161 | mod = evt.altKey<<15 | evt.ctrlKey<<14 | evt.shiftKey<<13; |
| 1162 | if( evt.target.tagName in { 'INPUT':1, 'SELECT':1, 'A':1 } || |
| 1163 | evt.button!=bMAIN || mod!=mCTRL ){ |
| 1164 | return; |
| 1165 | } |
| 1166 | var e = evt.target; |
| 1167 | while( e && !/\btimeline\w+Cell\b/.test(e.className) ){ |
| 1168 | e = e.parentElement; |
| 1169 | } |
| 1170 | if( e && (e = e.previousElementSibling.querySelector('.tl-nodemark')) ){ |
| 1171 | evt.preventDefault(); |
| 1172 | evt.stopPropagation(); |
| 1173 | focusCacheSet(e.id); |
| 1174 | focusVisualize(e.id,false); |
| 1175 | } |
| 1176 | },false); |
| 1177 | window.addEventListener('pageshow',function(evt){ |
| 1178 | var id = focusCacheGet(); |
| 1179 | if( !id || !focusVisualize(id,false) ){ |
| 1180 | if( focusCookieQuery() ){ |
| 1181 | id = focusDefaultId(); |
| 1182 |
+2
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1636,10 +1636,12 @@ | ||
| 1636 | 1636 | ** n Focus next (newer) entry, or open next page. |
| 1637 | 1637 | ** m Focus previous (older) entry, or open previous page. |
| 1638 | 1638 | ** M Focus last (oldest) entry. |
| 1639 | 1639 | ** j Move focus between selected, current (check-out) and ticked entries. |
| 1640 | 1640 | ** , Focus entry closest to center of viewport. |
| 1641 | +** Ctrl+Click | |
| 1642 | +** Focus clicked entry. | |
| 1641 | 1643 | ** J Scroll to focused entry. |
| 1642 | 1644 | ** h Tick/untick focused entry, or open diff if two entries ticked. |
| 1643 | 1645 | ** H Untick all entries. |
| 1644 | 1646 | ** b Copy commit hash of focused entry to clipboard. |
| 1645 | 1647 | ** B Copy branch name of focused entry to clipboard. |
| 1646 | 1648 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1636,10 +1636,12 @@ | |
| 1636 | ** n Focus next (newer) entry, or open next page. |
| 1637 | ** m Focus previous (older) entry, or open previous page. |
| 1638 | ** M Focus last (oldest) entry. |
| 1639 | ** j Move focus between selected, current (check-out) and ticked entries. |
| 1640 | ** , Focus entry closest to center of viewport. |
| 1641 | ** J Scroll to focused entry. |
| 1642 | ** h Tick/untick focused entry, or open diff if two entries ticked. |
| 1643 | ** H Untick all entries. |
| 1644 | ** b Copy commit hash of focused entry to clipboard. |
| 1645 | ** B Copy branch name of focused entry to clipboard. |
| 1646 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1636,10 +1636,12 @@ | |
| 1636 | ** n Focus next (newer) entry, or open next page. |
| 1637 | ** m Focus previous (older) entry, or open previous page. |
| 1638 | ** M Focus last (oldest) entry. |
| 1639 | ** j Move focus between selected, current (check-out) and ticked entries. |
| 1640 | ** , Focus entry closest to center of viewport. |
| 1641 | ** Ctrl+Click |
| 1642 | ** Focus clicked entry. |
| 1643 | ** J Scroll to focused entry. |
| 1644 | ** h Tick/untick focused entry, or open diff if two entries ticked. |
| 1645 | ** H Untick all entries. |
| 1646 | ** b Copy commit hash of focused entry to clipboard. |
| 1647 | ** B Copy branch name of focused entry to clipboard. |
| 1648 |