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

Function core

codebase/sources/dhtmlxscheduler.es.js:12343–12442  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

12341 })();
12342}
12343function core(scheduler2) {
12344 scheduler2.$keyboardNavigation.dispatcher = { isActive: false, activeNode: null, globalNode: new scheduler2.$keyboardNavigation.SchedulerNode(), keepScrollPosition: function(callback) {
12345 var top, left;
12346 var scrollable = scheduler2.$container.querySelector(".dhx_timeline_scrollable_data");
12347 if (!scrollable) {
12348 scrollable = scheduler2.$container.querySelector(".dhx_cal_data");
12349 }
12350 if (scrollable) {
12351 top = scrollable.scrollTop;
12352 left = scrollable.scrollLeft;
12353 }
12354 callback();
12355 if (scrollable) {
12356 scrollable.scrollTop = top;
12357 scrollable.scrollLeft = left;
12358 }
12359 }, enable: function() {
12360 if (!scheduler2.$container) {
12361 return;
12362 }
12363 this.isActive = true;
12364 var self = this;
12365 this.keepScrollPosition(function() {
12366 self.globalNode.enable();
12367 self.setActiveNode(self.getActiveNode());
12368 });
12369 }, disable: function() {
12370 this.isActive = false;
12371 this.globalNode.disable();
12372 }, isEnabled: function() {
12373 return !!this.isActive;
12374 }, getDefaultNode: function() {
12375 return this.globalNode.getDefaultNode();
12376 }, setDefaultNode: function() {
12377 this.setActiveNode(this.getDefaultNode());
12378 }, getActiveNode: function() {
12379 var node = this.activeNode;
12380 if (node && !node.isValid()) {
12381 node = node.fallback();
12382 }
12383 return node;
12384 }, focusGlobalNode: function() {
12385 this.blurNode(this.globalNode);
12386 this.focusNode(this.globalNode);
12387 }, setActiveNode: function(el) {
12388 if (!el || !el.isValid())
12389 return;
12390 if (this.activeNode) {
12391 if (this.activeNode.compareTo(el)) {
12392 return;
12393 }
12394 }
12395 if (this.isEnabled()) {
12396 this.blurNode(this.activeNode);
12397 this.activeNode = el;
12398 this.focusNode(this.activeNode);
12399 }
12400 }, focusNode: function(el) {

Callers 1

key_navFunction · 0.70

Calls 4

callbackFunction · 0.70
focusMethod · 0.65
getStateMethod · 0.65
getNodeMethod · 0.45

Tested by

no test coverage detected