|
@@ -12,6 +12,7 @@ var findEventHandlers = function (eventType, jqSelector) {
|
|
|
return arrayIntersection(array1, array2).length !== 0;
|
|
|
};
|
|
|
|
|
|
+
|
|
|
var addEventHandlerInfo = function (element, event, $elementsCovered) {
|
|
|
var extendedEvent = event;
|
|
|
if ($elementsCovered !== void 0 && $elementsCovered !== null) {
|
|
@@ -32,16 +33,13 @@ var findEventHandlers = function (eventType, jqSelector) {
|
|
|
results.push(eventInfo);
|
|
|
} else {
|
|
|
eventInfo = eventsInfo[0];
|
|
|
- eventInfo
|
|
|
- .events
|
|
|
- .push(extendedEvent);
|
|
|
+ eventInfo.events.push(extendedEvent);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+
|
|
|
var $elementsToWatch = $(jqSelector);
|
|
|
- if (jqSelector === "*")
|
|
|
- // * does not include document and we might be interested in handlers registered
|
|
|
- // there
|
|
|
+ if (jqSelector === "*") //* does not include document and we might be interested in handlers registered there
|
|
|
$elementsToWatch = $elementsToWatch.add(document);
|
|
|
var $allElements = $("*").add(document);
|
|
|
|
|
@@ -67,224 +65,161 @@ var findEventHandlers = function (eventType, jqSelector) {
|
|
|
return results;
|
|
|
};
|
|
|
|
|
|
-<<<<<<<HEAD
|
|
|
-window
|
|
|
- .top
|
|
|
- .addEventListener("popstate", function (event) {
|
|
|
- window
|
|
|
- .setTimeout(function () {
|
|
|
- if (!event)
|
|
|
- return;
|
|
|
- var state = event.state;
|
|
|
- if (state === "")
|
|
|
- state = "/";
|
|
|
- if (state[0] !== "/")
|
|
|
- state = "/" + state;
|
|
|
- if (!!state)
|
|
|
- fastLoad(state, false, true);
|
|
|
- }
|
|
|
- , 0);
|
|
|
- =======window
|
|
|
- .top
|
|
|
- .addEventListener('popstate', function (event) {
|
|
|
- window
|
|
|
- .setTimeout(function () {
|
|
|
- if (!event)
|
|
|
- return;
|
|
|
- var state = event.state;
|
|
|
- if (state === '')
|
|
|
- state = '/';
|
|
|
- if (state[0] !== '/')
|
|
|
- state = '/' + state;
|
|
|
- if (!!state)
|
|
|
- fastLoad(state, false, true);
|
|
|
- }
|
|
|
- , 0);
|
|
|
- });
|
|
|
- $(document).ready(function () {
|
|
|
- if (window === window.top) {
|
|
|
- window.location.href = '/mc' + window.location.pathname;
|
|
|
- return;
|
|
|
- }
|
|
|
- window
|
|
|
- .top
|
|
|
- .ensureRHS();
|
|
|
- $(document).on('click', '.stag_rhs_toggle', function () {
|
|
|
- var state = window
|
|
|
- .top
|
|
|
- .toggleRHS(),
|
|
|
- icon = $(this).find('i');
|
|
|
- if (state === 'collapsed') {
|
|
|
- icon
|
|
|
- .removeClass()
|
|
|
- .addClass('fa fa-arrow-left');
|
|
|
- } else {
|
|
|
- icon
|
|
|
- .removeClass()
|
|
|
- .addClass('fa fa-arrow-right');
|
|
|
- } >>>>>>> 8 a6acabd0b62f0eb47602d7d497e73c55fec82d5
|
|
|
- });
|
|
|
- $(document).ready(function () {
|
|
|
- $(document)
|
|
|
- .on("click", ".stag_rhs_toggle", function () {
|
|
|
- var state = window
|
|
|
- .top
|
|
|
- .toggleRHS(),
|
|
|
- icon = $(this).find("i");
|
|
|
- if (state === "collapsed") {
|
|
|
- icon
|
|
|
- .removeClass()
|
|
|
- .addClass("fa fa-arrow-left");
|
|
|
- } else {
|
|
|
- icon
|
|
|
- .removeClass()
|
|
|
- .addClass("fa fa-arrow-right");
|
|
|
- }
|
|
|
- });
|
|
|
- var body = $(window.top.document.body),
|
|
|
- icon = $(".stag_rhs_toggle i");
|
|
|
- if (body.is(".stag_rhs_collapsed")) {
|
|
|
- icon
|
|
|
- .removeClass()
|
|
|
- .addClass("fa fa-arrow-left");
|
|
|
- }
|
|
|
- initFastLoad();
|
|
|
- initializeCalendar();
|
|
|
- });
|
|
|
- function enableTimeSpecificFields(_checked, _valueClass, _rangeClass) {
|
|
|
- if (_valueClass)
|
|
|
- $('.' + _valueClass).prop('disabled', _checked);
|
|
|
- if (_rangeClass)
|
|
|
- $('.' + _rangeClass).prop('disabled', !_checked);
|
|
|
- }
|
|
|
- function toggleDisabledAsNeeded(_el, _targetValue, _enableClass, _disableClass) {
|
|
|
- if (_el.value === _targetValue) {
|
|
|
- if (_enableClass)
|
|
|
- $('.' + _enableClass).prop('disabled', false);
|
|
|
- if (_disableClass)
|
|
|
- $('.' + _disableClass).prop('disabled', true);
|
|
|
- }
|
|
|
- else {
|
|
|
- if (_enableClass)
|
|
|
- $('.' + _enableClass).prop('disabled', true);
|
|
|
- if (_disableClass)
|
|
|
- $('.' + _disableClass).prop('disabled', false);
|
|
|
- }
|
|
|
- }
|
|
|
- function toggleVisibilityAsNeeded(_el, _targetValue, _visibleClass, _hiddenClass) {
|
|
|
- if (_el.value === _targetValue) {
|
|
|
- if (_visibleClass)
|
|
|
- $('.' + _visibleClass).removeClass('d-none');
|
|
|
- if (_hiddenClass)
|
|
|
- $('.' + _hiddenClass).addClass('d-none');
|
|
|
- }
|
|
|
- else {
|
|
|
- if (_visibleClass)
|
|
|
- $('.' + _visibleClass).addClass('d-none');
|
|
|
- if (_hiddenClass)
|
|
|
- $('.' + _hiddenClass).removeClass('d-none');
|
|
|
- }
|
|
|
- }
|
|
|
- var fastCache = {};
|
|
|
+window.top.addEventListener('popstate', function (event) {
|
|
|
+ window.setTimeout(function () {
|
|
|
+ if (!event) return;
|
|
|
+ var state = event.state;
|
|
|
+ if (state === '') state = '/';
|
|
|
+ if (state[0] !== '/') state = '/' + state;
|
|
|
+ if (!!state) fastLoad(state, false, true);
|
|
|
+ }, 0);
|
|
|
+});
|
|
|
+$(document).ready(function () {
|
|
|
+ if(window === window.top) {
|
|
|
+ window.location.href = '/mc' + window.location.pathname;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.top.ensureRHS();
|
|
|
+ $(document).on('click', '.stag_rhs_toggle', function () {
|
|
|
+ var state = window.top.toggleRHS(),
|
|
|
+ icon = $(this).find('i');
|
|
|
+ if (state === 'collapsed') {
|
|
|
+ icon.removeClass().addClass('fa fa-arrow-left');
|
|
|
+ } else {
|
|
|
+ icon.removeClass().addClass('fa fa-arrow-right');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ var body = $(window.top.document.body),
|
|
|
+ icon = $('.stag_rhs_toggle i');
|
|
|
+ if (body.is('.stag_rhs_collapsed')) {
|
|
|
+ icon.removeClass().addClass('fa fa-arrow-left');
|
|
|
+ }
|
|
|
+ initFastLoad();
|
|
|
+ initializeCalendar();
|
|
|
+});
|
|
|
+function enableTimeSpecificFields(_checked, _valueClass, _rangeClass) {
|
|
|
+ if(_valueClass) $('.' + _valueClass).prop('disabled', _checked);
|
|
|
+ if(_rangeClass) $('.' + _rangeClass).prop('disabled', !_checked);
|
|
|
+}
|
|
|
+function toggleDisabledAsNeeded(_el, _targetValue, _enableClass, _disableClass) {
|
|
|
+ if(_el.value === _targetValue) {
|
|
|
+ if(_enableClass) $('.' + _enableClass).prop('disabled', false);
|
|
|
+ if(_disableClass) $('.' + _disableClass).prop('disabled', true);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if(_enableClass) $('.' + _enableClass).prop('disabled', true);
|
|
|
+ if(_disableClass) $('.' + _disableClass).prop('disabled', false);
|
|
|
+ }
|
|
|
+}
|
|
|
+function toggleVisibilityAsNeeded(_el, _targetValue, _visibleClass, _hiddenClass) {
|
|
|
+ if(_el.value === _targetValue) {
|
|
|
+ if(_visibleClass) $('.' + _visibleClass).removeClass('d-none');
|
|
|
+ if(_hiddenClass) $('.' + _hiddenClass).addClass('d-none');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if(_visibleClass) $('.' + _visibleClass).addClass('d-none');
|
|
|
+ if(_hiddenClass) $('.' + _hiddenClass).removeClass('d-none');
|
|
|
+ }
|
|
|
+}
|
|
|
+var fastCache = {};
|
|
|
|
|
|
- function initFastLoad(_parent = false) {
|
|
|
- fastCache = {};
|
|
|
+function initFastLoad(_parent = false) {
|
|
|
|
|
|
- var allAs = $('a:not([onclick]):not([href="#"])');
|
|
|
- if (_parent) {
|
|
|
- allAs = _parent.find('a:not([onclick]):not([href="#"])');
|
|
|
- }
|
|
|
- // find links without event handlers
|
|
|
- allAs
|
|
|
- .each(function () {
|
|
|
- if (!$(this).closest("[moe]").length) {
|
|
|
- if ($(this).closest('.dropdown-menu[aria-labelledby="practice-management"]').length) {
|
|
|
- enableFastLoad(this, true);
|
|
|
- } else {
|
|
|
- var handlers = findEventHandlers("click", this);
|
|
|
- if (!handlers || !handlers.length) {
|
|
|
- enableFastLoad(this);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ fastCache = {};
|
|
|
|
|
|
- function enableFastLoad(_a, _menuItem = false) {
|
|
|
- $(_a)
|
|
|
- .on("click", function () {
|
|
|
- fastLoad(this.href, true, true);
|
|
|
- if (_menuItem) {
|
|
|
- $(this)
|
|
|
- .closest(".dropdown-menu")
|
|
|
- .removeClass("show")
|
|
|
- .prev(".dropdown-toggle")
|
|
|
- .attr("aria-expanded", "false");
|
|
|
- }
|
|
|
- return false;
|
|
|
- });
|
|
|
- // console.info('FastLoad enabled for ' + _a.innerText + ' [' + _a.href + ']');
|
|
|
+ var allAs = $('a:not([onclick]):not([href="#"])');
|
|
|
+ if (_parent) {
|
|
|
+ allAs = _parent.find('a:not([onclick]):not([href="#"])');
|
|
|
+ }
|
|
|
+ // find links without event handlers
|
|
|
+ allAs.each(function () {
|
|
|
+ if (!$(this).closest('[moe]').length) {
|
|
|
+ if ($(this).closest('.dropdown-menu[aria-labelledby="practice-management"]').length) {
|
|
|
+ enableFastLoad(this, true);
|
|
|
+ } else {
|
|
|
+ var handlers = findEventHandlers('click', this);
|
|
|
+ if (!handlers || !handlers.length) {
|
|
|
+ enableFastLoad(this);
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- // fast cache
|
|
|
- allAs = $('a:not([onclick]):not([href="#"])');
|
|
|
- allAs.each(function () {
|
|
|
- var a = this;
|
|
|
- $.get(a.href, function (_data) {
|
|
|
- fastCache[a.href] = _data;
|
|
|
- });
|
|
|
- });
|
|
|
+ function enableFastLoad(_a, _menuItem = false) {
|
|
|
+ $(_a).on('click', function () {
|
|
|
+ fastLoad(this.href, true, true);
|
|
|
+ if (_menuItem) {
|
|
|
+ $(this).closest('.dropdown-menu')
|
|
|
+ .removeClass('show')
|
|
|
+ .prev('.dropdown-toggle').attr('aria-expanded', 'false');
|
|
|
}
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ // console.info('FastLoad enabled for ' + _a.innerText + ' [' + _a.href + ']');
|
|
|
+ }
|
|
|
+
|
|
|
+ // fast cache
|
|
|
+ allAs = $('a:not([onclick]):not([href="#"])');
|
|
|
+ allAs.each(function () {
|
|
|
+ var a = this;
|
|
|
+ $.get(a.href, function (_data) {
|
|
|
+ fastCache[a.href] = _data;
|
|
|
+ });
|
|
|
+ });
|
|
|
|
|
|
- function fastLoad(_href, _history = true, _useCache = true) {
|
|
|
- function onData(_data) {
|
|
|
- var targetParent = $(".stag-content");
|
|
|
- _data = "<div>" + _data + "</div>";
|
|
|
- var content = $(_data).find(".stag-content");
|
|
|
- if (content && content.length) {
|
|
|
- content = content.html();
|
|
|
- content += '<script src="/js/yemi.js"></script>';
|
|
|
- targetParent.html(content);
|
|
|
- initFastLoad(targetParent);
|
|
|
- initializeCalendar();
|
|
|
+}
|
|
|
|
|
|
- // push state
|
|
|
- if (_history) {
|
|
|
- var target = _href;
|
|
|
- if (target.indexOf("//") !== -1) {
|
|
|
- target = target.split("//")[1];
|
|
|
- if (target.indexOf("/") !== -1) {
|
|
|
- target = target.substr(target.indexOf("/") + 1);
|
|
|
- }
|
|
|
- }
|
|
|
- window
|
|
|
- .top
|
|
|
- .history
|
|
|
- .pushState(target, null, "/mc/" + target);
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.warn("Target page not found: " + _href);
|
|
|
- window.location.href = _href; // fallback
|
|
|
+function fastLoad(_href, _history = true, _useCache = true) {
|
|
|
+ function onData(_data) {
|
|
|
+ var targetParent = $('.stag-content');
|
|
|
+ _data = '<div>' + _data + '</div>';
|
|
|
+ var content = $(_data).find('.stag-content');
|
|
|
+ if (content && content.length) {
|
|
|
+ content = content.html();
|
|
|
+ content += '<script src="/js/yemi.js"></script>';
|
|
|
+ targetParent.html(content);
|
|
|
+ initFastLoad(targetParent);
|
|
|
+ initializeCalendar();
|
|
|
+
|
|
|
+ // push state
|
|
|
+ if (_history) {
|
|
|
+ var target = _href;
|
|
|
+ if (target.indexOf('//') !== -1) {
|
|
|
+ target = target.split('//')[1];
|
|
|
+ if (target.indexOf('/') !== -1) {
|
|
|
+ target = target.substr(target.indexOf('/') + 1);
|
|
|
}
|
|
|
- hideMask();
|
|
|
- }
|
|
|
- showMask();
|
|
|
- if (_useCache && !!fastCache[_href]) {
|
|
|
- onData(fastCache[_href]);
|
|
|
- } else {
|
|
|
- $.get(_href, onData);
|
|
|
}
|
|
|
+ window.top.history.pushState(target, null, '/mc/' + target);
|
|
|
}
|
|
|
|
|
|
- function openInRHS(_url) {
|
|
|
- window
|
|
|
- .top
|
|
|
- .showRHS();
|
|
|
- var icon = $(".stag_rhs_toggle i");
|
|
|
- icon
|
|
|
- .removeClass()
|
|
|
- .addClass("fa fa-arrow-right");
|
|
|
- window
|
|
|
- .top
|
|
|
- .openInRHS(_url);
|
|
|
- return false;
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ console.warn('Target page not found: ' + _href);
|
|
|
+ window.location.href = _href; // fallback
|
|
|
+ }
|
|
|
+ hideMask();
|
|
|
+ }
|
|
|
+ showMask();
|
|
|
+ if (_useCache && !!fastCache[_href]) {
|
|
|
+ onData(fastCache[_href]);
|
|
|
+ } else {
|
|
|
+ $.get(_href, onData);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function openInRHS(_url) {
|
|
|
+ window.top.showRHS();
|
|
|
+ var icon = $('.stag_rhs_toggle i');
|
|
|
+ icon.removeClass().addClass('fa fa-arrow-right');
|
|
|
+ window.top.openInRHS(_url);
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+function initializeCalendar() {
|
|
|
+ if(!$('#calendar').length) return;
|
|
|
+ var calendarEl = document.getElementById('calendar');
|
|
|
+ var calendar = new FullCalendar.Calendar(calendarEl, {
|
|
|
+ initialView: 'dayGridMonth'
|
|
|
+ });
|
|
|
+ calendar.render();
|
|
|
+}
|