()
| 989 | let ignorekeydown = false; |
| 990 | |
| 991 | function navigation() { |
| 992 | // if we have more groups, show the prev/next buttons |
| 993 | if (currentgroup.next) { |
| 994 | const prev = htmlToElement( |
| 995 | '<li><i class="icon-arrow-left icon-2"></i><span></span></li>', |
| 996 | ); |
| 997 | const next = htmlToElement( |
| 998 | '<li><i class="icon-arrow-right icon-2"></i><span></span></li>', |
| 999 | ); |
| 1000 | const prevnext = htmlToElement( |
| 1001 | '<ul class="inline" id="prevnext"><li>showing <u>all</u>, navigate:</li></ul>', |
| 1002 | ); |
| 1003 | prevnext.appendChild(prev); |
| 1004 | prevnext.appendChild(next); |
| 1005 | const navigate = document.getElementById('navigate'); |
| 1006 | navigate.style.height = 'auto'; |
| 1007 | navigate.appendChild(prevnext); |
| 1008 | |
| 1009 | const nextext = next.querySelector('span'), |
| 1010 | prevtext = prev.querySelector('span'), |
| 1011 | currentext = prevnext.querySelector('u'); |
| 1012 | |
| 1013 | const grouptext = (group) => { |
| 1014 | if (group.name === 'shell') return 'shell syntax'; |
| 1015 | else if (group.name !== 'all') |
| 1016 | return group.commandselector[0].textContent; |
| 1017 | return 'all'; |
| 1018 | }; |
| 1019 | |
| 1020 | nextext.textContent = ` explain ${grouptext(currentgroup.next)}`; |
| 1021 | prevtext.textContent = ` explain ${grouptext(currentgroup.prev)}`; |
| 1022 | |
| 1023 | prev.addEventListener('click', () => { |
| 1024 | if (affixon()) return; |
| 1025 | if (currentgroup.prev) { |
| 1026 | log( |
| 1027 | 'moving to the previous group (%s), current group is %s', |
| 1028 | currentgroup.prev.name, |
| 1029 | currentgroup.name, |
| 1030 | ); |
| 1031 | const oldgroup = currentgroup; |
| 1032 | currentgroup = currentgroup.prev; |
| 1033 | currentext.textContent = grouptext(currentgroup); |
| 1034 | |
| 1035 | // no need to potentically call drawvisible() here since for now |
| 1036 | // we don't allow clicking when scrolling |
| 1037 | drawgrouplines(currentgroup.commandselector); |
| 1038 | |
| 1039 | if (!currentgroup.prev) { |
| 1040 | log( |
| 1041 | 'new current group is the first group, disabling prev button', |
| 1042 | ); |
| 1043 | prev.style.display = 'none'; |
| 1044 | prevtext.textContent = ''; |
| 1045 | } else { |
| 1046 | log( |
| 1047 | 'setting prev button text to new current group prev %s', |
| 1048 | currentgroup.prev.name, |
nothing calls this directly
no test coverage detected