MCPcopy
hub / github.com/ollm/OpenComic / generateShortcutsTable

Function generateShortcutsTable

scripts/settings.js:731–835  ·  view source on GitHub ↗
(highlightItem = false)

Source from the content-addressed store, hash-verified

729}
730
731function generateShortcutsTable(highlightItem = false)
732{
733 let list = shortcuts.shortcuts();
734
735 // Keyboard
736 let keys = {};
737
738 for(let key in list.reading.shortcuts)
739 {
740 let action = list.reading.shortcuts[key];
741
742 if(!keys[action]) keys[action] = [];
743 keys[action].push(key);
744 }
745
746 // Gamepad
747 let buttons = {};
748
749 for(let button in list.reading.gamepad)
750 {
751 let action = list.reading.gamepad[button];
752
753 if(!buttons[action]) buttons[action] = [];
754 buttons[action].push(button);
755 }
756
757 // actionsGroups
758 let actionsGroups = [];
759
760 for(let key in list.reading.actionsGroups)
761 {
762 const group = list.reading.actionsGroups[key];
763 const actions = [];
764
765 for(let key2 in group.items)
766 {
767 let action = group.items[key2];
768 let data = list.reading.actions[action];
769
770 let _keys = keys[action] || {};
771 let _buttons = buttons[action] || {};
772
773 let shortcut = {
774 action: action,
775 name: data.name,
776 key1: _keys[0] || '',
777 key2: _keys[1] || '',
778 key3: _keys[2] || '',
779 key4: _keys[3] || '',
780 key5: _keys[4] || '',
781 gamepad1: (_buttons[0] || '').toLowerCase(),
782 gamepad1_: _buttons[0] || '',
783 gamepad2: (_buttons[1] || '').toLowerCase(),
784 gamepad2_: _buttons[1] || '',
785 };
786
787 actions.push(shortcut);
788 }

Callers 7

startSecondFunction · 0.85
changeShortcutFunction · 0.85
removeShortcutFunction · 0.85
changeButtonFunction · 0.85
removeButtonFunction · 0.85
restoreShortcutsFunction · 0.85

Calls 1

generateTapZonesTableFunction · 0.85

Tested by

no test coverage detected