|
@@ -12,7 +12,6 @@ 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) {
|
|
@@ -33,13 +32,16 @@ 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);
|
|
|
|
|
@@ -65,41 +67,59 @@ var findEventHandlers = function (eventType, jqSelector) {
|
|
|
return results;
|
|
|
};
|
|
|
|
|
|
-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 () {
|
|
|
- $(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');
|
|
|
- }
|
|
|
+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 () {
|
|
|
+ $(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');
|
|
|
+ icon = $(".stag_rhs_toggle i");
|
|
|
+ if (body.is(".stag_rhs_collapsed")) {
|
|
|
+ icon
|
|
|
+ .removeClass()
|
|
|
+ .addClass("fa fa-arrow-left");
|
|
|
}
|
|
|
initFastLoad();
|
|
|
});
|
|
|
function enableTimeSpecificFields(_checked, _valueClass, _rangeClass) {
|
|
|
- if(_valueClass) $('.' + _valueClass).prop('disabled', _checked);
|
|
|
- if(_rangeClass) $('.' + _rangeClass).prop('disabled', !_checked);
|
|
|
-}
|
|
|
+ if (_valueClass)
|
|
|
+ $("." + _valueClass).prop("disabled", _checked);
|
|
|
+ if (_rangeClass)
|
|
|
+ $("." + _rangeClass).prop("disabled", !_checked);
|
|
|
+ }
|
|
|
|
|
|
var fastCache = {};
|
|
|
|
|
|
function initFastLoad(_parent = false) {
|
|
|
-
|
|
|
fastCache = {};
|
|
|
|
|
|
var allAs = $('a:not([onclick]):not([href="#"])');
|
|
@@ -107,29 +127,33 @@ function initFastLoad(_parent = false) {
|
|
|
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);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
|
|
|
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;
|
|
|
- });
|
|
|
+ $(_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 + ']');
|
|
|
}
|
|
|
|
|
@@ -141,14 +165,13 @@ function initFastLoad(_parent = false) {
|
|
|
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');
|
|
|
+ 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>';
|
|
@@ -159,17 +182,19 @@ function fastLoad(_href, _history = true, _useCache = true) {
|
|
|
// 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);
|
|
|
+ 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);
|
|
|
+ window
|
|
|
+ .top
|
|
|
+ .history
|
|
|
+ .pushState(target, null, "/mc/" + target);
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
- console.warn('Target page not found: ' + _href);
|
|
|
+ console.warn("Target page not found: " + _href);
|
|
|
window.location.href = _href; // fallback
|
|
|
}
|
|
|
hideMask();
|
|
@@ -183,18 +208,15 @@ function fastLoad(_href, _history = true, _useCache = true) {
|
|
|
}
|
|
|
|
|
|
function openInRHS(_url) {
|
|
|
- window.top.showRHS();
|
|
|
- var icon = $('.stag_rhs_toggle i');
|
|
|
- icon.removeClass().addClass('fa fa-arrow-right');
|
|
|
- window.top.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();
|
|
|
-}
|