# HG changeset patch # User Thierry Florac # Date 1475761462 -7200 # Node ID 6a846ca3ba847ccfcab2226d13f05e032e1194bb # Parent 29cd533bd7e4d189369cbcda22d73aea822cff4b Refactoring variables names diff -r 29cd533bd7e4 -r 6a846ca3ba84 src/pyams_skin/resources/js/myams.js --- a/src/pyams_skin/resources/js/myams.js Thu Oct 06 11:53:42 2016 +0200 +++ b/src/pyams_skin/resources/js/myams.js Thu Oct 06 15:44:22 2016 +0200 @@ -225,9 +225,9 @@ .off('click') .on('click', function (e) { $(this).hide(); - var $invokedOn = $(this).data("invokedOn"); - var $selectedMenu = $(e.target); - settings.menuSelected.call(this, $invokedOn, $selectedMenu); + var invokedOn = $(this).data("invokedOn"); + var selectedMenu = $(e.target); + settings.menuSelected.call(this, invokedOn, selectedMenu); ams.event.stop(e); }); return false; @@ -258,17 +258,17 @@ // Add a mark [+] to a multilevel menu menu.find("LI").each(function() { - var menu_item = $(this); - if (menu_item.find("UL").size() > 0) { + var menuItem = $(this); + if (menuItem.find("UL").size() > 0) { // add the multilevel sign next to the link - menu_item.find("A:first") + menuItem.find("A:first") .append("" + settings.closedSign + ""); // avoid jumping to the top of the page when the href is an # - var first_link = menu_item.find("A:first"); - if (first_link.attr('href') === "#") { - first_link.click(function() { + var firstLink = menuItem.find("A:first"); + if (firstLink.attr('href') === "#") { + firstLink.click(function() { return false; }); } @@ -277,11 +277,11 @@ // Open active level menu.find("LI.active").each(function() { - var active_parent = $(this).parents('UL'); - var active_item = active_parent.parent('LI'); - active_parent.slideDown(settings.speed); - active_item.find("b:first").html(settings.openedSign); - active_item.addClass("open"); + var activeParent = $(this).parents('UL'); + var activeItem = activeParent.parent('LI'); + activeParent.slideDown(settings.speed); + activeItem.find("b:first").html(settings.openedSign); + activeItem.addClass("open"); }); menu.find("LI A").on('click', function() { @@ -290,7 +290,7 @@ return; } var href = link.attr('href').replace(/^#/,''); - var parent_ul = link.parent().find("UL"); + var parentUL = link.parent().find("UL"); if (settings.accordion) { var parents = link.parent().parents("UL"); var visible = menu.find("UL:visible"); @@ -303,24 +303,24 @@ } }); if (close) { - if (parent_ul !== visible[visibleIndex]) { + if (parentUL !== visible[visibleIndex]) { var visibleItem = $(visible[visibleIndex]); if (href || !visibleItem.hasClass('active')) { visibleItem.slideUp(settings.speed, function () { $(this).parent("LI") - .removeClass('open') - .find("B:first") - .delay(settings.speed) - .html(settings.closedSign); + .removeClass('open') + .find("B:first") + .delay(settings.speed) + .html(settings.closedSign); }); } } } }); } - var first_ul = link.parent().find("UL:first"); - if (!href && first_ul.is(":visible") && !first_ul.hasClass("active")) { - first_ul.slideUp(settings.speed, function() { + var firstUL = link.parent().find("UL:first"); + if (!href && firstUL.is(":visible") && !firstUL.hasClass("active")) { + firstUL.slideUp(settings.speed, function() { link.parent("LI") .removeClass("open") .find("B:first") @@ -328,7 +328,7 @@ .html(settings.closedSign); }); } else /*if (link.attr('href') !== location.hash)*/ { - first_ul.slideDown(settings.speed, function() { + firstUL.slideDown(settings.speed, function() { link.parent("LI") .addClass("open") .find("B:first") @@ -413,14 +413,14 @@ devmode: true, devext: '', lang: 'en', - throttle_delay: 350, - menu_speed: 235, - navbar_height: 49, - ajax_nav: true, - enable_widgets: true, - enable_mobile: false, - enable_fastclick: false, - warn_on_form_change: false, + throttleDelay: 350, + menuSpeed: 235, + navbarHeight: 49, + ajaxNav: true, + enableWidgets: true, + enableMobile: false, + enableFastclick: false, + warnOnFormChange: false, ismobile: (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())) }; } @@ -670,9 +670,9 @@ if (response.statusText === 'OK') { return; } - var ajax_response = ams.ajax.getResponse(response); - if (ajax_response.content_type === 'json') { - ams.ajax.handleJSON(ajax_response.data); + var response = ams.ajax.getResponse(response); + if (response.contentType === 'json') { + ams.ajax.handleJSON(response.data); } else { var title = event.statusText || event.type; var message = response.responseText; @@ -697,7 +697,7 @@ return; } var response = ams.ajax.getResponse(request); - if (response.content_type === 'json') { + if (response.contentType === 'json') { ams.ajax.handleJSON(response.data); } else { ams.skin.messageBox('error', { @@ -778,8 +778,6 @@ * Handle AJAX upload and download progress * * @param event: the source event - * @param request: the request - * @param options: AJAX options */ progress: function(event) { if (!event.lengthComputable) { @@ -838,37 +836,37 @@ * Extract data type and result from response */ getResponse: function(request) { - var content_type = request.getResponseHeader('content-type'), - data_type, + var contentType = request.getResponseHeader('content-type'), + dataType, result; - if (content_type) { + if (contentType) { // Got server response - if (content_type.startsWith('application/javascript')) { - data_type = 'script'; + if (contentType.startsWith('application/javascript')) { + dataType = 'script'; result = request.responseText; - } else if (content_type.startsWith('text/html')) { - data_type = 'html'; + } else if (contentType.startsWith('text/html')) { + dataType = 'html'; result = request.responseText; - } else if (content_type.startsWith('text/xml')) { - data_type = 'xml'; + } else if (contentType.startsWith('text/xml')) { + dataType = 'xml'; result = request.responseText; } else { result = request.responseJSON; if (result) { - data_type = 'json'; + dataType = 'json'; } else { try { result = JSON.parse(request.responseText); - data_type = 'json'; + dataType = 'json'; } catch (e) { result = request.responseText; - data_type = 'text'; + dataType = 'text'; } } } } else { // Probably no response from server... - data_type = 'json'; + dataType = 'json'; result = { status: 'alert', alert: { @@ -877,7 +875,7 @@ } }; } - return {content_type: data_type, + return {contentType: dataType, data: result}; }, @@ -1038,11 +1036,11 @@ timeout: 10000 }); } else { - var message_status = message.status || 'info'; - if (message_status === 'error' && form && target) { + var messageStatus = message.status || 'info'; + if (messageStatus === 'error' && form && target) { ams.executeFunctionByName(form.data('ams-form-submit-error') || 'MyAMS.form.finalizeSubmitOnError', form, target); } - ams.skin.messageBox(message_status, + ams.skin.messageBox(messageStatus, {title: message.title || ams.i18n.ERROR_OCCURED, content: message.content, icon: message.icon, @@ -1262,7 +1260,7 @@ init: function(element) { // Activate form changes if required var forms; - if (ams.warn_on_form_change) { + if (ams.warnOnFormChange) { forms = $('FORM[data-ams-warn-on-change!="false"]', element); } else { forms = $('FORM[data-ams-warn-on-change="true"]', element); @@ -1373,14 +1371,14 @@ /** * Submit given form */ - submit: function(form, handler, submit_options) { + submit: function(form, handler, submitOptions) { // Check params form = $(form); if (!form.exists()) { return false; } if (typeof(handler) === 'object') { - submit_options = handler; + submitOptions = handler; handler = undefined; } // Prevent multiple submits of the same form @@ -1414,17 +1412,17 @@ function _submitAjaxForm(form, options) { var button, - button_data, - button_target; + buttonData, + buttonTarget; var data = form.data(); - var form_options = data.amsFormOptions; - var form_data; - var form_data_callback; - - var progress_handler; - var progress_interval; - var progress_callback; - var progress_end_callback; + var formOptions = data.amsFormOptions; + var formData; + var formDataCallback; + + var progressHandler; + var progressInterval; + var progressCallback; + var progressEndCallback; // Inner progress status handler function _getProgress(handler, progress_id) { @@ -1434,14 +1432,14 @@ function _clearProgressStatus() { button.button('reset'); clearInterval(interval); - ams.executeFunctionByName(progress_end_callback, form, button); + ams.executeFunctionByName(progressEndCallback, form, button); } function _getProgressStatus() { ams.ajax.post(handler, {progress_id: progress_id}, {error: _clearProgressStatus}, - ams.getFunctionByName(progress_callback) || function(result, status) { + ams.getFunctionByName(progressCallback) || function(result, status) { if (status == 'success') { if (result.status === 'running') { if (result.message) { @@ -1460,24 +1458,24 @@ } button.button('loading'); - interval = setInterval(_getProgressStatus, progress_interval); + interval = setInterval(_getProgressStatus, progressInterval); } // Initialize form data - if (submit_options) { - form_data_callback = submit_options.formDataInitCallback; + if (submitOptions) { + formDataCallback = submitOptions.formDataInitCallback; } - if (form_data_callback) { - delete submit_options.formDataInitCallback; + if (formDataCallback) { + delete submitOptions.formDataInitCallback; } else { - form_data_callback = data.amsFormDataInitCallback; + formDataCallback = data.amsFormDataInitCallback; } - if (form_data_callback) { + if (formDataCallback) { var veto = {}; - if (typeof(form_data_callback) === 'function') { - form_data = form_data_callback.call(form, veto); + if (typeof(formDataCallback) === 'function') { + formData = formDataCallback.call(form, veto); } else { - form_data = ams.executeFunctionByName(form_data_callback, form, veto); + formData = ams.executeFunctionByName(formDataCallback, form, veto); } if (veto.veto) { button = form.data('ams-submit-button'); @@ -1488,44 +1486,44 @@ return false; } } else { - form_data = data.amsFormData || {}; + formData = data.amsFormData || {}; } // Check submit button for custom action handler and target button = $(form.data('ams-submit-button')); if (button && button.exists()) { - button_data = button.data(); - button_target = button_data.amsFormSubmitTarget; + buttonData = button.data(); + buttonTarget = buttonData.amsFormSubmitTarget; } else { - button_data = {}; + buttonData = {}; } // Check action URL var url; - var form_handler = handler || button_data.amsFormHandler || data.amsFormHandler || ''; - if (form_handler.startsWith(window.location.protocol)) { - url = form_handler; + var formHandler = handler || buttonData.amsFormHandler || data.amsFormHandler || ''; + if (formHandler.startsWith(window.location.protocol)) { + url = formHandler; } else { - var action = button_data.amsFormAction || form.attr('action').replace(/#/, ''); + var action = buttonData.amsFormAction || form.attr('action').replace(/#/, ''); if (action.startsWith(window.location.protocol)) { url = action; } else { url = ams.ajax.getAddr() + action; } - url += form_handler; + url += formHandler; } - progress_handler = button_data.amsProgressHandler || data.amsProgressHandler || ''; - progress_interval = button_data.amsProgressInterval || data.amsProgressInterval || 1000; - progress_callback = button_data.amsProgressCallback || data.amsProgressCallback; - progress_end_callback = button_data.amsProgressEndCallback || data.amsProgressEndCallback; + progressHandler = buttonData.amsProgressHandler || data.amsProgressHandler || ''; + progressInterval = buttonData.amsProgressInterval || data.amsProgressInterval || 1000; + progressCallback = buttonData.amsProgressCallback || data.amsProgressCallback; + progressEndCallback = buttonData.amsProgressEndCallback || data.amsProgressEndCallback; // Initialize submit target with AJAX indicator var target = null; - if (submit_options && submit_options.initSubmitTarget) { - ams.executeFunctionByName(submit_options.initSubmitTarget, form); + if (submitOptions && submitOptions.initSubmitTarget) { + ams.executeFunctionByName(submitOptions.initSubmitTarget, form); } else { if (data.amsFormInitSubmitTarget) { - target = $(button_target || data.amsFormSubmitTarget || '#content'); + target = $(buttonTarget || data.amsFormSubmitTarget || '#content'); ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmit', form, target); } else if (!data.amsFormHideSubmitFooter) { ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmitFooter', form); @@ -1533,14 +1531,14 @@ } // Complete form data - if (submit_options) { - form_data = $.extend({}, form_data, submit_options.form_data); + if (submitOptions) { + formData = $.extend({}, formData, submitOptions.form_data); } // Check progress handler var hasUpload; - if (progress_handler) { - form_data.progress_id = ams.generateUUID(); + if (progressHandler) { + formData.progress_id = ams.generateUUID(); } else { // Check progress meter via Apache progress module hasUpload = typeof(options.uuid) !== 'undefined'; @@ -1557,7 +1555,7 @@ url: url, type: 'post', cache: false, - data: form_data, + data: formData, dataType: data.amsFormDatatype, beforeSerialize: function(/*form, options*/) { if (typeof(globals.tinyMCE) !== 'undefined') { @@ -1577,12 +1575,12 @@ }; // Initialize IFrame for custom download target - var download_target = (submit_options && submit_options.downloadTarget) || data.amsFormDownloadTarget; - if (download_target) { - var iframe = $('iframe[name="' + download_target + '"]'); + var downloadTarget = (submitOptions && submitOptions.downloadTarget) || data.amsFormDownloadTarget; + if (downloadTarget) { + var iframe = $('iframe[name="' + downloadTarget + '"]'); if (!iframe.exists()) { iframe = $('').hide() - .attr('name', download_target) + .attr('name', downloadTarget) .appendTo($('body')); } defaults = $.extend({}, defaults, { @@ -1637,21 +1635,21 @@ iframe: hasUpload }); } - var settings = $.extend({}, defaults, options, form_options, submit_options); + var settings = $.extend({}, defaults, options, formOptions, submitOptions); // Initialize progress handler - if (progress_handler) { - _getProgress(progress_handler, form_data.progress_id); + if (progressHandler) { + _getProgress(progressHandler, formData.progress_id); } // Submit form $(form).ajaxSubmit(settings); // If external download target is specified, reset form submit button and footer - if (download_target) { + if (downloadTarget) { var modal = $(form).parents('.modal-dialog'); - var keep_modal = modal.exists() && button.exists() && button.data('ams-keep-modal'); - if (modal.exists() && (keep_modal !== true)) { + var keepModal = modal.exists() && button.exists() && button.data('ams-keep-modal'); + if (modal.exists() && (keepModal !== true)) { ams.dialog.close(form); } else { setTimeout(function() { @@ -1794,13 +1792,13 @@ } var data = form.data(); - var data_type; + var dataType; if (data.amsFormDatatype) { - data_type = data.amsFormDatatype; + dataType = data.amsFormDatatype; } else { - var request_data = ams.ajax.getResponse(request); - data_type = request_data.content_type; - result = request_data.data; + var response = ams.ajax.getResponse(request); + dataType = response.contentType; + result = response.data; } var target; @@ -1810,7 +1808,7 @@ target = $(data.amsFormSubmitTarget || '#content'); } - switch (data_type) { + switch (dataType) { case 'json': ams.ajax.handleJSON(result, form, target); break; @@ -1851,9 +1849,9 @@ */ _getSubmitValidators: function(form) { var validators = []; - var form_validator = form.data('ams-form-validator'); - if (form_validator) { - validators.push([form, form_validator]); + var formValidator = form.data('ams-form-validator'); + if (formValidator) { + validators.push([form, formValidator]); } $('[data-ams-form-validator]', form).each(function() { var source = $(this); @@ -1882,11 +1880,11 @@ var validator = validators[index]; var source = validator[0]; var handler = validator[1]; - var validator_result = ams.executeFunctionByName(handler, form, source); - if (validator_result === false) { + var validatorResult = ams.executeFunctionByName(handler, form, source); + if (validatorResult === false) { result = false; - } else if (typeof(validator_result) === 'string') { - output.push(validator_result); + } else if (typeof(validatorResult) === 'string') { + output.push(validatorResult); } else if (result.length && (result.length > 0)) { output = output.concat(result); } @@ -1939,22 +1937,22 @@ if (errors.widgets) { for (index = 0; index < errors.widgets.length; index++) { // set widget status message - var widget_data = errors.widgets[index]; - var widget = $('[name="' + widget_data.name + '"]', form); + var widgetData = errors.widgets[index]; + var widget = $('[name="' + widgetData.name + '"]', form); widget.parents('label:first') .removeClassPrefix('state-') .addClass('state-error') - .after('' + widget_data.message + ''); + .after('' + widgetData.message + ''); // complete form alert message - if (widget_data.label) { - message.push(widget_data.label + ' : ' + widget_data.message); + if (widgetData.label) { + message.push(widgetData.label + ' : ' + widgetData.message); } // mark parent tab (if any) with error status - var tab_index = widget.parents('.tab-pane').index() + 1; - if (tab_index > 0) { - var nav_tabs = $('.nav-tabs', $(widget).parents('.tabforms')); - $('li:nth-child(' + tab_index + ')', nav_tabs).removeClassPrefix('state-') - .addClass('state-error'); + var tabIndex = widget.parents('.tab-pane').index() + 1; + if (tabIndex > 0) { + var navTabs = $('.nav-tabs', $(widget).parents('.tabforms')); + $('li:nth-child(' + tabIndex + ')', navTabs).removeClassPrefix('state-') + .addClass('state-error'); $('li.state-error:first a', form).click(); } } @@ -2048,14 +2046,14 @@ ''; } - var source_data; + var sourceData; var url; if (typeof(source) === 'string') { - source_data = {}; + sourceData = {}; url = source; } else { - source_data = source.data(); - url = source.attr('href') || source_data.amsUrl; + sourceData = source.data(); + url = source.attr('href') || sourceData.amsUrl; var url_getter = ams.getFunctionByName(url); if (typeof(url_getter) === 'function') { url = url_getter.call(source); @@ -2073,14 +2071,14 @@ $.ajax({ url: url, type: 'get', - cache: source_data.amsAllowCache === undefined ? false : source_data.amsAllowCache, + cache: sourceData.amsAllowCache === undefined ? false : sourceData.amsAllowCache, data: options, success: function(data, status, request) { $('body').modalmanager('removeLoading'); - var request_data = ams.ajax.getResponse(request); - var data_type = request_data.content_type; - var result = request_data.data; - switch (data_type) { + var response = ams.ajax.getResponse(request); + var dataType = response.contentType; + var result = response.data; + switch (dataType) { case 'json': ams.ajax.handleJSON(result, $($(source).data('ams-json-target') || '#content')); break; @@ -2095,27 +2093,27 @@ default: var content = $(result); var dialog = $('.modal-dialog', content.wrap('
').parent()); - var dialog_data = dialog.data(); - var data_options = { + var dialogData = dialog.data(); + var dataOptions = { backdrop: 'static', - overflow: dialog_data.amsModalOverflow || '.modal-viewport', - maxHeight: dialog_data.amsModalMaxHeight === undefined ? + overflow: dialogData.amsModalOverflow || '.modal-viewport', + maxHeight: dialogData.amsModalMaxHeight === undefined ? function() { return $(window).height() - $('.modal-header', content).outerHeight(true) - $('footer', content).outerHeight(true) - 85; } - : ams.getFunctionByName(dialog_data.amsModalMaxHeight) + : ams.getFunctionByName(dialogData.amsModalMaxHeight) }; - var settings = $.extend({}, data_options, dialog_data.amsModalOptions); - settings = ams.executeFunctionByName(dialog_data.amsModalInitCallback, dialog, settings) || settings; + var settings = $.extend({}, dataOptions, dialogData.amsModalOptions); + settings = ams.executeFunctionByName(dialogData.amsModalInitCallback, dialog, settings) || settings; $('
').addClass('modal fade') .append(content) .modal(settings) .on('shown', ams.dialog.shown) .on('hidden', ams.dialog.hidden); ams.initContent(content); - if (source_data.amsLogEvent !== false) { + if (sourceData.amsLogEvent !== false) { ams.stats.logPageview(url); } } @@ -2134,14 +2132,14 @@ function resetViewport(ev) { var top = $('.scrollmarker.top', viewport); - var top_position = viewport.scrollTop(); - if (top_position > 0) { + var topPosition = viewport.scrollTop(); + if (topPosition > 0) { top.show(); } else { top.hide(); } var bottom = $('.scrollmarker.bottom', viewport); - if (maxHeight + top_position >= viewport.get(0).scrollHeight) { + if (maxHeight + topPosition >= viewport.get(0).scrollHeight) { bottom.hide(); } else { bottom.show(); @@ -2328,18 +2326,18 @@ /** Context menu handler */ contextMenuHandler: function(target, menu) { - var menu_data = menu.data(); - if (menu_data.toggle === 'modal') { + var menuData = menu.data(); + if (menuData.toggle === 'modal') { ams.dialog.open(menu); } else { - var href = menu.attr('href') || menu_data.amsUrl; + var href = menu.attr('href') || menuData.amsUrl; if (!href || href.startsWith('javascript') || menu.attr('target')) { return; } ams.event.stop(); - var href_getter = ams.getFunctionByName(href); - if (typeof(href_getter) === 'function') { - href = href_getter.call(menu, target); + var hrefGetter = ams.getFunctionByName(href); + if (typeof(hrefGetter) === 'function') { + href = hrefGetter.call(menu, target); } if (typeof(href) === 'function') { // Javascript function call @@ -2450,26 +2448,26 @@ $('[data-ams-plugins]', element).each(function() { var source = $(this); - var ams_plugins = source.data('ams-plugins'); - if (typeof(ams_plugins) === 'string') { + var amsPlugins = source.data('ams-plugins'); + if (typeof(amsPlugins) === 'string') { var names = source.data('ams-plugins').split(/\s+/); for (var index = 0; index < names.length; index++) { name = names[index]; - var new_plugin = { + var newPlugin = { src: source.data('ams-plugin-' + name + '-src'), css: source.data('ams-plugin-' + name + '-css'), callback: source.data('ams-plugin-' + name + '-callback'), register: source.data('ams-plugin-' + name + '-register'), async: source.data('ams-plugin-' + name + '-async') }; - _registerPlugin(name, new_plugin); + _registerPlugin(name, newPlugin); } } else { - for (name in ams_plugins) { - if (!ams_plugins.hasOwnProperty(name)) { + for (name in amsPlugins) { + if (!amsPlugins.hasOwnProperty(name)) { continue; } - _registerPlugin(name, ams_plugins[name]); + _registerPlugin(name, amsPlugins[name]); } } }); @@ -2525,8 +2523,8 @@ callbacks(element); break; default: - for (var cb_index = 0; cb_index < callbacks.length; cb_index++) { - var callback = callbacks[cb_index]; + for (var cbIndex = 0; cbIndex < callbacks.length; cbIndex++) { + var callback = callbacks[cbIndex]; if (typeof(callback) === 'function') { callback(element); } @@ -2544,12 +2542,12 @@ */ initData: function(element) { $('[data-ams-data]', element).each(function() { - var data_element = $(this); - var data = data_element.data('ams-data'); + var dataElement = $(this); + var data = dataElement.data('ams-data'); if (data) { for (var name in data) { if (data.hasOwnProperty(name)) { - data_element.attr('data-' + name, data[name]); + dataElement.attr('data-' + name, data[name]); } } } @@ -2635,7 +2633,7 @@ hints.each(function () { var hint = $(this); var data = hint.data(); - var data_options = { + var dataOptions = { html: data.amsHintHtml, title: ams.getFunctionByName(data.amsHintTitleGetter) || function () { var hint = $(this); @@ -2647,7 +2645,7 @@ gravity: data.amsHintGravity || 'sw', offset: data.amsHintOffset || 0 }; - var settings = $.extend({}, data_options, data.amsHintOptions); + var settings = $.extend({}, dataOptions, data.amsHintOptions); settings = ams.executeFunctionByName(data.amsHintInitCallback, hint, settings) || settings; var plugin = hint.tipsy(settings); ams.executeFunctionByName(data.amsHintAfterInitCallback, hint, plugin, settings); @@ -2665,11 +2663,11 @@ menus.each(function() { var menu = $(this); var data = menu.data(); - var data_options = { + var dataOptions = { menuSelector: data.amsContextmenuSelector, menuSelected: ams.helpers.contextMenuHandler }; - var settings = $.extend({}, data_options, data.amsContextmenuOptions); + var settings = $.extend({}, dataOptions, data.amsContextmenuOptions); settings = ams.executeFunctionByName(data.amsContextmenuInitCallback, menu, settings) || settings; var plugin = menu.contextMenu(settings); ams.executeFunctionByName(data.amsContextmenuAfterInitCallback, menu, plugin, settings); @@ -2738,7 +2736,7 @@ if (!data.amsChecker) { var checker = $(''); var fieldname = data.amsCheckerFieldname || ('checker_'+ams.generateId()); - var checkbox_id = fieldname.replace(/\./, '_'); + var checkboxId = fieldname.replace(/\./, '_'); var prefix = data.amsCheckerHiddenPrefix; var hidden = null; var checkedValue = data.amsCheckerHiddenValueOn || 'true'; @@ -2754,7 +2752,7 @@ .prependTo(legend); } var input = $('').attr('name', fieldname) - .attr('id', checkbox_id) + .attr('id', checkboxId) .data('ams-checker-hidden-input', hidden) .data('ams-checker-init', true) .val(data.amsCheckerValue || true) @@ -2834,8 +2832,8 @@ sliders.each(function() { var slider = $(this); var data = slider.data(); - var data_options = {}; - var settings = $.extend({}, data_options, slider.data.amsSliderOptions); + var dataOptions = {}; + var settings = $.extend({}, dataOptions, slider.data.amsSliderOptions); settings = ams.executeFunctionByName(data.amsSliderInitCallback, slider, settings) || settings; var plugin = slider.slider(settings); ams.executeFunctionByName(data.amsSliderAfterInitCallback, slider, plugin, settings); @@ -2853,13 +2851,13 @@ draggables.each(function() { var draggable = $(this); var data = draggable.data(); - var data_options = { + var dataOptions = { containment: data.amsDraggableContainment, helper: ams.getFunctionByName(data.amsDraggableHelper) || data.amsDraggableHelper, start: ams.getFunctionByName(data.amsDraggableStart), stop: ams.getFunctionByName(data.amsDraggableStop) }; - var settings = $.extend({}, data_options, data.amsDraggableOptions); + var settings = $.extend({}, dataOptions, data.amsDraggableOptions); settings = ams.executeFunctionByName(data.amsDraggableInitCallback, draggable, settings) || settings; var plugin = draggable.draggable(settings); draggable.disableSelection(); @@ -2877,7 +2875,7 @@ sortables.each(function() { var sortable = $(this); var data = sortable.data(); - var data_options = { + var dataOptions = { items: data.amsSortableItems, handle: data.amsSortableHandle, connectWith: data.amsSortableConnectwith, @@ -2887,7 +2885,7 @@ placeholder: data.amsSortablePlaceholder, stop: ams.getFunctionByName(data.amsSortableStop) }; - var settings = $.extend({}, data_options, data.amsSortableOptions); + var settings = $.extend({}, dataOptions, data.amsSortableOptions); settings = ams.executeFunctionByName(data.amsSortableInitCallback, sortable, settings) || settings; var plugin = sortable.sortable(settings); sortable.disableSelection(); @@ -2905,7 +2903,7 @@ resizables.each(function() { var resizable = $(this); var data = resizable.data(); - var data_options = { + var dataOptions = { autoHide: data.amsResizableAutohide === false ? true : data.amsResizableAutohide, containment: data.amsResizableContainment, grid: data.amsResizableGrid, @@ -2913,7 +2911,7 @@ start: ams.getFunctionByName(data.amsResizableStart), stop: ams.getFunctionByName(data.amsResizableStop) }; - var settings = $.extend({}, data_options, data.amsResizableOptions); + var settings = $.extend({}, dataOptions, data.amsResizableOptions); settings = ams.executeFunctionByName(data.amsResizableInitCallback, resizable, settings) || settings; var plugin = resizable.resizable(settings); resizable.disableSelection(); @@ -2934,8 +2932,8 @@ typeaheads.each(function() { var input = $(this); var data = input.data(); - var data_options = {}; - var settings = $.extend({}, data_options, data.amsTypeaheadOptions); + var dataOptions = {}; + var settings = $.extend({}, dataOptions, data.amsTypeaheadOptions); settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings; var plugin = input.typeahead(settings); ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings); @@ -2956,7 +2954,7 @@ selects.each(function() { var select = $(this); var data = select.data(); - var data_options = { + var dataOptions = { placeholder: data.amsSelect2Placeholder, multiple: data.amsSelect2Multiple, minimumInputLength: data.amsSelect2MinimumInputLength || 0, @@ -3024,14 +3022,14 @@ switch (select.context.type) { case 'text': case 'hidden': - if (!data_options.initSelection) { - var values_data = select.data('ams-select2-values'); - if (values_data) { - data_options.initSelection = function(element, callback) { + if (!dataOptions.initSelection) { + var valuesData = select.data('ams-select2-values'); + if (valuesData) { + dataOptions.initSelection = function(element, callback) { var data = []; - $(element.val().split(data_options.separator)).each(function() { + $(element.val().split(dataOptions.separator)).each(function() { data.push({id: this, - text: values_data[this] || this}); + text: valuesData[this] || this}); }); callback(data); }; @@ -3044,17 +3042,17 @@ if (select.attr('readonly')) { if (select.attr('type') === 'hidden') { - data_options.query = function () { + dataOptions.query = function () { return []; }; } } else if (data.amsSelect2Query) { // Custom query method - data_options.query = ams.getFunctionByName(data.amsSelect2Query); - data_options.minimumInputLength = data.amsSelect2MinimumInputLength || 1; + dataOptions.query = ams.getFunctionByName(data.amsSelect2Query); + dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1; } else if (data.amsSelect2QueryUrl) { // AJAX query - data_options.ajax = { + dataOptions.ajax = { url: data.amsSelect2QueryUrl, quietMillis: data.amsSelect2QuietMillis || 200, type: data.amsSelect2QueryType || 'POST', @@ -3068,10 +3066,10 @@ }, results: ams.helpers.select2QueryUrlResultsCallback }; - data_options.minimumInputLength = data.amsSelect2MinimumInputLength || 1; + dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1; } else if (data.amsSelect2QueryMethod) { // JSON-RPC query - data_options.query = function(options) { + dataOptions.query = function(options) { var settings = { id: new Date().getTime(), params: data.amsSelect2QueryParams || {}, @@ -3097,23 +3095,23 @@ }); }); }; - data_options.minimumInputLength = data.amsSelect2MinimumInputLength || 1; + dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1; } else if (data.amsSelect2Tags) { // Tags mode - data_options.tags = data.amsSelect2Tags; + dataOptions.tags = data.amsSelect2Tags; } else if (data.amsSelect2Data) { // Provided data mode - data_options.data = data.amsSelect2Data; + dataOptions.data = data.amsSelect2Data; } if (data.amsSelect2EnableFreeTags) { - data_options.createSearchChoice = function(term) { + dataOptions.createSearchChoice = function(term) { return {id: term, text: (data.amsSelect2FreeTagsPrefix || ams.i18n.SELECT2_FREETAG_PREFIX) + term}; }; } - var settings = $.extend({}, data_options, data.amsSelect2Options); + var settings = $.extend({}, dataOptions, data.amsSelect2Options); settings = ams.executeFunctionByName(data.amsSelect2InitCallback, select, settings) || settings; var plugin = select.select2(settings); ams.executeFunctionByName(data.amsSelect2AfterInitCallback, select, plugin, settings); @@ -3150,11 +3148,11 @@ masks.each(function() { var mask = $(this); var data = mask.data(); - var data_options = { + var dataOptions = { placeholder: data.amsMaskeditPlaceholder === undefined ? 'X' : data.amsMaskeditPlaceholder, complete: ams.getFunctionByName(data.amsMaskeditComplete) }; - var settings = $.extend({}, data_options, data.amsMaskeditOptions); + var settings = $.extend({}, dataOptions, data.amsMaskeditOptions); settings = ams.executeFunctionByName(data.amsMaskeditInitCallback, mask, settings) || settings; var plugin = mask.mask(mask.attr('data-mask'), settings); ams.executeFunctionByName(data.amsMaskeditAfterInitCallback, mask, plugin, settings); @@ -3180,15 +3178,15 @@ masks.each(function() { var input = $(this); var data = input.data(); - var data_options; + var dataOptions; if (typeof(data.inputMask) === 'object') { - data_options = data.inputMask; + dataOptions = data.inputMask; } else { - data_options = { + dataOptions = { mask: data.inputMask.toString() }; } - var settings = $.extend({}, data_options, data.amsInputmaskOptions); + var settings = $.extend({}, dataOptions, data.amsInputmaskOptions); settings = ams.executeFunctionByName(data.amsInputmaskInitCallback, input, settings) || settings; var plugin = input.inputmask(settings); ams.executeFunctionByName(data.amsInputmaskAfterInitCallback, input, plugin, settings); @@ -3213,14 +3211,14 @@ datepickers.each(function() { var input = $(this); var data = input.data(); - var data_options = { + var dataOptions = { lang: data.amsDatetimepickerLang || ams.lang, format: data.amsDatetimepickerFormat || 'd/m/y', datepicker: true, dayOfWeekStart: 1, timepicker: false }; - var settings = $.extend({}, data_options, data.amsDatetimepickerOptions); + var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions); settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings; var plugin = input.datetimepicker(settings); ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings); @@ -3245,14 +3243,14 @@ datetimepickers.each(function() { var input = $(this); var data = input.data(); - var data_options = { + var dataOptions = { lang: data.amsDatetimepickerLang || ams.lang, format: data.amsDatetimepickerFormat || 'd/m/y H:i', datepicker: true, dayOfWeekStart: 1, timepicker: true }; - var settings = $.extend({}, data_options, data.amsDatetimepickerOptions); + var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions); settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings; var plugin = input.datetimepicker(settings); ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings); @@ -3277,13 +3275,13 @@ timepickers.each(function() { var input = $(this); var data = input.data(); - var data_options = { + var dataOptions = { lang: data.amsDatetimepickerLang || ams.lang, format: data.amsDatetimepickerFormat || 'H:i', datepicker: false, timepicker: true }; - var settings = $.extend({}, data_options, data.amsDatetimepickerOptions); + var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions); settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings; var plugin = input.datetimepicker(settings); ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings); @@ -3307,10 +3305,10 @@ colorpickers.each(function() { var input = $(this); var data = input.data(); - var data_options = { + var dataOptions = { position: data.amsColorpickerPosition || input.closest('label.input').data('ams-colorpicker-position') || 'bottom left' }; - var settings = $.extend({}, data_options, data.amsColorpickerOptions); + var settings = $.extend({}, dataOptions, data.amsColorpickerOptions); settings = ams.executeFunctionByName(data.amsColorpickerInitCallback, input, settings) || settings; var plugin = input.minicolors(settings); ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings); @@ -3364,7 +3362,7 @@ forms.each(function() { var form = $(this); var data = form.data(); - var data_options = { + var dataOptions = { ignore: null, submitHandler: form.attr('data-async') !== undefined ? data.amsFormSubmitHandler === undefined ? @@ -3386,13 +3384,13 @@ $('.state-error', form).removeClass('state-error'); for (var index=0; index < validator.errorList.length; index++) { var error = validator.errorList[index]; - var tab_index = $(error.element).parents('.tab-pane').index() + 1; - if (tab_index > 0) { - var nav_tabs = $('.nav-tabs', $(error.element).parents('.tabforms')); - $('li:nth-child(' + tab_index + ')', nav_tabs) + var tabIndex = $(error.element).parents('.tab-pane').index() + 1; + if (tabIndex > 0) { + var navTabs = $('.nav-tabs', $(error.element).parents('.tabforms')); + $('li:nth-child(' + tabIndex + ')', navTabs) .removeClassPrefix('state-') .addClass('state-error'); - $('li.state-error:first a', nav_tabs).click(); + $('li.state-error:first a', navTabs).click(); } } } @@ -3401,11 +3399,11 @@ }; $('[data-ams-validate-rules]', form).each(function(index) { if (index === 0) { - data_options.rules = {}; + dataOptions.rules = {}; } - data_options.rules[$(this).attr('name')] = $(this).data('ams-validate-rules'); + dataOptions.rules[$(this).attr('name')] = $(this).data('ams-validate-rules'); }); - var settings = $.extend({}, data_options, data.amsValidateOptions); + var settings = $.extend({}, dataOptions, data.amsValidateOptions); settings = ams.executeFunctionByName(data.amsValidateInitCallback, form, settings) || settings; var plugin = form.validate(settings); ams.executeFunctionByName(data.amsValidateAfterInitCallback, form, plugin, settings); @@ -3452,9 +3450,9 @@ var sortings = sorting.split(';'); sorting = []; for (index=0; index < sortings.length; index++) { - var col_sorting = sortings[index].split(','); - col_sorting[0] = parseInt(col_sorting[0]); - sorting.push(col_sorting); + var colSorting = sortings[index].split(','); + colSorting[0] = parseInt(colSorting[0]); + sorting.push(colSorting); } } // Check columns sortings @@ -3470,17 +3468,17 @@ } } // Check columns types - var sort_types = $('th', table).listattr('data-ams-datatable-stype'); - for (index=0; index < sort_types.length; index++) { - var sort_type = sort_types[index]; - if (sort_type) { + var sortTypes = $('th', table).listattr('data-ams-datatable-stype'); + for (index=0; index < sortTypes.length; index++) { + var sortType = sortTypes[index]; + if (sortType) { column = columns[index] || {}; - column.sType = sort_type; + column.sType = sortType; columns[index] = column; } } // Set options - var data_options = { + var dataOptions = { bJQueryUI: false, bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0, bPaginate: data.amsDatatablePagination !== false, @@ -3496,10 +3494,11 @@ oLanguage: ams.plugins.i18n.datatables, fnInitComplete: function(oSettings, json) { $('.ColVis_Button').addClass('btn btn-default btn-sm') - .html((ams.plugins.i18n.datatables.sColumns || "Columns") + ' '); + .html((ams.plugins.i18n.datatables.sColumns || "Columns") + + ' '); } }; - var settings = $.extend({}, data_options, data.amsDatatableOptions); + var settings = $.extend({}, dataOptions, data.amsDatatableOptions); if (extensions.length > 0) { for (index=0; index < extensions.length; index++) { switch (extensions[index]) { @@ -3522,11 +3521,11 @@ case 'colvis': ams.ajax.check($.fn.dataTable.ColVis, ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js'); - var cv_default = { + var cvDefault = { activate: 'click', sAlign: 'right' }; - settings.oColVis = $.extend({}, cv_default, data.amsDatatableColvisOptions); + settings.oColVis = $.extend({}, cvDefault, data.amsDatatableColvisOptions); break; case 'editable': ams.ajax.check($.fn.editable, @@ -3571,67 +3570,67 @@ for (index=0; index < extensions.length; index++) { switch (extensions[index]) { case 'autofill': - var af_settings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill); - af_settings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, af_settings) || af_settings; + var afSettings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill); + afSettings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, afSettings) || afSettings; table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined ? - new $.fn.dataTable.AutoFill(table, af_settings) - : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, af_settings)); + new $.fn.dataTable.AutoFill(table, afSettings) + : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, afSettings)); break; case 'columnfilter': - var cf_default = { + var cfDefault = { sPlaceHolder: 'head:after' }; - var cf_settings = $.extend({}, cf_default, data.amsDatatableColumnfilterOptions, settings.columnfilter); - cf_settings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cf_settings) || cf_settings; + var cfSettings = $.extend({}, cfDefault, data.amsDatatableColumnfilterOptions, settings.columnfilter); + cfSettings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cfSettings) || cfSettings; table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined ? - plugin.columnFilter(cf_settings) - : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cf_settings)); + plugin.columnFilter(cfSettings) + : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cfSettings)); break; case 'editable': - var ed_settings = $.extend({}, data.amsDatatableEditableOptions, settings.editable); - ed_settings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, ed_settings) || ed_settings; + var edSettings = $.extend({}, data.amsDatatableEditableOptions, settings.editable); + edSettings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, edSettings) || edSettings; table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ? - table.makeEditable(ed_settings) - : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, ed_settings)); + table.makeEditable(edSettings) + : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, edSettings)); break; case 'fixedcolumns': - var fc_settings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns); - fc_settings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fc_settings) || fc_settings; + var fcSettings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns); + fcSettings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fcSettings) || fcSettings; table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined ? - new $.fn.dataTable.FixedColumns(table, fc_settings) - : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fc_settings)); + new $.fn.dataTable.FixedColumns(table, fcSettings) + : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fcSettings)); break; case 'fixedheader': - var fh_settings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader); - fh_settings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fh_settings) || fh_settings; + var fhSettings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader); + fhSettings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fhSettings) || fhSettings; table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined ? - new $.fn.dataTable.FixedHeader(table, fh_settings) - : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fh_settings)); + new $.fn.dataTable.FixedHeader(table, fhSettings) + : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fhSettings)); break; case 'keytable': - var kt_default = { + var ktDefault = { table: table.get(0), datatable: plugin }; - var kt_settings = $.extend({}, kt_default, data.amsDatatableKeytableOptions, settings.keytable); - kt_settings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, kt_settings) || kt_settings; + var ktSettings = $.extend({}, ktDefault, data.amsDatatableKeytableOptions, settings.keytable); + ktSettings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, ktSettings) || ktSettings; table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined ? - new KeyTable(kt_settings) - : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, kt_settings)); + new KeyTable(ktSettings) + : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, ktSettings)); break; case 'rowgrouping': - var rg_settings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping); - rg_settings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rg_settings) || rg_settings; + var rgSettings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping); + rgSettings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rgSettings) || rgSettings; table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ? - table.rowGrouping(rg_settings) - : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rg_settings)); + table.rowGrouping(rgSettings) + : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rgSettings)); break; case 'rowreordering': - var rr_settings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering); - rr_settings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rr_settings) || rr_settings; + var rrSettings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering); + rrSettings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rrSettings) || rrSettings; table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ? - table.rowReordering(rr_settings) - : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rr_settings)); + table.rowReordering(rrSettings) + : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rrSettings)); break; default: break; @@ -3672,7 +3671,7 @@ $(this.cells[0]).removeClass('drag-handle'); }); } - var data_options = { + var dataOptions = { onDragClass: data.amsTabledndDragClass || 'dragging-row', onDragStart: ams.getFunctionByName(data.amsTabledndDragStart), dragHandle: data.amsTabledndDragHandle, @@ -3685,14 +3684,14 @@ $(row).data('ams-disabled-handlers', 'click'); var rows = []; $(dnd_table.rows).each(function() { - var row_id = $(this).data('ams-element-name'); - if (row_id) { - rows.push(row_id); + var rowId = $(this).data('ams-element-name'); + if (rowId) { + rows.push(rowId); } }); - var local_target = ams.getFunctionByName(target); - if (typeof(local_target) === 'function') { - local_target.call(table, dnd_table, rows); + var localTarget = ams.getFunctionByName(target); + if (typeof(localTarget) === 'function') { + localTarget.call(table, dnd_table, rows); } else { ams.ajax.post(target, {names: JSON.stringify(rows)}); } @@ -3704,7 +3703,7 @@ return false; } }; - var settings = $.extend({}, data_options, data.amsTabledndOptions); + var settings = $.extend({}, dataOptions, data.amsTabledndOptions); settings = ams.executeFunctionByName(data.amsTabledndInitCallback, table, settings) || settings; var plugin = table.tableDnD(settings); ams.executeFunctionByName(data.amsTabledndAfterInitCallback, table, plugin, settings); @@ -3742,7 +3741,7 @@ editors.each(function() { var editor = $(this); var data = editor.data(); - var data_options = { + var dataOptions = { theme: "modern", language: ams.lang, plugins: [ @@ -3768,11 +3767,11 @@ if (data.amsTinymceExternalPlugins) { var names = data.amsTinymceExternalPlugins.split(/\s+/); for (var index in names) { - var plugin_src = editor.data('ams-tinymce-plugin-' + names[index]); - tinymce.PluginManager.load(names[index], ams.getSource(plugin_src)); + var pluginSrc = editor.data('ams-tinymce-plugin-' + names[index]); + tinymce.PluginManager.load(names[index], ams.getSource(pluginSrc)); } } - var settings = $.extend({}, data_options, data.amsTinymceOptions); + var settings = $.extend({}, dataOptions, data.amsTinymceOptions); settings = ams.executeFunctionByName(data.amsTinymceInitCallback, editor, settings) || settings; var plugin = editor.tinymce(settings); ams.executeFunctionByName(data.amsTinymceAfterInitCallback, editor, plugin, settings); @@ -3797,7 +3796,7 @@ var image = $(this); var data = image.data(); var parent = data.amsImgareaselectParent ? image.parents(data.amsImgareaselectParent) : 'body'; - var data_options = { + var dataOptions = { instance: true, handles: true, parent: parent, @@ -3818,7 +3817,7 @@ $('input[name="' + target + 'y2"]', parent).val(selection.y2); } }; - var settings = $.extend({}, data_options, data.amsImgareaselectOptions); + var settings = $.extend({}, dataOptions, data.amsImgareaselectOptions); settings = ams.executeFunctionByName(data.amsImgareaselectInitCallback, image, settings) || settings; var plugin = image.imgAreaSelect(settings); ams.executeFunctionByName(data.amsImgareaselectAfterInitCallback, image, plugin, settings); @@ -3868,7 +3867,7 @@ } } } - var data_options = { + var dataOptions = { type: data.amsFancyboxType, padding: data.amsFancyboxPadding || 10, margin: data.amsFancyboxMargin || 10, @@ -3881,7 +3880,7 @@ } } }; - var settings = $.extend({}, data_options, data.amsFancyboxOptions); + var settings = $.extend({}, dataOptions, data.amsFancyboxOptions); settings = ams.executeFunctionByName(data.amsFancyboxInitCallback, fancybox, settings) || settings; var plugin = fancybox.fancybox(settings); ams.executeFunctionByName(data.amsFancyboxAfterInitCallback, fancybox, plugin, settings); @@ -3903,9 +3902,9 @@ function checkPlugin(plugin) { for (var index in $.plot.plugins) { - var plugin_info = $.plot.plugins[index]; - if (plugin_info.name == plugin) { - return plugin_info; + var pluginInfo = $.plot.plugins[index]; + if (pluginInfo.name == plugin) { + return pluginInfo; } } return null; @@ -3913,21 +3912,21 @@ var chart = $(this); var data = chart.data(); - var data_options = {}; + var dataOptions = {}; var plugins = (data.amsChartPlugins || '').split(/\s+/); if (plugins.length > 0) { for (var index in plugins) { - var plugin_name = plugins[index]; - if (!checkPlugin(plugin_name)) { - ams.getScript(ams.baseURL + 'flot/jquery.flot.' + plugin_name + ams.devext + '.js'); + var pluginName = plugins[index]; + if (!checkPlugin(pluginName)) { + ams.getScript(ams.baseURL + 'flot/jquery.flot.' + pluginName + ams.devext + '.js'); } } } - var settings = $.extend({}, data_options, data.amsChartOptions); + var settings = $.extend({}, dataOptions, data.amsChartOptions); settings = ams.executeFunctionByName(data.amsChartInitCallback, chart, settings) || settings; - var chart_data = data.amsChartData; - chart_data = ams.executeFunctionByName(data.amsChartInitData, chart, chart_data) || chart_data; - var plugin = chart.plot(chart_data, settings); + var chartData = data.amsChartData; + chartData = ams.executeFunctionByName(data.amsChartInitData, chart, chartData) || chartData; + var plugin = chart.plot(chartData, settings); ams.executeFunctionByName(data.amsChartAfterInitCallback, chart, plugin, settings); }) }); @@ -3967,10 +3966,10 @@ scrollbars.each(function() { var scrollbar = $(this); var data = scrollbar.data(); - var data_options = { + var dataOptions = { theme: data.amsScrollbarTheme || 'light' }; - var settings = $.extend({}, data_options, data.amsScrollbarOptions); + var settings = $.extend({}, dataOptions, data.amsScrollbarOptions); settings = ams.executeFunctionByName(data.amsScrollbarInitCallback, scrollbar, settings) || settings; var plugin = scrollbar.mCustomScrollbar(settings); ams.executeFunctionByName(data.amsScrollbarAfterInitCallback, scrollbar, plugin, settings); @@ -4060,16 +4059,16 @@ */ messageBox: function(options) { var data = $(this).data(); - var data_options = $.extend({}, options, data.amsMessageboxOptions); - var settings = $.extend({}, data_options, { - title: data.amsMessageboxTitle || data_options.title || '', - content: data.amsMessageboxContent || data_options.content || '', - icon: data.amsMessageboxIcon || data_options.icon, - number: data.amsMessageboxNumber || data_options.number, - timeout: data.amsMessageboxTimeout || data_options.timeout + var dataOptions = $.extend({}, options, data.amsMessageboxOptions); + var settings = $.extend({}, dataOptions, { + title: data.amsMessageboxTitle || dataOptions.title || '', + content: data.amsMessageboxContent || dataOptions.content || '', + icon: data.amsMessageboxIcon || dataOptions.icon, + number: data.amsMessageboxNumber || dataOptions.number, + timeout: data.amsMessageboxTimeout || dataOptions.timeout }); - var status = data.amsMessageboxStatus || data_options.status || 'info'; - var callback = ams.getFunctionByName(data.amsMessageboxCallback || data_options.callback); + var status = data.amsMessageboxStatus || dataOptions.status || 'info'; + var callback = ams.getFunctionByName(data.amsMessageboxCallback || dataOptions.callback); ams.skin.messageBox(status, settings, callback); }, @@ -4089,16 +4088,16 @@ */ smallBox: function(options) { var data = $(this).data(); - var data_options = $.extend({}, options, data.amsSmallboxOptions); - var settings = $.extend({}, data_options, { - title: data.amsSmallboxTitle || data_options.title || '', - content: data.amsSmallboxContent || data_options.content || '', - icon: data.amsSmallboxIcon || data_options.icon, - iconSmall: data.amsSmallboxIconSmall || data_options.iconSmall, - timeout: data.amsSmallboxTimeout || data_options.timeout + var dataOptions = $.extend({}, options, data.amsSmallboxOptions); + var settings = $.extend({}, dataOptions, { + title: data.amsSmallboxTitle || dataOptions.title || '', + content: data.amsSmallboxContent || dataOptions.content || '', + icon: data.amsSmallboxIcon || dataOptions.icon, + iconSmall: data.amsSmallboxIconSmall || dataOptions.iconSmall, + timeout: data.amsSmallboxTimeout || dataOptions.timeout }); - var status = data.amsSmallboxStatus || data_options.status || 'info'; - var callback = ams.getFunctionByName(data.amsSmallboxCallback || data_options.callback); + var status = data.amsSmallboxStatus || dataOptions.status || 'info'; + var callback = ams.getFunctionByName(data.amsSmallboxCallback || dataOptions.callback); ams.skin.smallBox(status, settings, callback); } }; @@ -4169,9 +4168,9 @@ var table = link.parents('table'); var location = table.data('ams-location') || ''; var tr = link.parents('tr'); - var delete_target = tr.data('ams-delete-target') || table.data('ams-delete-target') || 'delete-element.json'; - var object_name = tr.data('ams-element-name'); - MyAMS.ajax.post(location + '/' + delete_target, {'object_name': object_name}, function(result, status) { + var deleteTarget = tr.data('ams-delete-target') || table.data('ams-delete-target') || 'delete-element.json'; + var objectName = tr.data('ams-element-name'); + MyAMS.ajax.post(location + '/' + deleteTarget, {'object_name': objectName}, function(result, status) { if (result.status === 'success') { if (table.hasClass('datatable')) { table.dataTable().fnDeleteRow(tr[0]); @@ -4196,15 +4195,15 @@ * Compute navigation page height */ _setPageHeight: function() { - var main_height = $('#main').height(); - var menu_height = ams.left_panel.height(); - var window_height = $(window).height() - ams.navbar_height; - if (main_height > window_height) { - ams.left_panel.css('min-height', main_height); - ams.root.css('min-height', main_height + ams.navbar_height); + var mainHeight = $('#main').height(); + var menuHeight = ams.left_panel.height(); + var windowHeight = $(window).height() - ams.navbarHeight; + if (mainHeight > windowHeight) { + ams.left_panel.css('min-height', mainHeight); + ams.root.css('min-height', mainHeight + ams.navbarHeight); } else { - ams.left_panel.css('min-height', window_height); - ams.root.css('min-height', window_height); + ams.left_panel.css('min-height', windowHeight); + ams.root.css('min-height', windowHeight); } }, @@ -4263,7 +4262,7 @@ * Initialize desktop and mobile widgets */ _initDesktopWidgets: function(element) { - if (ams.enable_widgets) { + if (ams.enableWidgets) { var widgets = $('.ams-widget', element); if (widgets.length > 0) { ams.ajax.check($.fn.MyAMSWidget, @@ -4272,11 +4271,11 @@ widgets.each(function () { var widget = $(this); var data = widget.data(); - var data_options = { + var dataOptions = { deleteSettingsKey: '#deletesettingskey-options', deletePositionKey: '#deletepositionkey-options' }; - var settings = $.extend({}, data_options, data.amsWidgetOptions); + var settings = $.extend({}, dataOptions, data.amsWidgetOptions); settings = ams.executeFunctionByName(data.amsWidgetInitcallback, widget, settings) || settings; widget.MyAMSWidget(settings); }); @@ -4287,7 +4286,7 @@ }, _initMobileWidgets: function(element) { - if (ams.enable_mobile && ams.enable_widgets) { + if (ams.enableMobile && ams.enableWidgets) { ams.skin._initDesktopWidgets(element); } }, @@ -4471,15 +4470,15 @@ menu.attr('title') || document.title); } else { - var active_url = $('[data-ams-active-menu]').data('ams-active-menu'); - if (active_url) { - menu = $('A[href="' + active_url + '"]', nav); + var activeUrl = $('[data-ams-active-menu]').data('ams-active-menu'); + if (activeUrl) { + menu = $('A[href="' + activeUrl + '"]', nav); } else { menu = $('>UL >LI >A[href!="#"]', nav).first(); } if (menu.exists()) { updateActiveMenus(menu); - if (active_url) { + if (activeUrl) { ams.skin._drawBreadCrumb(); } else { window.location.hash = menu.attr('href'); @@ -4559,11 +4558,11 @@ if (callback) { ams.executeFunctionByName(callback, this, data, status, request, options); } else { - var request_data = ams.ajax.getResponse(request); - var data_type = request_data.content_type; - var result = request_data.data; + var response = ams.ajax.getResponse(request); + var dataType = response.contentType; + var result = response.data; $('.loading', container).remove(); - switch (data_type) { + switch (dataType) { case 'json': ams.ajax.handleJSON(result, container); break; @@ -4609,8 +4608,8 @@ */ setLanguage: function(options) { var lang = options.lang; - var handler_type = options.handler_type || 'json'; - switch (handler_type) { + var handlerType = options.handler_type || 'json'; + switch (handlerType) { case 'json': var method = options.method || 'setUserLanguage'; ams.jsonrpc.post(method, {lang: lang}, function() { @@ -4687,12 +4686,12 @@ ams.plugins.initData(body); // Init main AJAX events - var jquery_xhr = $.ajaxSettings.xhr; + var xhr = $.ajaxSettings.xhr; $.ajaxSetup({ progress: ams.ajax.progress, progressUpload: ams.ajax.progress, xhr: function() { - var request = jquery_xhr(); + var request = xhr(); if (request && (typeof(request.addEventListener) === "function")) { var that = this; request.addEventListener("progress", function(evt) { @@ -4713,7 +4712,7 @@ } else { ams.root.addClass('mobile-detected'); ams.device = 'mobile'; - if (ams.enable_fastclick) { + if (ams.enableFastclick) { ams.ajax.check($.fn.noClickDelay, ams.baseURL + '/ext/jquery-smartclick' + ams.devext + '.js', function() { @@ -4788,9 +4787,9 @@ if (href) { e.preventDefault(); e.stopPropagation(); - var href_getter = ams.getFunctionByName(href); - if (typeof(href_getter) === 'function') { - href = href_getter.call(this); + var hrefGetter = ams.getFunctionByName(href); + if (typeof(hrefGetter) === 'function') { + href = hrefGetter.call(this); } if (typeof(href) === 'function') { // Javascript function call @@ -4826,7 +4825,7 @@ var nav = $('nav'); $('UL', nav).myams_menu({ accordion : nav.data('ams-menu-accordion') !== false, - speed : ams.menu_speed + speed : ams.menuSpeed }); // Left navigation collapser @@ -4875,7 +4874,7 @@ }); // Init AJAX navigation - if (ams.ajax_nav) { + if (ams.ajaxNav) { $(document).on('click', 'a[href="#"]', function(e) { e.preventDefault(); }); @@ -4891,9 +4890,9 @@ } e.preventDefault(); e.stopPropagation(); - var href_getter = ams.getFunctionByName(href); - if (typeof(href_getter) === 'function') { - href = href_getter.call(link); + var hrefGetter = ams.getFunctionByName(href); + if (typeof(hrefGetter) === 'function') { + href = hrefGetter.call(link); } if (typeof(href) === 'function') { // Javascript function call @@ -5105,7 +5104,7 @@ // Init page content ams.initContent(document); - if (ams.ajax_nav && nav.exists()) { + if (ams.ajaxNav && nav.exists()) { ams.skin.checkURL(); } ams.form.setFocus(document); diff -r 29cd533bd7e4 -r 6a846ca3ba84 src/pyams_skin/resources/js/myams.min.js --- a/src/pyams_skin/resources/js/myams.min.js Thu Oct 06 11:53:42 2016 +0200 +++ b/src/pyams_skin/resources/js/myams.min.js Thu Oct 06 15:44:22 2016 +0200 @@ -1,1 +1,1 @@ -(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('
').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l',openedSign:''};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append(""+f.closedSign+"");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var m=c(this);if(m.hasClass("active")){return}var k=m.attr("href").replace(/^#/,"");var i=m.parent().find("UL");if(f.accordion){var l=m.parent().parents("UL");var n=h.find("UL:visible");n.each(function(o){var q=true;l.each(function(r){if(l[r]===n[o]){q=false;return false}});if(q){if(i!==n[o]){var p=c(n[o]);if(k||!p.hasClass("active")){p.slideUp(f.speed,function(){c(this).parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}}}})}var j=m.parent().find("UL:first");if(!k&&j.is(":visible")&&!j.hasClass("active")){j.slideUp(f.speed,function(){m.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{j.slideDown(f.speed,function(){m.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.generateUUID=function(){var f=new Date().getTime();var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(h){var g=(f+Math.random()*16)%16|0;f=Math.floor(f/16);return(h=="x"?g:(g&3|8)).toString(16)});return e};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(j,e,i,f){if(e.statusText==="OK"){return}var h=a.ajax.getResponse(e);if(h.content_type==="json"){a.ajax.handleJSON(h.data)}else{var k=j.statusText||j.type;var g=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

"+k+"

"+g+"

",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(j);b.console.debug(e)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.content_type==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"

"+e+"

"+g+"

",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result}};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var g=h.getResponseHeader("content-type"),j,f;if(g){if(g.startsWith("application/javascript")){j="script";f=h.responseText}else{if(g.startsWith("text/html")){j="html";f=h.responseText}else{if(g.startsWith("text/xml")){j="xml";f=h.responseText}else{f=h.responseJSON;if(f){j="json"}else{try{f=JSON.parse(h.responseText);j="json"}catch(i){f=h.responseText;j="text"}}}}}}else{j="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:j,data:f}},handleJSON:function(p,g,l){var j=p.status;var e;switch(j){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||l||"#content");break;case"redirect":a.form.resetChanged(g);if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+j)}}var k;var m;var f;if(p.content){m=p.content;f=c(m.target||l||g||"#content");if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}if(p.contents){var i=p.contents;for(k=0;k  '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){h.call(g)}})}}else{h.call(g)}},setChanged:function(e){e.attr("data-ams-form-changed",true)},resetChanged:function(e){e.removeAttr("data-ams-form-changed")},submit:function(g,f,h){g=c(g);if(!g.exists()){return false}if(typeof(f)==="object"){h=f;f=undefined}if(g.data("submitted")){if(!g.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:g.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(g)){return false}c(".alert-danger, SPAN.state-error",g).not(".persistent").remove();c(".state-error",g).removeClassPrefix("state-");var e=c(g.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(m,p){var l,u,E;var K=m.data();var z=K.amsFormOptions;var o;var r;var H;var v;var F;var C;function n(O,P){var N;function M(){l.button("reset");clearInterval(N);a.executeFunctionByName(C,m,l)}function L(){a.ajax.post(O,{progress_id:P},{error:M},a.getFunctionByName(F)||function(Q,R){if(R=="success"){if(Q.status==="running"){if(Q.message){l.text(Q.message)}else{l.text(l.data("ams-progress-text")+" "+Q.current+" / "+Q.length)}}else{if(Q.status==="finished"){M()}}}else{M()}})}l.button("loading");N=setInterval(L,v)}if(h){r=h.formDataInitCallback}if(r){delete h.formDataInitCallback}else{r=K.amsFormDataInitCallback}if(r){var A={};if(typeof(r)==="function"){o=r.call(m,A)}else{o=a.executeFunctionByName(r,m,A)}if(A.veto){l=m.data("ams-submit-button");if(l){l.button("reset")}a.form.finalizeSubmitFooter.call(m);return false}}else{o=K.amsFormData||{}}l=c(m.data("ams-submit-button"));if(l&&l.exists()){u=l.data();E=u.amsFormSubmitTarget}else{u={}}var q;var w=f||u.amsFormHandler||K.amsFormHandler||"";if(w.startsWith(window.location.protocol)){q=w}else{var D=u.amsFormAction||m.attr("action").replace(/#/,"");if(D.startsWith(window.location.protocol)){q=D}else{q=a.ajax.getAddr()+D}q+=w}H=u.amsProgressHandler||K.amsProgressHandler||"";v=u.amsProgressInterval||K.amsProgressInterval||1000;F=u.amsProgressCallback||K.amsProgressCallback;C=u.amsProgressEndCallback||K.amsProgressEndCallback;var J=null;if(h&&h.initSubmitTarget){a.executeFunctionByName(h.initSubmitTarget,m)}else{if(K.amsFormInitSubmitTarget){J=c(E||K.amsFormSubmitTarget||"#content");a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmit",m,J)}else{if(!K.amsFormHideSubmitFooter){a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",m)}}}if(h){o=c.extend({},o,h.form_data)}var s;if(H){o.progress_id=a.generateUUID()}else{s=typeof(p.uuid)!=="undefined";if(s){if(q.indexOf("X-Progress-ID")<0){q+="?X-Progress-ID="+p.uuid}delete p.uuid}}var x={url:q,type:"post",cache:false,data:o,dataType:K.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(M,L){L.data("submitted",true)},error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},iframe:s};var B=(h&&h.downloadTarget)||K.amsFormDownloadTarget;if(B){var t=c('iframe[name="'+B+'"]');if(!t.exists()){t=c("").hide().attr("name",B).appendTo(c("body"))}x=c.extend({},x,{iframe:true,iframeTarget:t,success:function(L,M,Q,P){var O=c(P).parents(".modal-dialog");if(O.exists()){a.dialog.close(P)}else{var R;var N=P.data("ams-submit-button");if(N){R=N.data("ams-form-submit-callback")}if(!R){R=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{R.call(P,L,M,Q,P)}finally{a.form.resetAfterSubmit(P);a.form.resetChanged(P)}}}})}else{x=c.extend({},x,{error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},success:function(L,M,P,O){var Q;var N=O.data("ams-submit-button");if(N){Q=N.data("ams-form-submit-callback")}if(!Q){Q=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{Q.call(O,L,M,P,O)}finally{a.form.resetAfterSubmit(O);a.form.resetChanged(O)}},iframe:s})}var I=c.extend({},x,p,z,h);if(H){n(H,o.progress_id)}c(m).ajaxSubmit(I);if(B){var G=c(m).parents(".modal-dialog");var y=G.exists()&&l.exists()&&l.data("ams-keep-modal");if(G.exists()&&(y!==true)){a.dialog.close(m)}else{setTimeout(function(){a.form.resetAfterSubmit(m,l);a.form.resetChanged(m)},l.data("ams-form-reset-timeout")||2000)}}}var j=(g.data("ams-form-ignore-uploads")!==true)&&(c('INPUT[type="file"]',g).length>0);if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(g)});k(g,i)}else{k(g,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='';if(!f){f=e.data("ams-form-submit-message")}if(f){h+=""+f+""}c(g).html('
'+h+"
");c(g).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(f){if(f.is(":visible")){var e=f.data("ams-submit-button");if(e){e.button("reset")}a.form.finalizeSubmitFooter.call(f)}f.data("submitted",false);f.removeData("ams-submit-button")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+=''+f+""}var g=c("footer",e);c("button",g).hide();g.append('
'+h+"
")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,g,f,e){var i;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);i=e.data("ams-submit-button");if(i){i.button("reset")}}var h=e.data();var l;if(h.amsFormDatatype){l=h.amsFormDatatype}else{var j=a.ajax.getResponse(f);l=j.content_type;o=j.data}var k;if(i){k=c(i.data("ams-form-submit-target")||h.amsFormSubmitTarget||"#content")}else{k=c(h.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:a.form.resetChanged(e);if(i&&(i.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k);a.form.setFocus(k)}var m=f.getResponseHeader("X-AMS-Callback");if(m){var n=f.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),f)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,m){var i;if(typeof(m)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,m)}else{if(m instanceof Array){i=m.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,m)}else{c(".state-error",e).removeClass("state-error");i=m.error_header||(m.widgets&&(m.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var l;if(m.messages){for(l=0;l"+f.header+"
"+f.message)}else{n.push(f.message||f)}}}if(m.widgets){for(l=0;l'+g.message+"");if(g.label){n.push(g.label+" : "+g.message)}var k=j.parents(".tab-pane").index()+1;if(k>0){var h=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+k+")",h).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(c("fieldset:first",e),m.error_level||"error",i,n,m.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='
'}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(n,m,l){c("body").modalmanager("removeLoading");var o=a.ajax.getResponse(l);var t=o.content_type;var u=o.data;switch(t){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var p=c(u);var r=c(".modal-dialog",p.wrap("
").parent());var q=r.data();var s={backdrop:"static",overflow:q.amsModalOverflow||".modal-viewport",maxHeight:q.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",p).outerHeight(true)-c("footer",p).outerHeight(true)-85}:a.getFunctionByName(q.amsModalMaxHeight)};var k=c.extend({},s,q.amsModalOptions);k=a.executeFunctionByName(q.amsModalInitCallback,r,k)||k;c("
").addClass("modal fade").append(p).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(p);if(i.amsLogEvent!==false){a.stats.logPageview(h)}}}})}})})},shown:function(m){function l(o){var p=c(".scrollmarker.top",f);var n=f.scrollTop();if(n>0){p.show()}else{p.hide()}var e=c(".scrollmarker.bottom",f);if(j+n>=f.get(0).scrollHeight){e.hide()}else{e.show()}}var k=m.target;var f=c(".modal-viewport",k);if(f.exists()){var j=parseInt(f.css("max-height"));var h=c.scrollbarWidth();if((f.css("overflow")!=="hidden")&&(f.height()===j)){c("
").addClass("scrollmarker").addClass("top").css("top",0).css("width",f.width()-h).hide().appendTo(f);c("
").addClass("scrollmarker").addClass("bottom").css("top",j-20).css("width",f.width()-h).appendTo(f);f.scroll(l);f.off("resize").on("resize",l)}else{c(".scrollmarker",f).remove()}}var g;var i=c(".modal-dialog",k).data("shown-callbacks");if(i){for(g=0;g=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f"+g.error_message+"",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

"+f.error_message+"

",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var e=i.data();if(e.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||e.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var g=a.getFunctionByName(f);if(typeof(g)==="function"){f=g.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(j){a.plugins.initData(j);var i=[];c("[data-ams-plugins-disabled]",j).each(function(){var o=c(this).data("ams-plugins-disabled").split(/\s+/);for(var p=0;p=0){continue}var m=a.plugins.enabled[l];if(m){switch(typeof(m)){case"function":m(j);break;default:for(var f=0;f=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var k=c(this);var j=k.data();var h={html:j.amsHintHtml,title:a.getFunctionByName(j.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(j.amsHintTitleAttr||"title")||(j.amsHintHtml?l.html():l.text())},opacity:j.amsHintOpacity||0.95,gravity:j.amsHintGravity||"sw",offset:j.amsHintOffset||0};var g=c.extend({},h,j.amsHintOptions);g=a.executeFunctionByName(j.amsHintInitCallback,k,g)||g;var i=k.tipsy(g);a.executeFunctionByName(j.amsHintAfterInitCallback,k,i,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={menuSelector:j.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},h,j.amsContextmenuOptions);g=a.executeFunctionByName(j.amsContextmenuInitCallback,k,g)||g;var i=k.contextMenu(g);a.executeFunctionByName(j.amsContextmenuAfterInitCallback,k,i,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var q=c(this);var r=q.parent("fieldset");var h=q.data();if(!h.amsChecker){var f=c('');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var o=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(q)}else{if(g){c('').attr("name",g).attr("value",1).prependTo(q)}}var p=c('').attr("name",k).attr("id",o).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){p.attr("disabled","disabled")}else{p.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");q.trigger("ams.checker.before-switch",[q,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,q,v);if(!h.amsCheckerCancelDefault){var t=p.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");q.trigger("ams.checker.opened",[q])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");q.trigger("ams.checker.closed",[q])}}})}p.appendTo(f);c(">label",q).attr("for",p.attr("id"));f.append("").prependTo(q);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){p.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}q.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider-2.0.0"+a.devext+".js",function(){f.each(function(){var j=c(this);var k=j.data();var h={};var g=c.extend({},h,j.data.amsSliderOptions);g=a.executeFunctionByName(k.amsSliderInitCallback,j,g)||g;var i=j.slider(g);a.executeFunctionByName(k.amsSliderAfterInitCallback,j,i,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={containment:k.amsDraggableContainment,helper:a.getFunctionByName(k.amsDraggableHelper)||k.amsDraggableHelper,start:a.getFunctionByName(k.amsDraggableStart),stop:a.getFunctionByName(k.amsDraggableStop)};var h=c.extend({},i,k.amsDraggableOptions);h=a.executeFunctionByName(k.amsDraggableInitCallback,g,h)||h;var j=g.draggable(h);g.disableSelection();a.executeFunctionByName(k.amsDraggableAfterInitCallback,g,j,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={items:j.amsSortableItems,handle:j.amsSortableHandle,connectWith:j.amsSortableConnectwith,start:a.getFunctionByName(j.amsSortableStart),over:a.getFunctionByName(j.amsSortableOver),containment:j.amsSortableContainment,placeholder:j.amsSortablePlaceholder,stop:a.getFunctionByName(j.amsSortableStop)};var g=c.extend({},h,j.amsSortableOptions);g=a.executeFunctionByName(j.amsSortableInitCallback,k,g)||g;var i=k.sortable(g);k.disableSelection();a.executeFunctionByName(j.amsSortableAfterInitCallback,k,i,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={autoHide:k.amsResizableAutohide===false?true:k.amsResizableAutohide,containment:k.amsResizableContainment,grid:k.amsResizableGrid,handles:k.amsResizableHandles,start:a.getFunctionByName(k.amsResizableStart),stop:a.getFunctionByName(k.amsResizableStop)};var h=c.extend({},i,k.amsResizableOptions);h=a.executeFunctionByName(k.amsResizableInitCallback,g,h)||h;var j=g.resizable(h);g.disableSelection();a.executeFunctionByName(k.amsResizableAfterInitCallback,g,j,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={};var h=c.extend({},i,k.amsTypeaheadOptions);h=a.executeFunctionByName(k.amsTypeaheadInitCallback,g,h)||h;var j=g.typeahead(h);a.executeFunctionByName(k.amsTypeaheadAfterInitCallback,g,j,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var l=g.data();var j={placeholder:l.amsSelect2Placeholder,multiple:l.amsSelect2Multiple,minimumInputLength:l.amsSelect2MinimumInputLength||0,maximumSelectionSize:l.amsSelect2MaximumSelectionSize,openOnEnter:l.amsSelect2EnterOpen===undefined?true:l.amsSelect2EnterOpen,allowClear:l.amsSelect2AllowClear===undefined?true:l.amsSelect2AllowClear,width:l.amsSelect2Width||"100%",initSelection:a.getFunctionByName(l.amsSelect2InitSelection),formatSelection:l.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(l.amsSelect2FormatSelection),formatResult:a.getFunctionByName(l.amsSelect2FormatResult),formatMatches:l.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(l.amsSelect2FormatMatches),formatNoMatches:l.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(l.amsSelect2FormatResult),formatInputTooShort:l.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooShort),formatInputTooLong:l.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooLong),formatSelectionTooBig:l.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatSelectionTooBig),formatLoadMore:l.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(l.amsSelect2FormatLoadMore),formatSearching:l.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(l.amsSelect2FormatSearching),separator:l.amsSelect2Separator||",",tokenSeparators:l.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(l.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!j.initSelection){var h=g.data("ams-select2-values");if(h){j.initSelection=function(m,o){var n=[];c(m.val().split(j.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){j.query=function(){return[]}}}else{if(l.amsSelect2Query){j.query=a.getFunctionByName(l.amsSelect2Query);j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryUrl){j.ajax={url:l.amsSelect2QueryUrl,quietMillis:l.amsSelect2QuietMillis||200,type:l.amsSelect2QueryType||"POST",dataType:l.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[l.amsSelect2QueryParamName||"query"]=o;m[l.amsSelect2PageParamName||"page"]=p;m[l.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,l.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryMethod){j.query=function(m){var n={id:new Date().getTime(),params:l.amsSelect2QueryParams||{},success:function(o){return a.helpers.select2QueryMethodSuccessCallback.call(g,o,"success",m)},error:a.error.show};n.params[l.amsSelect2QueryParamName||"query"]=m.term;n.params[l.amsSelect2PageParamName||"page"]=m.page;n.params[l.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,l.amsSelect2QueryOptions);n=a.executeFunctionByName(l.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRPC,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){c.jsonRPC.withOptions({endPoint:l.amsSelect2MethodTarget||a.jsonrpc.getAddr(),namespace:l.amsSelect2MethodNamespace,cache:false},function(){c.jsonRPC.request(l.amsSelect2QueryMethod,n)})})};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2Tags){j.tags=l.amsSelect2Tags}else{if(l.amsSelect2Data){j.data=l.amsSelect2Data}}}}}}if(l.amsSelect2EnableFreeTags){j.createSearchChoice=function(m){return{id:m,text:(l.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},j,l.amsSelect2Options);i=a.executeFunctionByName(l.amsSelect2InitCallback,g,i)||i;var k=g.select2(i);a.executeFunctionByName(l.amsSelect2AfterInitCallback,g,k,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.4.1"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={placeholder:k.amsMaskeditPlaceholder===undefined?"X":k.amsMaskeditPlaceholder,complete:a.getFunctionByName(k.amsMaskeditComplete)};var h=c.extend({},i,k.amsMaskeditOptions);h=a.executeFunctionByName(k.amsMaskeditInitCallback,g,h)||h;var j=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(k.amsMaskeditAfterInitCallback,g,j,h)})})}},inputmask:function(f){var e=c("[data-input-mask]",f);if(e.length>0){a.ajax.check(c.fn.inputmask,a.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i;if(typeof(k.inputMask)==="object"){i=k.inputMask}else{i={mask:k.inputMask.toString()}}var h=c.extend({},i,k.amsInputmaskOptions);h=a.executeFunctionByName(k.amsInputmaskInitCallback,g,h)||h;var j=g.inputmask(h);a.executeFunctionByName(k.amsInputmaskAfterInitCallback,g,j,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var l=h.data();var j={position:l.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},j,l.amsColorpickerOptions);i=a.executeFunctionByName(l.amsColorpickerInitCallback,h,i)||i;var k=h.minicolors(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var m=c(this);var n=m.data();var k={ignore:null,submitHandler:m.attr("data-async")!==undefined?n.amsFormSubmitHandler===undefined?function(){c(".state-error",m).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(m)}:a.getFunctionByName(n.amsFormSubmitHandler):undefined,invalidHandler:m.attr("data-async")!==undefined?n.amsFormInvalidHandler===undefined?function(s,r){c(".state-error",m).removeClass("state-error");for(var p=0;p0){var t=c(".nav-tabs",c(o.element).parents(".tabforms"));c("li:nth-child("+q+")",t).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",t).click()}}}:a.getFunctionByName(n.amsFormInvalidHandler):undefined};c("[data-ams-validate-rules]",m).each(function(o){if(o===0){k.rules={}}k.rules[c(this).attr("name")]=c(this).data("ams-validate-rules")});var j=c.extend({},k,n.amsValidateOptions);j=a.executeFunctionByName(n.amsValidateInitCallback,m,j)||j;var l=m.validate(j);a.executeFunctionByName(n.amsValidateAfterInitCallback,m,l,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var F=c(this);var K=F.data();var H=(K.amsDatatableExtensions||"").split(/\s+/);var n=K.amsDatatableSdom||"W"+((H.indexOf("colreorder")>=0||H.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(H.indexOf("colvis")>=0?"C":"")+((K.amsDatatablePagination===false||K.amsDatatablePaginationSize===false)?"":"L")+(K.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(H.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(K.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var q;var i=K.amsDatatableSorting;if(typeof(i)==="string"){var I=i.split(";");i=[];for(q=0;q=0,bPaginate:K.amsDatatablePagination!==false,bInfo:K.amsDatatableInfo!==false,bSort:K.amsDatatableSort!==false,aaSorting:i,aoColumns:h.length>0?h:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:K.amsDatatableDisplayLength||25,sPaginationType:K.amsDatatablePaginationType||"bootstrap_full",sDom:n,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(M,L){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var G=c.extend({},A,K.amsDatatableOptions);if(H.length>0){for(q=0;q0){for(q=0;q0){for(q=0;q0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var k=c(this);var l=k.data();if(l.amsTabledndDragHandle){c("tr",k).addClass("no-drag-handle")}else{c(k).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")})}var i={onDragClass:l.amsTabledndDragClass||"dragging-row",onDragStart:a.getFunctionByName(l.amsTabledndDragStart),dragHandle:l.amsTabledndDragHandle,scrollAmount:l.amsTabledndScrollAmount,onAllowDrop:l.amsTabledndAllowDrop,onDrop:a.getFunctionByName(l.amsTabledndDrop)||function(o,q){var n=l.amsTabledndDropTarget;if(n){c(q).data("ams-disabled-handlers","click");var m=[];c(o.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var p=a.getFunctionByName(n);if(typeof(p)==="function"){p.call(k,o,m)}else{a.ajax.post(n,{names:JSON.stringify(m)})}setTimeout(function(){c(q).removeData("ams-disabled-handlers")},50)}return false}};var h=c.extend({},i,l.amsTabledndOptions);h=a.executeFunctionByName(l.amsTabledndInitCallback,k,h)||h;var j=k.tableDnD(h);a.executeFunctionByName(l.amsTabledndAfterInitCallback,k,j,h)})})}},tinymce:function(e){function h(){c(".tinymce",c(this)).each(function(){var i=tinymce.get(c(this).attr("id"));if(i){i.remove()}})}var f=c(".tinymce",e);if(f.length>0){var g=a.baseURL+"ext/tinymce"+(a.devmode?"/dev":"");a.ajax.check(window.tinymce,g+"/tinymce"+a.devext+".js",function(i){if(i){a.getScript(g+"/jquery.tinymce"+a.devext+".js");tinymce.baseURL=g;tinymce.suffix=a.devext;a.skin.registerCleanCallback(h)}f.each(function(){var m=c(this);var p=m.data();var l={theme:"modern",language:a.lang,plugins:["advlist autosave autolink lists link image charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code","insertdatetime media nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern"],toolbar1:"newdocument undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",toolbar2:"print preview media | forecolor backcolor emoticons | code",content_css:p.amsTinymceContentCss,formats:p.amsTinymceFormats,style_formats:p.amsTinymceStyleFormats,block_formats:p.amsTinymceBlockFormats,valid_classes:p.amsTinymceValidClasses,image_advtab:true,image_list:a.getFunctionByName(p.amsTinymceImageList)||p.amsTinymceImageList,image_class_list:p.amsTinymceImageClassList,link_list:a.getFunctionByName(p.amsTinymceLinkList)||p.amsTinymceLinkList,link_class_list:p.amsTinymceLinkClassList,resize:true};if(p.amsTinymceExternalPlugins){var q=p.amsTinymceExternalPlugins.split(/\s+/);for(var j in q){var o=m.data("ams-tinymce-plugin-"+q[j]);tinymce.PluginManager.load(q[j],a.getSource(o))}}var k=c.extend({},l,p.amsTinymceOptions);k=a.executeFunctionByName(p.amsTinymceInitCallback,m,k)||k;var n=m.tinymce(k);a.executeFunctionByName(p.amsTinymceAfterInitCallback,m,n,k)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var m=c(this);var l=m.data();var j=l.amsImgareaselectParent?m.parents(l.amsImgareaselectParent):"body";var i={instance:true,handles:true,parent:j,x1:l.amsImgareaselectX1||0,y1:l.amsImgareaselectY1||0,x2:l.amsImgareaselectX2||l.amsImgareaselectImageWidth,y2:l.amsImgareaselectY2||l.amsImgareaselectImageHeight,imageWidth:l.amsImgareaselectImageWidth,imageHeight:l.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:l.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(l.amsImgareaselectSelectEnd)||function(n,o){var p=l.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',j).val(o.x1);c('input[name="'+p+'y1"]',j).val(o.y1);c('input[name="'+p+'x2"]',j).val(o.x2);c('input[name="'+p+'y2"]',j).val(o.y2)}};var h=c.extend({},i,l.amsImgareaselectOptions);h=a.executeFunctionByName(l.amsImgareaselectInitCallback,m,h)||h;var k=m.imgAreaSelect(h);a.executeFunctionByName(l.amsImgareaselectAfterInitCallback,m,k,h);setTimeout(function(){k.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var o=h.data();var n=(o.amsFancyboxHelpers||"").split(/\s+/);if(n.length>0){for(var i=0;i0){a.ajax.check(c.fn.plot,a.baseURL+"flot/jquery.flot"+a.devext+".js",function(){f.each(function(){function k(r){for(var q in c.plot.plugins){var s=c.plot.plugins[q];if(s.name==r){return s}}return null}var m=c(this);var i=m.data();var p={};var h=(i.amsChartPlugins||"").split(/\s+/);if(h.length>0){for(var l in h){var n=h[l];if(!k(n)){a.getScript(a.baseURL+"flot/jquery.flot."+n+a.devext+".js")}}}var g=c.extend({},p,i.amsChartOptions);g=a.executeFunctionByName(i.amsChartInitCallback,m,g)||g;var o=i.amsChartData;o=a.executeFunctionByName(i.amsChartInitData,m,o)||o;var j=m.plot(o,g);a.executeFunctionByName(i.amsChartAfterInitCallback,m,j,g)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var k=l.data();var i={theme:k.amsScrollbarTheme||"light"};var h=c.extend({},i,k.amsScrollbarOptions);h=a.executeFunctionByName(k.amsScrollbarInitCallback,l,h)||h;var j=l.mCustomScrollbar(h);a.executeFunctionByName(k.amsScrollbarAfterInitCallback,l,j,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsMessageboxOptions);var g=c.extend({},h,{title:i.amsMessageboxTitle||h.title||"",content:i.amsMessageboxContent||h.content||"",icon:i.amsMessageboxIcon||h.icon,number:i.amsMessageboxNumber||h.number,timeout:i.amsMessageboxTimeout||h.timeout});var e=i.amsMessageboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsMessageboxCallback||h.callback);a.skin.messageBox(e,g,j)},smallBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsSmallboxOptions);var g=c.extend({},h,{title:i.amsSmallboxTitle||h.title||"",content:i.amsSmallboxContent||h.content||"",icon:i.amsSmallboxIcon||h.icon,iconSmall:i.amsSmallboxIconSmall||h.iconSmall,timeout:i.amsSmallboxTimeout||h.timeout});var e=i.amsSmallboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsSmallboxCallback||h.callback);a.skin.smallBox(e,g,j)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var k=f.parents("table");var h=k.data("ams-location")||"";var l=f.parents("tr");var j=l.data("ams-delete-target")||k.data("ams-delete-target")||"delete-element.json";var g=l.data("ams-element-name");d.ajax.post(h+"/"+j,{object_name:g},function(m,n){if(m.status==="success"){if(k.hasClass("datatable")){k.dataTable().fnDeleteRow(l[0])}else{l.remove()}}})}})}}};d.skin={_setPageHeight:function(){var g=c("#main").height();var e=a.left_panel.height();var f=c(window).height()-a.navbar_height;if(g>f){a.left_panel.css("min-height",g);a.root.css("min-height",g+a.navbar_height)}else{a.left_panel.css("min-height",f);a.root.css("min-height",f)}},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c(".badge","#user-activity >span");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},refreshNotificationsPanel:function(g){var f=c(this);f.addClass("disabled");c("i",f).addClass("fa-spin");c('input[name="activity"]:checked',"#user-activity").change();c("i",f).removeClass("fa-spin");f.removeClass("disabled")},_initDesktopWidgets:function(e){if(a.enable_widgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var j=c(this);var i=j.data();var h={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},h,i.amsWidgetOptions);g=a.executeFunctionByName(i.amsWidgetInitcallback,j,g)||g;j.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){if(f==="error"){f="danger"}c(".alert-"+f,l).remove();var i='

'+g+"

"+(k?("

"+k+"

"):"");if(typeof(m)==="string"){i+="
  • "+m+"
"}else{if(m){i+="
    ";for(var h in m){if(!c.isNumeric(h)){continue}i+="
  • "+m[h]+"
  • "}i+="
"}}i+="
";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("OL.breadcrumb","#ribbon");c("li",e).not(".parent").remove();if(!c("li",e).exists()){e.append(c("
  • ").append(c("").text(a.i18n.HOME).addClass("padding-right-5").attr("href",c('nav a[href!="#"]:first').attr("href"))))}c("LI.active >A","nav").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("
  • ").append(h.attr("href").replace(/^#/,"")?c("").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(m){c(".active",j).removeClass("active");m.addClass("open").addClass("active");m.parents("li").addClass("open active").children("ul").addClass("active").show();m.parents("li:first").removeClass("open");m.parents("ul").addClass(m.attr("href").replace(/^#/,"")?"active":"").show()}var k;var j=c("nav");var i=location.hash;var g=i.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}k=c('A[href="'+i+'"]',j);if(k.exists()){e(k)}a.skin.loadURL(g,f);var h=c("html head title").data("ams-title-prefix");document.title=(h?h+" > ":"")+(c("[data-ams-page-title]:first",f).data("ams-page-title")||k.attr("title")||document.title)}else{var l=c("[data-ams-active-menu]").data("ams-active-menu");if(l){k=c('A[href="'+l+'"]',j)}else{k=c('>UL >LI >A[href!="#"]',j).first()}if(k.exists()){e(k);if(l){a.skin._drawBreadCrumb()}else{window.location.hash=k.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},unregisterCleanCallback:function(g){var f=a.skin._clean_callbacks;var e=f.indexOf(g);if(e>=0){f.splice(e,1)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f Loading... ');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();var k=c("html head title").data("ams-title-prefix");document.title=(k?k+" > ":"")+c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(o,l,n){if(j){a.executeFunctionByName(j,this,o,l,n,f)}else{var m=a.ajax.getResponse(n);var p=m.content_type;var k=m.data;c(".loading",e).remove();switch(p){case"json":a.ajax.handleJSON(k,e);break;case"script":break;case"xml":break;case"html":case"text":default:e.parents(".hidden").removeClass("hidden");c(".alert",e.parents(".alerts-container")).remove();e.css({opacity:"0.0"}).html(o).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(e);a.form.setFocus(e)}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}a.stats.logPageview()}},error:function(m,l,k){e.html('

    '+a.i18n.ERROR+k+"

    "+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logPageview:function(f){if(typeof(b._gaq)==="undefined"){return}var e=b.window.location;b._gaq.push(["_trackPageview",f||e.pathname+e.hash])},logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.left_panel=c("#left-panel");a.shortcuts=c("#shortcuts");a.plugins.initData(e);var f=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var i=f();if(i&&(typeof(i.addEventListener)==="function")){var h=this;i.addEventListener("progress",function(j){h.progress(j)},false)}return i}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enable_fastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("A","#hide-menu").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(h){e.toggleClass("hidden-menu");h.preventDefault()});c("#show-shortcuts").click(function(h){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}h.preventDefault()});a.shortcuts.click(function(h){a.skin._hideShortcutButtons()});c(document).mouseup(function(h){if(!a.shortcuts.is(h.target)&&a.shortcuts.has(h.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c(".activity-button","#user-activity").click(function(i){var h=c("#user-activity");var j=c(".ajax-dropdown",h);if(!j.is(":visible")){j.css("left",-j.innerWidth()+h.innerWidth()).fadeIn(150);h.addClass("active")}else{j.fadeOut(150);h.removeClass("active")}i.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(h){var i=c(".ajax-dropdown");if(!i.is(h.target)&&i.has(h.target).length===0){i.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(k){var i=c(this).data("ams-url");if(i){k.preventDefault();k.stopPropagation();var j=a.getFunctionByName(i);if(typeof(j)==="function"){i=j.call(this)}if(typeof(i)==="function"){i.call(this)}else{var h=c(".ajax-notifications");a.skin.loadURL(i,h)}}});c("a","#user-menu LI.logout").click(function(h){h.preventDefault();h.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:" "+a.i18n.LOGOUT+" "+c("#show-shortcut").text()+" ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(i){if(i===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});var g=c("nav");c("UL",g).myams_menu({accordion:g.data("ams-menu-accordion")!==false,speed:a.menu_speed});c(".minifyme").click(function(h){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);h.preventDefault()});c("#refresh").click(function(h){a.skin.bigBox({title:" "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(i){if(i===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});h.preventDefault()});e.on("click",function(i){var h=c(this);if(!h.is(i.target)&&h.has(i.target).length===0&&c(".popover").has(i.target).length===0){h.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});g.resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){c(document).on("click",'a[href="#"]',function(h){h.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(m){var k=c(m.currentTarget);var i=k.data("ams-disabled-handlers");if((i===true)||(i==="click")||(i==="all")){return}var h=k.attr("href")||k.data("ams-url");if(!h||h.startsWith("javascript")||k.attr("target")||(k.data("ams-context-menu")===true)){return}m.preventDefault();m.stopPropagation();var j=a.getFunctionByName(h);if(typeof(j)==="function"){h=j.call(k)}if(typeof(h)==="function"){h.call(k)}else{h=h.replace(/\%23/,"#");var l=k.data("ams-target");if(l){a.form.confirmChangedForm(l,function(){a.skin.loadURL(h,l,k.data("ams-link-options"),k.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(h.startsWith("#")){if(h!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=h},50)}else{window.location.hash=h}}}else{window.location=h}})}}});c(document).on("click",'a[target="_blank"]',function(i){i.preventDefault();var h=c(i.currentTarget);window.open(h.attr("href"));a.stats.logEvent(h.data("ams-stats-category")||"Navigation",h.data("ams-stats-action")||"External",h.data("ams-stats-label")||h.attr("href"))});c(document).on("click",'a[target="_top"]',function(h){h.preventDefault();a.form.confirmChangedForm(function(){window.location=c(h.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(j){var i=c(this);var h=i.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}if(i.data("ams-context-menu")===true){return}if(i.data("ams-stop-propagation")===true){j.stopPropagation()}j.preventDefault();a.dialog.open(i);if(i.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var h=c(this);c(h.get(0).form).data("ams-submit-button",h)});c(document).on("click",'input[type="checkbox"][readonly]',function(){return false});c(document).on("click","[data-ams-click-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}var i=j.data();if(i.amsClickHandler){if((i.amsStopPropagation===true)||(i.amsClickStopPropagation===true)){k.stopPropagation()}if(i.amsClickKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsClickHandler);if(l!==undefined){l.call(j,i.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="change")||(h==="all")){return}var i=j.data();if(i.amsChangeHandler){if(i.amsChangeKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsChangeHandler);if(l!==undefined){l.call(j,i.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(i){var h=c(this);setTimeout(function(){h.find(".select2").trigger("change")},10);a.form.setFocus(h)});c(document).on("reset","[data-ams-reset-handler]",function(j){var h=c(this);var i=h.data();if(i.amsResetHandler){if(i.amsResetKeepDefault!==true){j.preventDefault()}var k=a.getFunctionByName(i.amsResetHandler);if(k!==undefined){k.call(h,i.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(j){j.preventDefault();var h=c(this);var i=h.parent(".button");if(i.exists()&&i.parent().hasClass("input-file")){i.next('input[type="text"]').val(h.val())}});c(document).on("focusin",function(h){if(c(h.target).closest(".mce-window").length){h.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(h){if(c(this).parent("li").hasClass("disabled")){h.preventDefault();return false}});c(document).on("show.bs.tab",function(j){var h=c(j.target);var i=h.data();if(i.amsUrl){if(i.amsTabLoaded){return}try{h.append('');a.skin.loadURL(i.amsUrl,h.attr("href"));if(i.amsTabLoadOnce){h.data("ams-tab-loaded",true)}}finally{c("i",h).remove()}}});c(document).on("hide.bs.modal",function(i){var h=c(i.target);a.form.confirmChangedForm(h,function(){h.data("modal").isShown=true;return true},function(){i.preventDefault();return false})});a.initContent(document);if(a.ajax_nav&&g.exists()){a.skin.checkURL()}a.form.setFocus(document);c(window).on("beforeunload",a.form.checkBeforeUnload)};d.initContent=function(e){c(".tipsy").remove();c("[rel=tooltip]",e).tooltip();c("[rel=popover]",e).popover();c("[rel=popover-hover]",e).popover({trigger:"hover"});a.plugins.init(e);a.callbacks.init(e);a.events.init(e);a.form.init(e);if(a.device==="desktop"){a.skin._initDesktopWidgets(e)}else{a.skin._initMobileWidgets(e)}a.skin._setPageHeight()};d.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};c(document).ready(function(){c=jQuery.noConflict();var e=c("HTML");var f=e.attr("lang")||e.attr("xml:lang");if(f&&!f.startsWith("en")){d.lang=f;d.getScript(d.baseURL+"i18n/myams_"+f.substr(0,2)+".js",function(){d.initPage()})}else{d.initPage()}})})(jQuery,this); \ No newline at end of file +(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('
    ').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l',openedSign:''};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append(""+f.closedSign+"");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var l=c(this);if(l.hasClass("active")){return}var i=l.attr("href").replace(/^#/,"");var k=l.parent().find("UL");if(f.accordion){var j=l.parent().parents("UL");var m=h.find("UL:visible");m.each(function(o){var q=true;j.each(function(r){if(j[r]===m[o]){q=false;return false}});if(q){if(k!==m[o]){var p=c(m[o]);if(i||!p.hasClass("active")){p.slideUp(f.speed,function(){c(this).parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}}}})}var n=l.parent().find("UL:first");if(!i&&n.is(":visible")&&!n.hasClass("active")){n.slideUp(f.speed,function(){l.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{n.slideDown(f.speed,function(){l.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:true,enableWidgets:true,enableMobile:false,enableFastclick:false,warnOnFormChange:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.generateUUID=function(){var f=new Date().getTime();var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(h){var g=(f+Math.random()*16)%16|0;f=Math.floor(f/16);return(h=="x"?g:(g&3|8)).toString(16)});return e};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(i,e,h,f){if(e.statusText==="OK"){return}var e=a.ajax.getResponse(e);if(e.contentType==="json"){a.ajax.handleJSON(e.data)}else{var j=i.statusText||i.type;var g=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+j+"

    "+g+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(i);b.console.debug(e)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.contentType==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"

    "+e+"

    "+g+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result}};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var j=h.getResponseHeader("content-type"),g,f;if(j){if(j.startsWith("application/javascript")){g="script";f=h.responseText}else{if(j.startsWith("text/html")){g="html";f=h.responseText}else{if(j.startsWith("text/xml")){g="xml";f=h.responseText}else{f=h.responseJSON;if(f){g="json"}else{try{f=JSON.parse(h.responseText);g="json"}catch(i){f=h.responseText;g="text"}}}}}}else{g="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{contentType:g,data:f}},handleJSON:function(p,g,k){var i=p.status;var e;switch(i){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||k||"#content");break;case"redirect":a.form.resetChanged(g);if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+i)}}var j;var l;var f;if(p.content){l=p.content;f=c(l.target||k||g||"#content");if(l.raw===true){f.text(l.text)}else{f.html(l.html);a.initContent(f)}if(!l.keep_hidden){f.removeClass("hidden")}}if(p.contents){var h=p.contents;for(j=0;j  '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){h.call(g)}})}}else{h.call(g)}},setChanged:function(e){e.attr("data-ams-form-changed",true)},resetChanged:function(e){e.removeAttr("data-ams-form-changed")},submit:function(h,g,f){h=c(h);if(!h.exists()){return false}if(typeof(g)==="object"){f=g;g=undefined}if(h.data("submitted")){if(!h.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:h.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(h)){return false}c(".alert-danger, SPAN.state-error",h).not(".persistent").remove();c(".state-error",h).removeClassPrefix("state-");var e=c(h.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(o,s){var m,z,D;var K=o.data();var n=K.amsFormOptions;var C;var q;var u;var t;var l;var H;function p(O,P){var N;function M(){m.button("reset");clearInterval(N);a.executeFunctionByName(H,o,m)}function L(){a.ajax.post(O,{progress_id:P},{error:M},a.getFunctionByName(l)||function(Q,R){if(R=="success"){if(Q.status==="running"){if(Q.message){m.text(Q.message)}else{m.text(m.data("ams-progress-text")+" "+Q.current+" / "+Q.length)}}else{if(Q.status==="finished"){M()}}}else{M()}})}m.button("loading");N=setInterval(L,t)}if(f){q=f.formDataInitCallback}if(q){delete f.formDataInitCallback}else{q=K.amsFormDataInitCallback}if(q){var A={};if(typeof(q)==="function"){C=q.call(o,A)}else{C=a.executeFunctionByName(q,o,A)}if(A.veto){m=o.data("ams-submit-button");if(m){m.button("reset")}a.form.finalizeSubmitFooter.call(o);return false}}else{C=K.amsFormData||{}}m=c(o.data("ams-submit-button"));if(m&&m.exists()){z=m.data();D=z.amsFormSubmitTarget}else{z={}}var v;var I=g||z.amsFormHandler||K.amsFormHandler||"";if(I.startsWith(window.location.protocol)){v=I}else{var B=z.amsFormAction||o.attr("action").replace(/#/,"");if(B.startsWith(window.location.protocol)){v=B}else{v=a.ajax.getAddr()+B}v+=I}u=z.amsProgressHandler||K.amsProgressHandler||"";t=z.amsProgressInterval||K.amsProgressInterval||1000;l=z.amsProgressCallback||K.amsProgressCallback;H=z.amsProgressEndCallback||K.amsProgressEndCallback;var J=null;if(f&&f.initSubmitTarget){a.executeFunctionByName(f.initSubmitTarget,o)}else{if(K.amsFormInitSubmitTarget){J=c(D||K.amsFormSubmitTarget||"#content");a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmit",o,J)}else{if(!K.amsFormHideSubmitFooter){a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",o)}}}if(f){C=c.extend({},C,f.form_data)}var w;if(u){C.progress_id=a.generateUUID()}else{w=typeof(s.uuid)!=="undefined";if(w){if(v.indexOf("X-Progress-ID")<0){v+="?X-Progress-ID="+s.uuid}delete s.uuid}}var y={url:v,type:"post",cache:false,data:C,dataType:K.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(M,L){L.data("submitted",true)},error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},iframe:w};var F=(f&&f.downloadTarget)||K.amsFormDownloadTarget;if(F){var x=c('iframe[name="'+F+'"]');if(!x.exists()){x=c("").hide().attr("name",F).appendTo(c("body"))}y=c.extend({},y,{iframe:true,iframeTarget:x,success:function(L,M,Q,P){var O=c(P).parents(".modal-dialog");if(O.exists()){a.dialog.close(P)}else{var R;var N=P.data("ams-submit-button");if(N){R=N.data("ams-form-submit-callback")}if(!R){R=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{R.call(P,L,M,Q,P)}finally{a.form.resetAfterSubmit(P);a.form.resetChanged(P)}}}})}else{y=c.extend({},y,{error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},success:function(L,M,P,O){var Q;var N=O.data("ams-submit-button");if(N){Q=N.data("ams-form-submit-callback")}if(!Q){Q=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{Q.call(O,L,M,P,O)}finally{a.form.resetAfterSubmit(O);a.form.resetChanged(O)}},iframe:w})}var G=c.extend({},y,s,n,f);if(u){p(u,C.progress_id)}c(o).ajaxSubmit(G);if(F){var E=c(o).parents(".modal-dialog");var r=E.exists()&&m.exists()&&m.data("ams-keep-modal");if(E.exists()&&(r!==true)){a.dialog.close(o)}else{setTimeout(function(){a.form.resetAfterSubmit(o,m);a.form.resetChanged(o)},m.data("ams-form-reset-timeout")||2000)}}}var j=(h.data("ams-form-ignore-uploads")!==true)&&(c('INPUT[type="file"]',h).length>0);if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(h)});k(h,i)}else{k(h,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='';if(!f){f=e.data("ams-form-submit-message")}if(f){h+=""+f+""}c(g).html('
    '+h+"
    ");c(g).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(f){if(f.is(":visible")){var e=f.data("ams-submit-button");if(e){e.button("reset")}a.form.finalizeSubmitFooter.call(f)}f.data("submitted",false);f.removeData("ams-submit-button")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+=''+f+""}var g=c("footer",e);c("button",g).hide();g.append('
    '+h+"
    ")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,h,g,e){var j;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);j=e.data("ams-submit-button");if(j){j.button("reset")}}var i=e.data();var l;if(i.amsFormDatatype){l=i.amsFormDatatype}else{var f=a.ajax.getResponse(g);l=f.contentType;o=f.data}var k;if(j){k=c(j.data("ams-form-submit-target")||i.amsFormSubmitTarget||"#content")}else{k=c(i.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:a.form.resetChanged(e);if(j&&(j.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k);a.form.setFocus(k)}var m=g.getResponseHeader("X-AMS-Callback");if(m){var n=g.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),g)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,l){var i;if(typeof(l)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,l)}else{if(l instanceof Array){i=l.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,l)}else{c(".state-error",e).removeClass("state-error");i=l.error_header||(l.widgets&&(l.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var k;if(l.messages){for(k=0;k"+h.header+"
    "+h.message)}else{n.push(h.message||h)}}}if(l.widgets){for(k=0;k'+m.message+"");if(m.label){n.push(m.label+" : "+m.message)}var g=j.parents(".tab-pane").index()+1;if(g>0){var f=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+g+")",f).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(c("fieldset:first",e),l.error_level||"error",i,n,l.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='
    '}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(o,n,m){c("body").modalmanager("removeLoading");var l=a.ajax.getResponse(m);var s=l.contentType;var u=l.data;switch(s){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var q=c(u);var r=c(".modal-dialog",q.wrap("
    ").parent());var p=r.data();var t={backdrop:"static",overflow:p.amsModalOverflow||".modal-viewport",maxHeight:p.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",q).outerHeight(true)-c("footer",q).outerHeight(true)-85}:a.getFunctionByName(p.amsModalMaxHeight)};var k=c.extend({},t,p.amsModalOptions);k=a.executeFunctionByName(p.amsModalInitCallback,r,k)||k;c("
    ").addClass("modal fade").append(q).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(q);if(i.amsLogEvent!==false){a.stats.logPageview(h)}}}})}})})},shown:function(m){function l(o){var p=c(".scrollmarker.top",f);var n=f.scrollTop();if(n>0){p.show()}else{p.hide()}var e=c(".scrollmarker.bottom",f);if(j+n>=f.get(0).scrollHeight){e.hide()}else{e.show()}}var k=m.target;var f=c(".modal-viewport",k);if(f.exists()){var j=parseInt(f.css("max-height"));var h=c.scrollbarWidth();if((f.css("overflow")!=="hidden")&&(f.height()===j)){c("
    ").addClass("scrollmarker").addClass("top").css("top",0).css("width",f.width()-h).hide().appendTo(f);c("
    ").addClass("scrollmarker").addClass("bottom").css("top",j-20).css("width",f.width()-h).appendTo(f);f.scroll(l);f.off("resize").on("resize",l)}else{c(".scrollmarker",f).remove()}}var g;var i=c(".modal-dialog",k).data("shown-callbacks");if(i){for(g=0;g=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f"+g.error_message+"",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+f.error_message+"

    ",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var g=i.data();if(g.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||g.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var e=a.getFunctionByName(f);if(typeof(e)==="function"){f=e.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(j){a.plugins.initData(j);var i=[];c("[data-ams-plugins-disabled]",j).each(function(){var o=c(this).data("ams-plugins-disabled").split(/\s+/);for(var p=0;p=0){continue}var m=a.plugins.enabled[l];if(m){switch(typeof(m)){case"function":m(j);break;default:for(var f=0;f=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var j=c(this);var i=j.data();var k={html:i.amsHintHtml,title:a.getFunctionByName(i.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(i.amsHintTitleAttr||"title")||(i.amsHintHtml?l.html():l.text())},opacity:i.amsHintOpacity||0.95,gravity:i.amsHintGravity||"sw",offset:i.amsHintOffset||0};var g=c.extend({},k,i.amsHintOptions);g=a.executeFunctionByName(i.amsHintInitCallback,j,g)||g;var h=j.tipsy(g);a.executeFunctionByName(i.amsHintAfterInitCallback,j,h,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var j=c(this);var i=j.data();var k={menuSelector:i.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},k,i.amsContextmenuOptions);g=a.executeFunctionByName(i.amsContextmenuInitCallback,j,g)||g;var h=j.contextMenu(g);a.executeFunctionByName(i.amsContextmenuAfterInitCallback,j,h,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var p=c(this);var r=p.parent("fieldset");var h=p.data();if(!h.amsChecker){var f=c('');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var q=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(p)}else{if(g){c('').attr("name",g).attr("value",1).prependTo(p)}}var o=c('').attr("name",k).attr("id",q).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){o.attr("disabled","disabled")}else{o.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");p.trigger("ams.checker.before-switch",[p,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,p,v);if(!h.amsCheckerCancelDefault){var t=o.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");p.trigger("ams.checker.opened",[p])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");p.trigger("ams.checker.closed",[p])}}})}o.appendTo(f);c(">label",p).attr("for",o.attr("id"));f.append("").prependTo(p);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){o.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}p.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider-2.0.0"+a.devext+".js",function(){f.each(function(){var i=c(this);var j=i.data();var k={};var g=c.extend({},k,i.data.amsSliderOptions);g=a.executeFunctionByName(j.amsSliderInitCallback,i,g)||g;var h=i.slider(g);a.executeFunctionByName(j.amsSliderAfterInitCallback,i,h,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var j=g.data();var k={containment:j.amsDraggableContainment,helper:a.getFunctionByName(j.amsDraggableHelper)||j.amsDraggableHelper,start:a.getFunctionByName(j.amsDraggableStart),stop:a.getFunctionByName(j.amsDraggableStop)};var h=c.extend({},k,j.amsDraggableOptions);h=a.executeFunctionByName(j.amsDraggableInitCallback,g,h)||h;var i=g.draggable(h);g.disableSelection();a.executeFunctionByName(j.amsDraggableAfterInitCallback,g,i,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var i=k.data();var j={items:i.amsSortableItems,handle:i.amsSortableHandle,connectWith:i.amsSortableConnectwith,start:a.getFunctionByName(i.amsSortableStart),over:a.getFunctionByName(i.amsSortableOver),containment:i.amsSortableContainment,placeholder:i.amsSortablePlaceholder,stop:a.getFunctionByName(i.amsSortableStop)};var g=c.extend({},j,i.amsSortableOptions);g=a.executeFunctionByName(i.amsSortableInitCallback,k,g)||g;var h=k.sortable(g);k.disableSelection();a.executeFunctionByName(i.amsSortableAfterInitCallback,k,h,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var j=g.data();var k={autoHide:j.amsResizableAutohide===false?true:j.amsResizableAutohide,containment:j.amsResizableContainment,grid:j.amsResizableGrid,handles:j.amsResizableHandles,start:a.getFunctionByName(j.amsResizableStart),stop:a.getFunctionByName(j.amsResizableStop)};var h=c.extend({},k,j.amsResizableOptions);h=a.executeFunctionByName(j.amsResizableInitCallback,g,h)||h;var i=g.resizable(h);g.disableSelection();a.executeFunctionByName(j.amsResizableAfterInitCallback,g,i,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k={};var h=c.extend({},k,j.amsTypeaheadOptions);h=a.executeFunctionByName(j.amsTypeaheadInitCallback,g,h)||h;var i=g.typeahead(h);a.executeFunctionByName(j.amsTypeaheadAfterInitCallback,g,i,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var l={placeholder:k.amsSelect2Placeholder,multiple:k.amsSelect2Multiple,minimumInputLength:k.amsSelect2MinimumInputLength||0,maximumSelectionSize:k.amsSelect2MaximumSelectionSize,openOnEnter:k.amsSelect2EnterOpen===undefined?true:k.amsSelect2EnterOpen,allowClear:k.amsSelect2AllowClear===undefined?true:k.amsSelect2AllowClear,width:k.amsSelect2Width||"100%",initSelection:a.getFunctionByName(k.amsSelect2InitSelection),formatSelection:k.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(k.amsSelect2FormatSelection),formatResult:a.getFunctionByName(k.amsSelect2FormatResult),formatMatches:k.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(k.amsSelect2FormatMatches),formatNoMatches:k.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(k.amsSelect2FormatResult),formatInputTooShort:k.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatInputTooShort),formatInputTooLong:k.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatInputTooLong),formatSelectionTooBig:k.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatSelectionTooBig),formatLoadMore:k.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(k.amsSelect2FormatLoadMore),formatSearching:k.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(k.amsSelect2FormatSearching),separator:k.amsSelect2Separator||",",tokenSeparators:k.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(k.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!l.initSelection){var h=g.data("ams-select2-values");if(h){l.initSelection=function(m,o){var n=[];c(m.val().split(l.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){l.query=function(){return[]}}}else{if(k.amsSelect2Query){l.query=a.getFunctionByName(k.amsSelect2Query);l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2QueryUrl){l.ajax={url:k.amsSelect2QueryUrl,quietMillis:k.amsSelect2QuietMillis||200,type:k.amsSelect2QueryType||"POST",dataType:k.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[k.amsSelect2QueryParamName||"query"]=o;m[k.amsSelect2PageParamName||"page"]=p;m[k.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,k.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2QueryMethod){l.query=function(m){var n={id:new Date().getTime(),params:k.amsSelect2QueryParams||{},success:function(o){return a.helpers.select2QueryMethodSuccessCallback.call(g,o,"success",m)},error:a.error.show};n.params[k.amsSelect2QueryParamName||"query"]=m.term;n.params[k.amsSelect2PageParamName||"page"]=m.page;n.params[k.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,k.amsSelect2QueryOptions);n=a.executeFunctionByName(k.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRPC,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){c.jsonRPC.withOptions({endPoint:k.amsSelect2MethodTarget||a.jsonrpc.getAddr(),namespace:k.amsSelect2MethodNamespace,cache:false},function(){c.jsonRPC.request(k.amsSelect2QueryMethod,n)})})};l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2Tags){l.tags=k.amsSelect2Tags}else{if(k.amsSelect2Data){l.data=k.amsSelect2Data}}}}}}if(k.amsSelect2EnableFreeTags){l.createSearchChoice=function(m){return{id:m,text:(k.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},l,k.amsSelect2Options);i=a.executeFunctionByName(k.amsSelect2InitCallback,g,i)||i;var j=g.select2(i);a.executeFunctionByName(k.amsSelect2AfterInitCallback,g,j,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.4.1"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k={placeholder:j.amsMaskeditPlaceholder===undefined?"X":j.amsMaskeditPlaceholder,complete:a.getFunctionByName(j.amsMaskeditComplete)};var h=c.extend({},k,j.amsMaskeditOptions);h=a.executeFunctionByName(j.amsMaskeditInitCallback,g,h)||h;var i=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(j.amsMaskeditAfterInitCallback,g,i,h)})})}},inputmask:function(f){var e=c("[data-input-mask]",f);if(e.length>0){a.ajax.check(c.fn.inputmask,a.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k;if(typeof(j.inputMask)==="object"){k=j.inputMask}else{k={mask:j.inputMask.toString()}}var h=c.extend({},k,j.amsInputmaskOptions);h=a.executeFunctionByName(j.amsInputmaskInitCallback,g,h)||h;var i=g.inputmask(h);a.executeFunctionByName(j.amsInputmaskAfterInitCallback,g,i,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var k=h.data();var l={position:k.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},l,k.amsColorpickerOptions);i=a.executeFunctionByName(k.amsColorpickerInitCallback,h,i)||i;var j=h.minicolors(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var l=c(this);var m=l.data();var n={ignore:null,submitHandler:l.attr("data-async")!==undefined?m.amsFormSubmitHandler===undefined?function(){c(".state-error",l).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(l)}:a.getFunctionByName(m.amsFormSubmitHandler):undefined,invalidHandler:l.attr("data-async")!==undefined?m.amsFormInvalidHandler===undefined?function(t,s){c(".state-error",l).removeClass("state-error");for(var r=0;r0){var o=c(".nav-tabs",c(q.element).parents(".tabforms"));c("li:nth-child("+p+")",o).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",o).click()}}}:a.getFunctionByName(m.amsFormInvalidHandler):undefined};c("[data-ams-validate-rules]",l).each(function(o){if(o===0){n.rules={}}n.rules[c(this).attr("name")]=c(this).data("ams-validate-rules")});var j=c.extend({},n,m.amsValidateOptions);j=a.executeFunctionByName(m.amsValidateInitCallback,l,j)||j;var k=l.validate(j);a.executeFunctionByName(m.amsValidateAfterInitCallback,l,k,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var D=c(this);var K=D.data();var G=(K.amsDatatableExtensions||"").split(/\s+/);var q=K.amsDatatableSdom||"W"+((G.indexOf("colreorder")>=0||G.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(G.indexOf("colvis")>=0?"C":"")+((K.amsDatatablePagination===false||K.amsDatatablePaginationSize===false)?"":"L")+(K.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(G.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(K.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var u;var m=K.amsDatatableSorting;if(typeof(m)==="string"){var J=m.split(";");m=[];for(u=0;u=0,bPaginate:K.amsDatatablePagination!==false,bInfo:K.amsDatatableInfo!==false,bSort:K.amsDatatableSort!==false,aaSorting:m,aoColumns:j.length>0?j:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:K.amsDatatableDisplayLength||25,sPaginationType:K.amsDatatablePaginationType||"bootstrap_full",sDom:q,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(M,L){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var E=c.extend({},x,K.amsDatatableOptions);if(G.length>0){for(u=0;u0){for(u=0;u0){for(u=0;u0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var j=c(this);var k=j.data();if(k.amsTabledndDragHandle){c("tr",j).addClass("no-drag-handle")}else{c(j).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")})}var l={onDragClass:k.amsTabledndDragClass||"dragging-row",onDragStart:a.getFunctionByName(k.amsTabledndDragStart),dragHandle:k.amsTabledndDragHandle,scrollAmount:k.amsTabledndScrollAmount,onAllowDrop:k.amsTabledndAllowDrop,onDrop:a.getFunctionByName(k.amsTabledndDrop)||function(p,q){var o=k.amsTabledndDropTarget;if(o){c(q).data("ams-disabled-handlers","click");var m=[];c(p.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var n=a.getFunctionByName(o);if(typeof(n)==="function"){n.call(j,p,m)}else{a.ajax.post(o,{names:JSON.stringify(m)})}setTimeout(function(){c(q).removeData("ams-disabled-handlers")},50)}return false}};var h=c.extend({},l,k.amsTabledndOptions);h=a.executeFunctionByName(k.amsTabledndInitCallback,j,h)||h;var i=j.tableDnD(h);a.executeFunctionByName(k.amsTabledndAfterInitCallback,j,i,h)})})}},tinymce:function(e){function h(){c(".tinymce",c(this)).each(function(){var i=tinymce.get(c(this).attr("id"));if(i){i.remove()}})}var f=c(".tinymce",e);if(f.length>0){var g=a.baseURL+"ext/tinymce"+(a.devmode?"/dev":"");a.ajax.check(window.tinymce,g+"/tinymce"+a.devext+".js",function(i){if(i){a.getScript(g+"/jquery.tinymce"+a.devext+".js");tinymce.baseURL=g;tinymce.suffix=a.devext;a.skin.registerCleanCallback(h)}f.each(function(){var m=c(this);var o=m.data();var q={theme:"modern",language:a.lang,plugins:["advlist autosave autolink lists link image charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code","insertdatetime media nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern"],toolbar1:"newdocument undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",toolbar2:"print preview media | forecolor backcolor emoticons | code",content_css:o.amsTinymceContentCss,formats:o.amsTinymceFormats,style_formats:o.amsTinymceStyleFormats,block_formats:o.amsTinymceBlockFormats,valid_classes:o.amsTinymceValidClasses,image_advtab:true,image_list:a.getFunctionByName(o.amsTinymceImageList)||o.amsTinymceImageList,image_class_list:o.amsTinymceImageClassList,link_list:a.getFunctionByName(o.amsTinymceLinkList)||o.amsTinymceLinkList,link_class_list:o.amsTinymceLinkClassList,resize:true};if(o.amsTinymceExternalPlugins){var p=o.amsTinymceExternalPlugins.split(/\s+/);for(var k in p){var j=m.data("ams-tinymce-plugin-"+p[k]);tinymce.PluginManager.load(p[k],a.getSource(j))}}var l=c.extend({},q,o.amsTinymceOptions);l=a.executeFunctionByName(o.amsTinymceInitCallback,m,l)||l;var n=m.tinymce(l);a.executeFunctionByName(o.amsTinymceAfterInitCallback,m,n,l)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var l=c(this);var k=l.data();var i=k.amsImgareaselectParent?l.parents(k.amsImgareaselectParent):"body";var m={instance:true,handles:true,parent:i,x1:k.amsImgareaselectX1||0,y1:k.amsImgareaselectY1||0,x2:k.amsImgareaselectX2||k.amsImgareaselectImageWidth,y2:k.amsImgareaselectY2||k.amsImgareaselectImageHeight,imageWidth:k.amsImgareaselectImageWidth,imageHeight:k.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:k.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(k.amsImgareaselectSelectEnd)||function(n,o){var p=k.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',i).val(o.x1);c('input[name="'+p+'y1"]',i).val(o.y1);c('input[name="'+p+'x2"]',i).val(o.x2);c('input[name="'+p+'y2"]',i).val(o.y2)}};var h=c.extend({},m,k.amsImgareaselectOptions);h=a.executeFunctionByName(k.amsImgareaselectInitCallback,l,h)||h;var j=l.imgAreaSelect(h);a.executeFunctionByName(k.amsImgareaselectAfterInitCallback,l,j,h);setTimeout(function(){j.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var n=h.data();var m=(n.amsFancyboxHelpers||"").split(/\s+/);if(m.length>0){for(var i=0;i0){a.ajax.check(c.fn.plot,a.baseURL+"flot/jquery.flot"+a.devext+".js",function(){f.each(function(){function l(s){for(var r in c.plot.plugins){var q=c.plot.plugins[r];if(q.name==s){return q}}return null}var o=c(this);var j=o.data();var p={};var h=(j.amsChartPlugins||"").split(/\s+/);if(h.length>0){for(var m in h){var n=h[m];if(!l(n)){a.getScript(a.baseURL+"flot/jquery.flot."+n+a.devext+".js")}}}var g=c.extend({},p,j.amsChartOptions);g=a.executeFunctionByName(j.amsChartInitCallback,o,g)||g;var i=j.amsChartData;i=a.executeFunctionByName(j.amsChartInitData,o,i)||i;var k=o.plot(i,g);a.executeFunctionByName(j.amsChartAfterInitCallback,o,k,g)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var j=l.data();var k={theme:j.amsScrollbarTheme||"light"};var h=c.extend({},k,j.amsScrollbarOptions);h=a.executeFunctionByName(j.amsScrollbarInitCallback,l,h)||h;var i=l.mCustomScrollbar(h);a.executeFunctionByName(j.amsScrollbarAfterInitCallback,l,i,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var h=c(this).data();var j=c.extend({},f,h.amsMessageboxOptions);var g=c.extend({},j,{title:h.amsMessageboxTitle||j.title||"",content:h.amsMessageboxContent||j.content||"",icon:h.amsMessageboxIcon||j.icon,number:h.amsMessageboxNumber||j.number,timeout:h.amsMessageboxTimeout||j.timeout});var e=h.amsMessageboxStatus||j.status||"info";var i=a.getFunctionByName(h.amsMessageboxCallback||j.callback);a.skin.messageBox(e,g,i)},smallBox:function(f){var h=c(this).data();var j=c.extend({},f,h.amsSmallboxOptions);var g=c.extend({},j,{title:h.amsSmallboxTitle||j.title||"",content:h.amsSmallboxContent||j.content||"",icon:h.amsSmallboxIcon||j.icon,iconSmall:h.amsSmallboxIconSmall||j.iconSmall,timeout:h.amsSmallboxTimeout||j.timeout});var e=h.amsSmallboxStatus||j.status||"info";var i=a.getFunctionByName(h.amsSmallboxCallback||j.callback);a.skin.smallBox(e,g,i)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var j=f.parents("table");var g=j.data("ams-location")||"";var k=f.parents("tr");var h=k.data("ams-delete-target")||j.data("ams-delete-target")||"delete-element.json";var l=k.data("ams-element-name");d.ajax.post(g+"/"+h,{object_name:l},function(m,n){if(m.status==="success"){if(j.hasClass("datatable")){j.dataTable().fnDeleteRow(k[0])}else{k.remove()}}})}})}}};d.skin={_setPageHeight:function(){var e=c("#main").height();var g=a.left_panel.height();var f=c(window).height()-a.navbarHeight;if(e>f){a.left_panel.css("min-height",e);a.root.css("min-height",e+a.navbarHeight)}else{a.left_panel.css("min-height",f);a.root.css("min-height",f)}},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c(".badge","#user-activity >span");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},refreshNotificationsPanel:function(g){var f=c(this);f.addClass("disabled");c("i",f).addClass("fa-spin");c('input[name="activity"]:checked',"#user-activity").change();c("i",f).removeClass("fa-spin");f.removeClass("disabled")},_initDesktopWidgets:function(e){if(a.enableWidgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var i=c(this);var h=i.data();var j={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},j,h.amsWidgetOptions);g=a.executeFunctionByName(h.amsWidgetInitcallback,i,g)||g;i.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enableMobile&&a.enableWidgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){if(f==="error"){f="danger"}c(".alert-"+f,l).remove();var i='

    '+g+"

    "+(k?("

    "+k+"

    "):"");if(typeof(m)==="string"){i+="
    • "+m+"
    "}else{if(m){i+="
      ";for(var h in m){if(!c.isNumeric(h)){continue}i+="
    • "+m[h]+"
    • "}i+="
    "}}i+="
    ";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("OL.breadcrumb","#ribbon");c("li",e).not(".parent").remove();if(!c("li",e).exists()){e.append(c("
  • ").append(c("").text(a.i18n.HOME).addClass("padding-right-5").attr("href",c('nav a[href!="#"]:first').attr("href"))))}c("LI.active >A","nav").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("
  • ").append(h.attr("href").replace(/^#/,"")?c("").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(m){c(".active",k).removeClass("active");m.addClass("open").addClass("active");m.parents("li").addClass("open active").children("ul").addClass("active").show();m.parents("li:first").removeClass("open");m.parents("ul").addClass(m.attr("href").replace(/^#/,"")?"active":"").show()}var l;var k=c("nav");var i=location.hash;var g=i.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}l=c('A[href="'+i+'"]',k);if(l.exists()){e(l)}a.skin.loadURL(g,f);var h=c("html head title").data("ams-title-prefix");document.title=(h?h+" > ":"")+(c("[data-ams-page-title]:first",f).data("ams-page-title")||l.attr("title")||document.title)}else{var j=c("[data-ams-active-menu]").data("ams-active-menu");if(j){l=c('A[href="'+j+'"]',k)}else{l=c('>UL >LI >A[href!="#"]',k).first()}if(l.exists()){e(l);if(j){a.skin._drawBreadCrumb()}else{window.location.hash=l.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},unregisterCleanCallback:function(g){var f=a.skin._clean_callbacks;var e=f.indexOf(g);if(e>=0){f.splice(e,1)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f Loading... ');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();var k=c("html head title").data("ams-title-prefix");document.title=(k?k+" > ":"")+c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(p,l,o){if(j){a.executeFunctionByName(j,this,p,l,o,f)}else{var n=a.ajax.getResponse(o);var m=n.contentType;var k=n.data;c(".loading",e).remove();switch(m){case"json":a.ajax.handleJSON(k,e);break;case"script":break;case"xml":break;case"html":case"text":default:e.parents(".hidden").removeClass("hidden");c(".alert",e.parents(".alerts-container")).remove();e.css({opacity:"0.0"}).html(p).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(e);a.form.setFocus(e)}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}a.stats.logPageview()}},error:function(m,l,k){e.html('

    '+a.i18n.ERROR+k+"

    "+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logPageview:function(f){if(typeof(b._gaq)==="undefined"){return}var e=b.window.location;b._gaq.push(["_trackPageview",f||e.pathname+e.hash])},logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.left_panel=c("#left-panel");a.shortcuts=c("#shortcuts");a.plugins.initData(e);var g=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var i=g();if(i&&(typeof(i.addEventListener)==="function")){var h=this;i.addEventListener("progress",function(j){h.progress(j)},false)}return i}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enableFastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("A","#hide-menu").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(h){e.toggleClass("hidden-menu");h.preventDefault()});c("#show-shortcuts").click(function(h){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}h.preventDefault()});a.shortcuts.click(function(h){a.skin._hideShortcutButtons()});c(document).mouseup(function(h){if(!a.shortcuts.is(h.target)&&a.shortcuts.has(h.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c(".activity-button","#user-activity").click(function(i){var h=c("#user-activity");var j=c(".ajax-dropdown",h);if(!j.is(":visible")){j.css("left",-j.innerWidth()+h.innerWidth()).fadeIn(150);h.addClass("active")}else{j.fadeOut(150);h.removeClass("active")}i.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(h){var i=c(".ajax-dropdown");if(!i.is(h.target)&&i.has(h.target).length===0){i.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(k){var j=c(this).data("ams-url");if(j){k.preventDefault();k.stopPropagation();var i=a.getFunctionByName(j);if(typeof(i)==="function"){j=i.call(this)}if(typeof(j)==="function"){j.call(this)}else{var h=c(".ajax-notifications");a.skin.loadURL(j,h)}}});c("a","#user-menu LI.logout").click(function(h){h.preventDefault();h.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:" "+a.i18n.LOGOUT+" "+c("#show-shortcut").text()+" ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(i){if(i===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});var f=c("nav");c("UL",f).myams_menu({accordion:f.data("ams-menu-accordion")!==false,speed:a.menuSpeed});c(".minifyme").click(function(h){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);h.preventDefault()});c("#refresh").click(function(h){a.skin.bigBox({title:" "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(i){if(i===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});h.preventDefault()});e.on("click",function(i){var h=c(this);if(!h.is(i.target)&&h.has(i.target).length===0&&c(".popover").has(i.target).length===0){h.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});f.resize(function(){a.skin._setPageHeight()})});if(a.ajaxNav){c(document).on("click",'a[href="#"]',function(h){h.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(m){var k=c(m.currentTarget);var j=k.data("ams-disabled-handlers");if((j===true)||(j==="click")||(j==="all")){return}var i=k.attr("href")||k.data("ams-url");if(!i||i.startsWith("javascript")||k.attr("target")||(k.data("ams-context-menu")===true)){return}m.preventDefault();m.stopPropagation();var h=a.getFunctionByName(i);if(typeof(h)==="function"){i=h.call(k)}if(typeof(i)==="function"){i.call(k)}else{i=i.replace(/\%23/,"#");var l=k.data("ams-target");if(l){a.form.confirmChangedForm(l,function(){a.skin.loadURL(i,l,k.data("ams-link-options"),k.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(i.startsWith("#")){if(i!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=i},50)}else{window.location.hash=i}}}else{window.location=i}})}}});c(document).on("click",'a[target="_blank"]',function(i){i.preventDefault();var h=c(i.currentTarget);window.open(h.attr("href"));a.stats.logEvent(h.data("ams-stats-category")||"Navigation",h.data("ams-stats-action")||"External",h.data("ams-stats-label")||h.attr("href"))});c(document).on("click",'a[target="_top"]',function(h){h.preventDefault();a.form.confirmChangedForm(function(){window.location=c(h.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(j){var i=c(this);var h=i.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}if(i.data("ams-context-menu")===true){return}if(i.data("ams-stop-propagation")===true){j.stopPropagation()}j.preventDefault();a.dialog.open(i);if(i.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var h=c(this);c(h.get(0).form).data("ams-submit-button",h)});c(document).on("click",'input[type="checkbox"][readonly]',function(){return false});c(document).on("click","[data-ams-click-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}var i=j.data();if(i.amsClickHandler){if((i.amsStopPropagation===true)||(i.amsClickStopPropagation===true)){k.stopPropagation()}if(i.amsClickKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsClickHandler);if(l!==undefined){l.call(j,i.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="change")||(h==="all")){return}var i=j.data();if(i.amsChangeHandler){if(i.amsChangeKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsChangeHandler);if(l!==undefined){l.call(j,i.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(i){var h=c(this);setTimeout(function(){h.find(".select2").trigger("change")},10);a.form.setFocus(h)});c(document).on("reset","[data-ams-reset-handler]",function(j){var h=c(this);var i=h.data();if(i.amsResetHandler){if(i.amsResetKeepDefault!==true){j.preventDefault()}var k=a.getFunctionByName(i.amsResetHandler);if(k!==undefined){k.call(h,i.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(j){j.preventDefault();var h=c(this);var i=h.parent(".button");if(i.exists()&&i.parent().hasClass("input-file")){i.next('input[type="text"]').val(h.val())}});c(document).on("focusin",function(h){if(c(h.target).closest(".mce-window").length){h.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(h){if(c(this).parent("li").hasClass("disabled")){h.preventDefault();return false}});c(document).on("show.bs.tab",function(j){var h=c(j.target);var i=h.data();if(i.amsUrl){if(i.amsTabLoaded){return}try{h.append('');a.skin.loadURL(i.amsUrl,h.attr("href"));if(i.amsTabLoadOnce){h.data("ams-tab-loaded",true)}}finally{c("i",h).remove()}}});c(document).on("hide.bs.modal",function(i){var h=c(i.target);a.form.confirmChangedForm(h,function(){h.data("modal").isShown=true;return true},function(){i.preventDefault();return false})});a.initContent(document);if(a.ajaxNav&&f.exists()){a.skin.checkURL()}a.form.setFocus(document);c(window).on("beforeunload",a.form.checkBeforeUnload)};d.initContent=function(e){c(".tipsy").remove();c("[rel=tooltip]",e).tooltip();c("[rel=popover]",e).popover();c("[rel=popover-hover]",e).popover({trigger:"hover"});a.plugins.init(e);a.callbacks.init(e);a.events.init(e);a.form.init(e);if(a.device==="desktop"){a.skin._initDesktopWidgets(e)}else{a.skin._initMobileWidgets(e)}a.skin._setPageHeight()};d.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};c(document).ready(function(){c=jQuery.noConflict();var e=c("HTML");var f=e.attr("lang")||e.attr("xml:lang");if(f&&!f.startsWith("en")){d.lang=f;d.getScript(d.baseURL+"i18n/myams_"+f.substr(0,2)+".js",function(){d.initPage()})}else{d.initPage()}})})(jQuery,this); \ No newline at end of file