MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / key_nav

Function key_nav

codebase/sources/dhtmlxscheduler.js:12866–12997  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

12864 };
12865 }
12866 function key_nav(scheduler2) {
12867 scheduler2.config.key_nav = true;
12868 scheduler2.config.key_nav_step = 30;
12869 scheduler2.addShortcut = function(shortcut, handler, scope) {
12870 var scopeObject = getScope(scope);
12871 if (scopeObject) {
12872 scopeObject.prototype.bind(shortcut, handler);
12873 }
12874 };
12875 scheduler2.getShortcutHandler = function(shortcut, scope) {
12876 var scopeObject = getScope(scope);
12877 if (scopeObject) {
12878 var commands = scheduler2.$keyboardNavigation.shortcuts.parse(shortcut);
12879 if (commands.length) {
12880 return scopeObject.prototype.findHandler(commands[0]);
12881 }
12882 }
12883 };
12884 scheduler2.removeShortcut = function(shortcut, scope) {
12885 var scopeObject = getScope(scope);
12886 if (scopeObject) {
12887 scopeObject.prototype.unbind(shortcut);
12888 }
12889 };
12890 scheduler2.focus = function() {
12891 if (!scheduler2.config.key_nav) {
12892 return;
12893 }
12894 var disp = scheduler2.$keyboardNavigation.dispatcher;
12895 disp.enable();
12896 var activeNode = disp.getActiveNode();
12897 if (!activeNode || activeNode instanceof scheduler2.$keyboardNavigation.MinicalButton || activeNode instanceof scheduler2.$keyboardNavigation.MinicalCell) {
12898 disp.setDefaultNode();
12899 } else {
12900 disp.focusNode(disp.getActiveNode());
12901 }
12902 };
12903 function getScope(mode) {
12904 var scopes = { minicalButton: scheduler2.$keyboardNavigation.MinicalButton, minicalDate: scheduler2.$keyboardNavigation.MinicalCell, scheduler: scheduler2.$keyboardNavigation.SchedulerNode, dataArea: scheduler2.$keyboardNavigation.DataArea, timeSlot: scheduler2.$keyboardNavigation.TimeSlot, event: scheduler2.$keyboardNavigation.Event };
12905 var searchMap = {};
12906 for (var i in scopes)
12907 searchMap[i.toLowerCase()] = scopes[i];
12908 mode = (mode + "").toLowerCase();
12909 return searchMap[mode] || scopes.scheduler;
12910 }
12911 scheduler2.$keyboardNavigation = {};
12912 scheduler2._compose = function() {
12913 var parts = Array.prototype.slice.call(arguments, 0);
12914 var res = {};
12915 for (var i = 0; i < parts.length; i++) {
12916 var obj = parts[i];
12917 if (typeof obj == "function") {
12918 obj = new obj();
12919 }
12920 for (var p in obj) {
12921 res[p] = obj[p];
12922 }
12923 }

Callers

nothing calls this directly

Calls 15

getScopeFunction · 0.70
keyboard_shortcutsFunction · 0.70
eventhandlerFunction · 0.70
trap_modal_focusFunction · 0.70
markerFunction · 0.70
scheduler_nodeFunction · 0.70
nav_nodeFunction · 0.70
header_cellFunction · 0.70
eventFunction · 0.70
time_slotFunction · 0.70
minical_buttonFunction · 0.70
minical_cellFunction · 0.70

Tested by

no test coverage detected