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

Function minical

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

Source from the content-addressed store, hash-verified

14159 });
14160 }
14161 function minical(scheduler2) {
14162 const minicalDomEvents = scheduler2._createDomEventScope();
14163 scheduler2.config.minicalendar = { mark_events: true };
14164 scheduler2._synced_minicalendars = [];
14165 scheduler2.renderCalendar = function(obj, _prev, is_refresh) {
14166 var cal = null;
14167 var date = obj.date || scheduler2._currentDate();
14168 if (typeof date == "string")
14169 date = this.templates.api_date(date);
14170 if (!_prev) {
14171 var cont = obj.container;
14172 var pos = obj.position;
14173 if (typeof cont == "string")
14174 cont = document.getElementById(cont);
14175 if (typeof pos == "string")
14176 pos = document.getElementById(pos);
14177 if (pos && (typeof pos.left == "undefined" && typeof pos.right == "undefined")) {
14178 var tpos = scheduler2.$domHelpers.getOffset(pos);
14179 pos = { top: tpos.top + pos.offsetHeight, left: tpos.left };
14180 }
14181 if (!cont)
14182 cont = scheduler2._get_def_cont(pos);
14183 cal = this._render_calendar(cont, date, obj);
14184 if (!cal.$_eventAttached) {
14185 cal.$_eventAttached = true;
14186 minicalDomEvents.attach(cal, "click", (function(e) {
14187 var src = e.target || e.srcElement;
14188 var $dom = scheduler2.$domHelpers;
14189 if ($dom.closest(src, ".dhx_month_head")) {
14190 if (!$dom.closest(src, ".dhx_after") && !$dom.closest(src, ".dhx_before")) {
14191 var cellRoot = $dom.closest(src, "[data-cell-date]");
14192 var dateAttribute = cellRoot.getAttribute("data-cell-date");
14193 var newDate = scheduler2.templates.parse_date(dateAttribute);
14194 scheduler2.unmarkCalendar(this);
14195 scheduler2.markCalendar(this, newDate, "dhx_calendar_click");
14196 this._last_date = newDate;
14197 if (this.conf.events && this.conf.events.onDateClick) {
14198 this.conf.events.onDateClick.call(this, newDate, e);
14199 }
14200 if (this.conf.handler)
14201 this.conf.handler.call(scheduler2, newDate, this);
14202 }
14203 }
14204 }).bind(cal));
14205 minicalDomEvents.attach(cal, "mouseover", (function(e) {
14206 const target = e.target;
14207 if (target.classList.contains("dhx_cal_month_cell")) {
14208 var dateAttribute = target.getAttribute("data-cell-date");
14209 var newDate = scheduler2.templates.parse_date(dateAttribute);
14210 if (this.conf.events && this.conf.events.onDateMouseOver) {
14211 this.conf.events.onDateMouseOver.call(this, newDate, e);
14212 }
14213 }
14214 }).bind(cal));
14215 }
14216 } else {
14217 cal = this._render_calendar(_prev.parentNode, date, obj, _prev);
14218 scheduler2.unmarkCalendar(cal);

Callers

nothing calls this directly

Calls 15

handlerFunction · 0.70
_attach_actionFunction · 0.70
_round_minutesFunction · 0.70
actionFunction · 0.70
api_dateMethod · 0.65
bindMethod · 0.65
parse_dateMethod · 0.65
unmarkCalendarMethod · 0.65
markCalendarMethod · 0.65
month_startMethod · 0.65
addMethod · 0.65
getEventsMethod · 0.65

Tested by

no test coverage detected