# HG changeset patch # User Thierry Florac # Date 1456831295 -3600 # Node ID 6c271ae9cfd32bb42a61f96b26a81f83951594b1 # Parent a2ac7c3363aea09f88eaaa453aa35f4adc4342b3 Upgrade JQuery-imgareaselect plug-in to release 0.9.11-rc1 diff -r a2ac7c3363ae -r 6c271ae9cfd3 src/ztfy/myams/resources/js/ext/bootstrap-slider.min.js --- a/src/ztfy/myams/resources/js/ext/bootstrap-slider.min.js Tue Mar 01 12:21:09 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -!function($){var Slider=function(element,options){this.element=$(element);this.picker=$('
').insertBefore(this.element).prepend(this.element);this.id=this.element.data("slider-id")||options.id;if(this.id){this.picker[0].id=this.id}if(typeof Modernizr!=="undefined"&&Modernizr.touch){this.touchCapable=true}var tooltip=this.element.data("slider-tooltip")||options.tooltip;this.tooltip=this.picker.find(".tooltip");this.tooltipInner=this.tooltip.find("div.tooltip-inner");this.orientation=this.element.data("slider-orientation")||options.orientation;switch(this.orientation){case"vertical":this.picker.addClass("slider-vertical");this.stylePos="top";this.mousePos="pageY";this.sizePos="offsetHeight";this.tooltip.addClass("right")[0].style.left="100%";break;default:this.picker.addClass("slider-horizontal").css("width",this.element.outerWidth());this.orientation="horizontal";this.stylePos="left";this.mousePos="pageX";this.sizePos="offsetWidth";this.tooltip.addClass("top")[0].style.top=-this.tooltip.outerHeight()-14+"px";break}this.min=this.element.data("slider-min")||options.min;this.max=this.element.data("slider-max")||options.max;this.step=this.element.data("slider-step")||options.step;this.value=this.element.data("slider-value")||options.value;if(this.value[1]){this.range=true}this.selection=this.element.data("slider-selection")||options.selection;this.selectionEl=this.picker.find(".slider-selection");if(this.selection==="none"){this.selectionEl.addClass("hide")}this.selectionElStyle=this.selectionEl[0].style;this.handle1=this.picker.find(".slider-handle:first");this.handle1Stype=this.handle1[0].style;this.handle2=this.picker.find(".slider-handle:last");this.handle2Stype=this.handle2[0].style;var handle=this.element.data("slider-handle")||options.handle;switch(handle){case"round":this.handle1.addClass("round");this.handle2.addClass("round");break;case"triangle":this.handle1.addClass("triangle");this.handle2.addClass("triangle");break}if(this.range){this.value[0]=Math.max(this.min,Math.min(this.max,this.value[0]));this.value[1]=Math.max(this.min,Math.min(this.max,this.value[1]))}else{this.value=[Math.max(this.min,Math.min(this.max,this.value))];this.handle2.addClass("hide");if(this.selection=="after"){this.value[1]=this.max}else{this.value[1]=this.min}}this.diff=this.max-this.min;this.percentage=[(this.value[0]-this.min)*100/this.diff,(this.value[1]-this.min)*100/this.diff,this.step*100/this.diff];this.offset=this.picker.offset();this.size=this.picker[0][this.sizePos];this.formater=options.formater;this.layout();if(this.touchCapable){this.picker.on({touchstart:$.proxy(this.mousedown,this)})}else{this.picker.on({mousedown:$.proxy(this.mousedown,this)})}if(tooltip==="show"){this.picker.on({mouseenter:$.proxy(this.showTooltip,this),mouseleave:$.proxy(this.hideTooltip,this)})}else{this.tooltip.addClass("hide")}};Slider.prototype={constructor:Slider,over:false,inDrag:false,showTooltip:function(){this.tooltip.addClass("in");this.over=true},hideTooltip:function(){if(this.inDrag===false){this.tooltip.removeClass("in")}this.over=false},layout:function(){this.handle1Stype[this.stylePos]=this.percentage[0]+"%";this.handle2Stype[this.stylePos]=this.percentage[1]+"%";if(this.orientation=="vertical"){this.selectionElStyle.top=Math.min(this.percentage[0],this.percentage[1])+"%";this.selectionElStyle.height=Math.abs(this.percentage[0]-this.percentage[1])+"%"}else{this.selectionElStyle.left=Math.min(this.percentage[0],this.percentage[1])+"%";this.selectionElStyle.width=Math.abs(this.percentage[0]-this.percentage[1])+"%"}if(this.range){this.tooltipInner.text(this.formater(this.value[0])+" : "+this.formater(this.value[1]));this.tooltip[0].style[this.stylePos]=this.size*(this.percentage[0]+(this.percentage[1]-this.percentage[0])/2)/100-(this.orientation==="vertical"?this.tooltip.outerHeight()/2:this.tooltip.outerWidth()/2)+"px"}else{this.tooltipInner.text(this.formater(this.value[0]));this.tooltip[0].style[this.stylePos]=this.size*this.percentage[0]/100-(this.orientation==="vertical"?this.tooltip.outerHeight()/2:this.tooltip.outerWidth()/2)+"px"}},mousedown:function(ev){if(this.touchCapable&&ev.type==="touchstart"){ev=ev.originalEvent}this.offset=this.picker.offset();this.size=this.picker[0][this.sizePos];var percentage=this.getPercentage(ev);if(this.range){var diff1=Math.abs(this.percentage[0]-percentage);var diff2=Math.abs(this.percentage[1]-percentage);this.dragged=(diff1percentage){this.percentage[1]=this.percentage[0];this.dragged=0}}}this.percentage[this.dragged]=percentage;this.layout();var val=this.calculateValue();this.element.trigger({type:"slide",value:val}).data("value",val).prop("value",val);return false},mouseup:function(ev){if(this.touchCapable){$(document).off({touchmove:this.mousemove,touchend:this.mouseup})}else{$(document).off({mousemove:this.mousemove,mouseup:this.mouseup})}this.inDrag=false;if(this.over==false){this.hideTooltip()}this.element;var val=this.calculateValue();this.element.trigger({type:"slideStop",value:val}).data("value",val).prop("value",val);return false},calculateValue:function(){var val;if(this.range){val=[(this.min+Math.round((this.diff*this.percentage[0]/100)/this.step)*this.step),(this.min+Math.round((this.diff*this.percentage[1]/100)/this.step)*this.step)];this.value=val}else{val=(this.min+Math.round((this.diff*this.percentage[0]/100)/this.step)*this.step);this.value=[val,this.value[1]]}return val},getPercentage:function(ev){if(this.touchCapable){ev=ev.touches[0]}var percentage=(ev[this.mousePos]-this.offset[this.stylePos])*100/this.size;percentage=Math.round(percentage/this.percentage[2])*this.percentage[2];return Math.max(0,Math.min(100,percentage))},getValue:function(){if(this.range){return this.value}return this.value[0]},setValue:function(val){this.value=val;if(this.range){this.value[0]=Math.max(this.min,Math.min(this.max,this.value[0]));this.value[1]=Math.max(this.min,Math.min(this.max,this.value[1]))}else{this.value=[Math.max(this.min,Math.min(this.max,this.value))];this.handle2.addClass("hide");if(this.selection=="after"){this.value[1]=this.max}else{this.value[1]=this.min}}this.diff=this.max-this.min;this.percentage=[(this.value[0]-this.min)*100/this.diff,(this.value[1]-this.min)*100/this.diff,this.step*100/this.diff];this.layout()}};$.fn.slider=function(option,val){return this.each(function(){var $this=$(this),data=$this.data("slider"),options=typeof option==="object"&&option;if(!data){$this.data("slider",(data=new Slider(this,$.extend({},$.fn.slider.defaults,options))))}if(typeof option=="string"){data[option](val)}})};$.fn.slider.defaults={min:0,max:10,step:1,orientation:"horizontal",value:5,selection:"before",tooltip:"show",handle:"round",formater:function(value){return value}};$.fn.slider.Constructor=Slider}(window.jQuery); \ No newline at end of file diff -r a2ac7c3363ae -r 6c271ae9cfd3 src/ztfy/myams/resources/js/ext/jquery-imgareaselect-0.9.10.js --- a/src/ztfy/myams/resources/js/ext/jquery-imgareaselect-0.9.10.js Tue Mar 01 12:21:09 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,730 +0,0 @@ -/* - * imgAreaSelect jQuery plugin - * version 0.9.10 - * - * Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net) - * - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * http://odyniec.net/projects/imgareaselect/ - * - */ - -(function($) { - -var abs = Math.abs, - max = Math.max, - min = Math.min, - round = Math.round; - -function div() { - return $('
'); -} - -$.imgAreaSelect = function (img, options) { - var - - $img = $(img), - - imgLoaded, - - $box = div(), - $area = div(), - $border = div().add(div()).add(div()).add(div()), - $outer = div().add(div()).add(div()).add(div()), - $handles = $([]), - - $areaOpera, - - left, top, - - imgOfs = { left: 0, top: 0 }, - - imgWidth, imgHeight, - - $parent, - - parOfs = { left: 0, top: 0 }, - - zIndex = 0, - - position = 'absolute', - - startX, startY, - - scaleX, scaleY, - - resize, - - minWidth, minHeight, maxWidth, maxHeight, - - aspectRatio, - - shown, - - x1, y1, x2, y2, - - selection = { x1: 0, y1: 0, x2: 0, y2: 0, width: 0, height: 0 }, - - docElem = document.documentElement, - - ua = navigator.userAgent, - - $p, d, i, o, w, h, adjusted; - - function viewX(x) { - return x + imgOfs.left - parOfs.left; - } - - function viewY(y) { - return y + imgOfs.top - parOfs.top; - } - - function selX(x) { - return x - imgOfs.left + parOfs.left; - } - - function selY(y) { - return y - imgOfs.top + parOfs.top; - } - - function evX(event) { - return event.pageX - parOfs.left; - } - - function evY(event) { - return event.pageY - parOfs.top; - } - - function getSelection(noScale) { - var sx = noScale || scaleX, sy = noScale || scaleY; - - return { x1: round(selection.x1 * sx), - y1: round(selection.y1 * sy), - x2: round(selection.x2 * sx), - y2: round(selection.y2 * sy), - width: round(selection.x2 * sx) - round(selection.x1 * sx), - height: round(selection.y2 * sy) - round(selection.y1 * sy) }; - } - - function setSelection(x1, y1, x2, y2, noScale) { - var sx = noScale || scaleX, sy = noScale || scaleY; - - selection = { - x1: round(x1 / sx || 0), - y1: round(y1 / sy || 0), - x2: round(x2 / sx || 0), - y2: round(y2 / sy || 0) - }; - - selection.width = selection.x2 - selection.x1; - selection.height = selection.y2 - selection.y1; - } - - function adjust() { - if (!imgLoaded || !$img.width()) - return; - - imgOfs = { left: round($img.offset().left), top: round($img.offset().top) }; - - imgWidth = $img.innerWidth(); - imgHeight = $img.innerHeight(); - - imgOfs.top += ($img.outerHeight() - imgHeight) >> 1; - imgOfs.left += ($img.outerWidth() - imgWidth) >> 1; - - minWidth = round(options.minWidth / scaleX) || 0; - minHeight = round(options.minHeight / scaleY) || 0; - maxWidth = round(min(options.maxWidth / scaleX || 1<<24, imgWidth)); - maxHeight = round(min(options.maxHeight / scaleY || 1<<24, imgHeight)); - - if ($().jquery == '1.3.2' && position == 'fixed' && - !docElem['getBoundingClientRect']) - { - imgOfs.top += max(document.body.scrollTop, docElem.scrollTop); - imgOfs.left += max(document.body.scrollLeft, docElem.scrollLeft); - } - - parOfs = /absolute|relative/.test($parent.css('position')) ? - { left: round($parent.offset().left) - $parent.scrollLeft(), - top: round($parent.offset().top) - $parent.scrollTop() } : - position == 'fixed' ? - { left: $(document).scrollLeft(), top: $(document).scrollTop() } : - { left: 0, top: 0 }; - - left = viewX(0); - top = viewY(0); - - if (selection.x2 > imgWidth || selection.y2 > imgHeight) - doResize(); - } - - function update(resetKeyPress) { - if (!shown) return; - - $box.css({ left: viewX(selection.x1), top: viewY(selection.y1) }) - .add($area).width(w = selection.width).height(h = selection.height); - - $area.add($border).add($handles).css({ left: 0, top: 0 }); - - $border - .width(max(w - $border.outerWidth() + $border.innerWidth(), 0)) - .height(max(h - $border.outerHeight() + $border.innerHeight(), 0)); - - $($outer[0]).css({ left: left, top: top, - width: selection.x1, height: imgHeight }); - $($outer[1]).css({ left: left + selection.x1, top: top, - width: w, height: selection.y1 }); - $($outer[2]).css({ left: left + selection.x2, top: top, - width: imgWidth - selection.x2, height: imgHeight }); - $($outer[3]).css({ left: left + selection.x1, top: top + selection.y2, - width: w, height: imgHeight - selection.y2 }); - - w -= $handles.outerWidth(); - h -= $handles.outerHeight(); - - switch ($handles.length) { - case 8: - $($handles[4]).css({ left: w >> 1 }); - $($handles[5]).css({ left: w, top: h >> 1 }); - $($handles[6]).css({ left: w >> 1, top: h }); - $($handles[7]).css({ top: h >> 1 }); - case 4: - $handles.slice(1,3).css({ left: w }); - $handles.slice(2,4).css({ top: h }); - } - - if (resetKeyPress !== false) { - if ($.imgAreaSelect.onKeyPress != docKeyPress) - $(document).unbind($.imgAreaSelect.keyPress, - $.imgAreaSelect.onKeyPress); - - if (options.keys) - $(document)[$.imgAreaSelect.keyPress]( - $.imgAreaSelect.onKeyPress = docKeyPress); - } - - if (msie && $border.outerWidth() - $border.innerWidth() == 2) { - $border.css('margin', 0); - setTimeout(function () { $border.css('margin', 'auto'); }, 0); - } - } - - function doUpdate(resetKeyPress) { - adjust(); - update(resetKeyPress); - x1 = viewX(selection.x1); y1 = viewY(selection.y1); - x2 = viewX(selection.x2); y2 = viewY(selection.y2); - } - - function hide($elem, fn) { - options.fadeSpeed ? $elem.fadeOut(options.fadeSpeed, fn) : $elem.hide(); - - } - - function areaMouseMove(event) { - var x = selX(evX(event)) - selection.x1, - y = selY(evY(event)) - selection.y1; - - if (!adjusted) { - adjust(); - adjusted = true; - - $box.one('mouseout', function () { adjusted = false; }); - } - - resize = ''; - - if (options.resizable) { - if (y <= options.resizeMargin) - resize = 'n'; - else if (y >= selection.height - options.resizeMargin) - resize = 's'; - if (x <= options.resizeMargin) - resize += 'w'; - else if (x >= selection.width - options.resizeMargin) - resize += 'e'; - } - - $box.css('cursor', resize ? resize + '-resize' : - options.movable ? 'move' : ''); - if ($areaOpera) - $areaOpera.toggle(); - } - - function docMouseUp(event) { - $('body').css('cursor', ''); - if (options.autoHide || selection.width * selection.height == 0) - hide($box.add($outer), function () { $(this).hide(); }); - - $(document).unbind('mousemove', selectingMouseMove); - $box.mousemove(areaMouseMove); - - options.onSelectEnd(img, getSelection()); - } - - function areaMouseDown(event) { - if (event.which != 1) return false; - - adjust(); - - if (resize) { - $('body').css('cursor', resize + '-resize'); - - x1 = viewX(selection[/w/.test(resize) ? 'x2' : 'x1']); - y1 = viewY(selection[/n/.test(resize) ? 'y2' : 'y1']); - - $(document).mousemove(selectingMouseMove) - .one('mouseup', docMouseUp); - $box.unbind('mousemove', areaMouseMove); - } - else if (options.movable) { - startX = left + selection.x1 - evX(event); - startY = top + selection.y1 - evY(event); - - $box.unbind('mousemove', areaMouseMove); - - $(document).mousemove(movingMouseMove) - .one('mouseup', function () { - options.onSelectEnd(img, getSelection()); - - $(document).unbind('mousemove', movingMouseMove); - $box.mousemove(areaMouseMove); - }); - } - else - $img.mousedown(event); - - return false; - } - - function fixAspectRatio(xFirst) { - if (aspectRatio) - if (xFirst) { - x2 = max(left, min(left + imgWidth, - x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1))); - - y2 = round(max(top, min(top + imgHeight, - y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1)))); - x2 = round(x2); - } - else { - y2 = max(top, min(top + imgHeight, - y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1))); - x2 = round(max(left, min(left + imgWidth, - x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1)))); - y2 = round(y2); - } - } - - function doResize() { - x1 = min(x1, left + imgWidth); - y1 = min(y1, top + imgHeight); - - if (abs(x2 - x1) < minWidth) { - x2 = x1 - minWidth * (x2 < x1 || -1); - - if (x2 < left) - x1 = left + minWidth; - else if (x2 > left + imgWidth) - x1 = left + imgWidth - minWidth; - } - - if (abs(y2 - y1) < minHeight) { - y2 = y1 - minHeight * (y2 < y1 || -1); - - if (y2 < top) - y1 = top + minHeight; - else if (y2 > top + imgHeight) - y1 = top + imgHeight - minHeight; - } - - x2 = max(left, min(x2, left + imgWidth)); - y2 = max(top, min(y2, top + imgHeight)); - - fixAspectRatio(abs(x2 - x1) < abs(y2 - y1) * aspectRatio); - - if (abs(x2 - x1) > maxWidth) { - x2 = x1 - maxWidth * (x2 < x1 || -1); - fixAspectRatio(); - } - - if (abs(y2 - y1) > maxHeight) { - y2 = y1 - maxHeight * (y2 < y1 || -1); - fixAspectRatio(true); - } - - selection = { x1: selX(min(x1, x2)), x2: selX(max(x1, x2)), - y1: selY(min(y1, y2)), y2: selY(max(y1, y2)), - width: abs(x2 - x1), height: abs(y2 - y1) }; - - update(); - - options.onSelectChange(img, getSelection()); - } - - function selectingMouseMove(event) { - x2 = /w|e|^$/.test(resize) || aspectRatio ? evX(event) : viewX(selection.x2); - y2 = /n|s|^$/.test(resize) || aspectRatio ? evY(event) : viewY(selection.y2); - - doResize(); - - return false; - - } - - function doMove(newX1, newY1) { - x2 = (x1 = newX1) + selection.width; - y2 = (y1 = newY1) + selection.height; - - $.extend(selection, { x1: selX(x1), y1: selY(y1), x2: selX(x2), - y2: selY(y2) }); - - update(); - - options.onSelectChange(img, getSelection()); - } - - function movingMouseMove(event) { - x1 = max(left, min(startX + evX(event), left + imgWidth - selection.width)); - y1 = max(top, min(startY + evY(event), top + imgHeight - selection.height)); - - doMove(x1, y1); - - event.preventDefault(); - - return false; - } - - function startSelection() { - $(document).unbind('mousemove', startSelection); - adjust(); - - x2 = x1; - y2 = y1; - - doResize(); - - resize = ''; - - if (!$outer.is(':visible')) - $box.add($outer).hide().fadeIn(options.fadeSpeed||0); - - shown = true; - - $(document).unbind('mouseup', cancelSelection) - .mousemove(selectingMouseMove).one('mouseup', docMouseUp); - $box.unbind('mousemove', areaMouseMove); - - options.onSelectStart(img, getSelection()); - } - - function cancelSelection() { - $(document).unbind('mousemove', startSelection) - .unbind('mouseup', cancelSelection); - hide($box.add($outer)); - - setSelection(selX(x1), selY(y1), selX(x1), selY(y1)); - - if (!(this instanceof $.imgAreaSelect)) { - options.onSelectChange(img, getSelection()); - options.onSelectEnd(img, getSelection()); - } - } - - function imgMouseDown(event) { - if (event.which != 1 || $outer.is(':animated')) return false; - - adjust(); - startX = x1 = evX(event); - startY = y1 = evY(event); - - $(document).mousemove(startSelection).mouseup(cancelSelection); - - return false; - } - - function windowResize() { - doUpdate(false); - } - - function imgLoad() { - imgLoaded = true; - - setOptions(options = $.extend({ - classPrefix: 'imgareaselect', - movable: true, - parent: 'body', - resizable: true, - resizeMargin: 10, - onInit: function () {}, - onSelectStart: function () {}, - onSelectChange: function () {}, - onSelectEnd: function () {} - }, options)); - - $box.add($outer).css({ visibility: '' }); - - if (options.show) { - shown = true; - adjust(); - update(); - $box.add($outer).hide().fadeIn(options.fadeSpeed||0); - } - - setTimeout(function () { options.onInit(img, getSelection()); }, 0); - } - - var docKeyPress = function(event) { - var k = options.keys, d, t, key = event.keyCode; - - d = !isNaN(k.alt) && (event.altKey || event.originalEvent.altKey) ? k.alt : - !isNaN(k.ctrl) && event.ctrlKey ? k.ctrl : - !isNaN(k.shift) && event.shiftKey ? k.shift : - !isNaN(k.arrows) ? k.arrows : 10; - - if (k.arrows == 'resize' || (k.shift == 'resize' && event.shiftKey) || - (k.ctrl == 'resize' && event.ctrlKey) || - (k.alt == 'resize' && (event.altKey || event.originalEvent.altKey))) - { - switch (key) { - case 37: - d = -d; - case 39: - t = max(x1, x2); - x1 = min(x1, x2); - x2 = max(t + d, x1); - fixAspectRatio(); - break; - case 38: - d = -d; - case 40: - t = max(y1, y2); - y1 = min(y1, y2); - y2 = max(t + d, y1); - fixAspectRatio(true); - break; - default: - return; - } - - doResize(); - } - else { - x1 = min(x1, x2); - y1 = min(y1, y2); - - switch (key) { - case 37: - doMove(max(x1 - d, left), y1); - break; - case 38: - doMove(x1, max(y1 - d, top)); - break; - case 39: - doMove(x1 + min(d, imgWidth - selX(x2)), y1); - break; - case 40: - doMove(x1, y1 + min(d, imgHeight - selY(y2))); - break; - default: - return; - } - } - - return false; - }; - - function styleOptions($elem, props) { - for (var option in props) - if (options[option] !== undefined) - $elem.css(props[option], options[option]); - } - - function setOptions(newOptions) { - if (newOptions.parent) - ($parent = $(newOptions.parent)).append($box.add($outer)); - - $.extend(options, newOptions); - - adjust(); - - if (newOptions.handles != null) { - $handles.remove(); - $handles = $([]); - - i = newOptions.handles ? newOptions.handles == 'corners' ? 4 : 8 : 0; - - while (i--) - $handles = $handles.add(div()); - - $handles.addClass(options.classPrefix + '-handle').css({ - position: 'absolute', - fontSize: 0, - zIndex: zIndex + 1 || 1 - }); - - if (!parseInt($handles.css('width')) >= 0) - $handles.width(5).height(5); - - if (o = options.borderWidth) - $handles.css({ borderWidth: o, borderStyle: 'solid' }); - - styleOptions($handles, { borderColor1: 'border-color', - borderColor2: 'background-color', - borderOpacity: 'opacity' }); - } - - scaleX = options.imageWidth / imgWidth || 1; - scaleY = options.imageHeight / imgHeight || 1; - - if (newOptions.x1 != null) { - setSelection(newOptions.x1, newOptions.y1, newOptions.x2, - newOptions.y2); - newOptions.show = !newOptions.hide; - } - - if (newOptions.keys) - options.keys = $.extend({ shift: 1, ctrl: 'resize' }, - newOptions.keys); - - $outer.addClass(options.classPrefix + '-outer'); - $area.addClass(options.classPrefix + '-selection'); - for (i = 0; i++ < 4;) - $($border[i-1]).addClass(options.classPrefix + '-border' + i); - - styleOptions($area, { selectionColor: 'background-color', - selectionOpacity: 'opacity' }); - styleOptions($border, { borderOpacity: 'opacity', - borderWidth: 'border-width' }); - styleOptions($outer, { outerColor: 'background-color', - outerOpacity: 'opacity' }); - if (o = options.borderColor1) - $($border[0]).css({ borderStyle: 'solid', borderColor: o }); - if (o = options.borderColor2) - $($border[1]).css({ borderStyle: 'dashed', borderColor: o }); - - $box.append($area.add($border).add($areaOpera)).append($handles); - - if (msie) { - if (o = ($outer.css('filter')||'').match(/opacity=(\d+)/)) - $outer.css('opacity', o[1]/100); - if (o = ($border.css('filter')||'').match(/opacity=(\d+)/)) - $border.css('opacity', o[1]/100); - } - - if (newOptions.hide) - hide($box.add($outer)); - else if (newOptions.show && imgLoaded) { - shown = true; - $box.add($outer).fadeIn(options.fadeSpeed||0); - doUpdate(); - } - - aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1]; - - $img.add($outer).unbind('mousedown', imgMouseDown); - - if (options.disable || options.enable === false) { - $box.unbind('mousemove', areaMouseMove).unbind('mousedown', areaMouseDown); - $(window).unbind('resize', windowResize); - } - else { - if (options.enable || options.disable === false) { - if (options.resizable || options.movable) - $box.mousemove(areaMouseMove).mousedown(areaMouseDown); - - $(window).resize(windowResize); - } - - if (!options.persistent) - $img.add($outer).mousedown(imgMouseDown); - } - - options.enable = options.disable = undefined; - } - - this.remove = function () { - setOptions({ disable: true }); - $box.add($outer).remove(); - }; - - this.getOptions = function () { return options; }; - - this.setOptions = setOptions; - - this.getSelection = getSelection; - - this.setSelection = setSelection; - - this.cancelSelection = cancelSelection; - - this.update = doUpdate; - - var msie = (/msie ([\w.]+)/i.exec(ua)||[])[1], - opera = /opera/i.test(ua), - safari = /webkit/i.test(ua) && !/chrome/i.test(ua); - - $p = $img; - - while ($p.length) { - zIndex = max(zIndex, - !isNaN($p.css('z-index')) ? $p.css('z-index') : zIndex); - if ($p.css('position') == 'fixed') - position = 'fixed'; - - $p = $p.parent(':not(body)'); - } - - zIndex = options.zIndex || zIndex; - - if (msie) - $img.attr('unselectable', 'on'); - - $.imgAreaSelect.keyPress = msie || safari ? 'keydown' : 'keypress'; - - if (opera) - - $areaOpera = div().css({ width: '100%', height: '100%', - position: 'absolute', zIndex: zIndex + 2 || 2 }); - - $box.add($outer).css({ visibility: 'hidden', position: position, - overflow: 'hidden', zIndex: zIndex || '0' }); - $box.css({ zIndex: zIndex + 2 || 2 }); - $area.add($border).css({ position: 'absolute', fontSize: 0 }); - - img.complete || img.readyState == 'complete' || !$img.is('img') ? - imgLoad() : $img.one('load', imgLoad); - - if (!imgLoaded && msie && msie >= 7) - img.src = img.src; -}; - -$.fn.imgAreaSelect = function (options) { - options = options || {}; - - this.each(function () { - if ($(this).data('imgAreaSelect')) { - if (options.remove) { - $(this).data('imgAreaSelect').remove(); - $(this).removeData('imgAreaSelect'); - } - else - $(this).data('imgAreaSelect').setOptions(options); - } - else if (!options.remove) { - if (options.enable === undefined && options.disable === undefined) - options.enable = true; - - $(this).data('imgAreaSelect', new $.imgAreaSelect(this, options)); - } - }); - - if (options.instance) - return $(this).data('imgAreaSelect'); - - return this; -}; - -})(jQuery); diff -r a2ac7c3363ae -r 6c271ae9cfd3 src/ztfy/myams/resources/js/ext/jquery-imgareaselect-0.9.10.min.js --- a/src/ztfy/myams/resources/js/ext/jquery-imgareaselect-0.9.10.min.js Tue Mar 01 12:21:09 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -(function(e){var b=Math.abs,a=Math.max,d=Math.min,c=Math.round;function f(){return e("
")}e.imgAreaSelect=function(R,af){var N=e(R),u,B=f(),F=f(),at=f().add(f()).add(f()).add(f()),v=f().add(f()).add(f()).add(f()),aB=e([]),am,U,ar,aC={left:0,top:0},T,aD,p,X={left:0,top:0},g=0,an="absolute",aq,ap,ad,ac,t,q,ao,k,x,aH,ak,E,n,D,l,aF={x1:0,y1:0,x2:0,y2:0,width:0,height:0},G=document.documentElement,V=navigator.userAgent,ab,S,P,O,L,Q,J;function aa(h){return h+aC.left-X.left}function Z(h){return h+aC.top-X.top}function ay(h){return h-aC.left+X.left}function ax(h){return h-aC.top+X.top}function A(h){return h.pageX-X.left}function z(h){return h.pageY-X.top}function aw(h){var o=h||ad,i=h||ac;return{x1:c(aF.x1*o),y1:c(aF.y1*i),x2:c(aF.x2*o),y2:c(aF.y2*i),width:c(aF.x2*o)-c(aF.x1*o),height:c(aF.y2*i)-c(aF.y1*i)}}function au(i,w,h,o,aI){var aK=aI||ad,aJ=aI||ac;aF={x1:c(i/aK||0),y1:c(w/aJ||0),x2:c(h/aK||0),y2:c(o/aJ||0)};aF.width=aF.x2-aF.x1;aF.height=aF.y2-aF.y1}function m(){if(!u||!N.width()){return}aC={left:c(N.offset().left),top:c(N.offset().top)};T=N.innerWidth();aD=N.innerHeight();aC.top+=(N.outerHeight()-aD)>>1;aC.left+=(N.outerWidth()-T)>>1;q=c(af.minWidth/ad)||0;ao=c(af.minHeight/ac)||0;k=c(d(af.maxWidth/ad||1<<24,T));x=c(d(af.maxHeight/ac||1<<24,aD));if(e().jquery=="1.3.2"&&an=="fixed"&&!G.getBoundingClientRect){aC.top+=a(document.body.scrollTop,G.scrollTop);aC.left+=a(document.body.scrollLeft,G.scrollLeft)}X=/absolute|relative/.test(p.css("position"))?{left:c(p.offset().left)-p.scrollLeft(),top:c(p.offset().top)-p.scrollTop()}:an=="fixed"?{left:e(document).scrollLeft(),top:e(document).scrollTop()}:{left:0,top:0};U=aa(0);ar=Z(0);if(aF.x2>T||aF.y2>aD){aE()}}function K(h){if(!ak){return}B.css({left:aa(aF.x1),top:Z(aF.y1)}).add(F).width(L=aF.width).height(Q=aF.height);F.add(at).add(aB).css({left:0,top:0});at.width(a(L-at.outerWidth()+at.innerWidth(),0)).height(a(Q-at.outerHeight()+at.innerHeight(),0));e(v[0]).css({left:U,top:ar,width:aF.x1,height:aD});e(v[1]).css({left:U+aF.x1,top:ar,width:L,height:aF.y1});e(v[2]).css({left:U+aF.x2,top:ar,width:T-aF.x2,height:aD});e(v[3]).css({left:U+aF.x1,top:ar+aF.y2,width:L,height:aD-aF.y2});L-=aB.outerWidth();Q-=aB.outerHeight();switch(aB.length){case 8:e(aB[4]).css({left:L>>1});e(aB[5]).css({left:L,top:Q>>1});e(aB[6]).css({left:L>>1,top:Q});e(aB[7]).css({top:Q>>1});case 4:aB.slice(1,3).css({left:L});aB.slice(2,4).css({top:Q})}if(h!==false){if(e.imgAreaSelect.onKeyPress!=az){e(document).unbind(e.imgAreaSelect.keyPress,e.imgAreaSelect.onKeyPress)}if(af.keys){e(document)[e.imgAreaSelect.keyPress](e.imgAreaSelect.onKeyPress=az)}}if(aj&&at.outerWidth()-at.innerWidth()==2){at.css("margin",0);setTimeout(function(){at.css("margin","auto")},0)}}function y(h){m();K(h);E=aa(aF.x1);n=Z(aF.y1);D=aa(aF.x2);l=Z(aF.y2)}function ai(h,i){af.fadeSpeed?h.fadeOut(af.fadeSpeed,i):h.hide()}function I(i){var h=ay(A(i))-aF.x1,o=ax(z(i))-aF.y1;if(!J){m();J=true;B.one("mouseout",function(){J=false})}t="";if(af.resizable){if(o<=af.resizeMargin){t="n"}else{if(o>=aF.height-af.resizeMargin){t="s"}}if(h<=af.resizeMargin){t+="w"}else{if(h>=aF.width-af.resizeMargin){t+="e"}}}B.css("cursor",t?t+"-resize":af.movable?"move":"");if(am){am.toggle()}}function j(h){e("body").css("cursor","");if(af.autoHide||aF.width*aF.height==0){ai(B.add(v),function(){e(this).hide()})}e(document).unbind("mousemove",ag);B.mousemove(I);af.onSelectEnd(R,aw())}function aA(h){if(h.which!=1){return false}m();if(t){e("body").css("cursor",t+"-resize");E=aa(aF[/w/.test(t)?"x2":"x1"]);n=Z(aF[/n/.test(t)?"y2":"y1"]);e(document).mousemove(ag).one("mouseup",j);B.unbind("mousemove",I)}else{if(af.movable){aq=U+aF.x1-A(h);ap=ar+aF.y1-z(h);B.unbind("mousemove",I);e(document).mousemove(ae).one("mouseup",function(){af.onSelectEnd(R,aw());e(document).unbind("mousemove",ae);B.mousemove(I)})}else{N.mousedown(h)}}return false}function M(h){if(aH){if(h){D=a(U,d(U+T,E+b(l-n)*aH*(D>E||-1)));l=c(a(ar,d(ar+aD,n+b(D-E)/aH*(l>n||-1))));D=c(D)}else{l=a(ar,d(ar+aD,n+b(D-E)/aH*(l>n||-1)));D=c(a(U,d(U+T,E+b(l-n)*aH*(D>E||-1))));l=c(l)}}}function aE(){E=d(E,U+T);n=d(n,ar+aD);if(b(D-E)U+T){E=U+T-q}}}if(b(l-n)ar+aD){n=ar+aD-ao}}}D=a(U,d(D,U+T));l=a(ar,d(l,ar+aD));M(b(D-E)k){D=E-k*(Dx){l=n-x*(l=0){aB.width(5).height(5)}if(O=af.borderWidth){aB.css({borderWidth:O,borderStyle:"solid"})}H(aB,{borderColor1:"border-color",borderColor2:"background-color",borderOpacity:"opacity"})}ad=af.imageWidth/T||1;ac=af.imageHeight/aD||1;if(h.x1!=null){au(h.x1,h.y1,h.x2,h.y2);h.show=!h.hide}if(h.keys){af.keys=e.extend({shift:1,ctrl:"resize"},h.keys)}v.addClass(af.classPrefix+"-outer");F.addClass(af.classPrefix+"-selection");for(P=0;P++<4;){e(at[P-1]).addClass(af.classPrefix+"-border"+P)}H(F,{selectionColor:"background-color",selectionOpacity:"opacity"});H(at,{borderOpacity:"opacity",borderWidth:"border-width"});H(v,{outerColor:"background-color",outerOpacity:"opacity"});if(O=af.borderColor1){e(at[0]).css({borderStyle:"solid",borderColor:O})}if(O=af.borderColor2){e(at[1]).css({borderStyle:"dashed",borderColor:O})}B.append(F.add(at).add(am)).append(aB);if(aj){if(O=(v.css("filter")||"").match(/opacity=(\d+)/)){v.css("opacity",O[1]/100)}if(O=(at.css("filter")||"").match(/opacity=(\d+)/)){at.css("opacity",O[1]/100)}}if(h.hide){ai(B.add(v))}else{if(h.show&&u){ak=true;B.add(v).fadeIn(af.fadeSpeed||0);y()}}aH=(S=(af.aspectRatio||"").split(/:/))[0]/S[1];N.add(v).unbind("mousedown",aG);if(af.disable||af.enable===false){B.unbind("mousemove",I).unbind("mousedown",aA);e(window).unbind("resize",al)}else{if(af.enable||af.disable===false){if(af.resizable||af.movable){B.mousemove(I).mousedown(aA)}e(window).resize(al)}if(!af.persistent){N.add(v).mousedown(aG)}}af.enable=af.disable=undefined}this.remove=function(){ah({disable:true});B.add(v).remove()};this.getOptions=function(){return af};this.setOptions=ah;this.getSelection=aw;this.setSelection=au;this.cancelSelection=Y;this.update=y;var aj=(/msie ([\w.]+)/i.exec(V)||[])[1],av=/opera/i.test(V),C=/webkit/i.test(V)&&!/chrome/i.test(V);ab=N;while(ab.length){g=a(g,!isNaN(ab.css("z-index"))?ab.css("z-index"):g);if(ab.css("position")=="fixed"){an="fixed"}ab=ab.parent(":not(body)")}g=af.zIndex||g;if(aj){N.attr("unselectable","on")}e.imgAreaSelect.keyPress=aj||C?"keydown":"keypress";if(av){am=f().css({width:"100%",height:"100%",position:"absolute",zIndex:g+2||2})}B.add(v).css({visibility:"hidden",position:an,overflow:"hidden",zIndex:g||"0"});B.css({zIndex:g+2||2});F.add(at).css({position:"absolute",fontSize:0});R.complete||R.readyState=="complete"||!N.is("img")?s():N.one("load",s);if(!u&&aj&&aj>=7){R.src=R.src}};e.fn.imgAreaSelect=function(g){g=g||{};this.each(function(){if(e(this).data("imgAreaSelect")){if(g.remove){e(this).data("imgAreaSelect").remove();e(this).removeData("imgAreaSelect")}else{e(this).data("imgAreaSelect").setOptions(g)}}else{if(!g.remove){if(g.enable===undefined&&g.disable===undefined){g.enable=true}e(this).data("imgAreaSelect",new e.imgAreaSelect(this,g))}}});if(g.instance){return e(this).data("imgAreaSelect")}return this}})(jQuery); \ No newline at end of file diff -r a2ac7c3363ae -r 6c271ae9cfd3 src/ztfy/myams/resources/js/ext/jquery-imgareaselect-0.9.11-rc1.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ztfy/myams/resources/js/ext/jquery-imgareaselect-0.9.11-rc1.js Tue Mar 01 12:21:35 2016 +0100 @@ -0,0 +1,1205 @@ +/* + * imgAreaSelect jQuery plugin + * version 0.9.11-rc.1 + * + * Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net) + * + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://odyniec.net/projects/imgareaselect/ + * + */ + +(function($) { + +/* + * Math functions will be used extensively, so it's convenient to make a few + * shortcuts + */ +var abs = Math.abs, + max = Math.max, + min = Math.min, + round = Math.round; + +/** + * Create a new HTML div element + * + * @return A jQuery object representing the new element + */ +function div() { + return $('
'); +} + +/** + * imgAreaSelect initialization + * + * @param img + * A HTML image element to attach the plugin to + * @param options + * An options object + */ +$.imgAreaSelect = function (img, options) { + var + /* jQuery object representing the image */ + $img = $(img), + + /* Has the image finished loading? */ + imgLoaded, + + /* Plugin elements */ + + /* Container box */ + $box = div(), + /* Selection area */ + $area = div(), + /* Border (four divs) */ + $border = div().add(div()).add(div()).add(div()), + /* Outer area (four divs) */ + $outer = div().add(div()).add(div()).add(div()), + /* Handles (empty by default, initialized in setOptions()) */ + $handles = $([]), + + /* + * Additional element to work around a cursor problem in Opera + * (explained later) + */ + $areaOpera, + + /* Image position (relative to viewport) */ + left, top, + + /* Image offset (as returned by .offset()) */ + imgOfs = { left: 0, top: 0 }, + + /* Image dimensions (as returned by .width() and .height()) */ + imgWidth, imgHeight, + + /* + * jQuery object representing the parent element that the plugin + * elements are appended to + */ + $parent, + + /* Parent element offset (as returned by .offset()) */ + parOfs = { left: 0, top: 0 }, + + /* Base z-index for plugin elements */ + zIndex = 0, + + /* Plugin elements position */ + position = 'absolute', + + /* X/Y coordinates of the starting point for move/resize operations */ + startX, startY, + + /* Horizontal and vertical scaling factors */ + scaleX, scaleY, + + /* Current resize mode ("nw", "se", etc.) */ + resize, + + /* Selection area constraints */ + minWidth, minHeight, maxWidth, maxHeight, + + /* Aspect ratio to maintain (floating point number) */ + aspectRatio, + + /* Are the plugin elements currently displayed? */ + shown, + + /* Current selection (relative to parent element) */ + x1, y1, x2, y2, + + /* Current selection (relative to scaled image) */ + selection = { x1: 0, y1: 0, x2: 0, y2: 0, width: 0, height: 0 }, + + /* Document element */ + docElem = document.documentElement, + + /* User agent */ + ua = navigator.userAgent, + + /* Various helper variables used throughout the code */ + $p, d, i, o, w, h, adjusted; + + /* + * Translate selection coordinates (relative to scaled image) to viewport + * coordinates (relative to parent element) + */ + + /** + * Translate selection X to viewport X + * + * @param x + * Selection X + * @return Viewport X + */ + function viewX(x) { + return x + imgOfs.left - parOfs.left; + } + + /** + * Translate selection Y to viewport Y + * + * @param y + * Selection Y + * @return Viewport Y + */ + function viewY(y) { + return y + imgOfs.top - parOfs.top; + } + + /* + * Translate viewport coordinates to selection coordinates + */ + + /** + * Translate viewport X to selection X + * + * @param x + * Viewport X + * @return Selection X + */ + function selX(x) { + return x - imgOfs.left + parOfs.left; + } + + /** + * Translate viewport Y to selection Y + * + * @param y + * Viewport Y + * @return Selection Y + */ + function selY(y) { + return y - imgOfs.top + parOfs.top; + } + + /* + * Translate event coordinates (relative to document) to viewport + * coordinates + */ + + /** + * Get event X and translate it to viewport X + * + * @param event + * The event object + * @return Viewport X + */ + function evX(event) { + return event.pageX - parOfs.left; + } + + /** + * Get event Y and translate it to viewport Y + * + * @param event + * The event object + * @return Viewport Y + */ + function evY(event) { + return event.pageY - parOfs.top; + } + + /** + * Get the current selection + * + * @param noScale + * If set to true, scaling is not applied to the + * returned selection + * @return Selection object + */ + function getSelection(noScale) { + var sx = noScale || scaleX, sy = noScale || scaleY; + + return { x1: round(selection.x1 * sx), + y1: round(selection.y1 * sy), + x2: round(selection.x2 * sx), + y2: round(selection.y2 * sy), + width: round(selection.x2 * sx) - round(selection.x1 * sx), + height: round(selection.y2 * sy) - round(selection.y1 * sy) }; + } + + /** + * Set the current selection + * + * @param x1 + * X coordinate of the upper left corner of the selection area + * @param y1 + * Y coordinate of the upper left corner of the selection area + * @param x2 + * X coordinate of the lower right corner of the selection area + * @param y2 + * Y coordinate of the lower right corner of the selection area + * @param noScale + * If set to true, scaling is not applied to the + * new selection + */ + function setSelection(x1, y1, x2, y2, noScale) { + var sx = noScale || scaleX, sy = noScale || scaleY; + + selection = { + x1: round(x1 / sx || 0), + y1: round(y1 / sy || 0), + x2: round(x2 / sx || 0), + y2: round(y2 / sy || 0) + }; + + selection.width = selection.x2 - selection.x1; + selection.height = selection.y2 - selection.y1; + } + + /** + * Recalculate image and parent offsets + */ + function adjust() { + /* + * Do not adjust if image has not yet loaded or if width is not a + * positive number. The latter might happen when imgAreaSelect is put + * on a parent element which is then hidden. + */ + if (!imgLoaded || !$img.width()) + return; + + /* + * Get image offset. The .offset() method returns float values, so they + * need to be rounded. + */ + imgOfs = { left: round($img.offset().left), top: round($img.offset().top) }; + + /* Get image dimensions */ + imgWidth = $img.innerWidth(); + imgHeight = $img.innerHeight(); + + imgOfs.top += ($img.outerHeight() - imgHeight) >> 1; + imgOfs.left += ($img.outerWidth() - imgWidth) >> 1; + + /* Set minimum and maximum selection area dimensions */ + minWidth = round(options.minWidth / scaleX) || 0; + minHeight = round(options.minHeight / scaleY) || 0; + maxWidth = round(min(options.maxWidth / scaleX || 1<<24, imgWidth)); + maxHeight = round(min(options.maxHeight / scaleY || 1<<24, imgHeight)); + + /* + * Workaround for jQuery 1.3.2 incorrect offset calculation, originally + * observed in Safari 3. Firefox 2 is also affected. + */ + if ($().jquery == '1.3.2' && position == 'fixed' && + !docElem['getBoundingClientRect']) + { + imgOfs.top += max(document.body.scrollTop, docElem.scrollTop); + imgOfs.left += max(document.body.scrollLeft, docElem.scrollLeft); + } + + /* Determine parent element offset */ + parOfs = /absolute|relative/.test($parent.css('position')) ? + { left: round($parent.offset().left) - $parent.scrollLeft(), + top: round($parent.offset().top) - $parent.scrollTop() } : + position == 'fixed' ? + { left: $(document).scrollLeft(), top: $(document).scrollTop() } : + { left: 0, top: 0 }; + + left = viewX(0); + top = viewY(0); + + /* + * Check if selection area is within image boundaries, adjust if + * necessary + */ + if (selection.x2 > imgWidth || selection.y2 > imgHeight) + doResize(); + } + + /** + * Update plugin elements + * + * @param resetKeyPress + * If set to false, this instance's keypress + * event handler is not activated + */ + function update(resetKeyPress) { + /* If plugin elements are hidden, do nothing */ + if (!shown) return; + + /* + * Set the position and size of the container box and the selection area + * inside it + */ + $box.css({ left: viewX(selection.x1), top: viewY(selection.y1) }) + .add($area).width(w = selection.width).height(h = selection.height); + + /* + * Reset the position of selection area, borders, and handles (IE6/IE7 + * position them incorrectly if we don't do this) + */ + $area.add($border).add($handles).css({ left: 0, top: 0 }); + + /* Set border dimensions */ + $border + .width(max(w - $border.outerWidth() + $border.innerWidth(), 0)) + .height(max(h - $border.outerHeight() + $border.innerHeight(), 0)); + + /* Arrange the outer area elements */ + $($outer[0]).css({ left: left, top: top, + width: selection.x1, height: imgHeight }); + $($outer[1]).css({ left: left + selection.x1, top: top, + width: w, height: selection.y1 }); + $($outer[2]).css({ left: left + selection.x2, top: top, + width: imgWidth - selection.x2, height: imgHeight }); + $($outer[3]).css({ left: left + selection.x1, top: top + selection.y2, + width: w, height: imgHeight - selection.y2 }); + + w -= $handles.outerWidth(); + h -= $handles.outerHeight(); + + /* Arrange handles */ + switch ($handles.length) { + case 8: + $($handles[4]).css({ left: w >> 1 }); + $($handles[5]).css({ left: w, top: h >> 1 }); + $($handles[6]).css({ left: w >> 1, top: h }); + $($handles[7]).css({ top: h >> 1 }); + case 4: + $handles.slice(1,3).css({ left: w }); + $handles.slice(2,4).css({ top: h }); + } + + if (resetKeyPress !== false) { + /* + * Need to reset the document keypress event handler -- unbind the + * current handler + */ + if ($.imgAreaSelect.onKeyPress != docKeyPress) + $(document).unbind($.imgAreaSelect.keyPress, + $.imgAreaSelect.onKeyPress); + + if (options.keys) + /* + * Set the document keypress event handler to this instance's + * docKeyPress() function + */ + $(document)[$.imgAreaSelect.keyPress]( + $.imgAreaSelect.onKeyPress = docKeyPress); + } + + /* + * Internet Explorer displays 1px-wide dashed borders incorrectly by + * filling the spaces between dashes with white. Toggling the margin + * property between 0 and "auto" fixes this in IE6 and IE7 (IE8 is still + * broken). This workaround is not perfect, as it requires setTimeout() + * and thus causes the border to flicker a bit, but I haven't found a + * better solution. + * + * Note: This only happens with CSS borders, set with the borderWidth, + * borderOpacity, borderColor1, and borderColor2 options (which are now + * deprecated). Borders created with GIF background images are fine. + */ + if (msie && $border.outerWidth() - $border.innerWidth() == 2) { + $border.css('margin', 0); + setTimeout(function () { $border.css('margin', 'auto'); }, 0); + } + } + + /** + * Do the complete update sequence: recalculate offsets, update the + * elements, and set the correct values of x1, y1, x2, and y2. + * + * @param resetKeyPress + * If set to false, this instance's keypress + * event handler is not activated + */ + function doUpdate(resetKeyPress) { + adjust(); + update(resetKeyPress); + x1 = viewX(selection.x1); y1 = viewY(selection.y1); + x2 = viewX(selection.x2); y2 = viewY(selection.y2); + } + + /** + * Hide or fade out an element (or multiple elements) + * + * @param $elem + * A jQuery object containing the element(s) to hide/fade out + * @param fn + * Callback function to be called when fadeOut() completes + */ + function hide($elem, fn) { + options.fadeSpeed ? $elem.fadeOut(options.fadeSpeed, fn) : $elem.hide(); + } + + /** + * Selection area mousemove event handler + * + * @param event + * The event object + */ + function areaMouseMove(event) { + var x = selX(evX(event)) - selection.x1, + y = selY(evY(event)) - selection.y1; + + if (!adjusted) { + adjust(); + adjusted = true; + + $box.one('mouseout', function () { adjusted = false; }); + } + + /* Clear the resize mode */ + resize = ''; + + if (options.resizable) { + /* + * Check if the mouse pointer is over the resize margin area and set + * the resize mode accordingly + */ + if (y <= options.resizeMargin) + resize = 'n'; + else if (y >= selection.height - options.resizeMargin) + resize = 's'; + if (x <= options.resizeMargin) + resize += 'w'; + else if (x >= selection.width - options.resizeMargin) + resize += 'e'; + } + + $box.css('cursor', resize ? resize + '-resize' : + options.movable ? 'move' : ''); + if ($areaOpera) + $areaOpera.toggle(); + } + + /** + * Document mouseup event handler + * + * @param event + * The event object + */ + function docMouseUp(event) { + /* Set back the default cursor */ + $('body').css('cursor', ''); + /* + * If autoHide is enabled, or if the selection has zero width/height, + * hide the selection and the outer area + */ + if (options.autoHide || selection.width * selection.height == 0) + hide($box.add($outer), function () { $(this).hide(); }); + + $(document).unbind('mousemove', selectingMouseMove); + $box.mousemove(areaMouseMove); + + options.onSelectEnd(img, getSelection()); + } + + /** + * Selection area mousedown event handler + * + * @param event + * The event object + * @return false + */ + function areaMouseDown(event) { + if (event.which != 1) return false; + + adjust(); + + if (resize) { + /* Resize mode is in effect */ + $('body').css('cursor', resize + '-resize'); + + x1 = viewX(selection[/w/.test(resize) ? 'x2' : 'x1']); + y1 = viewY(selection[/n/.test(resize) ? 'y2' : 'y1']); + + $(document).mousemove(selectingMouseMove) + .one('mouseup', docMouseUp); + $box.unbind('mousemove', areaMouseMove); + } + else if (options.movable) { + startX = left + selection.x1 - evX(event); + startY = top + selection.y1 - evY(event); + + $box.unbind('mousemove', areaMouseMove); + + $(document).mousemove(movingMouseMove) + .one('mouseup', function () { + options.onSelectEnd(img, getSelection()); + + $(document).unbind('mousemove', movingMouseMove); + $box.mousemove(areaMouseMove); + }); + } + else + $img.mousedown(event); + + return false; + } + + /** + * Adjust the x2/y2 coordinates to maintain aspect ratio (if defined) + * + * @param xFirst + * If set to true, calculate x2 first. Otherwise, + * calculate y2 first. + */ + function fixAspectRatio(xFirst) { + if (aspectRatio) + if (xFirst) { + x2 = max(left, min(left + imgWidth, + x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1))); + y2 = round(max(top, min(top + imgHeight, + y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1)))); + x2 = round(x2); + } + else { + y2 = max(top, min(top + imgHeight, + y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1))); + x2 = round(max(left, min(left + imgWidth, + x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1)))); + y2 = round(y2); + } + } + + /** + * Resize the selection area respecting the minimum/maximum dimensions and + * aspect ratio + */ + function doResize() { + /* + * Make sure the top left corner of the selection area stays within + * image boundaries (it might not if the image source was dynamically + * changed). + */ + x1 = min(x1, left + imgWidth); + y1 = min(y1, top + imgHeight); + + if (abs(x2 - x1) < minWidth) { + /* Selection width is smaller than minWidth */ + x2 = x1 - minWidth * (x2 < x1 || -1); + + if (x2 < left) + x1 = left + minWidth; + else if (x2 > left + imgWidth) + x1 = left + imgWidth - minWidth; + } + + if (abs(y2 - y1) < minHeight) { + /* Selection height is smaller than minHeight */ + y2 = y1 - minHeight * (y2 < y1 || -1); + + if (y2 < top) + y1 = top + minHeight; + else if (y2 > top + imgHeight) + y1 = top + imgHeight - minHeight; + } + + x2 = max(left, min(x2, left + imgWidth)); + y2 = max(top, min(y2, top + imgHeight)); + + fixAspectRatio(abs(x2 - x1) < abs(y2 - y1) * aspectRatio); + + if (abs(x2 - x1) > maxWidth) { + /* Selection width is greater than maxWidth */ + x2 = x1 - maxWidth * (x2 < x1 || -1); + fixAspectRatio(); + } + + if (abs(y2 - y1) > maxHeight) { + /* Selection height is greater than maxHeight */ + y2 = y1 - maxHeight * (y2 < y1 || -1); + fixAspectRatio(true); + } + + selection = { x1: selX(min(x1, x2)), x2: selX(max(x1, x2)), + y1: selY(min(y1, y2)), y2: selY(max(y1, y2)), + width: abs(x2 - x1), height: abs(y2 - y1) }; + + update(); + + options.onSelectChange(img, getSelection()); + } + + /** + * Mousemove event handler triggered when the user is selecting an area + * + * @param event + * The event object + * @return false + */ + function selectingMouseMove(event) { + x2 = /w|e|^$/.test(resize) || aspectRatio ? evX(event) : viewX(selection.x2); + y2 = /n|s|^$/.test(resize) || aspectRatio ? evY(event) : viewY(selection.y2); + + doResize(); + + return false; + } + + /** + * Move the selection area + * + * @param newX1 + * New viewport X1 + * @param newY1 + * New viewport Y1 + */ + function doMove(newX1, newY1) { + x2 = (x1 = newX1) + selection.width; + y2 = (y1 = newY1) + selection.height; + + $.extend(selection, { x1: selX(x1), y1: selY(y1), x2: selX(x2), + y2: selY(y2) }); + + update(); + + options.onSelectChange(img, getSelection()); + } + + /** + * Mousemove event handler triggered when the selection area is being moved + * + * @param event + * The event object + * @return false + */ + function movingMouseMove(event) { + x1 = max(left, min(startX + evX(event), left + imgWidth - selection.width)); + y1 = max(top, min(startY + evY(event), top + imgHeight - selection.height)); + + doMove(x1, y1); + + event.preventDefault(); + return false; + } + + /** + * Start selection + */ + function startSelection() { + $(document).unbind('mousemove', startSelection); + adjust(); + + x2 = x1; + y2 = y1; + doResize(); + + resize = ''; + + if (!$outer.is(':visible')) + /* Show the plugin elements */ + $box.add($outer).hide().fadeIn(options.fadeSpeed||0); + + shown = true; + + $(document).unbind('mouseup', cancelSelection) + .mousemove(selectingMouseMove).one('mouseup', docMouseUp); + $box.unbind('mousemove', areaMouseMove); + + options.onSelectStart(img, getSelection()); + } + + /** + * Cancel selection + */ + function cancelSelection() { + $(document).unbind('mousemove', startSelection) + .unbind('mouseup', cancelSelection); + hide($box.add($outer)); + + setSelection(selX(x1), selY(y1), selX(x1), selY(y1)); + + /* If this is an API call, callback functions should not be triggered */ + if (!(this instanceof $.imgAreaSelect)) { + options.onSelectChange(img, getSelection()); + options.onSelectEnd(img, getSelection()); + } + } + + /** + * Image mousedown event handler + * + * @param event + * The event object + * @return false + */ + function imgMouseDown(event) { + /* Ignore the event if animation is in progress */ + if (event.which != 1 || $outer.is(':animated')) return false; + + adjust(); + startX = x1 = evX(event); + startY = y1 = evY(event); + + /* Selection will start when the mouse is moved */ + $(document).mousemove(startSelection).mouseup(cancelSelection); + + return false; + } + + /** + * Window resize event handler + */ + function windowResize() { + doUpdate(false); + } + + /** + * Image load event handler. This is the final part of the initialization + * process. + */ + function imgLoad() { + imgLoaded = true; + + /* Set options */ + setOptions(options = $.extend({ + classPrefix: 'imgareaselect', + movable: true, + parent: 'body', + resizable: true, + resizeMargin: 10, + onInit: function () {}, + onSelectStart: function () {}, + onSelectChange: function () {}, + onSelectEnd: function () {} + }, options)); + + $box.add($outer).css({ visibility: '' }); + + if (options.show) { + shown = true; + adjust(); + update(); + $box.add($outer).hide().fadeIn(options.fadeSpeed||0); + } + + /* + * Call the onInit callback. The setTimeout() call is used to ensure + * that the plugin has been fully initialized and the object instance is + * available (so that it can be obtained in the callback). + */ + setTimeout(function () { options.onInit(img, getSelection()); }, 0); + } + + /** + * Document keypress event handler + * + * @param event + * The event object + * @return false + */ + var docKeyPress = function(event) { + var k = options.keys, d, t, key = event.keyCode; + + d = !isNaN(k.alt) && (event.altKey || event.originalEvent.altKey) ? k.alt : + !isNaN(k.ctrl) && event.ctrlKey ? k.ctrl : + !isNaN(k.shift) && event.shiftKey ? k.shift : + !isNaN(k.arrows) ? k.arrows : 10; + + if (k.arrows == 'resize' || (k.shift == 'resize' && event.shiftKey) || + (k.ctrl == 'resize' && event.ctrlKey) || + (k.alt == 'resize' && (event.altKey || event.originalEvent.altKey))) + { + /* Resize selection */ + + switch (key) { + case 37: + /* Left */ + d = -d; + case 39: + /* Right */ + t = max(x1, x2); + x1 = min(x1, x2); + x2 = max(t + d, x1); + fixAspectRatio(); + break; + case 38: + /* Up */ + d = -d; + case 40: + /* Down */ + t = max(y1, y2); + y1 = min(y1, y2); + y2 = max(t + d, y1); + fixAspectRatio(true); + break; + default: + return; + } + + doResize(); + } + else { + /* Move selection */ + + x1 = min(x1, x2); + y1 = min(y1, y2); + + switch (key) { + case 37: + /* Left */ + doMove(max(x1 - d, left), y1); + break; + case 38: + /* Up */ + doMove(x1, max(y1 - d, top)); + break; + case 39: + /* Right */ + doMove(x1 + min(d, imgWidth - selX(x2)), y1); + break; + case 40: + /* Down */ + doMove(x1, y1 + min(d, imgHeight - selY(y2))); + break; + default: + return; + } + } + + return false; + }; + + /** + * Apply style options to plugin element (or multiple elements) + * + * @param $elem + * A jQuery object representing the element(s) to style + * @param props + * An object that maps option names to corresponding CSS + * properties + */ + function styleOptions($elem, props) { + for (var option in props) + if (options[option] !== undefined) + $elem.css(props[option], options[option]); + } + + /** + * Set plugin options + * + * @param newOptions + * The new options object + */ + function setOptions(newOptions) { + if (newOptions.parent) + ($parent = $(newOptions.parent)).append($box).append($outer); + + /* Merge the new options with the existing ones */ + $.extend(options, newOptions); + + adjust(); + + if (newOptions.handles != null) { + /* Recreate selection area handles */ + $handles.remove(); + $handles = $([]); + + i = newOptions.handles ? newOptions.handles == 'corners' ? 4 : 8 : 0; + + while (i--) + $handles = $handles.add(div()); + + /* Add a class to handles and set the CSS properties */ + $handles.addClass(options.classPrefix + '-handle').css({ + position: 'absolute', + /* + * The font-size property needs to be set to zero, otherwise + * Internet Explorer makes the handles too large + */ + fontSize: 0, + zIndex: zIndex + 1 || 1 + }); + + /* + * If handle width/height has not been set with CSS rules, set the + * default 5px + */ + if (!parseInt($handles.css('width')) >= 0) + $handles.width(5).height(5); + + /* + * If the borderWidth option is in use, add a solid border to + * handles + */ + if (o = options.borderWidth) + $handles.css({ borderWidth: o, borderStyle: 'solid' }); + + /* Apply other style options */ + styleOptions($handles, { borderColor1: 'border-color', + borderColor2: 'background-color', + borderOpacity: 'opacity' }); + } + + /* Calculate scale factors */ + scaleX = options.imageWidth / imgWidth || 1; + scaleY = options.imageHeight / imgHeight || 1; + + /* Set selection */ + if (newOptions.x1 != null) { + setSelection(newOptions.x1, newOptions.y1, newOptions.x2, + newOptions.y2); + newOptions.show = !newOptions.hide; + } + + if (newOptions.keys) + /* Enable keyboard support */ + options.keys = $.extend({ shift: 1, ctrl: 'resize' }, + newOptions.keys); + + /* Add classes to plugin elements */ + $outer.addClass(options.classPrefix + '-outer'); + $area.addClass(options.classPrefix + '-selection'); + for (i = 0; i++ < 4;) + $($border[i-1]).addClass(options.classPrefix + '-border' + i); + + /* Apply style options */ + styleOptions($area, { selectionColor: 'background-color', + selectionOpacity: 'opacity' }); + styleOptions($border, { borderOpacity: 'opacity', + borderWidth: 'border-width' }); + styleOptions($outer, { outerColor: 'background-color', + outerOpacity: 'opacity' }); + if (o = options.borderColor1) + $($border[0]).css({ borderStyle: 'solid', borderColor: o }); + if (o = options.borderColor2) + $($border[1]).css({ borderStyle: 'dashed', borderColor: o }); + + /* Append all the selection area elements to the container box */ + $box.append($area.add($border).add($areaOpera)).append($handles); + + if (msie) { + if (o = ($outer.css('filter')||'').match(/opacity=(\d+)/)) + $outer.css('opacity', o[1]/100); + if (o = ($border.css('filter')||'').match(/opacity=(\d+)/)) + $border.css('opacity', o[1]/100); + } + + if (newOptions.hide) + hide($box.add($outer)); + else if (newOptions.show && imgLoaded) { + shown = true; + $box.add($outer).fadeIn(options.fadeSpeed||0); + doUpdate(); + } + + /* Calculate the aspect ratio factor */ + aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1]; + + $img.add($outer).unbind('mousedown', imgMouseDown); + + if (options.disable || options.enable === false) { + /* Disable the plugin */ + $box.unbind('mousemove', areaMouseMove).unbind('mousedown', areaMouseDown); + $(window).unbind('resize', windowResize); + } + else { + if (options.enable || options.disable === false) { + /* Enable the plugin */ + if (options.resizable || options.movable) + $box.mousemove(areaMouseMove).mousedown(areaMouseDown); + + $(window).resize(windowResize); + } + + if (!options.persistent) + $img.add($outer).mousedown(imgMouseDown); + } + + options.enable = options.disable = undefined; + } + + /** + * Remove plugin completely + */ + this.remove = function () { + /* + * Call setOptions with { disable: true } to unbind the event handlers + */ + setOptions({ disable: true }); + $box.add($outer).remove(); + }; + + /* + * Public API + */ + + /** + * Get current options + * + * @return An object containing the set of options currently in use + */ + this.getOptions = function () { return options; }; + + /** + * Set plugin options + * + * @param newOptions + * The new options object + */ + this.setOptions = setOptions; + + /** + * Get the current selection + * + * @param noScale + * If set to true, scaling is not applied to the + * returned selection + * @return Selection object + */ + this.getSelection = getSelection; + + /** + * Set the current selection + * + * @param x1 + * X coordinate of the upper left corner of the selection area + * @param y1 + * Y coordinate of the upper left corner of the selection area + * @param x2 + * X coordinate of the lower right corner of the selection area + * @param y2 + * Y coordinate of the lower right corner of the selection area + * @param noScale + * If set to true, scaling is not applied to the + * new selection + */ + this.setSelection = setSelection; + + /** + * Cancel selection + */ + this.cancelSelection = cancelSelection; + + /** + * Update plugin elements + * + * @param resetKeyPress + * If set to false, this instance's keypress + * event handler is not activated + */ + this.update = doUpdate; + + /* Do the dreaded browser detection */ + var msie = (/msie ([\w.]+)/i.exec(ua)||[])[1], + opera = /opera/i.test(ua), + safari = /webkit/i.test(ua) && !/chrome/i.test(ua); + + /* + * Traverse the image's parent elements (up to ) and find the + * highest z-index + */ + $p = $img; + + while ($p.length) { + zIndex = max(zIndex, + !isNaN($p.css('z-index')) ? $p.css('z-index') : zIndex); + /* Also check if any of the ancestor elements has fixed position */ + //if ($p.css('position') == 'fixed') + // position = 'fixed'; + + $p = $p.parent(':not(body)'); + } + + /* + * If z-index is given as an option, it overrides the one found by the + * above loop + */ + zIndex = options.zIndex || zIndex; + + if (msie) + $img.attr('unselectable', 'on'); + + /* + * In MSIE and WebKit, we need to use the keydown event instead of keypress + */ + $.imgAreaSelect.keyPress = msie || safari ? 'keydown' : 'keypress'; + + /* + * There is a bug affecting the CSS cursor property in Opera (observed in + * versions up to 10.00) that prevents the cursor from being updated unless + * the mouse leaves and enters the element again. To trigger the mouseover + * event, we're adding an additional div to $box and we're going to toggle + * it when mouse moves inside the selection area. + */ + if (opera) + $areaOpera = div().css({ width: '100%', height: '100%', + position: 'absolute', zIndex: zIndex + 2 || 2 }); + + /* + * We initially set visibility to "hidden" as a workaround for a weird + * behaviour observed in Google Chrome 1.0.154.53 (on Windows XP). Normally + * we would just set display to "none", but, for some reason, if we do so + * then Chrome refuses to later display the element with .show() or + * .fadeIn(). + */ + $box.add($outer).css({ visibility: 'hidden', position: position, + overflow: 'hidden', zIndex: zIndex || '0' }); + $box.css({ zIndex: zIndex + 2 || 2 }); + $area.add($border).css({ position: 'absolute', fontSize: 0 }); + + /* + * If the image has been fully loaded, or if it is not really an image (eg. + * a div), call imgLoad() immediately; otherwise, bind it to be called once + * on image load event. + */ + img.complete || img.readyState == 'complete' || !$img.is('img') ? + imgLoad() : $img.one('load', imgLoad); + + /* + * MSIE 9.0 doesn't always fire the image load event -- resetting the src + * attribute seems to trigger it. The check is for version 7 and above to + * accommodate for MSIE 9 running in compatibility mode. + */ + if (!imgLoaded && msie && msie >= 7) + img.src = img.src; +}; + +/** + * Invoke imgAreaSelect on a jQuery object containing the image(s) + * + * @param options + * Options object + * @return The jQuery object or a reference to imgAreaSelect instance (if the + * instance option was specified) + */ +$.fn.imgAreaSelect = function (options) { + options = options || {}; + + this.each(function () { + /* Is there already an imgAreaSelect instance bound to this element? */ + if ($(this).data('imgAreaSelect')) { + /* Yes there is -- is it supposed to be removed? */ + if (options.remove) { + /* Remove the plugin */ + $(this).data('imgAreaSelect').remove(); + $(this).removeData('imgAreaSelect'); + } + else + /* Reset options */ + $(this).data('imgAreaSelect').setOptions(options); + } + else if (!options.remove) { + /* No exising instance -- create a new one */ + + /* + * If neither the "enable" nor the "disable" option is present, add + * "enable" as the default + */ + if (options.enable === undefined && options.disable === undefined) + options.enable = true; + + $(this).data('imgAreaSelect', new $.imgAreaSelect(this, options)); + } + }); + + if (options.instance) + /* + * Return the imgAreaSelect instance bound to the first element in the + * set + */ + return $(this).data('imgAreaSelect'); + + return this; +}; + +})(jQuery); diff -r a2ac7c3363ae -r 6c271ae9cfd3 src/ztfy/myams/resources/js/ext/jquery-imgareaselect-0.9.11-rc1.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ztfy/myams/resources/js/ext/jquery-imgareaselect-0.9.11-rc1.min.js Tue Mar 01 12:21:35 2016 +0100 @@ -0,0 +1,1 @@ +(function(e){var b=Math.abs,a=Math.max,d=Math.min,c=Math.round;function f(){return e("
")}e.imgAreaSelect=function(R,af){var N=e(R),u,B=f(),F=f(),at=f().add(f()).add(f()).add(f()),v=f().add(f()).add(f()).add(f()),aB=e([]),am,U,ar,aC={left:0,top:0},T,aD,p,X={left:0,top:0},g=0,an="absolute",aq,ap,ad,ac,t,q,ao,k,x,aH,ak,E,n,D,l,aF={x1:0,y1:0,x2:0,y2:0,width:0,height:0},G=document.documentElement,V=navigator.userAgent,ab,S,P,O,L,Q,J;function aa(h){return h+aC.left-X.left}function Z(h){return h+aC.top-X.top}function ay(h){return h-aC.left+X.left}function ax(h){return h-aC.top+X.top}function A(h){return h.pageX-X.left}function z(h){return h.pageY-X.top}function aw(h){var o=h||ad,i=h||ac;return{x1:c(aF.x1*o),y1:c(aF.y1*i),x2:c(aF.x2*o),y2:c(aF.y2*i),width:c(aF.x2*o)-c(aF.x1*o),height:c(aF.y2*i)-c(aF.y1*i)}}function au(i,w,h,o,aI){var aK=aI||ad,aJ=aI||ac;aF={x1:c(i/aK||0),y1:c(w/aJ||0),x2:c(h/aK||0),y2:c(o/aJ||0)};aF.width=aF.x2-aF.x1;aF.height=aF.y2-aF.y1}function m(){if(!u||!N.width()){return}aC={left:c(N.offset().left),top:c(N.offset().top)};T=N.innerWidth();aD=N.innerHeight();aC.top+=(N.outerHeight()-aD)>>1;aC.left+=(N.outerWidth()-T)>>1;q=c(af.minWidth/ad)||0;ao=c(af.minHeight/ac)||0;k=c(d(af.maxWidth/ad||1<<24,T));x=c(d(af.maxHeight/ac||1<<24,aD));if(e().jquery=="1.3.2"&&an=="fixed"&&!G.getBoundingClientRect){aC.top+=a(document.body.scrollTop,G.scrollTop);aC.left+=a(document.body.scrollLeft,G.scrollLeft)}X=/absolute|relative/.test(p.css("position"))?{left:c(p.offset().left)-p.scrollLeft(),top:c(p.offset().top)-p.scrollTop()}:an=="fixed"?{left:e(document).scrollLeft(),top:e(document).scrollTop()}:{left:0,top:0};U=aa(0);ar=Z(0);if(aF.x2>T||aF.y2>aD){aE()}}function K(h){if(!ak){return}B.css({left:aa(aF.x1),top:Z(aF.y1)}).add(F).width(L=aF.width).height(Q=aF.height);F.add(at).add(aB).css({left:0,top:0});at.width(a(L-at.outerWidth()+at.innerWidth(),0)).height(a(Q-at.outerHeight()+at.innerHeight(),0));e(v[0]).css({left:U,top:ar,width:aF.x1,height:aD});e(v[1]).css({left:U+aF.x1,top:ar,width:L,height:aF.y1});e(v[2]).css({left:U+aF.x2,top:ar,width:T-aF.x2,height:aD});e(v[3]).css({left:U+aF.x1,top:ar+aF.y2,width:L,height:aD-aF.y2});L-=aB.outerWidth();Q-=aB.outerHeight();switch(aB.length){case 8:e(aB[4]).css({left:L>>1});e(aB[5]).css({left:L,top:Q>>1});e(aB[6]).css({left:L>>1,top:Q});e(aB[7]).css({top:Q>>1});case 4:aB.slice(1,3).css({left:L});aB.slice(2,4).css({top:Q})}if(h!==false){if(e.imgAreaSelect.onKeyPress!=az){e(document).unbind(e.imgAreaSelect.keyPress,e.imgAreaSelect.onKeyPress)}if(af.keys){e(document)[e.imgAreaSelect.keyPress](e.imgAreaSelect.onKeyPress=az)}}if(aj&&at.outerWidth()-at.innerWidth()==2){at.css("margin",0);setTimeout(function(){at.css("margin","auto")},0)}}function y(h){m();K(h);E=aa(aF.x1);n=Z(aF.y1);D=aa(aF.x2);l=Z(aF.y2)}function ai(h,i){af.fadeSpeed?h.fadeOut(af.fadeSpeed,i):h.hide()}function I(i){var h=ay(A(i))-aF.x1,o=ax(z(i))-aF.y1;if(!J){m();J=true;B.one("mouseout",function(){J=false})}t="";if(af.resizable){if(o<=af.resizeMargin){t="n"}else{if(o>=aF.height-af.resizeMargin){t="s"}}if(h<=af.resizeMargin){t+="w"}else{if(h>=aF.width-af.resizeMargin){t+="e"}}}B.css("cursor",t?t+"-resize":af.movable?"move":"");if(am){am.toggle()}}function j(h){e("body").css("cursor","");if(af.autoHide||aF.width*aF.height==0){ai(B.add(v),function(){e(this).hide()})}e(document).unbind("mousemove",ag);B.mousemove(I);af.onSelectEnd(R,aw())}function aA(h){if(h.which!=1){return false}m();if(t){e("body").css("cursor",t+"-resize");E=aa(aF[/w/.test(t)?"x2":"x1"]);n=Z(aF[/n/.test(t)?"y2":"y1"]);e(document).mousemove(ag).one("mouseup",j);B.unbind("mousemove",I)}else{if(af.movable){aq=U+aF.x1-A(h);ap=ar+aF.y1-z(h);B.unbind("mousemove",I);e(document).mousemove(ae).one("mouseup",function(){af.onSelectEnd(R,aw());e(document).unbind("mousemove",ae);B.mousemove(I)})}else{N.mousedown(h)}}return false}function M(h){if(aH){if(h){D=a(U,d(U+T,E+b(l-n)*aH*(D>E||-1)));l=c(a(ar,d(ar+aD,n+b(D-E)/aH*(l>n||-1))));D=c(D)}else{l=a(ar,d(ar+aD,n+b(D-E)/aH*(l>n||-1)));D=c(a(U,d(U+T,E+b(l-n)*aH*(D>E||-1))));l=c(l)}}}function aE(){E=d(E,U+T);n=d(n,ar+aD);if(b(D-E)U+T){E=U+T-q}}}if(b(l-n)ar+aD){n=ar+aD-ao}}}D=a(U,d(D,U+T));l=a(ar,d(l,ar+aD));M(b(D-E)k){D=E-k*(Dx){l=n-x*(l=0){aB.width(5).height(5)}if(O=af.borderWidth){aB.css({borderWidth:O,borderStyle:"solid"})}H(aB,{borderColor1:"border-color",borderColor2:"background-color",borderOpacity:"opacity"})}ad=af.imageWidth/T||1;ac=af.imageHeight/aD||1;if(h.x1!=null){au(h.x1,h.y1,h.x2,h.y2);h.show=!h.hide}if(h.keys){af.keys=e.extend({shift:1,ctrl:"resize"},h.keys)}v.addClass(af.classPrefix+"-outer");F.addClass(af.classPrefix+"-selection");for(P=0;P++<4;){e(at[P-1]).addClass(af.classPrefix+"-border"+P)}H(F,{selectionColor:"background-color",selectionOpacity:"opacity"});H(at,{borderOpacity:"opacity",borderWidth:"border-width"});H(v,{outerColor:"background-color",outerOpacity:"opacity"});if(O=af.borderColor1){e(at[0]).css({borderStyle:"solid",borderColor:O})}if(O=af.borderColor2){e(at[1]).css({borderStyle:"dashed",borderColor:O})}B.append(F.add(at).add(am)).append(aB);if(aj){if(O=(v.css("filter")||"").match(/opacity=(\d+)/)){v.css("opacity",O[1]/100)}if(O=(at.css("filter")||"").match(/opacity=(\d+)/)){at.css("opacity",O[1]/100)}}if(h.hide){ai(B.add(v))}else{if(h.show&&u){ak=true;B.add(v).fadeIn(af.fadeSpeed||0);y()}}aH=(S=(af.aspectRatio||"").split(/:/))[0]/S[1];N.add(v).unbind("mousedown",aG);if(af.disable||af.enable===false){B.unbind("mousemove",I).unbind("mousedown",aA);e(window).unbind("resize",al)}else{if(af.enable||af.disable===false){if(af.resizable||af.movable){B.mousemove(I).mousedown(aA)}e(window).resize(al)}if(!af.persistent){N.add(v).mousedown(aG)}}af.enable=af.disable=undefined}this.remove=function(){ah({disable:true});B.add(v).remove()};this.getOptions=function(){return af};this.setOptions=ah;this.getSelection=aw;this.setSelection=au;this.cancelSelection=Y;this.update=y;var aj=(/msie ([\w.]+)/i.exec(V)||[])[1],av=/opera/i.test(V),C=/webkit/i.test(V)&&!/chrome/i.test(V);ab=N;while(ab.length){g=a(g,!isNaN(ab.css("z-index"))?ab.css("z-index"):g);ab=ab.parent(":not(body)")}g=af.zIndex||g;if(aj){N.attr("unselectable","on")}e.imgAreaSelect.keyPress=aj||C?"keydown":"keypress";if(av){am=f().css({width:"100%",height:"100%",position:"absolute",zIndex:g+2||2})}B.add(v).css({visibility:"hidden",position:an,overflow:"hidden",zIndex:g||"0"});B.css({zIndex:g+2||2});F.add(at).css({position:"absolute",fontSize:0});R.complete||R.readyState=="complete"||!N.is("img")?s():N.one("load",s);if(!u&&aj&&aj>=7){R.src=R.src}};e.fn.imgAreaSelect=function(g){g=g||{};this.each(function(){if(e(this).data("imgAreaSelect")){if(g.remove){e(this).data("imgAreaSelect").remove();e(this).removeData("imgAreaSelect")}else{e(this).data("imgAreaSelect").setOptions(g)}}else{if(!g.remove){if(g.enable===undefined&&g.disable===undefined){g.enable=true}e(this).data("imgAreaSelect",new e.imgAreaSelect(this,g))}}});if(g.instance){return e(this).data("imgAreaSelect")}return this}})(jQuery); \ No newline at end of file diff -r a2ac7c3363ae -r 6c271ae9cfd3 src/ztfy/myams/resources/js/myams.js --- a/src/ztfy/myams/resources/js/myams.js Tue Mar 01 12:21:09 2016 +0100 +++ b/src/ztfy/myams/resources/js/myams.js Tue Mar 01 12:21:35 2016 +0100 @@ -2063,6 +2063,9 @@ * Close modal dialog associated with given context */ close: function(context) { + if (typeof(context) === 'string') { + context = $(context); + } var modal = context.parents('.modal').data('modal'); if (modal) { var manager = $('body').data('modalmanager'); @@ -2691,7 +2694,7 @@ var sliders = $('.slider', element); if (sliders.length > 0) { ams.ajax.check($.fn.slider, - ams.baseURL + 'ext/bootstrap-slider.min.js', + ams.baseURL + 'ext/bootstrap-slider-2.0.0' + ams.devext + '.js', function() { sliders.each(function() { var slider = $(this); @@ -3528,7 +3531,7 @@ var images = $('.imgareaselect', element); if (images.length > 0) { ams.ajax.check($.fn.imgAreaSelect, - ams.baseURL + 'ext/jquery-imgareaselect-0.9.10' + ams.devext + '.js', + ams.baseURL + 'ext/jquery-imgareaselect-0.9.11-rc1' + ams.devext + '.js', function(first_load) { if (first_load) { ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.css'); @@ -4530,7 +4533,7 @@ $(document).on('click', 'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])', function(e) { var link = $(e.currentTarget); var handlers = link.data('ams-disabled-handlers'); - if ((handlers === true) || (handlers === 'click')) { + if ((handlers === true) || (handlers === 'click') || (handlers === 'all')) { return; } var href = link.attr('href') || link.data('ams-url'); @@ -4595,7 +4598,7 @@ .on('click', '[data-toggle="modal"]', function(e) { var source = $(this); var handlers = source.data('ams-disabled-handlers'); - if ((handlers === true) || (handlers === 'click')) { + if ((handlers === true) || (handlers === 'click') || (handlers === 'all')) { return; } if (source.data('ams-context-menu') === true) { @@ -4621,7 +4624,7 @@ $(document).on('click', '[data-ams-click-handler]', function(e) { var source = $(this); var handlers = source.data('ams-disabled-handlers'); - if ((handlers === true) || (handlers === 'click')) { + if ((handlers === true) || (handlers === 'click') || (handlers === 'all')) { return; } var data = source.data(); @@ -4643,7 +4646,7 @@ $(document).on('change', '[data-ams-change-handler]', function(e) { var source = $(this); var handlers = source.data('ams-disabled-handlers'); - if ((handlers === true) || (handlers === 'change')) { + if ((handlers === true) || (handlers === 'change') || (handlers === 'all')) { return; } var data = source.data(); diff -r a2ac7c3363ae -r 6c271ae9cfd3 src/ztfy/myams/resources/js/myams.min.js --- a/src/ztfy/myams/resources/js/myams.min.js Tue Mar 01 12:21:09 2016 +0100 +++ b/src/ztfy/myams/resources/js/myams.min.js Tue Mar 01 12:21:35 2016 +0100 @@ -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.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":if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":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":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(h){if(h===a.i18n.BTN_OK){g.call(f)}})}else{g.call(f)}},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,o){var l;var E=m.data();var v=E.amsFormOptions;var n;var q;if(h){q=h.formDataInitCallback}if(q){delete h.formDataInitCallback}else{q=E.amsFormDataInitCallback}if(q){var w={};if(typeof(q)==="function"){n=q.call(m,w)}else{n=a.executeFunctionByName(q,m,w)}if(w.veto){l=m.data("ams-submit-button");if(l){l.button("reset")}a.form.finalizeSubmitFooter.call(m);return false}}else{n=E.amsFormData||{}}l=c(m.data("ams-submit-button"));var x,A;if(l){x=l.data("ams-form-handler");A=l.data("ams-form-submit-target")}var p;var t=f||x||E.amsFormHandler||"";if(t.startsWith(window.location.protocol)){p=t}else{var z=m.attr("action").replace(/#/,"");if(z.startsWith(window.location.protocol)){p=z}else{p=a.ajax.getAddr()+z}p+=t}var D=null;if(h&&h.initSubmitTarget){a.executeFunctionByName(h.initSubmitTarget)}else{if(E.amsFormInitSubmitTarget){D=c(A||E.amsFormSubmitTarget||"#content");a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmit",m,D)}else{if(!E.amsFormHideSubmitFooter){a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",m)}}}var r=typeof(o.uuid)!=="undefined";if(r){if(p.indexOf("X-Progress-ID")<0){p+="?X-Progress-ID="+o.uuid}delete o.uuid}if(h){n=c.extend({},n,h.form_data)}var u={url:p,type:"post",cache:false,data:n,dataType:E.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(G,F){F.data("submitted",true)},error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},iframe:r};var y=(h&&h.downloadTarget)||E.amsFormDownloadTarget;if(y){var s=c('iframe[name="'+y+'"]');if(!s.exists()){s=c("").hide().attr("name",y).appendTo(m)}u=c.extend({},u,{iframe:true,iframeTarget:s,success:function(F,G,K,J){var I=c(J).parents(".modal-dialog");if(I.exists()){a.dialog.close(J)}else{var L;var H=J.data("ams-submit-button");if(H){L=H.data("ams-form-submit-callback")}if(!L){L=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}L.call(J,F,G,K,J);if(J.is(":visible")&&H){H.button("reset")}J.data("submitted",false);J.removeData("ams-submit-button");J.removeAttr("data-ams-form-changed")}}})}else{u=c.extend({},u,{error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},success:function(F,G,J,I){var K;var H=I.data("ams-submit-button");if(H){K=H.data("ams-form-submit-callback")}if(!K){K=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}K.call(I,F,G,J,I);if(I.is(":visible")&&H){H.button("reset")}I.data("submitted",false);I.removeData("ams-submit-button");I.removeAttr("data-ams-form-changed")},iframe:r})}var C=c.extend({},u,o,v,h);c(m).ajaxSubmit(C);if(y){var B=c(m).parents(".modal-dialog");if(B.exists()){a.dialog.close(m)}else{a.form.finalizeSubmitFooter.call(m);if(l){l.button("reset")}m.data("submitted",false);m.removeData("ams-submit-button");m.removeAttr("data-ams-form-changed")}}}var j=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")},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: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)}}})}})})},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.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(i){a.plugins.initData(i);var h=[];c("[data-ams-plugins-disabled]",i).each(function(){var n=c(this).data("ams-plugins-disabled").split(/\s+/);for(var o=0;o=0){continue}var l=a.plugins.enabled[k];switch(typeof(l)){case"function":l(i);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.min.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={url:l.amsSelect2MethodTarget||a.jsonrpc.getAddr(),type:l.amsSelect2MethodType||"POST",cache:false,method:l.amsSelect2QueryMethod,params:l.amsSelect2QueryParams||{},success:function(p,o){return a.helpers.select2QueryMethodSuccessCallback.call(g,p,o,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.devmode?".js":".min.js"),function(){c.jsonRpc(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)})})}},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};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 D=c(this);var H=D.data();var F=(H.amsDatatableExtensions||"").split(/\s+/);var m=H.amsDatatableSdom||"W"+((F.indexOf("colreorder")>=0||F.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(F.indexOf("colvis")>=0?"C":"")+((H.amsDatatablePagination===false||H.amsDatatablePaginationSize===false)?"":"L")+(H.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(F.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(H.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var p;var i=H.amsDatatableSorting;if(typeof(i)==="string"){var G=i.split(";");i=[];for(p=0;p0?h:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:H.amsDatatableDisplayLength||25,sPaginationType:H.amsDatatablePaginationType||"bootstrap_full",sDom:m,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(K,J){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var E=c.extend({},z,H.amsDatatableOptions);if(F.length>0){for(p=0;p0){for(p=0;p0){for(p=0;p0){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)})})}},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.10"+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(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("#activity > .badge");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_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("#ribbon OL.breadcrumb");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("nav LI.active >A").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(l){c(".active",i).removeClass("active");l.addClass("open").addClass("active");l.parents("li").addClass("open active").children("ul").addClass("active").show();l.parents("li:first").removeClass("open");l.parents("ul").addClass(l.attr("href").replace(/^#/,"")?"active":"").show()}var j;var i=c("nav");var h=location.hash;var g=h.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}j=c('A[href="'+h+'"]',i);if(j.exists()){e(j)}a.skin.loadURL(g,f);document.title=c("[data-ams-page-title]:first",f).data("ams-page-title")||j.attr("title")||document.title}else{var k=c("[data-ams-active-menu]").data("ams-active-menu");if(k){j=c('A[href="'+k+'"]',i)}else{j=c('>UL >LI >A[href!="#"]',i).first()}if(j.exists()){e(j);if(k){a.skin._drawBreadCrumb()}else{window.location.hash=j.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f Loading... ');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();document.title=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)}}},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={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("#shortcut");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-shortcut").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").click(function(i){var h=c(this);var j=h.next(".ajax-dropdown");if(!j.is(":visible")){j.css("left",h.position().left-j.innerWidth()/2+h.innerWidth()/2).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(){var i=c(this).data("ams-url");var h=c(".ajax-notifications");a.skin.loadURL(i,h)});c("#logout a").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")){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(h){h.preventDefault();window.open(c(h.currentTarget).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")){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","[data-ams-click-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="click")){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")){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()}}});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 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.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":if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":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":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(h){if(h===a.i18n.BTN_OK){g.call(f)}})}else{g.call(f)}},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,o){var l;var E=m.data();var v=E.amsFormOptions;var n;var q;if(h){q=h.formDataInitCallback}if(q){delete h.formDataInitCallback}else{q=E.amsFormDataInitCallback}if(q){var w={};if(typeof(q)==="function"){n=q.call(m,w)}else{n=a.executeFunctionByName(q,m,w)}if(w.veto){l=m.data("ams-submit-button");if(l){l.button("reset")}a.form.finalizeSubmitFooter.call(m);return false}}else{n=E.amsFormData||{}}l=c(m.data("ams-submit-button"));var x,A;if(l){x=l.data("ams-form-handler");A=l.data("ams-form-submit-target")}var p;var t=f||x||E.amsFormHandler||"";if(t.startsWith(window.location.protocol)){p=t}else{var z=m.attr("action").replace(/#/,"");if(z.startsWith(window.location.protocol)){p=z}else{p=a.ajax.getAddr()+z}p+=t}var D=null;if(h&&h.initSubmitTarget){a.executeFunctionByName(h.initSubmitTarget)}else{if(E.amsFormInitSubmitTarget){D=c(A||E.amsFormSubmitTarget||"#content");a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmit",m,D)}else{if(!E.amsFormHideSubmitFooter){a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",m)}}}var r=typeof(o.uuid)!=="undefined";if(r){if(p.indexOf("X-Progress-ID")<0){p+="?X-Progress-ID="+o.uuid}delete o.uuid}if(h){n=c.extend({},n,h.form_data)}var u={url:p,type:"post",cache:false,data:n,dataType:E.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(G,F){F.data("submitted",true)},error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},iframe:r};var y=(h&&h.downloadTarget)||E.amsFormDownloadTarget;if(y){var s=c('iframe[name="'+y+'"]');if(!s.exists()){s=c("").hide().attr("name",y).appendTo(m)}u=c.extend({},u,{iframe:true,iframeTarget:s,success:function(F,G,K,J){var I=c(J).parents(".modal-dialog");if(I.exists()){a.dialog.close(J)}else{var L;var H=J.data("ams-submit-button");if(H){L=H.data("ams-form-submit-callback")}if(!L){L=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}L.call(J,F,G,K,J);if(J.is(":visible")&&H){H.button("reset")}J.data("submitted",false);J.removeData("ams-submit-button");J.removeAttr("data-ams-form-changed")}}})}else{u=c.extend({},u,{error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},success:function(F,G,J,I){var K;var H=I.data("ams-submit-button");if(H){K=H.data("ams-form-submit-callback")}if(!K){K=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}K.call(I,F,G,J,I);if(I.is(":visible")&&H){H.button("reset")}I.data("submitted",false);I.removeData("ams-submit-button");I.removeAttr("data-ams-form-changed")},iframe:r})}var C=c.extend({},u,o,v,h);c(m).ajaxSubmit(C);if(y){var B=c(m).parents(".modal-dialog");if(B.exists()){a.dialog.close(m)}else{a.form.finalizeSubmitFooter.call(m);if(l){l.button("reset")}m.data("submitted",false);m.removeData("ams-submit-button");m.removeAttr("data-ams-form-changed")}}}var j=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")},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: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)}}})}})})},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.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(i){a.plugins.initData(i);var h=[];c("[data-ams-plugins-disabled]",i).each(function(){var n=c(this).data("ams-plugins-disabled").split(/\s+/);for(var o=0;o=0){continue}var l=a.plugins.enabled[k];switch(typeof(l)){case"function":l(i);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={url:l.amsSelect2MethodTarget||a.jsonrpc.getAddr(),type:l.amsSelect2MethodType||"POST",cache:false,method:l.amsSelect2QueryMethod,params:l.amsSelect2QueryParams||{},success:function(p,o){return a.helpers.select2QueryMethodSuccessCallback.call(g,p,o,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.devmode?".js":".min.js"),function(){c.jsonRpc(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)})})}},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};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 D=c(this);var H=D.data();var F=(H.amsDatatableExtensions||"").split(/\s+/);var m=H.amsDatatableSdom||"W"+((F.indexOf("colreorder")>=0||F.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(F.indexOf("colvis")>=0?"C":"")+((H.amsDatatablePagination===false||H.amsDatatablePaginationSize===false)?"":"L")+(H.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(F.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(H.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var p;var i=H.amsDatatableSorting;if(typeof(i)==="string"){var G=i.split(";");i=[];for(p=0;p0?h:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:H.amsDatatableDisplayLength||25,sPaginationType:H.amsDatatablePaginationType||"bootstrap_full",sDom:m,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(K,J){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var E=c.extend({},z,H.amsDatatableOptions);if(F.length>0){for(p=0;p0){for(p=0;p0){for(p=0;p0){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)})})}},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(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("#activity > .badge");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_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("#ribbon OL.breadcrumb");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("nav LI.active >A").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(l){c(".active",i).removeClass("active");l.addClass("open").addClass("active");l.parents("li").addClass("open active").children("ul").addClass("active").show();l.parents("li:first").removeClass("open");l.parents("ul").addClass(l.attr("href").replace(/^#/,"")?"active":"").show()}var j;var i=c("nav");var h=location.hash;var g=h.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}j=c('A[href="'+h+'"]',i);if(j.exists()){e(j)}a.skin.loadURL(g,f);document.title=c("[data-ams-page-title]:first",f).data("ams-page-title")||j.attr("title")||document.title}else{var k=c("[data-ams-active-menu]").data("ams-active-menu");if(k){j=c('A[href="'+k+'"]',i)}else{j=c('>UL >LI >A[href!="#"]',i).first()}if(j.exists()){e(j);if(k){a.skin._drawBreadCrumb()}else{window.location.hash=j.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f Loading... ');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();document.title=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)}}},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={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("#shortcut");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-shortcut").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").click(function(i){var h=c(this);var j=h.next(".ajax-dropdown");if(!j.is(":visible")){j.css("left",h.position().left-j.innerWidth()/2+h.innerWidth()/2).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(){var i=c(this).data("ams-url");var h=c(".ajax-notifications");a.skin.loadURL(i,h)});c("#logout a").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(h){h.preventDefault();window.open(c(h.currentTarget).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","[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()}}});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