diff --git a/Release/1.2/jquerymy-1.2.11.js b/Release/1.2/jquerymy-1.2.11.js new file mode 100644 index 0000000..1a0e4a3 --- /dev/null +++ b/Release/1.2/jquerymy-1.2.11.js @@ -0,0 +1,4504 @@ +/* + * jQuery.my 1.2.11 + * Requires jQuery 2.0+, SugarJS 1.3.9-1.4.x + * + * — fixed inability of $.my.modal to close popup + * when source pivot DOM node was removed + * — other minor fixes in $.my.modal + * + * More details at jquerymy.com + * + * (c) @ermouth, thanks @carpogoryanin, @ftescht + * 2017-10-10 + */ + +;(function ($) { + + var _version = "1.2.11"; + + // Some shortcuts and constants + var TMP, lang = "en", + wURL = window.URL || window.webkitURL, + ie8 = !document.addEventListener, + + Lang = ((window.navigator.language || window.navigator.userLanguage || 'en')+'').split('-')[0].toLowerCase(), + + d8 = "{yyyy}-{MM}-{dd}", + h24="{HH}:{mm}", + Ob = "object", + Da = "data", + Ar = "array", + St = "string", + Fu = "function", + Ch = "change", + rthis = /^this\./, + + isA = Object.isArray, + isB = Object.isBoolean, + isS = Object.isString, + isO = Object.isObject, + isN = Object.isNumber, + isR = Object.isRegExp, + isF = Object.isFunction, + isP = function (a) { + // detects promise + return null != a && typeof a == Ob && isF(a.then); + }, + + forms = _getref($,"my.f.repo")? $.my.f.repo():{_src:{}, _name:"Default manifest cache"}, + restyles = _getref($,"my.f.restyles")? $.my.f.restyles():{}, + + Merge = Object.merge, + Clone = Object.clone, + Keys = Object.keys, + $E = $.extend, + $D = $.Deferred, + T = $.type, + + N = null, + n = function (o) {return o!==null && o!==undefined;}, + + // Configurables using $.my[fname](newHandler) + // like $.my.ajax(newGlobalAjaxHandlerFunction) + + _ajax = $.ajax, + _cache = _localCache, + _now = Date.now, + _require = _localRequire; + + //######################################################## + // Storage of rules defined by cascading selectors + // very similar to css. Leafs are processors + // or processing rules for this type of node + + var MY = { + + //getter and setter functions for different types of nodes + + vals: { + + ".my-form": function ($o, v) { + //object is jQuery.my instance + if ($o && $o.my ) {var d = $o.my(Da); return Object.equal(d,v)?d:$o.my(Da, v, true);} + else return v||N; + }, + + ".hasDatepicker":function ($o,v) { + //object has jQ UI datepicker + if(n(v)) $o.datepicker("setDate", ((v=="")?v:Date.create(v))); + var date = $o.datepicker("getDate"); + return (date?date.format(d8):""); + }, + + ".my-tags": function ($o,v) { + //object is jQ tags control + if (n(v)) { + if (isS(v) || isN(v)) $o.tags(Da,[v+""]); + else if (isA(v)) $o.tags(Da,v); + } + return $o.tags(Da); + }, + + ".ui-draggable": (function ($o,v) { + //object is jQ UI draggable + if (n(v) && isO(v)) { + var c = {}; + if (!isNaN(v.left)) c.left = Number(v.left).ceil(2)+"px"; + if (!isNaN(v.top)) c.top = Number(v.top).ceil(2)+"px"; + if (c.left || c.top) $o.css(c); + } + var p = $o.position(); + return { + left:((v&&!isNaN(v.left))?(v.left*1).ceil(2):p.left.ceil(2)), + top:((v&&!isNaN(v.top))?(v.top*1).ceil(2):p.top.ceil(2)) + }; + }), + + ".my-form-list": (function ($o,list) { + //object is list of forms + var i,old,xold,mod,eq,ctr = 0, + $n, $drag, + od = $o.data("formlist")||{}, + gen = od.generator||{}, + itemSel = gen.selector||">.my-form", + merge = !!gen.merge, + tmpl = gen.template||"
", + tmplIsVar = /\{/.test(tmpl), + hasher = gen.hash || _sdbm, + ider = gen.id || _sdbm, + extHasher = gen.ext, + delay = gen.delay||50, + sP = "ui-sortable", + sPlc= "."+sP+"-placeholder", + sortable = $o.is("."+sP), + sorting = !!$o.children(sPlc).length, + result=[], + redraw = [], + now = _now(); + var $c = sortable?$o.find($o.sortable("option","items")):$o.find(itemSel); + + if (n(list) && isA(list)) { + //return list passed if dragging taking place + if (sorting) return list; + // first we must estimate + // if putting new data over old + // changes anything + old= []; xold={}; + $c.each(function (i) { + var $x = $(this), xd = $x.data("my"), dd; + if (xd) { + old.push(xd.data); + if (!merge && (dd = $x.data("formlist"))) xold[dd.oid] = xd.data; + } + }); + + //fast compare + eq = _aeq(old, list, "=="); + + if (!eq){ + // We possibly have new data, hash it + var hash=[], oid = [], xoid = {}, present={}; + + redraw = []; + + // Build id <-> idx and hashes + for (i=0;i1.4*delay) + || now-gen.stamp > 100 + || !gen.stashed + || (gen.stashed.length !== $c.length-(sorting?1:0)) + ) { + + if (sorting) $drag = $o.find('>.'+sP+'-helper'); + var ri=0; + $c.each(function (idx, elt) { + var $x = $(elt), xd, xf, chash, dirty = false; + if (!sorting || !$x.hasClass(sP+'-helper')) { + if (sorting && $x.hasClass(sP + '-placeholder')) $x = $drag; + xd = $x.data("my"); + xf = $x.data("formlist"); + if (xd && xf) { + result.push(xd.data); + if (ri != xf.index) { + xf.index = ri; + dirty = !0; + } + if (extHasher) { + chash = hasher(xd.data, ri)+""; + if (chash !== xf.hash) { + xf.hash = chash; + dirty = !0; + } + } + ri += 1; + if (dirty) redraw.push($x); + } + } + }); + for (i=0;i-1) { + var $x = $o.eq(pos); + if (!$x.is(":checked")) { + $x.prop("checked",true); + if (jqcheck) $x.checkboxradio("refresh"); + } + } else if (!jqcheck) $o.each(function () { $(this).prop("checked",false); }); + } + if (pos==-1) for (var ind=0; ind<$o.length; ind++) { + if ($o.eq(ind).is(":checked")) pos=ind; + } + return pos!=-1?$o.eq(pos).val():""; + }, + + ":checkbox": function ($o, v0) { + //checkbox + var pos = -1, v = v0, a = []; + if (n(v)) { + if (!isA(v)) v = [v0]; + var jqcheck = !!$o.eq(0).checkboxradio; + $o.each(function (ind) { + var $x = $(this), val = $x.val(), on = $x.is(":checked"); + if (v.indexOf(val)!=-1) { + a.push(val); + if (!on) $x.prop("checked", true); + } else if (on) $x.prop("checked", false); + if (jqcheck) $x.checkboxradio("refresh"); + }); + } else { + $o.each(function () { + var $x = $(this); + if ($x.is(":checked")) a.push($x.val()); + }); + } + return a; + } + }), + + "select": ({ + ".ui-slider-switch": function ($o,v) { + //on-off in jQ Mobile + if (n(v)) { + $o.val(v+""); + $o.slider("refresh"); + } + }, + "div.select2-container+select":{ + "[multiple]": function ($o, v) { + if (n(v)) $o.select2("val", (isA(v)?v:[v])); + return $o.select2("val"); + }, + "":function ($o, v) { + if (n(v)) $o.select2("val", v+""); + return $o.select2("val"); + } + }, + "[multiple]": function ($o,v) { + if (n(v)) { + $o.val(v,[]); + if ($o.selectmenu && ($o.data("uiSelectmenu") || $o.data("selectmenu"))) $o.selectmenu("refresh",true); + //the only way to check if we have jQ UI selectmenu() attached + } + return $o.val()||[]; + }, + "": function ($o,v) { + if (n(v)) { + $o.val(v+""); + if ($o.selectmenu && ($o.data("uiSelectmenu") || $o.data("selectmenu"))) $o.selectmenu("refresh",true); + } + } + }), + + "textarea": ({ + // textarea or rich editor over + ".my-cleditor":function ($o,v) { + if(n(v)) $o.val(v).cleditor()[0].updateFrame(); + return $o.val(); + }, + "div.redactor_box textarea,.redactor": function ($o,v) { + var r9 = $o.hasClass('my-redactor-9'); + if(n(v)) { + if(r9) $o.redactor('set', v); + else $o.setCode(v, false); + return v; + } + return r9 ? $o.redactor('get') : $o.getCode(); + }, + ".my-codemirror":function ($o,v){ + if (n(v)) { + $o[0].nextSibling.CodeMirror.setValue(v); + return v; + } + return $o[0].nextSibling.CodeMirror.getValue(); + }, + "":function ($o,v) {if(n(v)) $o.val(v+"");} + }), + + "fieldset,form,section,footer,aside,.my-container": (function ($o, v) { + //object is class-manageable container, + //value is an array of css rules + var clist = _slice($o[0], 0).sort(), + list = v; + if (n(v)) { + if (isS(v)) list = v.split(/[,\s]+/).compact(true); + if (isA(list)) { + list.sort(); + if (list.join(" ")!==clist.join(" ")) { + $o.atrr("css", list.join(" ")); + clist = list; + } + } + } + return clist; + }), + + "div,span": ({ + ".ui-slider":function ($o, v){ + if(n(v)) $o.slider("option",$o.slider("option","values")?"values":"value", f.clone(v)); + return f.clone($o.slider("option","values")||$o.slider("option","value")||0); + }, + ".ui-buttonset": function ($o,v) { + //jQ UI buttonset () + if (!n(v)) { + var jor = $o.find(":radio:checked"); + if (jor.length && jor.button) return jor.val()||jor.button("option", "label") ; + } else if (v!="") { + var jon = N; + $o.find(":radio").each(function () { + jon=( ($(this).val()||$(this).button("option", "label"))==v?$(this):jon ); + }); + if (jon) { + jon.attr("checked",true); + $o.buttonset("refresh"); + return v; + } + } + $o.find(":radio:checked").attr("checked",false); + $o.buttonset("refresh"); + return ""; + }, + ".ace_editor":function ($o,v) { + if(n(v)) ace.edit($o[0]).setValue(v); + return ace.edit($o[0]).getValue(v); + }, + "": function ($o,v) { + if(n(v)) $o.html(v); + return $o.html(); + } + }), + + "a,p,li,td,th,h1,h2,h3,h4,h5,h6,pre,code":function ($o,v) { + if(n(v)) $o.html(v); + return $o.html(); + }, + "img":function ($o,v) { + if (n(v)) $o.attr("src",v); + return $o.attr("src")||""; + }, + "":function ($o,v) { + if (n(v)) $o.html(v); + return $o.html()||$o.text()||String($o.val())||""; + } + }, + + + //messages + //######################################################## + + msg:{ + "":{en:"Invalid input", ru:"Неверное значение"}, + + formError:{en:"Form error",ru:"Ошибка формы"}, + initFailed:{ + en:'

Form init failed

', + ru:'

Ошибка инициализации формы

' + }, + + badInput:{en:"Invalid input", ru:"Неверное значение"}, + patternMismatch:{en:"Pattern mismatch", ru:"Не соответствует шаблону"}, + rangeOverflow:{en:"Over maximum", ru:"Больше максимума"}, + rangeUnderflow:{en:"Under minimum", ru:"Меньше минимума"}, + stepMismatch:{en:"Step mismatch", ru:"Не кратно шагу"}, + tooLong:{en:"Too long", ru:"Слишком длинно"}, + typeMismatch:{en:"Invalid type", ru:"Неверный тип"}, + valueMissing:{en:"Required", ru:"Обязательное поле"} + }, + + + // Different controls’ events to watch for + // ######################################################## + + events: { + ".hasDatepicker":"change.my check.my", + ".my-form,.my-tags":"change.my check.my", + ".ui-slider":"slide.my check.my", + "div.redactor_box textarea":"redactor.my check.my", + ".my-codemirror":"codemirror.my check.my", + ".ace_editor":"ace.my check.my", + ".my-form-list":"sortupdate.my check.my", + ".ui-sortable":"sortchange.my sortupdate.my check.my", + ".ui-draggable":"drag.my dragstop.my check.my", + "a, .pseudolink, input[type=button], button": "click.my", + "img, :radio, :checkbox": "click.my check.my", + "div.select2-container+input,div.select2-container+select":"change.my check.my input.my", + ".ui-buttonset,input, select, textarea": + "blur.my change.my check.my"+(navigator.appName.to(5)==="Micro"?" keyup.my":" input.my"), + "":"check.my" + }, + + // Functions retrieving container for different controls + // ######################################################## + + containers: { + "*[data-role='fieldcontain'] *":{ //jQuery Mobile + "input,textarea,select,button,:radio": function ($o) { + return $o.parents('[data-role="fieldcontain"]').eq(0); + } + }, + ".tagstrip *.value": function ($o){ //$.tagstrip() + return $o.parents('.tagstrip').eq(0); + }, + "div.redactor_box textarea":function ($o){ + return $o.parents('div.redactor_box').eq(0).parent(); + }, + ".my-tags,.hasDatepicker,.ui-widget,input,textarea,select,button" :{ + ".my-cleditor": function ($o) { + return $o.parents('div.cleditorMain').eq(0).parent(); + }, + "": function ($o) { + var p = $o[0].parentNode, t = p.nodeName; + if (/^(div|span|a|p|form|fieldset|li|ul|td|th|h\d)$/i.test(t)) return $(p); + else return $o.parents('div,span,a,p,form,fieldset,li,ul,td,th,h1,h2,h3,h4,h5,h6').eq(0); + } + }, + "": function ($o) {return $o;} + + }, + + // Disablers and enablers + // ######################################################## + + offon: { //if x==true disables control else enables + ".ace_editor": function (x,$o) {ace.edit($o[0]).setReadOnly(x);}, + ".ui-selectable": function (x,$o) {_jquix($o,"selectable",x);}, + ".ui-slider": function (x,$o) {_jquix($o,"slider",x);}, + ".ui-draggable": function (x,$o) {_jquix($o,"draggable",x);}, + ".ui-buttonset": function (x,$o) {_jquix($o,"buttonset",x);}, + ".hasDatepicker": function (x,$o) {_jquix($o,"datepicker",x);}, + ".my-form":function (x,$o){$o.my("disabled", !!x);}, + "div.select2-container+input,div.select2-container+select": + function (x,$o) {_jquix($o,"select2",x);}, + ".my-cleditor": function (x,$o) { $o.cleditor()[0].disable(!!x);}, + "": function (x, $o) {$o.attr("disabled", !!x);} + }, + + // Destructors + // ######################################################## + destroy:{ + ".hasDatepicker":function ($o){$o.datepicker("destroy");}, + ".ui-slider":function ($o){$o.slider("destroy");}, + ".ui-sortable":{ + ".my-form-list":function ($o){ + $o.find(">.my-form").each(function () { + $(this).my("remove"); + }); + $o.removeClass("my-form-list"); + $o.sortable("destroy"); + }, + "":function ($o){$o.sortable("destroy");} + }, + ".my-form-list":function ($o){ + $o.find(">.my-form").each(function () { + $(this).my("remove"); + }); + + }, + ".ui-draggable":function ($o){$o.draggable("destroy");}, + ".my-redactor-8":function ($o){ + $o.destroyEditor(); + $o.removeClass("my-redactor-8"); + }, + "div.select2-container+input,div.select2-container+select": + function ($o){$o.select2('destroy');}, + ".my-form": function ($o) {$o.my("remove");}, + "textarea": { + ".my-codemirror": function ($o) { + $o[0].nextSibling.CodeMirror.toTextArea(); + $o.removeClass("my-codemirror"); + } + } + } + }; + + // Default values for .params section of manifest + // ######################################################## + + MY.params = { + container:function ($o) { + return _traverse($o, MY.containers)($o); + }, + change:N, + + // depth of dependencies resolver tree + recalcDepth: 2, + + // default delay of bind invocation + delay: 0, + + // if true form assumed unjsonned + strict: false, + + // delay of '); + } + var h = "", $s = $("style#my-modal-style-"+m.cid); + if (m.nose=="top" || m.nose=="bottom") { + h+='div.my-modal-'+m.cid+'.nose-'+m.nose+':before {left:' + + (m.pos.ox - m.pos.px + m.pos.ow/2 - m.pos.vx) + +'px!important;}'; + $s.text(h); + } + else if (m.nose=="left" || m.nose=="right") { + h+='div.my-modal-'+m.cid+'.nose-'+m.nose+':before {top:' + + (m.pos.oy - m.pos.py + m.pos.oh/2 - m.pos.vy) + +'px!important;}'; + $s.text(h); + } + } + } + else $m.css({ + left:"50%", + "margin-left":"-"+((m.width+padx)/2).round(0)+"px" + }); + + + if (m.screen) { + if (!m.global) $bg.css({ + top:0, left:0, position:"absolute", + width: $bg.parent().outerWidth()+'px', + height: $bg.parent().outerHeight()+'px', + display:"block", + background:isS(m.screen)? m.screen:'rgba(255,255,255,0.6)', + "z-index":m.z-1 + }); + else { + $bg.css({ + top:0, left:0, + width:"100%", height:"100%", + display:"block", + position:"fixed", + "z-index":m.z-1 + }); + if (isS(m.screen)) $bg.css({ + background:m.screen? m.screen:'rgba(18,41,72,0.88)' + }); + else $bg.css({ + background:m.screen?'rgba(18,41,72,0.88)':'' + }); + } + } + else if ($bg.length) $bg.hide(); + + if (m.height> m.pos.wh) { + $m.height(m.pos.wh-30); + $f.css({'overflow-y':'scroll'}); + } else { + $f.css({'overflow-y':''}); + } + + $m.animate({top: m.pos.vy+'px', opacity:'1'}, m.animate); + } + + // - - - - - - - - - - - - - - - - - - + + function _remove(){ + try { $f.my('remove'); } catch(e){} + try { + // root may not exist + $r.data('modals')[m.cid] = null; + } catch(e){} + $f.parent().off('.my').remove(); + if (_indom($bg)) $bg.off('.my'+ m.cid); + if (m.screen && _indom($bg)) { + (function(g){ + if (!g || !isOpen) $bg.hide(); + if (!!g && !isOpen) { + // repair screen color + $bg.css({background:'rgba(18,41,72,0.88)'}); + } + }).delay(50, m.global); // curry m.global + } + if (m.global) { + isOpen = false; + $(document.body).css({overflow:''}); + } + } + + // - - - - - - - - - - - - - - - - - - + + function _f(msg) { + try { done(null, null); } catch(e) {} + (function () { pi.reject(msg); }).delay(0); + } + + }; // -- end $.fn.modal + +})(jQuery); \ No newline at end of file diff --git a/Release/1.2/jquerymy-1.2.11.min.js b/Release/1.2/jquerymy-1.2.11.min.js new file mode 100644 index 0000000..edbc6f4 --- /dev/null +++ b/Release/1.2/jquerymy-1.2.11.min.js @@ -0,0 +1,5 @@ +/* jQuery.my 1.2.11, (c) 2017 ermouth + * Requires jQuery 2.0+, SugarJS 1.3.9-1.4.x + * More details at jquerymy.com */ +!function(a){function b(){window.console&&console.error.apply(console,arguments)}function c(){window.console&&console.log.apply(console,arguments)}function d(a,b){return a.hasOwnProperty(b)}function e(b){return a.contains(document.documentElement,b[0])}function f(a,b){return Array.prototype.slice.call(a,b||0)}function g(a,b,c){var d=0,e=a.length,f=!0;if(a===b)return"===";if("==="==c)return"";if(e!=b.length)return"";for(;e>d&&f;d++)f=a[d]===b[d];if(f)return"==";if("=="==c)return"";for(f=!0;e>d&&f;d++)f=Object.equal(a[d],b[d]);return f?"=":""}function h(a,b){return(ib(b)?b.split("."):gb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return jb(a)?Object.values(a).find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):gb(a)?a.find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):void 0}if(null!=a&&null!=a[b])return a[b]}return void 0},a)}function i(a){var b=a.my();return b?b.root?b.root.my():b:null}function j(a){var b,c={},d=function(){return null};if(ib(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(gb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(jb(a))for(b in a)c[b]=mb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(ib(c)&&(c=c.split(/[,\s]+/)),gb(c)){for(c=c.compact(!0),b=0;b$/.test(y.list)?f=y.list:i=y.list||i,!f){var l=">*"==i?a(d[0].children):p(d,i,!0);f="
",l.length&&(f=a(f).append(l.eq(0).clone(!0)).html(),l.eq(0).remove())}d.data("formlist")||d.data("formlist",{}),d.data("formlist").generator={manifest:t,delay:(y.delay||w.delay||10)/1.3,template:f,selector:i,parent:B,bind:y.bind,merge:mb(y.merge)?y.merge.bind(B):y.merge?n:!1,hash:mb(y.hash)?y.hash.bind(B):ib(y.hash)?k.fill(void 0,y.hash):gb(y.hash)?m.fill(void 0,y.hash.slice(0)):null,id:mb(y.id)?y.id.bind(B):ib(y.id)?k.fill(void 0,y.id):gb(y.id)?m.fill(void 0,y.id.slice(0)):null,ext:!(!y.id&&!y.hash),stamp:0},d.on("insert.my",function(b,c){b.stopPropagation();var d={what:void 0,where:0};null==c?d.where=1e6:jb(c)?qb(d,c):(ib(c)||kb(c))&&(d.where=c),a(b.target).my("insert",d.where,d.what)}),d.on("remove.my",function(b){b.stopPropagation(),a(b.target).my("remove")})}else try{b=K.call(d,r(B,t),jb(e)?e:void 0)}catch(q){j("$.my subform init of "+g+" failed: "+q.message,q.stack)}}nb(b)?b.then(o,function(a,b){j("Init of subform "+g+" failed with error: "+a,b)}):o()}function j(a,c){b(a,c),z&&z.reject(a,c)}function k(a,b){var c=h(a,b)||"";return"string"==typeof c?c:l(c)}function m(a,b){return l(D(a,b))}function o(){d.each(function(){var b,c,h,i=a(this),j=i[0].nodeName,k=!1;if("TEXTAREA"==j&&(h=i[0].nextSibling,c=h&&h.CodeMirror?h.CodeMirror:null,c&&i.addClass("my-codemirror")),b=y.events||N(i,Cb.events),i.hasClass("my-form")?tb(i.data("my"),{dui:y,root:e,selector:g,dparams:w,devents:b,ddata:v.data,container:w.container(i),derrors:v.errors,single:!0}):(i.data("my",{events:b,selector:g,initial:s,previous:s,root:e,container:w.container(i),id:v.id,ui:y,data:v.data,params:w,errors:v.errors,single:1==C}),f._update=y.delay?O.debounce(y.delay):wb,k=!0),k)if(i.cleditor&&i.parent().hasClass("cleditorMain")){var l=i.cleditor()[0];if(l&&l.$frame&&l.$frame[0]){i.addClass("my-cleditor"),tb(i.data("my"),{container:w.container(i)});var m,n=function(a){i.val(a).trigger(eb)},o=Number.random(1e5,1e6-1);a(l.$frame[0]).attr("id","cleditCool"+o),m=document.frames?document.frames["cleditCool"+o].document:a("#cleditCool"+o)[0].contentWindow.document;var p=a(m).find("body");a(m).on("keyup.my",function(){n(a(this).find("body").html())}),i.parent().find("div.cleditorToolbar").on("click.my mouseup.my",function(){n(p.html())}),a("body").on("click","div.cleditorPopup",function(){n(p.html())})}}else if("TEXTAREA"==j&&i.parent().hasClass("redactor_box")){var q,r="my-redactor-9";try{q=i.getEditor(),r="my-redactor-8"}catch(t){q=i.redactor("getEditor")}q&&(i.addClass(r),q.on("input.my keyup.my blur.my",function(a){a.trigger("redactor")}.fill(i)))}else i.hasClass("ace_editor")?ace.edit(d[0]).on(eb,function(a){a.trigger("ace")}.fill(i)):c&&c.on(eb,function(a){a.trigger("codemirror")}.fill(i));i.my()._changed=x.debounce(u),i.my()._recalc=I.debounce(u),i.on(b,function(a){a.type==eb&&a.stopPropagation(),k&&(v.locktill=Ab()+f.delay),i.my()._changed(i,e,f,w)}),/check(\.my)?/.test(b+"")||i.on("check.my",function(){return i.my()._changed(i,e,f,w,!0),!1}),k||i.off("redraw.my"),i.on("recalc.my, redraw.my",function(a){a.stopPropagation(),i.my()._recalc(i,e,f,w)})}),z&&z.resolve()}var q,s,t,u,v=e.my(),w=(v||{}).params,y=f,z=null,A=0,B=v.manifest,C=0|d.length;return v?(u=f.delay,C?(y.init!=wb&&(q=H(B,y.init,d,v)),nb(q)?(A+=1,z=ub(),q.then(i,function(a,b){j("Init of "+g+" failed: "+a,b)})):i()):c("Not found "+g+" selector.",e),z):(b("Failed to find $root building "+g+" selector."),null)}function w(c,d){jb(d)&&d.channel&&d.message&&p(c,".my-listen-"+l(d.channel),!0).each(function(){var c,e=a(this),f=e.data("my"),g=void 0;if(f&&f.ui.listen&&mb(f.ui.listen[d.channel])){c=f.ui.listen[d.channel];try{g=c.call(f.manifest||f.root.my().manifest,f.data,d.message,e)}catch(h){b("Listener failed",h.message,h.stack)}void 0!==g&&(null===g?e.trigger("check"):g&&e.trigger("recalc"))}})}function x(a,b,c,d,e){{var f,g=a.data("my");b.data("my")}g&&(g.disabled?g.ddata||O(a,wb,c.recalcDepth||d.recalcDepth):(B(g.ddata||g.data,g.dparams||g.params),e||(f=g.single?a:p(b,g.selector)),O(a,e?wb:A(f,wb),c.recalcDepth||d.recalcDepth),d.change&&d.change.call(a)))}function y(b,c,d){var e=d.compact(),f=e.replace(/:disabled/g,""),g=f!==e,h="self:"===f.to(5);return h&&(f=f.replace(/^self:/g,"")),c.each(function(){var d=a(this),e=d.my(),i=!h&&e?e.container:d;i.toggleClass(f,!!b),g&&void 0!==e&&!!b!=!!e.disabled&&(d.my().disabled=!!b,e._disable||(d.my()._disable=N(c,Cb.offon).fill(void 0,c)),e._disable(!!b))}),c}function z(a,b,c){return a[b](c?"disable":"enable")}function A(a,b){var c,d,e=a.data("myval");return e||(d=N(a,Cb.vals),mb(d)&&(c=d(a,wb),void 0===c?a.data("myval",function(a,b){return wb!=b&&d(a,b),a.val()}.fill(a,void 0)):a.data("myval",d.fill(a,void 0))),e=a.data("myval")),mb(e)?(c=e(),(c!==b&&(0==b||0==c)||c!=b||jb(b))&&(c=e(b)),c):wb}function B(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=b;if(!jb(n)||isNaN(h=n.remember)||!jb(e=n.history))return wb;if(jb(a)&&h){if(j=rb(a,!0),k=Ab(),g=sb(e).sort(),g.length&&(k-g.last()=2*h){for(m={},f=h;2*h>f;f++)m[g[f]]=e[g[f]];b.history=m}return d||n.form.trigger(eb),n.history[g.last()]}if(!isNaN(a)||a===wb){if(i=parseInt(a)||0,0>i)return wb;if(g=sb(e).sort(),i>=g.length&&(i=g.length-1),l=rb(n.history[g[g.length-i-1]],!0),c){for(m={},f=0;f=i;i++)if(i===h){if(d)return wb!=b?e[f[i]]=b:void 0===e[f[i]]&&(e[f[i]]=wb),e[f[i]];e[f[i]]=b}else 0===i?(e=a[f[0]],g=a):(g=g[f[i-1]],e=e[f[i]]),(null==e||!jb(e)&&(gb(e)&&!isNaN(f[i+1])&&+f[i]>-1))&&(e=g[f[i]]={});return a}function G(a,b,c){var e=jb(b)?b:null;return Object.each(a,function(b,c){var d=typeof c;/^str|^fu/.test(d)&&(a[b]={bind:c})}),Object.each(a,function(b,f){var g,i,k,l=[],m=[],n=/\s?[,;]\s?/;f.recalc&&(ib(f.recalc)?l=f.recalc.split(n):gb(f.recalc)&&(l=f.recalc),l=l.compact(!0).unique()),l.length&&(a[b].recalc=l),null==f.bind&&(f.bind=function(){});var o;if(f.listen&&(o=j(f.listen),f.listen=Object.size(o)?o:void 0),d(f,"events")&&(f.events=(f.events+"").replace(/,\s*|\s+/g," ")),d(f,"watch"))for(ib(f.watch)?m=f.watch.split(n):gb(f.watch)&&(m=f.watch.slice(0)),m=m.compact(!0).unique(),k=0;ki&&h.resolve()}var d,e,f,g=!1,h=ub(),i=a.length;for(e=0;i>e;e++)d=a[e],f=ib(d.ajax)?w.loader:yb,f(d.ajax).then(function(a,d){fb.test(d.ref)&&(null!=a?tb(!0,b,E(a,d.ref.from(5))):(g=!0,v.push("Invalid data for ‘"+d.ref+"’ resource."))),c()}.fill(void 0,d)).fail(function(a,b){v.push("Failed to load ‘"+b.ref+"’ resource."),g=!0,c()}.fill(void 0,d));return h.promise()}function i(a){var c=!1;return fb.test(a)?null!=h(b,a.from(5))&&(c=!0):null!=h(window,a)&&(c=!0),c}function j(a){for(var b in a)a[b]===!1&&(a[b]=i(b));return a}var k,l,m,n,o,p,q,r,s=ub(),t=[],u={},v=[],w=tb(!0,{ajaxTimeout:1e4,loader:Cb.params.loader},c||{}),x={ref:null,ajax:{type:"GET",async:!0,timeout:w.ajaxTimeout}};if(jb(b))if(gb(b.require)){for(n=b.require,k=0;k'+f+""}!_.style||b&&!sb.is(":visible")||(S=L(sb,_),S&&S[0].length&&!b&&(V=a("style#"+T),V.length||(V=a(c(S[0],T)).appendTo(a("body"))),V.data("count",1*V.data("count")+1),sb.data("my").style=V),S&&S[1].length&&(Z=a("style#"+U),Z.length?b&&(a(c(S[1],U)).replaceAll(Z),Z=a("style#"+U)):(Z=a(c(S[1],U)).appendTo(a("body")),Q.restyle>-1&&!pb[J]&&(pb[J]=function(){q(!0)}.debounce(Q.restyle)),sb.data("my").restyle=q.fill(!0).debounce(0)),sb.data("my").localStyle=Z,b||sb.addClass("my-restyle")))}function r(){var a,b,c=!0;if(b=t(_),ib(b))B("Error decoding base64 to local Blob/URL",b),c=!1;else{if(W)for(a=0;a*").clone();try{$=H(_,R.init,sb,R)}catch(b){return B(ib(b)?b:b.message,b.stack),sb}}if(nb($)?$.then(function(){x()},function(a,b){B(a,b)}):x(),!hb){if(!sb.my())return B("Internal error initializing controls.",""),sb;sb.data("my").initial=tb(!0,{},bb),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function x(){function a(a){hb||(b[a]=A(p(sb,a),wb),d-=1,.5>d&&y(b))}var b={},c=Object.keys(O),d=c.length;0===d?z():(sb.addClass(lb),c.forEach(function(b){if(!hb){var c=p(sb,b),d=v(c,sb,O[b],b);rb[b]=c,nb(d)?d.then(a.fill(b)).fail(function(a,c){B("Error building "+b+", "+a,c)}):hb||a(b)}}))}function y(a){var c,d,e,f,g;for(g in O){if(hb)return;if(c=O[g],e=rb[g],f=e.length){c.listen&&(eb[g]=e.eq(0));try{d=u(bb,wb,c,e),d==wb&&a[g]!=wb&&void 0!==d&&u(bb,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+J+"')",h.message,h.stack)}try{d!=wb&&A(e,d),e.eq(0).trigger("check.my")}catch(h){B("Error linking "+g,h.message,h.stack)}}}z()}function z(){sb.removeClass(lb),sb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),sb.my("redraw")}),qb=null,fb.resolve(bb)}function B(a,c){var d;if(hb=!0,b("Form "+I+" failed to initialize.",a,c),Object.keys(rb).forEach(function(a){delete rb[a]}),sb.removeClass(lb),d=kb(a,c),ib(d)||jb(d)&&d.jquery?sb.html(d):d===!0&&sb.html(qb),Q.silent)fb.resolve(bb);else{if(!sb.my().ddata){if(sb.removeData("my"),sb.removeClass("my-form"),V)if("1"==V.data("count"))try{V.remove()}catch(e){}else V.data("count",V.data("count")-1);if(Z)try{delete pb[J],Z.remove()}catch(e){}}fb.reject("Form "+I+" failed to initialize: "+a,c)}}var D,F,I,J,K,N,O,Q,R,S,T,U,V,Z,$,_={},bb={},cb=null,db=[],eb={},fb=ub(),hb=!1,kb=function(){},lb="my-form-init",ob="std",qb="",rb={};if(ib(d)){if(D=zb(d),!D)return fb.reject("No manifest with id "+d+" found in repo."),fb.promise();jb(f)&&jb(e)?(D=tb(D,e),F=f):F=e,ob="repo"}else D=d,F=e;if(!D)return this;R=jb(F)&&"repo"!=ob?tb(!0,{},D):D;var sb=this.eq(0),vb=sb.my();return jb(vb)&&vb.id&&vb.ui?(c("jQuery.my is already bound.",sb),sb.my("ui",R.ui),sb.my(ab,R.data),fb.resolve(sb.my(ab)).promise()):(Q=R.params||{},Q.strict||mb(R.init)||(Q=tb(!0,{},Q),P(Q)),Q=tb(!0,{},Cb.params,Q),fb.fail(function(){sb.removeClass(U+" "+T)}),tb(sb,fb.promise()),jb(F)?(bb=m(F,R.data||{}),R.data=bb):bb=R.data||{},_.data=bb,sb.data("my",{data:bb,params:Q,promise:fb.promise(),locktill:0}),sb.addClass(lb),R.inherit&&i(R),gb(R.require)?Bb(R,Q).then(g).fail(function(a){o(),B("Linker of the ‘require’ property failed.",a)}):g(),fb.then(n),sb)}function L(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=mb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),ib(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Db.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),gb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==_&&c(a,i,g+1)}wb!=b[""]&&typeof b[""]!=_&&g>e&&(d=b[""],e=g)}var d=wb,e=0,f="";return c(a,b,1),d}function O(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,q,r=!1,s=!1,t=a,v=t.my(),w="";if(v){if(m=v.selector,n=v.root,n.hasClass("my-form-init"))return{};if(o=p(n,m),q=n.my().ui,r=a.hasClass("my-form"),r?(f=a,g=v.ddata,h=v.dui,i=v.dparams):(f=v.container,g=v.data,h=v.ui,i=v.params),h.bind!=wb){if(j=xb(c)?c:A(o,u(g,wb,h,o)),wb!=h.check){w="Unknown error";try{w=U(g,j,h,o)}catch(x){b("Error "+x.message+" in .check validator for "+m,n,x.stack)}}var z=i.errorCss,B="ui-state-error";try{wb!=c&&(j=A(o,u(g,c,h,o)))}catch(x){w=i.messages.formError||"Error"}if(wb!=h.check)if(s=a.hasClass("my-form-list"),""==w&&(r||f.hasClass(z)))r?v.derrors[m]="":v.errors[m]="",f.removeClass(z),f.attr("title")&&f.attr("title",""),r||s||i.effect(p(f,i.errorTip),!1,i.animate/2),t.removeClass(B),p(t,".ui-widget").removeClass(B);else if(w){if(r)v.derrors[m]=w;else if(s)v.errors[m]=w;else{f.addClass(z),v.errors[m]=w;var C=p(f,i.errorTip);C.length?i.effect(C.addClass(z).html(ib(w)?w:"Error"),!0,i.animate):f.attr("title",(ib(w)?w:"Error").stripTags())}t.hasClass("hasDatepicker")&&(t.is("input")?t.addClass(B):p(t,".ui-widget").addClass(B)),t.hasClass("ui-slider")&&t.addClass(B)}}var D=c==wb?j:c;if(h.css)for(k in h.css)l=h.css[k],lb(l)?y(l.test(D),o,k):mb(l)&&y(l.call(n.my().manifest,g,D,o),o,k);var e,E,F=h.recalc,G=[],H={};if(d&&h.recalc&&n.my()){for(q=n.my().ui,e=0;e-1?"":o;case"s":return c==k?"":o;case"o":return k[c]?"":o;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},l=0,(">*"==h?a(e[0].children):p(e,h,!0)).each(function(){var b=a(this);b.hasClass("ui-sortable-placeholder")||(b.data("my")&&!b.my("valid")&&(j[l]=b.my("errors")),l+=1)}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return m.formError||"Error"}return""}var V="1.2.11",W=window.URL||window.webkitURL,X=!document.addEventListener,Y=((window.navigator.language||window.navigator.userLanguage||"en")+"").split("-")[0].toLowerCase(),Z="{yyyy}-{MM}-{dd}",$="{HH}:{mm}",_="object",ab="data",bb="array",cb="string",db="function",eb="change",fb=/^this\./,gb=Object.isArray,hb=Object.isBoolean,ib=Object.isString,jb=Object.isObject,kb=Object.isNumber,lb=Object.isRegExp,mb=Object.isFunction,nb=function(a){return null!=a&&typeof a==_&&mb(a.then)},ob=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},pb=h(a,"my.f.restyles")?a.my.f.restyles():{},qb=Object.merge,rb=Object.clone,sb=Object.keys,tb=a.extend,ub=a.Deferred,vb=a.type,wb=null,xb=function(a){return null!==a&&void 0!==a},yb=a.ajax,zb=q,Ab=Date.now,Bb=J,Cb={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my(ab);return Object.equal(c,b)?c:a.my(ab,b,!0)}return b||wb},".hasDatepicker":function(a,b){xb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(Z):""},".my-tags":function(a,b){return xb(b)&&(ib(b)||kb(b)?a.tags(ab,[b+""]):gb(b)&&a.tags(ab,b)),a.tags(ab)},".ui-draggable":function(a,b){if(xb(b)&&jb(b)){var c={};isNaN(b.left)||(c.left=Number(b.left).ceil(2)+"px"),isNaN(b.top)||(c.top=Number(b.top).ceil(2)+"px"),(c.left||c.top)&&a.css(c)}var d=a.position();return{left:b&&!isNaN(b.left)?(1*b.left).ceil(2):d.left.ceil(2),top:b&&!isNaN(b.top)?(1*b.top).ceil(2):d.top.ceil(2)}},".my-form-list":function(b,c){function e(){var c,d,e=a(this),f=e.data("my");f&&(c=e.data("formlist"),d=c.index,c.hash=w(f.data,d)+"",c.oid=x!==w?x(f.data,d)+"":c.hash),b.trigger("check.my")}function f(a){a.data("my").locktill+z/1.3.my-form",t=!!q.merge,u=q.template||"
",v=/\{/.test(u),w=q.hash||l,x=q.id||l,y=q.ext,z=q.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).length,E=[],F=[],G=Ab(),H=b.find(C?b.sortable("option","items"):s);if(xb(c)&&gb(c)){if(D)return c;if(i=[],j={},H.each(function(){var b,c=a(this),d=c.data("my");d&&(i.push(d.data),!t&&(b=c.data("formlist"))&&(j[b.oid]=d.data))}),m=g(i,c,"=="),!m){var I=[],J=[],L={},M={};for(F=[],h=0;h1.4*z||G-q.stamp>100||!q.stashed||q.stashed.length!==H.length-(D?1:0)){D&&(o=b.find(">."+A+"-helper"));var N=0;for(H.each(function(b,c){var d,e,f,g=a(c),h=!1;D&&g.hasClass(A+"-helper")||(D&&g.hasClass(A+"-placeholder")&&(g=o),d=g.data("my"),e=g.data("formlist"),d&&e&&(E.push(d.data),N!=e.index&&(e.index=N,h=!0),y&&(f=w(d.data,N)+"",f!==e.hash&&(e.hash=f,h=!0)),N+=1,h&&F.push(g)))}),h=0;h-1){var f=b.eq(d);f.is(":checked")||(f.prop("checked",!0),e&&f.checkboxradio("refresh"))}else e||b.each(function(){a(this).prop("checked",!1)})}if(-1==d)for(var g=0;gForm init failed

',ru:'

Ошибка инициализации формы

'},badInput:{en:"Invalid input",ru:"Неверное значение"},patternMismatch:{en:"Pattern mismatch",ru:"Не соответствует шаблону"},rangeOverflow:{en:"Over maximum",ru:"Больше максимума"},rangeUnderflow:{en:"Under minimum",ru:"Меньше минимума"},stepMismatch:{en:"Step mismatch",ru:"Не кратно шагу"},tooLong:{en:"Too long",ru:"Слишком длинно"},typeMismatch:{en:"Invalid type",ru:"Неверный тип"},valueMissing:{en:"Required",ru:"Обязательное поле"}},events:{".hasDatepicker":"change.my check.my",".my-form,.my-tags":"change.my check.my",".ui-slider":"slide.my check.my","div.redactor_box textarea":"redactor.my check.my",".my-codemirror":"codemirror.my check.my",".ace_editor":"ace.my check.my",".my-form-list":"sortupdate.my check.my",".ui-sortable":"sortchange.my sortupdate.my check.my",".ui-draggable":"drag.my dragstop.my check.my","a, .pseudolink, input[type=button], button":"click.my","img, :radio, :checkbox":"click.my check.my","div.select2-container+input,div.select2-container+select":"change.my check.my input.my",".ui-buttonset,input, select, textarea":"blur.my change.my check.my"+("Micro"===navigator.appName.to(5)?" keyup.my":" input.my"),"":"check.my"},containers:{"*[data-role='fieldcontain'] *":{"input,textarea,select,button,:radio":function(a){return a.parents('[data-role="fieldcontain"]').eq(0)}},".tagstrip *.value":function(a){return a.parents(".tagstrip").eq(0)},"div.redactor_box textarea":function(a){return a.parents("div.redactor_box").eq(0).parent()},".my-tags,.hasDatepicker,.ui-widget,input,textarea,select,button":{".my-cleditor":function(a){return a.parents("div.cleditorMain").eq(0).parent()},"":function(b){var c=b[0].parentNode,d=c.nodeName;return/^(div|span|a|p|form|fieldset|li|ul|td|th|h\d)$/i.test(d)?a(c):b.parents("div,span,a,p,form,fieldset,li,ul,td,th,h1,h2,h3,h4,h5,h6").eq(0)}},"":function(a){return a}},offon:{".ace_editor":function(a,b){ace.edit(b[0]).setReadOnly(a)},".ui-selectable":function(a,b){z(b,"selectable",a)},".ui-slider":function(a,b){z(b,"slider",a)},".ui-draggable":function(a,b){z(b,"draggable",a)},".ui-buttonset":function(a,b){z(b,"buttonset",a)},".hasDatepicker":function(a,b){z(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){z(b,"select2",a)},".my-cleditor":function(a,b){b.cleditor()[0].disable(!!a)},"":function(a,b){b.attr("disabled",!!a)}},destroy:{".hasDatepicker":function(a){a.datepicker("destroy")},".ui-slider":function(a){a.slider("destroy")},".ui-sortable":{".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")}),b.removeClass("my-form-list"),b.sortable("destroy")},"":function(a){a.sortable("destroy")}},".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")})},".ui-draggable":function(a){a.draggable("destroy")},".my-redactor-8":function(a){a.destroyEditor(),a.removeClass("my-redactor-8")},"div.select2-container+input,div.select2-container+select":function(a){a.select2("destroy")},".my-form":function(a){a.my("remove")},textarea:{".my-codemirror":function(a){a[0].nextSibling.CodeMirror.toTextArea(),a.removeClass("my-codemirror")}}}};Cb.params={container:function(a){return N(a,Cb.containers)(a)},change:wb,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:Y,messages:Object.map(Cb.msg,function(a,b){return b[Y]||b.en}),errorTip:".my-error-tip",errorCss:"my-error",animate:0,effect:function(a,b,c){return b?a.fadeIn(c):(a.fadeOut(c),void 0)},remember:0,silent:!1,history:{},historyDelay:100,loader:function(a){var b=ub(),c=zb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Db={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:z,overlap:n,patch:m,kickoff:o,sdbmCode:l,tojson:function(){function a(a){return 10>a?"0"+a:a}function b(a,f,g){var h,i,j,k,l=0,m=f||0,n=d;switch(g&&ib(g)&&(l=String(g).length,n=String(g).repeat(10)),(typeof a).substr(0,3)){case"str":return e(a).replace(/<\/scri/gi,"<\\u002fscri");case"num":return isFinite(a)?""+String(a):"null";case"boo":case"nul":return String(a);case"fun":return e(c(a.toString()).replace(/<\/scri/gi,"<\\u002fscri"));case"obj":if(!a)return"null";if(typeof a.toJSON===db)return b(a.toJSON(),m+(g?1:0),g);if(h=[],gb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),mb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=ib(b)?b:a.my.tojson(b),g=ib(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Db.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:L,css2json:function(a){var b="",c=(a+"").replace(/\/\*[\s\S]+\*\//gm,"").replace(/@charset[^;]+;/gim,"").replace(/[\n\t\s]+/g," ").replace(/\s*@media[^{]*\{/g,function(a){return a.to(-1).trim()+"ᴥ"}).replace(/\}/g,"}ᴥ").replace(/^\n+/g,"").replace(/[\n\s]+$/g,"").split("ᴥ").compact(!0).reduce(function(a,c){var d,e,f,g=c.trim();return"}"==g?b="":/^[^{]+\{[^\}]+\}$/.test(g)?(d=g.to(-1).split("{"),e=" "+d[0].trim(),f=d[1].trim(),";"!=f.last()&&(f+=";"),b?a[b][e]=(a[b][e]||"")+f:a[e]=(a[e]||"")+f):/^@media/.test(g)&&(a[g]={},b=g),a},{});return c}},Eb={container:function(a){return N(a,Cb.containers)(a)},data:function(a,b){var c=this;return jb(a)&&(c.my().data=n(c.my().data,a),this.my("redraw",b)),c.my().data},disabled:function(a){var b,c,d,e,f=this,g=f.my();if(!g)return void 0;if(a==wb)return g.disabled;if(a){for(c in g.ui)b=p(f,c),d=b.my(),d&&(d.predisabled=d.disabled),y(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=p(f,c),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),y(e,b,":disabled");f.removeClass("my-disabled"),f.my("redraw")}},errors:function(){var b=a(this).my().errors,c={};for(var d in b)b[d]&&ib(b[d])&&(c[d]=b[d]),jb(b[d])&&sb(b[d]).length&&(c[d]=b[d]);return c},find:function(a){var b=this,c=b.my();return c&&c.root&&(b=c.root),b.find(a)},history:function(a,b){return B(a,this.my().params,b)},id:function(a,b){if(ib(a))return zb(a,b);var c=this.my();return c&&c.id?c.id:wb},index:function(){var a=this.my().root&&!this.my().ddata?this.my().root:this;return(a.data("formlist")||{}).index},indom:function(){return e(this)},init:K,insert:function(a,b){var c,d,e=this.hasClass("my-form-list")?this:this.my().root||this,f=e.hasClass("my-form-list")?e:e.parent(".my-form-list"),g=(e.data("formlist")||{}).index,i=b,j=f.data("formlist").generator;if(null==g&&(g=0),c=fb.test(j.bind)?h(f.my().manifest,j.bind.replace(fb,"")):h(f.my().data,j.bind),!jb(i))if(jb(j.manifest))i=rb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=rb(e.my().manifest.data,!0)}if("before"===a)d=g;else if("after"===a)d=g+1;else{if(isNaN(a))throw"Invalid position for insertion";d=(1*a).clamp(0,c.length)}c.add(i,d),f.trigger("redraw")},manifest:function(a){return"json"==a?Db.tojson(this.my().manifest):this.my().manifest},promise:function(a){return mb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",ib(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my(),e=2;return d&&jb(d.ui)&&(e=d.params.recalcDepth,Object.keys(d.ui).forEach(function(b){var d=p(c,b);O(d,a?wb:void 0,e),a||(d.hasClass("my-form")&&d.my("redraw"),d.trigger(d.hasClass("my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(eb)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return wb;if(this.my().root&&!this.my().ddata&&(j=this.my().root),d=j.my(),f=d.data,h=d.cid,i=d.mid,j.unbind(".my"),jb(d)&&d.manifest&&mb(d.manifest.die))try{d.manifest.die.call(d.manifest,j,d.manifest)}catch(k){}if(b=d.style)if("1"==b.data("count"))try{b.remove()}catch(k){}else b.data("count",b.data("count")-1);if(c=d.localStyle)try{delete pb[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?wb:(d.params.errors&&d.params.errors.values().compact(!0).length?Object.equal(d.data,d.lastCorrect)||(g+=1):Object.equal(e[f.last()],d.data)&&(g+=1),b=B(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return A(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&ib(b[d])?c++:jb(b[d])&&sb(b[d]).length&&c++;return!c},version:function(){return V}},Fb=Object.keys(Eb);a.my||(a.my={}),tb(a.my,{f:a.extend({},Db),tojson:Db.tojson,fromjson:Db.fromjson,radio:function(b,c){w(a(document),ib(b)?{channel:b,message:c}:b)},rules:Cb,locale:function(a){return ib(a)?(Y=a.toLowerCase(),Cb.params.locale=Y,void 0):Y},ajax:function(a){return mb(a)?yb=a:yb.apply(this,f(arguments,0))},cache:function(a,b){return mb(a)?zb=a:zb(a,b)},now:function(a){return mb(a)?(Ab=a,void 0):Ab()},require:function(a){return mb(a)?Bb=a:Bb.apply(this,f(arguments,0))},chain:function(){function a(){if(d.length&&e){var b,c=d.shift(),f=function(){a.delay(c[1])}.once();try{b=c[0]()}catch(g){f()}nb(b)?(b.then(f,f),f.delay(c[1])):f()}}var b=1,c=1e3,d=[],e=!1,f=function(e,f,g){d.push([e,f||b,g||c]),a()};return f.delay=function(a){return isNaN(a)||(b=(a-0).clamp(0,1e6)),b},f.timeout=function(a){return isNaN(a)||(c=(a-0).clamp(1,1e6)),c},f.start=function(){e=!0,a()},f.stop=function(){e=!1},f}(),version:function(){return V}}),a.my.version.toString=function(){return V},a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(ib(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Eb.init.apply(this,[c].add(f(arguments,1)))}return ib(b)&&Eb[b]?Eb[b].apply(this,f(arguments,1)):ib(b)&&zb(b,"exist")?Eb.init.apply(this,arguments):typeof b!==_&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Eb.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),w(a(document),c)}).on("resize.my",function(){for(var a in pb)try{pb[a]()}catch(b){}}.debounce(67))}(jQuery),function(a){function b(a,b,c){if(i(b))return a+b;if(j(b))return c=e(!0,c,b),a;if(h(b)&&b.length>1&&i(b[1])){for(var d,k,m,n,o,p,q,r,s=b[0],t="",u=1;u'+(s?"<"+c.labelTag+' class="'+c.labelCss+'" '+(c.label?'style="display:inline-block;width:'+c.label+";margin-left:-"+c.label+'" ':"")+">"+s+"":"")+t+""),a+t}return a}function c(a){var b=a;if(i(b)&&(b=b.split(/[\s,]/).compact(!0)),h(b)){for(var c={},d=0;d',inp:k+'text" {ext}/>',sli:k+'range" {ext}/>',dat:k+'date" {ext}/>',btn:k+'button" {ext}/>',pwd:k+'password" {ext}/>',but:"",div:"
{txt}
",spn:"{txt}",sel:"",mul:'',txt:"",err:' {txt}',msg:'
{txt}
',val:function(a){if(!h(a.vals))return"";var b=e({style:"",css:""},a);return b.txt=a.vals.reduce(function(a,b){return a+""+b+" "}," "),'{txt}'.assign(b)},"":"<{_tag} {ext}>{txt}"},txt:{sel:function(a){if(!a.vals)return"";var b=c(a.vals);return Object.keys(b).reduce(function(a,c){return a+'"},"")}},params:{styles:{num:"width:30%;",dat:"width:30%;",inp:"width:100%",pwd:"width:100%",but:"width:30%",txt:"width:100%;max-width:100%;min-height:1px;word-break:break-word;",err:"display:none",msg:"display:none"},alias:{number:"num",date:"dat",slider:"sli",textarea:"txt",input:"inp",span:"spn",select:"select",vals:"val"},row:"",rowTag:"div",rowCss:"my-row",label:"",labelTag:"span",labelCss:"my-label"},defaults:{id:"","class":"",style:"",placeholder:"",value:"",rows:1},attnames:{css:"class",plc:"placeholder",val:"value",txt:"",vals:"",tip:"title"}},m={init:function(b,c){return a(this).html(d(b,c))}};a.my||(a.my={}),a.my.formgen=d,a.fn.formgen=function(b){return i(b)&&m[b]?m[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?(a.error("Method "+b+" does not exist on jQuery.formgen"),void 0):m.init.apply(this,arguments)}}(jQuery),function(a){function b(b,c,d,e){var f,g,i,j,k,n,o;if("object"==typeof c&&c.jquery)c.is("img")&&(n=c,k=c.attr("alt")||c.attr("title")||c.data("text")||"",g=n[0].naturalWidth||n[0].width,f=n[0].naturalHeight||n[0].height,1>f&&(f=1),1>g&&(g=1),j=a(window).width()-90,i=a(window).height()-90,f>i&&(g=g*(i/f)|0,f=i),g>j&&(g=j,f=f*(j/g)|0),o=300>g?300:g,h(b,{source:"image",manifest:{init:function(a){a.html(this.HTML),a.on("click.my","img:eq(0)",function(){a.trigger("cancel")})},HTML:'

',ui:{"img:eq(0)":"img",h4:{bind:"text",css:{hide:function(a,b){return!b}}}}},data:{img:n.attr("src"),text:k},esc:!0,screen:!0,width:e||o,focus:!1,global:!0,z:"1995"},d));else if(m(c)&&c.manifest)h(b,c,d);else{if(!l(c))return null;h(b,{source:"html",manifest:{init:function(a){a.html(this.HTML)},HTML:c,ui:{"div:eq(0)":function(){}}},data:{},esc:!0,focus:!1,width:e},d)}return b}var c,d,e={},f="body",g=!1,h=a.extend,i={},j=a.my.f.indom,k=(Object.isArray,Object.isBoolean),l=Object.isString,m=Object.isObject,n=Object.isNumber,o=(Object.isRegExp,Object.isFunction);if(a.fn.modal&&o(a().emulateTransitionEnd)&&(d=a.fn.modal),a(document).off(".modal"),a(document).on("keydown.modal",function(a){var b,c,d=a.keyCode;if(!1!==g&&(13===d||27===d)){if(c=g.data("modal"),b=c.form,27==d&&(c.esc||Object.equal(b.data("my").initial,b.my("data"))))return g.modal(!0),!1;if(13==d&&c.enter)return function(a){a.modal()}.fill(g).delay(50),!1}}),o(a.my.f.getref(a,"my.modal.parent"))){var p=a.my.f.getref(a,"my.modal.parent")().attr("id");p&&(f="#"+p)}e.modal=function(c,d,e){var h,i={},j=a(f),l=j.find(">.my-modal-proxy"),m={global:!0,screen:!0,done:o(d)?d:void 0,z:"1995"};return k(c)||null==c?l.modal(c):(h=a.Deferred(),b(i,c,m,e)?g?h.reject("Locked").promise():(l.length||(l=a('
').prependTo(j),l.css({position:"absolute",top:"0",left:"0",margin:"0",padding:"0",width:"1px",height:"0"})),l.modal(i)):h.reject("Invalid data").promise())},e.modal.loading=function(b){a(f).find(">.my-modal").toggleClass("my-modal-loading",!!b)},e.modal.parent=function(b){return b&&a(b).length?(f=b,void 0):a(f)},e.modal.parentBack=function(b){return b&&a(b).length?(c=b,void 0):a(c||f)},e.modal.visible=function(){return!!g},a.my||(a.my={}),a.my.modal=e.modal,a.fn.modal=function(e,p,q){function r(a){if(x=K.form,z=K.bg,y=K.root,I=K.done,B=x.my("data"),C=!1,a){try{I.call(x.my("manifest"),null,null)}catch(b){}try{j(x)?u():""}catch(b){}if(j(F)&&F.removeData("modal"),i[K.cid])try{i[K.cid].reject("Cancelled")}catch(b){}delete i[K.cid],K=null}else{try{C=I.call(x.my("manifest"),x.my("valid")?null:x.my("errors"),B)}catch(b){}if(!C){try{j(x)?u():""}catch(b){}j(F)&&F.removeData("modal"),function(){if(i[K.cid])try{i[K.cid].resolve(B)}catch(a){}delete i[K.cid],K=null}.delay(0)}}}function s(){var b,c,d=window,e=!!K.global,f=y.offset(),g=F.offset(),h=y.scrollTop();K.pos={px:f.left,py:f.top,pw:y.outerWidth(),ph:y.outerHeight(),ox:g.left,oy:g.top,ow:F.outerWidth(),oh:F.outerHeight(),ww:c,wh:b};var i=1*(K.x.match(/\-?\d+(\.\d+)?/)||[0])[0],j=1*(K.y.match(/\-?\d+(\.\d+)?/)||[0])[0],k=K.x.has("left")?-1:K.x.has("right")?1:0,l=K.y.has("top")?-1:K.y.has("bottom")?1:0,m=K.pos.ox+K.pos.ow/2-K.pos.px,o=K.pos.oy+K.pos.oh/2-K.pos.py;if(e&&(K.pos.wh=b=d.innerHeight||a(d).height(),K.pos.ww=c=d.innerWidth||a(d).width(),m=c/2,o=b/2.5),i=K.x.has("%")?K.pos.ow/100*i:i,j=K.y.has("%")?K.pos.oh/100*j:j,K.pos.pix=m,K.pos.piy=o,m=m+k*(K.pos.ow/2)+i*(k>0?-1:1)-(K.width+G)*(k+1)/2,e?(o=(b-K.height-20)/3,10>o&&(o=10)):o=o+l*(K.pos.oh/2)+j*(l>0?-1:1)-(K.height||0)*(l+1)/2,m=m.round(1),o=(o+h).round(1),K.pos.vx=m,K.pos.vy=o,K.bound!==!1&&!K.global){var p=(n(K.bound)?K.bound:0).clamp(-100,100);K.pos.pw-2*pK.pos.pw-p?K.pos.vx=K.pos.pw-p-K.width-G:K.pos.vxK.pos.ph-p?K.pos.vy=K.pos.ph-p-K.height:K.pos.vy');var c="",d=a("style#my-modal-style-"+K.cid);"top"==K.nose||"bottom"==K.nose?(c+="div.my-modal-"+K.cid+".nose-"+K.nose+":before {left:"+(K.pos.ox-K.pos.px+K.pos.ow/2-K.pos.vx)+"px!important;}",d.text(c)):("left"==K.nose||"right"==K.nose)&&(c+="div.my-modal-"+K.cid+".nose-"+K.nose+":before {top:"+(K.pos.oy-K.pos.py+K.pos.oh/2-K.pos.vy)+"px!important;}",d.text(c))}K.screen?K.global?(z.css({top:0,left:0,width:"100%",height:"100%",display:"block",position:"fixed","z-index":K.z-1}),z.css(l(K.screen)?{background:K.screen?K.screen:"rgba(18,41,72,0.88)"}:{background:K.screen?"rgba(18,41,72,0.88)":""})):z.css({top:0,left:0,position:"absolute",width:z.parent().outerWidth()+"px",height:z.parent().outerHeight()+"px",display:"block",background:l(K.screen)?K.screen:"rgba(255,255,255,0.6)","z-index":K.z-1}):z.length&&z.hide(),K.height>K.pos.wh?(w.height(K.pos.wh-30),x.css({"overflow-y":"scroll"})):x.css({"overflow-y":""}),w.animate({top:K.pos.vy+"px",opacity:"1"},K.animate)}function u(){try{x.my("remove")}catch(b){}try{y.data("modals")[K.cid]=null}catch(b){}x.parent().off(".my").remove(),j(z)&&z.off(".my"+K.cid),K.screen&&j(z)&&function(a){a&&g||z.hide(),a&&!g&&z.css({background:"rgba(18,41,72,0.88)"})}.delay(50,K.global),K.global&&(g=!1,a(document.body).css({overflow:""}))}function v(a){try{I(null,null)}catch(b){}(function(){D.reject(a)}).delay(0)}if(d){if(void 0===e&&void 0===p&&void 0===q)return d.call(this);if(m(e)&&(e.hasOwnProperty("backdrop")||e.hasOwnProperty("keyborad")||e.hasOwnProperty("show")))return d.call(this,e,p);if(l(e)&&/^(toggle|show|hide|handleUpdate)$/.test(e))return d.call(this,e,p)}var w,x,y,z,A,B,C,D=a.Deferred(),E={},F=this,G=0,H=0,I=o(p)?p:function(){return!1},J=m(e)?e:{},K=F.data("modal");if(h(F,D.promise()),K){if(null==e||k(e))return r(e),F;if(J)return v("Locked"),F}return F.is(":visible")?(J=b(E,e,{}))?J.global&&g?(v("Locked"),F):(K=h({type:"DOM",source:"manifest",form:null,modal:null,root:null,bgroot:null,caller:F,manifest:{},data:{},global:!1,screen:!1,drag:!1,focus:!0,close:!0,silent:!0,esc:!1,enter:!1,bound:!1,hardClose:!0,nose:"",width:q||300,height:null,x:"0",y:"0",z:"1901",background:"white",css:"",animate:200},J,{promise:D.promise(),cid:Number.random(268435456,4294967295).toString(16)}),K.done=o(K.done)?K.done:I,l(K.align)&&K.align&&(K.x=(K.align.match(/(left|right):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0],K.y=(K.align.match(/(top|bottom):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0]),K.width=1*(a.my.f.getref(l(K.manifest)?a.my.cache(K.manifest):K.manifest,"params.width")||K.width),K.type="DOM",F.hasClass("my-form")?(K.type="form",K.root=K.root||F):F.data("my")?(K.type="control",K.root=K.root||F.my().root):(K.root=K.root||F.parents(".my-form").eq(0),K.root.length||(K.root=a(f))),K.global?(K.root=a(f),K.bgroot=a(c||f)):K.bgroot=K.bgroot?a(K.bgroot):K.root,y=K.root,y.data("modals")||y.data("modals",{}),s(),w=a('
'),K.root.find(">.my-modal").length?w.insertAfter(K.root.find(">.my-modal").last()):w.prependTo(K.root),w.addClass("my-modal-"+K.cid),G=w.outerWidth(),H=w.outerHeight(),w.hide(),w.html('
'),x=w.find(".my-modal-form"),K.close&&(A=a(l(K.close)?K.close:'
×
').prependTo(w).on("click.my",function(){r(K.hardClose)}),A.css({"z-index":("+"===(K.z+"").to(1)?"+":"")+(1*K.z+1)})),z=K.bgroot.find(">.my-modal-screen"),K.screen&&(z.length||(z=a('').prependTo(K.bgroot)),K.esc&&z.on("click.my"+K.cid,function(){F.modal(!0)}),z.toggleClass("my-modal-screen-global",!!K.global)),F.data("modal",K),K.silent&&w.on("change.my",function(){return!1}),w.css({display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto"}),w.css(K.global?{position:"fixed",left:"50%",top:K.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto","margin-left":"-"+((K.width+G)/2).round(0)+"px"}:{position:"absolute",left:K.pos.vx+"px",top:K.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto"}),x.my(K.manifest,K.data).then(function(){var b,c,d,e,f;if(h(K,{form:x,bg:z,cancel:function(){r(!0)},commit:function(){r()}}),w.data("modal",K),K.height=w.outerHeight(),"manifest"!==K.source&&(K.width=w.width()),s(),w.css({top:K.pos.vy+"px"}),t(!0),w.removeClass("my-modal-init"),y.data("modals")[K.cid]=K,i[K.cid]=D,x.on("commit.my",function(){return K.commit.delay(30),!1}).on("cancel.my",function(){return K.cancel.delay(30),!1}),w.on("layout.my",function(){t()}.debounce(30)),K.global&&(g=F,a(document.body).css({overflow:"hidden"})),K.global||!K.esc&&!K.enter||x.on("keydown.my",function(b){var c=b.keyCode;return 27==c&&K.esc?(K.cancel(),!1):13==c&&K.enter&&!a(b.target).is("textarea")?(K.commit.delay(50),!1):void 0}),K.focus===!0){e=!1,f=K.manifest.ui;for(d in f)e||(c=x.find(d),c.length&&c.is("input, textarea","button")&&(e=!0,c.focus()))}else l(K.focus)&&x.find(K.focus).focus();if(b=x.find("img").filter(function(){return""!=a(this).attr("src")}),b.length){var j=function(){"manifest"!==K.source&&w.css({width:"auto"}),t()}.after(b.length);b.each(function(){a(this).bind("load",j)})}K.drag&&a.fn.draggable&&(l(K.drag)?w.draggable({handle:K.drag}):w.draggable(),K.nose&&w.on("dragstart.my",function(){w.removeClass("nose-"+K.nose)})),w.on("mousedown.my",function(b){var c,d=[],e=a(b.currentTarget),f=e.parent(),g=+e.css("z-index"),h=g;f.length&&(c=f.find(">.my-modal").each(function(c,e){var f=+a(e).css("z-index");e!=b.currentTarget&&f>=g&&d.push([f,a(e)]),f>h&&(h=f)}),d.forEach(function(a){a[1].css("z-index",a[0]-1+"")}),e.css("z-index",h+""))}),D.notify("Ready")}).fail(function(a){try{u()}catch(b){}F.data("modal",null),D.reject(a)}),F):(v("Invalid data"),F):(v("Object must be visible"),F)}}(jQuery); \ No newline at end of file diff --git a/Release/jquery.my.last.js b/Release/jquery.my.last.js index 2fb7371..edbc6f4 100644 --- a/Release/jquery.my.last.js +++ b/Release/jquery.my.last.js @@ -1,5 +1,5 @@ -/* jQuery.my 1.2.10, © ermouth +/* jQuery.my 1.2.11, (c) 2017 ermouth * Requires jQuery 2.0+, SugarJS 1.3.9-1.4.x * More details at jquerymy.com */ -!function(a){function b(){window.console&&console.error.apply(console,arguments)}function c(){window.console&&console.log.apply(console,arguments)}function d(a,b){return a.hasOwnProperty(b)}function e(b){return a.contains(document.documentElement,b[0])}function f(a,b){return Array.prototype.slice.call(a,b||0)}function g(a,b,c){var d=0,e=a.length,f=!0;if(a===b)return"===";if("==="==c)return"";if(e!=b.length)return"";for(;e>d&&f;d++)f=a[d]===b[d];if(f)return"==";if("=="==c)return"";for(f=!0;e>d&&f;d++)f=Object.equal(a[d],b[d]);return f?"=":""}function h(a,b){return(ib(b)?b.split("."):gb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return jb(a)?Object.values(a).find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):gb(a)?a.find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):void 0}if(null!=a&&null!=a[b])return a[b]}return void 0},a)}function i(a){var b=a.my();return b?b.root?b.root.my():b:null}function j(a){var b,c={},d=function(){return null};if(ib(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(gb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(jb(a))for(b in a)c[b]=mb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(ib(c)&&(c=c.split(/[,\s]+/)),gb(c)){for(c=c.compact(!0),b=0;b$/.test(y.list)?f=y.list:i=y.list||i,!f){var l=">*"==i?a(d[0].children):p(d,i,!0);f="
",l.length&&(f=a(f).append(l.eq(0).clone(!0)).html(),l.eq(0).remove())}d.data("formlist")||d.data("formlist",{}),d.data("formlist").generator={manifest:t,delay:(y.delay||w.delay||10)/1.3,template:f,selector:i,parent:B,bind:y.bind,merge:mb(y.merge)?y.merge.bind(B):y.merge?n:!1,hash:mb(y.hash)?y.hash.bind(B):ib(y.hash)?k.fill(void 0,y.hash):gb(y.hash)?m.fill(void 0,y.hash.slice(0)):null,id:mb(y.id)?y.id.bind(B):ib(y.id)?k.fill(void 0,y.id):gb(y.id)?m.fill(void 0,y.id.slice(0)):null,ext:!(!y.id&&!y.hash),stamp:0},d.on("insert.my",function(b,c){b.stopPropagation();var d={what:void 0,where:0};null==c?d.where=1e6:jb(c)?qb(d,c):(ib(c)||kb(c))&&(d.where=c),a(b.target).my("insert",d.where,d.what)}),d.on("remove.my",function(b){b.stopPropagation(),a(b.target).my("remove")})}else try{b=K.call(d,r(B,t),jb(e)?e:void 0)}catch(q){j("$.my subform init of "+g+" failed: "+q.message,q.stack)}}nb(b)?b.then(o,function(a,b){j("Init of subform "+g+" failed with error: "+a,b)}):o()}function j(a,c){b(a,c),z&&z.reject(a,c)}function k(a,b){var c=h(a,b)||"";return"string"==typeof c?c:l(c)}function m(a,b){return l(D(a,b))}function o(){d.each(function(){var b,c,h,i=a(this),j=i[0].nodeName,k=!1;if("TEXTAREA"==j&&(h=i[0].nextSibling,c=h&&h.CodeMirror?h.CodeMirror:null,c&&i.addClass("my-codemirror")),b=y.events||N(i,Cb.events),i.hasClass("my-form")?tb(i.data("my"),{dui:y,root:e,selector:g,dparams:w,devents:b,ddata:v.data,container:w.container(i),derrors:v.errors,single:!0}):(i.data("my",{events:b,selector:g,initial:s,previous:s,root:e,container:w.container(i),id:v.id,ui:y,data:v.data,params:w,errors:v.errors,single:1==C}),f._update=y.delay?O.debounce(y.delay):wb,k=!0),k)if(i.cleditor&&i.parent().hasClass("cleditorMain")){var l=i.cleditor()[0];if(l&&l.$frame&&l.$frame[0]){i.addClass("my-cleditor"),tb(i.data("my"),{container:w.container(i)});var m,n=function(a){i.val(a).trigger(eb)},o=Number.random(1e5,1e6-1);a(l.$frame[0]).attr("id","cleditCool"+o),m=document.frames?document.frames["cleditCool"+o].document:a("#cleditCool"+o)[0].contentWindow.document;var p=a(m).find("body");a(m).on("keyup.my",function(){n(a(this).find("body").html())}),i.parent().find("div.cleditorToolbar").on("click.my mouseup.my",function(){n(p.html())}),a("body").on("click","div.cleditorPopup",function(){n(p.html())})}}else if("TEXTAREA"==j&&i.parent().hasClass("redactor_box")){var q,r="my-redactor-9";try{q=i.getEditor(),r="my-redactor-8"}catch(t){q=i.redactor("getEditor")}q&&(i.addClass(r),q.on("input.my keyup.my blur.my",function(a){a.trigger("redactor")}.fill(i)))}else i.hasClass("ace_editor")?ace.edit(d[0]).on(eb,function(a){a.trigger("ace")}.fill(i)):c&&c.on(eb,function(a){a.trigger("codemirror")}.fill(i));i.my()._changed=x.debounce(u),i.my()._recalc=I.debounce(u),i.on(b,function(a){a.type==eb&&a.stopPropagation(),k&&(v.locktill=Ab()+f.delay),i.my()._changed(i,e,f,w)}),/check(\.my)?/.test(b+"")||i.on("check.my",function(){return i.my()._changed(i,e,f,w,!0),!1}),k||i.off("redraw.my"),i.on("recalc.my, redraw.my",function(a){a.stopPropagation(),i.my()._recalc(i,e,f,w)})}),z&&z.resolve()}var q,s,t,u,v=e.my(),w=(v||{}).params,y=f,z=null,A=0,B=v.manifest,C=0|d.length;return v?(u=f.delay,C?(y.init!=wb&&(q=H(B,y.init,d,v)),nb(q)?(A+=1,z=ub(),q.then(i,function(a,b){j("Init of "+g+" failed: "+a,b)})):i()):c("Not found "+g+" selector.",e),z):(b("Failed to find $root building "+g+" selector."),null)}function w(c,d){jb(d)&&d.channel&&d.message&&p(c,".my-listen-"+l(d.channel),!0).each(function(){var c,e=a(this),f=e.data("my"),g=void 0;if(f&&f.ui.listen&&mb(f.ui.listen[d.channel])){c=f.ui.listen[d.channel];try{g=c.call(f.manifest||f.root.my().manifest,f.data,d.message,e)}catch(h){b("Listener failed",h.message,h.stack)}void 0!==g&&(null===g?e.trigger("check"):g&&e.trigger("recalc"))}})}function x(a,b,c,d,e){{var f,g=a.data("my");b.data("my")}g&&(g.disabled?g.ddata||O(a,wb,c.recalcDepth||d.recalcDepth):(B(g.ddata||g.data,g.dparams||g.params),e||(f=g.single?a:p(b,g.selector)),O(a,e?wb:A(f,wb),c.recalcDepth||d.recalcDepth),d.change&&d.change.call(a)))}function y(b,c,d){var e=d.compact(),f=e.replace(/:disabled/g,""),g=f!==e,h="self:"===f.to(5);return h&&(f=f.replace(/^self:/g,"")),c.each(function(){var d=a(this),e=d.my(),i=!h&&e?e.container:d;i.toggleClass(f,!!b),g&&void 0!==e&&!!b!=!!e.disabled&&(d.my().disabled=!!b,e._disable||(d.my()._disable=N(c,Cb.offon).fill(void 0,c)),e._disable(!!b))}),c}function z(a,b,c){return a[b](c?"disable":"enable")}function A(a,b){var c,d,e=a.data("myval");return e||(d=N(a,Cb.vals),mb(d)&&(c=d(a,wb),void 0===c?a.data("myval",function(a,b){return wb!=b&&d(a,b),a.val()}.fill(a,void 0)):a.data("myval",d.fill(a,void 0))),e=a.data("myval")),mb(e)?(c=e(),(c!==b&&(0==b||0==c)||c!=b||jb(b))&&(c=e(b)),c):wb}function B(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=b;if(!jb(n)||isNaN(h=n.remember)||!jb(e=n.history))return wb;if(jb(a)&&h){if(j=rb(a,!0),k=Ab(),g=sb(e).sort(),g.length&&(k-g.last()=2*h){for(m={},f=h;2*h>f;f++)m[g[f]]=e[g[f]];b.history=m}return d||n.form.trigger(eb),n.history[g.last()]}if(!isNaN(a)||a===wb){if(i=parseInt(a)||0,0>i)return wb;if(g=sb(e).sort(),i>=g.length&&(i=g.length-1),l=rb(n.history[g[g.length-i-1]],!0),c){for(m={},f=0;f=i;i++)if(i===h){if(d)return wb!=b?e[f[i]]=b:void 0===e[f[i]]&&(e[f[i]]=wb),e[f[i]];e[f[i]]=b}else 0===i?(e=a[f[0]],g=a):(g=g[f[i-1]],e=e[f[i]]),(null==e||!jb(e)&&(gb(e)&&!isNaN(f[i+1])&&+f[i]>-1))&&(e=g[f[i]]={});return a}function G(a,b,c){var e=jb(b)?b:null;return Object.each(a,function(b,c){var d=typeof c;/^str|^fu/.test(d)&&(a[b]={bind:c})}),Object.each(a,function(b,f){var g,i,k,l=[],m=[],n=/\s?[,;]\s?/;f.recalc&&(ib(f.recalc)?l=f.recalc.split(n):gb(f.recalc)&&(l=f.recalc),l=l.compact(!0).unique()),l.length&&(a[b].recalc=l),null==f.bind&&(f.bind=function(){});var o;if(f.listen&&(o=j(f.listen),f.listen=Object.size(o)?o:void 0),d(f,"events")&&(f.events=(f.events+"").replace(/,\s*|\s+/g," ")),d(f,"watch"))for(ib(f.watch)?m=f.watch.split(n):gb(f.watch)&&(m=f.watch.slice(0)),m=m.compact(!0).unique(),k=0;ki&&h.resolve()}var d,e,f,g=!1,h=ub(),i=a.length;for(e=0;i>e;e++)d=a[e],f=ib(d.ajax)?w.loader:yb,f(d.ajax).then(function(a,d){fb.test(d.ref)&&(null!=a?tb(!0,b,E(a,d.ref.from(5))):(g=!0,v.push("Invalid data for ‘"+d.ref+"’ resource."))),c()}.fill(void 0,d)).fail(function(a,b){v.push("Failed to load ‘"+b.ref+"’ resource."),g=!0,c()}.fill(void 0,d));return h.promise()}function i(a){var c=!1;return fb.test(a)?null!=h(b,a.from(5))&&(c=!0):null!=h(window,a)&&(c=!0),c}function j(a){for(var b in a)a[b]===!1&&(a[b]=i(b));return a}var k,l,m,n,o,p,q,r,s=ub(),t=[],u={},v=[],w=tb(!0,{ajaxTimeout:1e4,loader:Cb.params.loader},c||{}),x={ref:null,ajax:{type:"GET",async:!0,timeout:w.ajaxTimeout}};if(jb(b))if(gb(b.require)){for(n=b.require,k=0;k'+f+""}!_.style||b&&!sb.is(":visible")||(S=L(sb,_),S&&S[0].length&&!b&&(V=a("style#"+T),V.length||(V=a(c(S[0],T)).appendTo(a("body"))),V.data("count",1*V.data("count")+1),sb.data("my").style=V),S&&S[1].length&&(Z=a("style#"+U),Z.length?b&&(a(c(S[1],U)).replaceAll(Z),Z=a("style#"+U)):(Z=a(c(S[1],U)).appendTo(a("body")),Q.restyle>-1&&!pb[J]&&(pb[J]=function(){q(!0)}.debounce(Q.restyle)),sb.data("my").restyle=q.fill(!0).debounce(0)),sb.data("my").localStyle=Z,b||sb.addClass("my-restyle")))}function r(){var a,b,c=!0;if(b=t(_),ib(b))B("Error decoding base64 to local Blob/URL",b),c=!1;else{if(W)for(a=0;a*").clone();try{$=H(_,R.init,sb,R)}catch(b){return B(ib(b)?b:b.message,b.stack),sb}}if(nb($)?$.then(function(){x()},function(a,b){B(a,b)}):x(),!hb){if(!sb.my())return B("Internal error initializing controls.",""),sb;sb.data("my").initial=tb(!0,{},bb),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function x(){function a(a){hb||(b[a]=A(p(sb,a),wb),d-=1,.5>d&&y(b))}var b={},c=Object.keys(O),d=c.length;0===d?z():(sb.addClass(lb),c.forEach(function(b){if(!hb){var c=p(sb,b),d=v(c,sb,O[b],b);rb[b]=c,nb(d)?d.then(a.fill(b)).fail(function(a,c){B("Error building "+b+", "+a,c)}):hb||a(b)}}))}function y(a){var c,d,e,f,g;for(g in O){if(hb)return;if(c=O[g],e=rb[g],f=e.length){c.listen&&(eb[g]=e.eq(0));try{d=u(bb,wb,c,e),d==wb&&a[g]!=wb&&void 0!==d&&u(bb,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+J+"')",h.message,h.stack)}try{d!=wb&&A(e,d),e.eq(0).trigger("check.my")}catch(h){B("Error linking "+g,h.message,h.stack)}}}z()}function z(){sb.removeClass(lb),sb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),sb.my("redraw")}),qb=null,fb.resolve(bb)}function B(a,c){var d;if(hb=!0,b("Form "+I+" failed to initialize.",a,c),Object.keys(rb).forEach(function(a){delete rb[a]}),sb.removeClass(lb),d=kb(a,c),ib(d)||jb(d)&&d.jquery?sb.html(d):d===!0&&sb.html(qb),Q.silent)fb.resolve(bb);else{if(!sb.my().ddata){if(sb.removeData("my"),sb.removeClass("my-form"),V)if("1"==V.data("count"))try{V.remove()}catch(e){}else V.data("count",V.data("count")-1);if(Z)try{delete pb[J],Z.remove()}catch(e){}}fb.reject("Form "+I+" failed to initialize: "+a,c)}}var D,F,I,J,K,N,O,Q,R,S,T,U,V,Z,$,_={},bb={},cb=null,db=[],eb={},fb=ub(),hb=!1,kb=function(){},lb="my-form-init",ob="std",qb="",rb={};if(ib(d)){if(D=zb(d),!D)return fb.reject("No manifest with id "+d+" found in repo."),fb.promise();jb(f)&&jb(e)?(D=tb(D,e),F=f):F=e,ob="repo"}else D=d,F=e;if(!D)return this;R=jb(F)&&"repo"!=ob?tb(!0,{},D):D;var sb=this.eq(0),vb=sb.my();return jb(vb)&&vb.id&&vb.ui?(c("jQuery.my is already bound.",sb),sb.my("ui",R.ui),sb.my(ab,R.data),fb.resolve(sb.my(ab)).promise()):(Q=R.params||{},Q.strict||mb(R.init)||(Q=tb(!0,{},Q),P(Q)),Q=tb(!0,{},Cb.params,Q),fb.fail(function(){sb.removeClass(U+" "+T)}),tb(sb,fb.promise()),jb(F)?(bb=m(F,R.data||{}),R.data=bb):bb=R.data||{},_.data=bb,sb.data("my",{data:bb,params:Q,promise:fb.promise(),locktill:0}),sb.addClass(lb),R.inherit&&i(R),gb(R.require)?Bb(R,Q).then(g).fail(function(a){o(),B("Linker of the ‘require’ property failed.",a)}):g(),fb.then(n),sb)}function L(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=mb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),ib(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Db.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),gb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==_&&c(a,i,g+1)}wb!=b[""]&&typeof b[""]!=_&&g>e&&(d=b[""],e=g)}var d=wb,e=0,f="";return c(a,b,1),d}function O(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,q,r=!1,s=!1,t=a,v=t.my(),w="";if(v){if(m=v.selector,n=v.root,n.hasClass("my-form-init"))return{};if(o=p(n,m),q=n.my().ui,r=a.hasClass("my-form"),r?(f=a,g=v.ddata,h=v.dui,i=v.dparams):(f=v.container,g=v.data,h=v.ui,i=v.params),h.bind!=wb){if(j=xb(c)?c:A(o,u(g,wb,h,o)),wb!=h.check){w="Unknown error";try{w=U(g,j,h,o)}catch(x){b("Error "+x.message+" in .check validator for "+m,n,x.stack)}}var z=i.errorCss,B="ui-state-error";try{wb!=c&&(j=A(o,u(g,c,h,o)))}catch(x){w=i.messages.formError||"Error"}if(wb!=h.check)if(s=a.hasClass("my-form-list"),""==w&&(r||f.hasClass(z)))r?v.derrors[m]="":v.errors[m]="",f.removeClass(z),f.attr("title")&&f.attr("title",""),r||s||i.effect(p(f,i.errorTip),!1,i.animate/2),t.removeClass(B),p(t,".ui-widget").removeClass(B);else if(w){if(r)v.derrors[m]=w;else if(s)v.errors[m]=w;else{f.addClass(z),v.errors[m]=w;var C=p(f,i.errorTip);C.length?i.effect(C.addClass(z).html(ib(w)?w:"Error"),!0,i.animate):f.attr("title",(ib(w)?w:"Error").stripTags())}t.hasClass("hasDatepicker")&&(t.is("input")?t.addClass(B):p(t,".ui-widget").addClass(B)),t.hasClass("ui-slider")&&t.addClass(B)}}var D=c==wb?j:c;if(h.css)for(k in h.css)l=h.css[k],lb(l)?y(l.test(D),o,k):mb(l)&&y(l.call(n.my().manifest,g,D,o),o,k);var e,E,F=h.recalc,G=[],H={};if(d&&h.recalc&&n.my()){for(q=n.my().ui,e=0;e-1?"":o;case"s":return c==k?"":o;case"o":return k[c]?"":o;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},l=0,(">*"==h?a(e[0].children):p(e,h,!0)).each(function(){var b=a(this);b.hasClass("ui-sortable-placeholder")||(b.data("my")&&!b.my("valid")&&(j[l]=b.my("errors")),l+=1)}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return m.formError||"Error"}return""}var V="1.2.10",W=window.URL||window.webkitURL,X=!document.addEventListener,Y=((window.navigator.language||window.navigator.userLanguage||"en")+"").split("-")[0].toLowerCase(),Z="{yyyy}-{MM}-{dd}",$="{HH}:{mm}",_="object",ab="data",bb="array",cb="string",db="function",eb="change",fb=/^this\./,gb=Object.isArray,hb=Object.isBoolean,ib=Object.isString,jb=Object.isObject,kb=Object.isNumber,lb=Object.isRegExp,mb=Object.isFunction,nb=function(a){return null!=a&&typeof a==_&&mb(a.then)},ob=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},pb=h(a,"my.f.restyles")?a.my.f.restyles():{},qb=Object.merge,rb=Object.clone,sb=Object.keys,tb=a.extend,ub=a.Deferred,vb=a.type,wb=null,xb=function(a){return null!==a&&void 0!==a},yb=a.ajax,zb=q,Ab=Date.now,Bb=J,Cb={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my(ab);return Object.equal(c,b)?c:a.my(ab,b,!0)}return b||wb},".hasDatepicker":function(a,b){xb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(Z):""},".my-tags":function(a,b){return xb(b)&&(ib(b)||kb(b)?a.tags(ab,[b+""]):gb(b)&&a.tags(ab,b)),a.tags(ab)},".ui-draggable":function(a,b){if(xb(b)&&jb(b)){var c={};isNaN(b.left)||(c.left=Number(b.left).ceil(2)+"px"),isNaN(b.top)||(c.top=Number(b.top).ceil(2)+"px"),(c.left||c.top)&&a.css(c)}var d=a.position();return{left:b&&!isNaN(b.left)?(1*b.left).ceil(2):d.left.ceil(2),top:b&&!isNaN(b.top)?(1*b.top).ceil(2):d.top.ceil(2)}},".my-form-list":function(b,c){function e(){var c,d,e=a(this),f=e.data("my");f&&(c=e.data("formlist"),d=c.index,c.hash=w(f.data,d)+"",c.oid=x!==w?x(f.data,d)+"":c.hash),b.trigger("check.my")}function f(a){a.data("my").locktill+z/1.3.my-form",t=!!q.merge,u=q.template||"
",v=/\{/.test(u),w=q.hash||l,x=q.id||l,y=q.ext,z=q.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).length,E=[],F=[],G=Ab(),H=b.find(C?b.sortable("option","items"):s);if(xb(c)&&gb(c)){if(D)return c;if(i=[],j={},H.each(function(){var b,c=a(this),d=c.data("my");d&&(i.push(d.data),!t&&(b=c.data("formlist"))&&(j[b.oid]=d.data))}),m=g(i,c,"=="),!m){var I=[],J=[],L={},M={};for(F=[],h=0;h1.4*z||G-q.stamp>100||!q.stashed||q.stashed.length!==H.length-(D?1:0)){D&&(o=b.find(">."+A+"-helper"));var N=0;for(H.each(function(b,c){var d,e,f,g=a(c),h=!1;D&&g.hasClass(A+"-helper")||(D&&g.hasClass(A+"-placeholder")&&(g=o),d=g.data("my"),e=g.data("formlist"),d&&e&&(E.push(d.data),N!=e.index&&(e.index=N,h=!0),y&&(f=w(d.data,N)+"",f!==e.hash&&(e.hash=f,h=!0)),N+=1,h&&F.push(g)))}),h=0;h-1){var f=b.eq(d);f.is(":checked")||(f.prop("checked",!0),e&&f.checkboxradio("refresh"))}else e||b.each(function(){a(this).prop("checked",!1)})}if(-1==d)for(var g=0;gForm init failed

',ru:'

Ошибка инициализации формы

'},badInput:{en:"Invalid input",ru:"Неверное значение"},patternMismatch:{en:"Pattern mismatch",ru:"Не соответствует шаблону"},rangeOverflow:{en:"Over maximum",ru:"Больше максимума"},rangeUnderflow:{en:"Under minimum",ru:"Меньше минимума"},stepMismatch:{en:"Step mismatch",ru:"Не кратно шагу"},tooLong:{en:"Too long",ru:"Слишком длинно"},typeMismatch:{en:"Invalid type",ru:"Неверный тип"},valueMissing:{en:"Required",ru:"Обязательное поле"}},events:{".hasDatepicker":"change.my check.my",".my-form,.my-tags":"change.my check.my",".ui-slider":"slide.my check.my","div.redactor_box textarea":"redactor.my check.my",".my-codemirror":"codemirror.my check.my",".ace_editor":"ace.my check.my",".my-form-list":"sortupdate.my check.my",".ui-sortable":"sortchange.my sortupdate.my check.my",".ui-draggable":"drag.my dragstop.my check.my","a, .pseudolink, input[type=button], button":"click.my","img, :radio, :checkbox":"click.my check.my","div.select2-container+input,div.select2-container+select":"change.my check.my input.my",".ui-buttonset,input, select, textarea":"blur.my change.my check.my"+("Micro"===navigator.appName.to(5)?" keyup.my":" input.my"),"":"check.my"},containers:{"*[data-role='fieldcontain'] *":{"input,textarea,select,button,:radio":function(a){return a.parents('[data-role="fieldcontain"]').eq(0)}},".tagstrip *.value":function(a){return a.parents(".tagstrip").eq(0)},"div.redactor_box textarea":function(a){return a.parents("div.redactor_box").eq(0).parent()},".my-tags,.hasDatepicker,.ui-widget,input,textarea,select,button":{".my-cleditor":function(a){return a.parents("div.cleditorMain").eq(0).parent()},"":function(b){var c=b[0].parentNode,d=c.nodeName;return/^(div|span|a|p|form|fieldset|li|ul|td|th|h\d)$/i.test(d)?a(c):b.parents("div,span,a,p,form,fieldset,li,ul,td,th,h1,h2,h3,h4,h5,h6").eq(0)}},"":function(a){return a}},offon:{".ace_editor":function(a,b){ace.edit(b[0]).setReadOnly(a)},".ui-selectable":function(a,b){z(b,"selectable",a)},".ui-slider":function(a,b){z(b,"slider",a)},".ui-draggable":function(a,b){z(b,"draggable",a)},".ui-buttonset":function(a,b){z(b,"buttonset",a)},".hasDatepicker":function(a,b){z(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){z(b,"select2",a)},".my-cleditor":function(a,b){b.cleditor()[0].disable(!!a)},"":function(a,b){b.attr("disabled",!!a)}},destroy:{".hasDatepicker":function(a){a.datepicker("destroy")},".ui-slider":function(a){a.slider("destroy")},".ui-sortable":{".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")}),b.removeClass("my-form-list"),b.sortable("destroy")},"":function(a){a.sortable("destroy")}},".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")})},".ui-draggable":function(a){a.draggable("destroy")},".my-redactor-8":function(a){a.destroyEditor(),a.removeClass("my-redactor-8")},"div.select2-container+input,div.select2-container+select":function(a){a.select2("destroy")},".my-form":function(a){a.my("remove")},textarea:{".my-codemirror":function(a){a[0].nextSibling.CodeMirror.toTextArea(),a.removeClass("my-codemirror")}}}};Cb.params={container:function(a){return N(a,Cb.containers)(a)},change:wb,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:Y,messages:Object.map(Cb.msg,function(a,b){return b[Y]||b.en}),errorTip:".my-error-tip",errorCss:"my-error",animate:0,effect:function(a,b,c){return b?a.fadeIn(c):(a.fadeOut(c),void 0)},remember:0,silent:!1,history:{},historyDelay:100,loader:function(a){var b=ub(),c=zb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Db={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:z,overlap:n,patch:m,kickoff:o,sdbmCode:l,tojson:function(){function a(a){return 10>a?"0"+a:a}function b(a,f,g){var h,i,j,k,l=0,m=f||0,n=d;switch(g&&ib(g)&&(l=String(g).length,n=String(g).repeat(10)),(typeof a).substr(0,3)){case"str":return e(a).replace(/<\/scri/gi,"<\\u002fscri");case"num":return isFinite(a)?""+String(a):"null";case"boo":case"nul":return String(a);case"fun":return e(c(a.toString()).replace(/<\/scri/gi,"<\\u002fscri"));case"obj":if(!a)return"null";if(typeof a.toJSON===db)return b(a.toJSON(),m+(g?1:0),g);if(h=[],gb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),mb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=ib(b)?b:a.my.tojson(b),g=ib(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Db.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:L,css2json:function(a){var b="",c=(a+"").replace(/\/\*[\s\S]+\*\//gm,"").replace(/@charset[^;]+;/gim,"").replace(/[\n\t\s]+/g," ").replace(/\s*@media[^{]*\{/g,function(a){return a.to(-1).trim()+"ᴥ"}).replace(/\}/g,"}ᴥ").replace(/^\n+/g,"").replace(/[\n\s]+$/g,"").split("ᴥ").compact(!0).reduce(function(a,c){var d,e,f,g=c.trim();return"}"==g?b="":/^[^{]+\{[^\}]+\}$/.test(g)?(d=g.to(-1).split("{"),e=" "+d[0].trim(),f=d[1].trim(),";"!=f.last()&&(f+=";"),b?a[b][e]=(a[b][e]||"")+f:a[e]=(a[e]||"")+f):/^@media/.test(g)&&(a[g]={},b=g),a},{});return c}},Eb={container:function(a){return N(a,Cb.containers)(a)},data:function(a,b){var c=this;return jb(a)&&(c.my().data=n(c.my().data,a),this.my("redraw",b)),c.my().data},disabled:function(a){var b,c,d,e,f=this,g=f.my();if(!g)return void 0;if(a==wb)return g.disabled;if(a){for(c in g.ui)b=p(f,c),d=b.my(),d&&(d.predisabled=d.disabled),y(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=p(f,c),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),y(e,b,":disabled");f.removeClass("my-disabled"),f.my("redraw")}},errors:function(){var b=a(this).my().errors,c={};for(var d in b)b[d]&&ib(b[d])&&(c[d]=b[d]),jb(b[d])&&sb(b[d]).length&&(c[d]=b[d]);return c},find:function(a){var b=this,c=b.my();return c&&c.root&&(b=c.root),b.find(a)},history:function(a,b){return B(a,this.my().params,b)},id:function(a,b){if(ib(a))return zb(a,b);var c=this.my();return c&&c.id?c.id:wb},index:function(){var a=this.my().root&&!this.my().ddata?this.my().root:this;return(a.data("formlist")||{}).index},indom:function(){return e(this)},init:K,insert:function(a,b){var c,d,e=this.hasClass("my-form-list")?this:this.my().root||this,f=e.hasClass("my-form-list")?e:e.parent(".my-form-list"),g=(e.data("formlist")||{}).index,i=b,j=f.data("formlist").generator;if(null==g&&(g=0),c=fb.test(j.bind)?h(f.my().manifest,j.bind.replace(fb,"")):h(f.my().data,j.bind),!jb(i))if(jb(j.manifest))i=rb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=rb(e.my().manifest.data,!0)}if("before"===a)d=g;else if("after"===a)d=g+1;else{if(isNaN(a))throw"Invalid position for insertion";d=(1*a).clamp(0,c.length)}c.add(i,d),f.trigger("redraw")},manifest:function(a){return"json"==a?Db.tojson(this.my().manifest):this.my().manifest},promise:function(a){return mb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",ib(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my(),e=2;return d&&jb(d.ui)&&(e=d.params.recalcDepth,Object.keys(d.ui).forEach(function(b){var d=p(c,b);O(d,a?wb:void 0,e),a||(d.hasClass("my-form")&&d.my("redraw"),d.trigger(d.hasClass("my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(eb)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return wb;if(this.my().root&&!this.my().ddata&&(j=this.my().root),d=j.my(),f=d.data,h=d.cid,i=d.mid,j.unbind(".my"),jb(d)&&d.manifest&&mb(d.manifest.die))try{d.manifest.die.call(d.manifest,j,d.manifest)}catch(k){}if(b=d.style)if("1"==b.data("count"))try{b.remove()}catch(k){}else b.data("count",b.data("count")-1);if(c=d.localStyle)try{delete pb[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?wb:(d.params.errors&&d.params.errors.values().compact(!0).length?Object.equal(d.data,d.lastCorrect)||(g+=1):Object.equal(e[f.last()],d.data)&&(g+=1),b=B(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return A(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&ib(b[d])?c++:jb(b[d])&&sb(b[d]).length&&c++;return!c},version:function(){return V}},Fb=Object.keys(Eb);a.my||(a.my={}),tb(a.my,{f:a.extend({},Db),tojson:Db.tojson,fromjson:Db.fromjson,radio:function(b,c){w(a(document),ib(b)?{channel:b,message:c}:b)},rules:Cb,locale:function(a){return ib(a)?(Y=a.toLowerCase(),Cb.params.locale=Y,void 0):Y},ajax:function(a){return mb(a)?yb=a:yb.apply(this,f(arguments,0))},cache:function(a,b){return mb(a)?zb=a:zb(a,b)},now:function(a){return mb(a)?(Ab=a,void 0):Ab()},require:function(a){return mb(a)?Bb=a:Bb.apply(this,f(arguments,0))},chain:function(){function a(){if(d.length&&e){var b,c=d.shift(),f=function(){a.delay(c[1])}.once();try{b=c[0]()}catch(g){f()}nb(b)?(b.then(f,f),f.delay(c[1])):f()}}var b=1,c=1e3,d=[],e=!1,f=function(e,f,g){d.push([e,f||b,g||c]),a()};return f.delay=function(a){return isNaN(a)||(b=(a-0).clamp(0,1e6)),b},f.timeout=function(a){return isNaN(a)||(c=(a-0).clamp(1,1e6)),c},f.start=function(){e=!0,a()},f.stop=function(){e=!1},f}(),version:function(){return V}}),a.my.version.toString=function(){return V},a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(ib(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Eb.init.apply(this,[c].add(f(arguments,1)))}return ib(b)&&Eb[b]?Eb[b].apply(this,f(arguments,1)):ib(b)&&zb(b,"exist")?Eb.init.apply(this,arguments):typeof b!==_&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Eb.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),w(a(document),c)}).on("resize.my",function(){for(var a in pb)try{pb[a]()}catch(b){}}.debounce(67))}(jQuery),function(a){function b(a,b,c){if(i(b))return a+b;if(j(b))return c=e(!0,c,b),a;if(h(b)&&b.length>1&&i(b[1])){for(var d,k,m,n,o,p,q,r,s=b[0],t="",u=1;u'+(s?"<"+c.labelTag+' class="'+c.labelCss+'" '+(c.label?'style="display:inline-block;width:'+c.label+";margin-left:-"+c.label+'" ':"")+">"+s+"":"")+t+""),a+t}return a}function c(a){var b=a;if(i(b)&&(b=b.split(/[\s,]/).compact(!0)),h(b)){for(var c={},d=0;d',inp:k+'text" {ext}/>',sli:k+'range" {ext}/>',dat:k+'date" {ext}/>',btn:k+'button" {ext}/>',pwd:k+'password" {ext}/>',but:"",div:"
{txt}
",spn:"{txt}",sel:"",mul:'',txt:"",err:' {txt}',msg:'
{txt}
',val:function(a){if(!h(a.vals))return"";var b=e({style:"",css:""},a);return b.txt=a.vals.reduce(function(a,b){return a+""+b+" "}," "),'{txt}'.assign(b)},"":"<{_tag} {ext}>{txt}"},txt:{sel:function(a){if(!a.vals)return"";var b=c(a.vals);return Object.keys(b).reduce(function(a,c){return a+'"},"")}},params:{styles:{num:"width:30%;",dat:"width:30%;",inp:"width:100%",pwd:"width:100%",but:"width:30%",txt:"width:100%;max-width:100%;min-height:1px;word-break:break-word;",err:"display:none",msg:"display:none"},alias:{number:"num",date:"dat",slider:"sli",textarea:"txt",input:"inp",span:"spn",select:"select",vals:"val"},row:"",rowTag:"div",rowCss:"my-row",label:"",labelTag:"span",labelCss:"my-label"},defaults:{id:"","class":"",style:"",placeholder:"",value:"",rows:1},attnames:{css:"class",plc:"placeholder",val:"value",txt:"",vals:"",tip:"title"}},m={init:function(b,c){return a(this).html(d(b,c))}};a.my||(a.my={}),a.my.formgen=d,a.fn.formgen=function(b){return i(b)&&m[b]?m[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?(a.error("Method "+b+" does not exist on jQuery.formgen"),void 0):m.init.apply(this,arguments)}}(jQuery),function(a){function b(b,c,d,e){var f,g,i,j,k,n,o;if("object"==typeof c&&c.jquery)c.is("img")&&(n=c,k=c.attr("alt")||c.attr("title")||c.data("text")||"",g=n[0].naturalWidth||n[0].width,f=n[0].naturalHeight||n[0].height,1>f&&(f=1),1>g&&(g=1),j=a(window).width()-90,i=a(window).height()-90,f>i&&(g=g*(i/f)|0,f=i),g>j&&(g=j,f=f*(j/g)|0),o=300>g?300:g,h(b,{source:"image",manifest:{init:function(a){a.html(this.HTML),a.on("click.my","img:eq(0)",function(){a.trigger("cancel")})},HTML:'

',ui:{"img:eq(0)":"img",h4:{bind:"text",css:{hide:function(a,b){return!b}}}}},data:{img:n.attr("src"),text:k},esc:!0,screen:!0,width:e||o,focus:!1,global:!0,z:"1995"},d));else if(m(c)&&c.manifest)h(b,c,d);else{if(!l(c))return null;h(b,{source:"html",manifest:{init:function(a){a.html(this.HTML)},HTML:c,ui:{"div:eq(0)":function(){}}},data:{},esc:!0,focus:!1,width:e},d)}return b}var c,d,e={},f="body",g=!1,h=a.extend,i={},j=a.my.f.indom,k=(Object.isArray,Object.isBoolean),l=Object.isString,m=Object.isObject,n=Object.isNumber,o=(Object.isRegExp,Object.isFunction);if(a.fn.modal&&o(a().emulateTransitionEnd)&&(d=a.fn.modal),a(document).off(".modal"),a(document).on("keydown.modal",function(a){var b,c,d=a.keyCode;if(!1!==g&&(13===d||27===d)){if(c=g.data("modal"),b=c.form,27==d&&(c.esc||Object.equal(b.data("my").initial,b.my("data"))))return g.modal(!0),!1;if(13==d&&c.enter)return function(a){a.modal()}.fill(g).delay(50),!1}}),o(a.my.f.getref(a,"my.modal.parent"))){var p=a.my.f.getref(a,"my.modal.parent")().attr("id");p&&(f="#"+p)}e.modal=function(c,d,e){var h,i={},j=a(f),l=j.find(">.my-modal-proxy"),m={global:!0,screen:!0,done:o(d)?d:void 0,z:"1995"};return k(c)||null==c?l.modal(c):(h=a.Deferred(),b(i,c,m,e)?g?h.reject("Locked").promise():(l.length||(l=a('
').prependTo(j),l.css({position:"absolute",top:"0",left:"0",margin:"0",padding:"0",width:"1px",height:"0"})),l.modal(i)):h.reject("Invalid data").promise())},e.modal.loading=function(b){a(f).find(">.my-modal").toggleClass("my-modal-loading",!!b)},e.modal.parent=function(b){return b&&a(b).length?(f=b,void 0):a(f)},e.modal.parentBack=function(b){return b&&a(b).length?(c=b,void 0):a(c||f)},e.modal.visible=function(){return!!g},a.my||(a.my={}),a.my.modal=e.modal,a.fn.modal=function(e,p,q){function r(){var b,c,d=window,e=!!J.global,f=x.offset(),g=E.offset(),h=x.scrollTop();J.pos={px:f.left,py:f.top,pw:x.outerWidth(),ph:x.outerHeight(),ox:g.left,oy:g.top,ow:E.outerWidth(),oh:E.outerHeight(),ww:c,wh:b};var i=1*(J.x.match(/\-?\d+(\.\d+)?/)||[0])[0],j=1*(J.y.match(/\-?\d+(\.\d+)?/)||[0])[0],k=J.x.has("left")?-1:J.x.has("right")?1:0,l=J.y.has("top")?-1:J.y.has("bottom")?1:0,m=J.pos.ox+J.pos.ow/2-J.pos.px,o=J.pos.oy+J.pos.oh/2-J.pos.py;if(e&&(J.pos.wh=b=d.innerHeight||a(d).height(),J.pos.ww=c=d.innerWidth||a(d).width(),m=c/2,o=b/2.5),i=J.x.has("%")?J.pos.ow/100*i:i,j=J.y.has("%")?J.pos.oh/100*j:j,J.pos.pix=m,J.pos.piy=o,m=m+k*(J.pos.ow/2)+i*(k>0?-1:1)-(J.width+F)*(k+1)/2,e?(o=(b-J.height-20)/3,10>o&&(o=10)):o=o+l*(J.pos.oh/2)+j*(l>0?-1:1)-(J.height||0)*(l+1)/2,m=m.round(1),o=(o+h).round(1),J.pos.vx=m,J.pos.vy=o,J.bound!==!1&&!J.global){var p=(n(J.bound)?J.bound:0).clamp(-100,100);J.pos.pw-2*pJ.pos.pw-p?J.pos.vx=J.pos.pw-p-J.width-F:J.pos.vxJ.pos.ph-p?J.pos.vy=J.pos.ph-p-J.height:J.pos.vy');var c="",d=a("style#my-modal-style-"+J.cid);"top"==J.nose||"bottom"==J.nose?(c+="div.my-modal-"+J.cid+".nose-"+J.nose+":before {left:"+(J.pos.ox-J.pos.px+J.pos.ow/2-J.pos.vx)+"px!important;}",d.text(c)):("left"==J.nose||"right"==J.nose)&&(c+="div.my-modal-"+J.cid+".nose-"+J.nose+":before {top:"+(J.pos.oy-J.pos.py+J.pos.oh/2-J.pos.vy)+"px!important;}",d.text(c))}J.screen?J.global?(y.css({top:0,left:0,width:"100%",height:"100%",display:"block",position:"fixed","z-index":J.z-1}),l(J.screen)&&y.css({background:J.screen?J.screen:"rgba(25, 39, 59, 0.88)"})):y.css({top:0,left:0,position:"absolute",width:y.parent().outerWidth()+"px",height:y.parent().outerHeight()+"px",display:"block",background:l(J.screen)?J.screen:"rgba(255,255,255,0.6)","z-index":J.z-1}):y.length&&y.hide(),J.height>J.pos.wh?(v.height(J.pos.wh-30),w.css({"overflow-y":"scroll"})):w.css({"overflow-y":""}),v.animate({top:J.pos.vy+"px",opacity:"1"},J.animate)}function t(){try{w.my("remove")}catch(b){}try{x.data("modals")[J.cid]=null}catch(b){}w.parent().off(".my").remove(),y.off(".my"+J.cid),J.screen&&function(a){a&&g||y.hide(),a&&!g&&y.css({background:"rgba(25, 39, 59, 0.88)"})}.delay(50,J.global),J.global&&(g=!1,a(document.body).css({overflow:""}))}function u(a){try{H(null,null)}catch(b){}(function(){C.reject(a)}).delay(0)}if(d){if(void 0===e&&void 0===p&&void 0===q)return d.call(this);if(m(e)&&(e.hasOwnProperty("backdrop")||e.hasOwnProperty("keyborad")||e.hasOwnProperty("show")))return d.call(this,e,p);if(l(e)&&/^(toggle|show|hide|handleUpdate)$/.test(e))return d.call(this,e,p)}var v,w,x,y,z,A,B,C=a.Deferred(),D={},E=this,F=0,G=0,H=o(p)?p:function(){return!1},I=m(e)?e:{},J=E.data("modal");if(h(E,C.promise()),J){if(null==e||k(e)){if(w=J.form,y=J.bg,x=J.root,H=J.done,A=w.my("data"),B=!1,e){try{H.call(w.my("manifest"),null,null)}catch(K){}try{j(w)?t():""}catch(K){}if(E.removeData("modal"),i[J.cid])try{i[J.cid].reject("Cancelled")}catch(K){}delete i[J.cid],J=null}else{try{B=H.call(w.my("manifest"),w.my("valid")?null:w.my("errors"),A)}catch(K){}if(!B){try{j(w)?t():""}catch(K){}E.removeData("modal"),function(){i[J.cid]&&i[J.cid].resolve(A),delete i[J.cid],J=null}.delay(0)}}return E}if(I)return u("Locked"),E}return E.is(":visible")?(I=b(D,e,{}))?I.global&&g?(u("Locked"),E):(J=h({type:"DOM",source:"manifest",form:null,modal:null,root:null,bgroot:null,caller:E,manifest:{},data:{},global:!1,screen:!1,drag:!1,focus:!0,close:!0,silent:!0,esc:!1,enter:!1,bound:!1,hardClose:!0,nose:"",width:q||300,height:null,x:"0",y:"0",z:"1901",background:"white",css:"",animate:200},I,{promise:C.promise(),cid:Number.random(268435456,4294967295).toString(16)}),J.done=o(J.done)?J.done:H,l(J.align)&&J.align&&(J.x=(J.align.match(/(left|right):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0],J.y=(J.align.match(/(top|bottom):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0]),J.width=1*(a.my.f.getref(l(J.manifest)?a.my.cache(J.manifest):J.manifest,"params.width")||J.width),J.type="DOM",E.hasClass("my-form")?(J.type="form",J.root=J.root||E):E.data("my")?(J.type="control",J.root=J.root||E.my().root):(J.root=J.root||E.parents(".my-form").eq(0),J.root.length||(J.root=a(f))),J.global?(J.root=a(f),J.bgroot=a(c||f)):J.bgroot=J.bgroot?a(J.bgroot):J.root,x=J.root,x.data("modals")||x.data("modals",{}),r(),v=a('
'),J.root.find(">.my-modal").length?v.insertAfter(J.root.find(">.my-modal").last()):v.prependTo(J.root),v.addClass("my-modal-"+J.cid),F=v.outerWidth(),G=v.outerHeight(),v.hide(),v.html('
'),w=v.find(".my-modal-form"),J.close&&(z=a(l(J.close)?J.close:'
×
').prependTo(v).on("click.my",function(){E.modal(J.hardClose)}),z.css({"z-index":("+"===(J.z+"").to(1)?"+":"")+(1*J.z+1)})),y=J.bgroot.find(">.my-modal-screen"),J.screen&&(y.length||(y=a('').prependTo(J.bgroot)),J.esc&&y.on("click.my"+J.cid,function(){E.modal(!0)})),E.data("modal",J),J.silent&&v.on("change.my",function(){return!1}),v.css({display:"block",height:"none",opacity:"0.005","z-index":J.z,width:"auto"}),v.css(J.global?{position:"fixed",left:"50%",top:J.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":J.z,width:"auto","margin-left":"-"+((J.width+F)/2).round(0)+"px"}:{position:"absolute",left:J.pos.vx+"px",top:J.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":J.z,width:"auto"}),w.my(J.manifest,J.data).then(function(){var b,c,d,e,f;if(h(J,{form:w,bg:y,cancel:function(){E.modal(!0)},commit:function(){E.modal()}}),v.data("modal",J),J.height=v.outerHeight(),"manifest"!==J.source&&(J.width=v.width()),r(),v.css({top:J.pos.vy+"px"}),s(!0),v.removeClass("my-modal-init"),x.data("modals")[J.cid]=J,i[J.cid]=C,w.on("commit.my",function(){return J.commit.delay(50),!1}).on("cancel.my",function(){return J.cancel.delay(50),!1}),v.on("layout.my",function(){s()}.debounce(50)),J.global&&(g=E,a(document.body).css({overflow:"hidden"})),J.global||!J.esc&&!J.enter||w.on("keydown.my",function(b){var c=b.keyCode;return 27==c&&J.esc?(J.cancel(),!1):13==c&&J.enter&&!a(b.target).is("textarea")?(J.commit.delay(50),!1):void 0}),J.focus===!0){e=!1,f=J.manifest.ui;for(d in f)e||(c=w.find(d),c.length&&c.is("input, textarea","button")&&(e=!0,c.focus()))}else l(J.focus)&&w.find(J.focus).focus();if(b=w.find("img").filter(function(){return""!=a(this).attr("src")}),b.length){var j=function(){"manifest"!==J.source&&v.css({width:"auto"}),s()}.after(b.length);b.each(function(){a(this).bind("load",j)})}J.drag&&a.fn.draggable&&(l(J.drag)?v.draggable({handle:J.drag}):v.draggable(),J.nose&&v.on("dragstart.my",function(){v.removeClass("nose-"+J.nose)})),v.on("mousedown.my",function(b){var c,d=[],e=a(b.currentTarget),f=e.parent(),g=+e.css("z-index"),h=g;f.length&&(c=f.find(">.my-modal").each(function(c,e){var f=+a(e).css("z-index");e!=b.currentTarget&&f>=g&&d.push([f,a(e)]),f>h&&(h=f)}),d.forEach(function(a){a[1].css("z-index",a[0]-1+"")}),e.css("z-index",h+""))}),C.notify("Ready")}).fail(function(a){try{t()}catch(b){}E.data("modal",null),C.reject(a)}),E):(u("Invalid data"),E):(u("Object must be visible"),E)}}(jQuery); \ No newline at end of file +!function(a){function b(){window.console&&console.error.apply(console,arguments)}function c(){window.console&&console.log.apply(console,arguments)}function d(a,b){return a.hasOwnProperty(b)}function e(b){return a.contains(document.documentElement,b[0])}function f(a,b){return Array.prototype.slice.call(a,b||0)}function g(a,b,c){var d=0,e=a.length,f=!0;if(a===b)return"===";if("==="==c)return"";if(e!=b.length)return"";for(;e>d&&f;d++)f=a[d]===b[d];if(f)return"==";if("=="==c)return"";for(f=!0;e>d&&f;d++)f=Object.equal(a[d],b[d]);return f?"=":""}function h(a,b){return(ib(b)?b.split("."):gb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return jb(a)?Object.values(a).find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):gb(a)?a.find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):void 0}if(null!=a&&null!=a[b])return a[b]}return void 0},a)}function i(a){var b=a.my();return b?b.root?b.root.my():b:null}function j(a){var b,c={},d=function(){return null};if(ib(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(gb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(jb(a))for(b in a)c[b]=mb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(ib(c)&&(c=c.split(/[,\s]+/)),gb(c)){for(c=c.compact(!0),b=0;b$/.test(y.list)?f=y.list:i=y.list||i,!f){var l=">*"==i?a(d[0].children):p(d,i,!0);f="
",l.length&&(f=a(f).append(l.eq(0).clone(!0)).html(),l.eq(0).remove())}d.data("formlist")||d.data("formlist",{}),d.data("formlist").generator={manifest:t,delay:(y.delay||w.delay||10)/1.3,template:f,selector:i,parent:B,bind:y.bind,merge:mb(y.merge)?y.merge.bind(B):y.merge?n:!1,hash:mb(y.hash)?y.hash.bind(B):ib(y.hash)?k.fill(void 0,y.hash):gb(y.hash)?m.fill(void 0,y.hash.slice(0)):null,id:mb(y.id)?y.id.bind(B):ib(y.id)?k.fill(void 0,y.id):gb(y.id)?m.fill(void 0,y.id.slice(0)):null,ext:!(!y.id&&!y.hash),stamp:0},d.on("insert.my",function(b,c){b.stopPropagation();var d={what:void 0,where:0};null==c?d.where=1e6:jb(c)?qb(d,c):(ib(c)||kb(c))&&(d.where=c),a(b.target).my("insert",d.where,d.what)}),d.on("remove.my",function(b){b.stopPropagation(),a(b.target).my("remove")})}else try{b=K.call(d,r(B,t),jb(e)?e:void 0)}catch(q){j("$.my subform init of "+g+" failed: "+q.message,q.stack)}}nb(b)?b.then(o,function(a,b){j("Init of subform "+g+" failed with error: "+a,b)}):o()}function j(a,c){b(a,c),z&&z.reject(a,c)}function k(a,b){var c=h(a,b)||"";return"string"==typeof c?c:l(c)}function m(a,b){return l(D(a,b))}function o(){d.each(function(){var b,c,h,i=a(this),j=i[0].nodeName,k=!1;if("TEXTAREA"==j&&(h=i[0].nextSibling,c=h&&h.CodeMirror?h.CodeMirror:null,c&&i.addClass("my-codemirror")),b=y.events||N(i,Cb.events),i.hasClass("my-form")?tb(i.data("my"),{dui:y,root:e,selector:g,dparams:w,devents:b,ddata:v.data,container:w.container(i),derrors:v.errors,single:!0}):(i.data("my",{events:b,selector:g,initial:s,previous:s,root:e,container:w.container(i),id:v.id,ui:y,data:v.data,params:w,errors:v.errors,single:1==C}),f._update=y.delay?O.debounce(y.delay):wb,k=!0),k)if(i.cleditor&&i.parent().hasClass("cleditorMain")){var l=i.cleditor()[0];if(l&&l.$frame&&l.$frame[0]){i.addClass("my-cleditor"),tb(i.data("my"),{container:w.container(i)});var m,n=function(a){i.val(a).trigger(eb)},o=Number.random(1e5,1e6-1);a(l.$frame[0]).attr("id","cleditCool"+o),m=document.frames?document.frames["cleditCool"+o].document:a("#cleditCool"+o)[0].contentWindow.document;var p=a(m).find("body");a(m).on("keyup.my",function(){n(a(this).find("body").html())}),i.parent().find("div.cleditorToolbar").on("click.my mouseup.my",function(){n(p.html())}),a("body").on("click","div.cleditorPopup",function(){n(p.html())})}}else if("TEXTAREA"==j&&i.parent().hasClass("redactor_box")){var q,r="my-redactor-9";try{q=i.getEditor(),r="my-redactor-8"}catch(t){q=i.redactor("getEditor")}q&&(i.addClass(r),q.on("input.my keyup.my blur.my",function(a){a.trigger("redactor")}.fill(i)))}else i.hasClass("ace_editor")?ace.edit(d[0]).on(eb,function(a){a.trigger("ace")}.fill(i)):c&&c.on(eb,function(a){a.trigger("codemirror")}.fill(i));i.my()._changed=x.debounce(u),i.my()._recalc=I.debounce(u),i.on(b,function(a){a.type==eb&&a.stopPropagation(),k&&(v.locktill=Ab()+f.delay),i.my()._changed(i,e,f,w)}),/check(\.my)?/.test(b+"")||i.on("check.my",function(){return i.my()._changed(i,e,f,w,!0),!1}),k||i.off("redraw.my"),i.on("recalc.my, redraw.my",function(a){a.stopPropagation(),i.my()._recalc(i,e,f,w)})}),z&&z.resolve()}var q,s,t,u,v=e.my(),w=(v||{}).params,y=f,z=null,A=0,B=v.manifest,C=0|d.length;return v?(u=f.delay,C?(y.init!=wb&&(q=H(B,y.init,d,v)),nb(q)?(A+=1,z=ub(),q.then(i,function(a,b){j("Init of "+g+" failed: "+a,b)})):i()):c("Not found "+g+" selector.",e),z):(b("Failed to find $root building "+g+" selector."),null)}function w(c,d){jb(d)&&d.channel&&d.message&&p(c,".my-listen-"+l(d.channel),!0).each(function(){var c,e=a(this),f=e.data("my"),g=void 0;if(f&&f.ui.listen&&mb(f.ui.listen[d.channel])){c=f.ui.listen[d.channel];try{g=c.call(f.manifest||f.root.my().manifest,f.data,d.message,e)}catch(h){b("Listener failed",h.message,h.stack)}void 0!==g&&(null===g?e.trigger("check"):g&&e.trigger("recalc"))}})}function x(a,b,c,d,e){{var f,g=a.data("my");b.data("my")}g&&(g.disabled?g.ddata||O(a,wb,c.recalcDepth||d.recalcDepth):(B(g.ddata||g.data,g.dparams||g.params),e||(f=g.single?a:p(b,g.selector)),O(a,e?wb:A(f,wb),c.recalcDepth||d.recalcDepth),d.change&&d.change.call(a)))}function y(b,c,d){var e=d.compact(),f=e.replace(/:disabled/g,""),g=f!==e,h="self:"===f.to(5);return h&&(f=f.replace(/^self:/g,"")),c.each(function(){var d=a(this),e=d.my(),i=!h&&e?e.container:d;i.toggleClass(f,!!b),g&&void 0!==e&&!!b!=!!e.disabled&&(d.my().disabled=!!b,e._disable||(d.my()._disable=N(c,Cb.offon).fill(void 0,c)),e._disable(!!b))}),c}function z(a,b,c){return a[b](c?"disable":"enable")}function A(a,b){var c,d,e=a.data("myval");return e||(d=N(a,Cb.vals),mb(d)&&(c=d(a,wb),void 0===c?a.data("myval",function(a,b){return wb!=b&&d(a,b),a.val()}.fill(a,void 0)):a.data("myval",d.fill(a,void 0))),e=a.data("myval")),mb(e)?(c=e(),(c!==b&&(0==b||0==c)||c!=b||jb(b))&&(c=e(b)),c):wb}function B(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=b;if(!jb(n)||isNaN(h=n.remember)||!jb(e=n.history))return wb;if(jb(a)&&h){if(j=rb(a,!0),k=Ab(),g=sb(e).sort(),g.length&&(k-g.last()=2*h){for(m={},f=h;2*h>f;f++)m[g[f]]=e[g[f]];b.history=m}return d||n.form.trigger(eb),n.history[g.last()]}if(!isNaN(a)||a===wb){if(i=parseInt(a)||0,0>i)return wb;if(g=sb(e).sort(),i>=g.length&&(i=g.length-1),l=rb(n.history[g[g.length-i-1]],!0),c){for(m={},f=0;f=i;i++)if(i===h){if(d)return wb!=b?e[f[i]]=b:void 0===e[f[i]]&&(e[f[i]]=wb),e[f[i]];e[f[i]]=b}else 0===i?(e=a[f[0]],g=a):(g=g[f[i-1]],e=e[f[i]]),(null==e||!jb(e)&&(gb(e)&&!isNaN(f[i+1])&&+f[i]>-1))&&(e=g[f[i]]={});return a}function G(a,b,c){var e=jb(b)?b:null;return Object.each(a,function(b,c){var d=typeof c;/^str|^fu/.test(d)&&(a[b]={bind:c})}),Object.each(a,function(b,f){var g,i,k,l=[],m=[],n=/\s?[,;]\s?/;f.recalc&&(ib(f.recalc)?l=f.recalc.split(n):gb(f.recalc)&&(l=f.recalc),l=l.compact(!0).unique()),l.length&&(a[b].recalc=l),null==f.bind&&(f.bind=function(){});var o;if(f.listen&&(o=j(f.listen),f.listen=Object.size(o)?o:void 0),d(f,"events")&&(f.events=(f.events+"").replace(/,\s*|\s+/g," ")),d(f,"watch"))for(ib(f.watch)?m=f.watch.split(n):gb(f.watch)&&(m=f.watch.slice(0)),m=m.compact(!0).unique(),k=0;ki&&h.resolve()}var d,e,f,g=!1,h=ub(),i=a.length;for(e=0;i>e;e++)d=a[e],f=ib(d.ajax)?w.loader:yb,f(d.ajax).then(function(a,d){fb.test(d.ref)&&(null!=a?tb(!0,b,E(a,d.ref.from(5))):(g=!0,v.push("Invalid data for ‘"+d.ref+"’ resource."))),c()}.fill(void 0,d)).fail(function(a,b){v.push("Failed to load ‘"+b.ref+"’ resource."),g=!0,c()}.fill(void 0,d));return h.promise()}function i(a){var c=!1;return fb.test(a)?null!=h(b,a.from(5))&&(c=!0):null!=h(window,a)&&(c=!0),c}function j(a){for(var b in a)a[b]===!1&&(a[b]=i(b));return a}var k,l,m,n,o,p,q,r,s=ub(),t=[],u={},v=[],w=tb(!0,{ajaxTimeout:1e4,loader:Cb.params.loader},c||{}),x={ref:null,ajax:{type:"GET",async:!0,timeout:w.ajaxTimeout}};if(jb(b))if(gb(b.require)){for(n=b.require,k=0;k'+f+""}!_.style||b&&!sb.is(":visible")||(S=L(sb,_),S&&S[0].length&&!b&&(V=a("style#"+T),V.length||(V=a(c(S[0],T)).appendTo(a("body"))),V.data("count",1*V.data("count")+1),sb.data("my").style=V),S&&S[1].length&&(Z=a("style#"+U),Z.length?b&&(a(c(S[1],U)).replaceAll(Z),Z=a("style#"+U)):(Z=a(c(S[1],U)).appendTo(a("body")),Q.restyle>-1&&!pb[J]&&(pb[J]=function(){q(!0)}.debounce(Q.restyle)),sb.data("my").restyle=q.fill(!0).debounce(0)),sb.data("my").localStyle=Z,b||sb.addClass("my-restyle")))}function r(){var a,b,c=!0;if(b=t(_),ib(b))B("Error decoding base64 to local Blob/URL",b),c=!1;else{if(W)for(a=0;a*").clone();try{$=H(_,R.init,sb,R)}catch(b){return B(ib(b)?b:b.message,b.stack),sb}}if(nb($)?$.then(function(){x()},function(a,b){B(a,b)}):x(),!hb){if(!sb.my())return B("Internal error initializing controls.",""),sb;sb.data("my").initial=tb(!0,{},bb),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function x(){function a(a){hb||(b[a]=A(p(sb,a),wb),d-=1,.5>d&&y(b))}var b={},c=Object.keys(O),d=c.length;0===d?z():(sb.addClass(lb),c.forEach(function(b){if(!hb){var c=p(sb,b),d=v(c,sb,O[b],b);rb[b]=c,nb(d)?d.then(a.fill(b)).fail(function(a,c){B("Error building "+b+", "+a,c)}):hb||a(b)}}))}function y(a){var c,d,e,f,g;for(g in O){if(hb)return;if(c=O[g],e=rb[g],f=e.length){c.listen&&(eb[g]=e.eq(0));try{d=u(bb,wb,c,e),d==wb&&a[g]!=wb&&void 0!==d&&u(bb,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+J+"')",h.message,h.stack)}try{d!=wb&&A(e,d),e.eq(0).trigger("check.my")}catch(h){B("Error linking "+g,h.message,h.stack)}}}z()}function z(){sb.removeClass(lb),sb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),sb.my("redraw")}),qb=null,fb.resolve(bb)}function B(a,c){var d;if(hb=!0,b("Form "+I+" failed to initialize.",a,c),Object.keys(rb).forEach(function(a){delete rb[a]}),sb.removeClass(lb),d=kb(a,c),ib(d)||jb(d)&&d.jquery?sb.html(d):d===!0&&sb.html(qb),Q.silent)fb.resolve(bb);else{if(!sb.my().ddata){if(sb.removeData("my"),sb.removeClass("my-form"),V)if("1"==V.data("count"))try{V.remove()}catch(e){}else V.data("count",V.data("count")-1);if(Z)try{delete pb[J],Z.remove()}catch(e){}}fb.reject("Form "+I+" failed to initialize: "+a,c)}}var D,F,I,J,K,N,O,Q,R,S,T,U,V,Z,$,_={},bb={},cb=null,db=[],eb={},fb=ub(),hb=!1,kb=function(){},lb="my-form-init",ob="std",qb="",rb={};if(ib(d)){if(D=zb(d),!D)return fb.reject("No manifest with id "+d+" found in repo."),fb.promise();jb(f)&&jb(e)?(D=tb(D,e),F=f):F=e,ob="repo"}else D=d,F=e;if(!D)return this;R=jb(F)&&"repo"!=ob?tb(!0,{},D):D;var sb=this.eq(0),vb=sb.my();return jb(vb)&&vb.id&&vb.ui?(c("jQuery.my is already bound.",sb),sb.my("ui",R.ui),sb.my(ab,R.data),fb.resolve(sb.my(ab)).promise()):(Q=R.params||{},Q.strict||mb(R.init)||(Q=tb(!0,{},Q),P(Q)),Q=tb(!0,{},Cb.params,Q),fb.fail(function(){sb.removeClass(U+" "+T)}),tb(sb,fb.promise()),jb(F)?(bb=m(F,R.data||{}),R.data=bb):bb=R.data||{},_.data=bb,sb.data("my",{data:bb,params:Q,promise:fb.promise(),locktill:0}),sb.addClass(lb),R.inherit&&i(R),gb(R.require)?Bb(R,Q).then(g).fail(function(a){o(),B("Linker of the ‘require’ property failed.",a)}):g(),fb.then(n),sb)}function L(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=mb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),ib(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Db.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),gb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==_&&c(a,i,g+1)}wb!=b[""]&&typeof b[""]!=_&&g>e&&(d=b[""],e=g)}var d=wb,e=0,f="";return c(a,b,1),d}function O(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,q,r=!1,s=!1,t=a,v=t.my(),w="";if(v){if(m=v.selector,n=v.root,n.hasClass("my-form-init"))return{};if(o=p(n,m),q=n.my().ui,r=a.hasClass("my-form"),r?(f=a,g=v.ddata,h=v.dui,i=v.dparams):(f=v.container,g=v.data,h=v.ui,i=v.params),h.bind!=wb){if(j=xb(c)?c:A(o,u(g,wb,h,o)),wb!=h.check){w="Unknown error";try{w=U(g,j,h,o)}catch(x){b("Error "+x.message+" in .check validator for "+m,n,x.stack)}}var z=i.errorCss,B="ui-state-error";try{wb!=c&&(j=A(o,u(g,c,h,o)))}catch(x){w=i.messages.formError||"Error"}if(wb!=h.check)if(s=a.hasClass("my-form-list"),""==w&&(r||f.hasClass(z)))r?v.derrors[m]="":v.errors[m]="",f.removeClass(z),f.attr("title")&&f.attr("title",""),r||s||i.effect(p(f,i.errorTip),!1,i.animate/2),t.removeClass(B),p(t,".ui-widget").removeClass(B);else if(w){if(r)v.derrors[m]=w;else if(s)v.errors[m]=w;else{f.addClass(z),v.errors[m]=w;var C=p(f,i.errorTip);C.length?i.effect(C.addClass(z).html(ib(w)?w:"Error"),!0,i.animate):f.attr("title",(ib(w)?w:"Error").stripTags())}t.hasClass("hasDatepicker")&&(t.is("input")?t.addClass(B):p(t,".ui-widget").addClass(B)),t.hasClass("ui-slider")&&t.addClass(B)}}var D=c==wb?j:c;if(h.css)for(k in h.css)l=h.css[k],lb(l)?y(l.test(D),o,k):mb(l)&&y(l.call(n.my().manifest,g,D,o),o,k);var e,E,F=h.recalc,G=[],H={};if(d&&h.recalc&&n.my()){for(q=n.my().ui,e=0;e-1?"":o;case"s":return c==k?"":o;case"o":return k[c]?"":o;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},l=0,(">*"==h?a(e[0].children):p(e,h,!0)).each(function(){var b=a(this);b.hasClass("ui-sortable-placeholder")||(b.data("my")&&!b.my("valid")&&(j[l]=b.my("errors")),l+=1)}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return m.formError||"Error"}return""}var V="1.2.11",W=window.URL||window.webkitURL,X=!document.addEventListener,Y=((window.navigator.language||window.navigator.userLanguage||"en")+"").split("-")[0].toLowerCase(),Z="{yyyy}-{MM}-{dd}",$="{HH}:{mm}",_="object",ab="data",bb="array",cb="string",db="function",eb="change",fb=/^this\./,gb=Object.isArray,hb=Object.isBoolean,ib=Object.isString,jb=Object.isObject,kb=Object.isNumber,lb=Object.isRegExp,mb=Object.isFunction,nb=function(a){return null!=a&&typeof a==_&&mb(a.then)},ob=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},pb=h(a,"my.f.restyles")?a.my.f.restyles():{},qb=Object.merge,rb=Object.clone,sb=Object.keys,tb=a.extend,ub=a.Deferred,vb=a.type,wb=null,xb=function(a){return null!==a&&void 0!==a},yb=a.ajax,zb=q,Ab=Date.now,Bb=J,Cb={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my(ab);return Object.equal(c,b)?c:a.my(ab,b,!0)}return b||wb},".hasDatepicker":function(a,b){xb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(Z):""},".my-tags":function(a,b){return xb(b)&&(ib(b)||kb(b)?a.tags(ab,[b+""]):gb(b)&&a.tags(ab,b)),a.tags(ab)},".ui-draggable":function(a,b){if(xb(b)&&jb(b)){var c={};isNaN(b.left)||(c.left=Number(b.left).ceil(2)+"px"),isNaN(b.top)||(c.top=Number(b.top).ceil(2)+"px"),(c.left||c.top)&&a.css(c)}var d=a.position();return{left:b&&!isNaN(b.left)?(1*b.left).ceil(2):d.left.ceil(2),top:b&&!isNaN(b.top)?(1*b.top).ceil(2):d.top.ceil(2)}},".my-form-list":function(b,c){function e(){var c,d,e=a(this),f=e.data("my");f&&(c=e.data("formlist"),d=c.index,c.hash=w(f.data,d)+"",c.oid=x!==w?x(f.data,d)+"":c.hash),b.trigger("check.my")}function f(a){a.data("my").locktill+z/1.3.my-form",t=!!q.merge,u=q.template||"
",v=/\{/.test(u),w=q.hash||l,x=q.id||l,y=q.ext,z=q.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).length,E=[],F=[],G=Ab(),H=b.find(C?b.sortable("option","items"):s);if(xb(c)&&gb(c)){if(D)return c;if(i=[],j={},H.each(function(){var b,c=a(this),d=c.data("my");d&&(i.push(d.data),!t&&(b=c.data("formlist"))&&(j[b.oid]=d.data))}),m=g(i,c,"=="),!m){var I=[],J=[],L={},M={};for(F=[],h=0;h1.4*z||G-q.stamp>100||!q.stashed||q.stashed.length!==H.length-(D?1:0)){D&&(o=b.find(">."+A+"-helper"));var N=0;for(H.each(function(b,c){var d,e,f,g=a(c),h=!1;D&&g.hasClass(A+"-helper")||(D&&g.hasClass(A+"-placeholder")&&(g=o),d=g.data("my"),e=g.data("formlist"),d&&e&&(E.push(d.data),N!=e.index&&(e.index=N,h=!0),y&&(f=w(d.data,N)+"",f!==e.hash&&(e.hash=f,h=!0)),N+=1,h&&F.push(g)))}),h=0;h-1){var f=b.eq(d);f.is(":checked")||(f.prop("checked",!0),e&&f.checkboxradio("refresh"))}else e||b.each(function(){a(this).prop("checked",!1)})}if(-1==d)for(var g=0;gForm init failed

',ru:'

Ошибка инициализации формы

'},badInput:{en:"Invalid input",ru:"Неверное значение"},patternMismatch:{en:"Pattern mismatch",ru:"Не соответствует шаблону"},rangeOverflow:{en:"Over maximum",ru:"Больше максимума"},rangeUnderflow:{en:"Under minimum",ru:"Меньше минимума"},stepMismatch:{en:"Step mismatch",ru:"Не кратно шагу"},tooLong:{en:"Too long",ru:"Слишком длинно"},typeMismatch:{en:"Invalid type",ru:"Неверный тип"},valueMissing:{en:"Required",ru:"Обязательное поле"}},events:{".hasDatepicker":"change.my check.my",".my-form,.my-tags":"change.my check.my",".ui-slider":"slide.my check.my","div.redactor_box textarea":"redactor.my check.my",".my-codemirror":"codemirror.my check.my",".ace_editor":"ace.my check.my",".my-form-list":"sortupdate.my check.my",".ui-sortable":"sortchange.my sortupdate.my check.my",".ui-draggable":"drag.my dragstop.my check.my","a, .pseudolink, input[type=button], button":"click.my","img, :radio, :checkbox":"click.my check.my","div.select2-container+input,div.select2-container+select":"change.my check.my input.my",".ui-buttonset,input, select, textarea":"blur.my change.my check.my"+("Micro"===navigator.appName.to(5)?" keyup.my":" input.my"),"":"check.my"},containers:{"*[data-role='fieldcontain'] *":{"input,textarea,select,button,:radio":function(a){return a.parents('[data-role="fieldcontain"]').eq(0)}},".tagstrip *.value":function(a){return a.parents(".tagstrip").eq(0)},"div.redactor_box textarea":function(a){return a.parents("div.redactor_box").eq(0).parent()},".my-tags,.hasDatepicker,.ui-widget,input,textarea,select,button":{".my-cleditor":function(a){return a.parents("div.cleditorMain").eq(0).parent()},"":function(b){var c=b[0].parentNode,d=c.nodeName;return/^(div|span|a|p|form|fieldset|li|ul|td|th|h\d)$/i.test(d)?a(c):b.parents("div,span,a,p,form,fieldset,li,ul,td,th,h1,h2,h3,h4,h5,h6").eq(0)}},"":function(a){return a}},offon:{".ace_editor":function(a,b){ace.edit(b[0]).setReadOnly(a)},".ui-selectable":function(a,b){z(b,"selectable",a)},".ui-slider":function(a,b){z(b,"slider",a)},".ui-draggable":function(a,b){z(b,"draggable",a)},".ui-buttonset":function(a,b){z(b,"buttonset",a)},".hasDatepicker":function(a,b){z(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){z(b,"select2",a)},".my-cleditor":function(a,b){b.cleditor()[0].disable(!!a)},"":function(a,b){b.attr("disabled",!!a)}},destroy:{".hasDatepicker":function(a){a.datepicker("destroy")},".ui-slider":function(a){a.slider("destroy")},".ui-sortable":{".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")}),b.removeClass("my-form-list"),b.sortable("destroy")},"":function(a){a.sortable("destroy")}},".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")})},".ui-draggable":function(a){a.draggable("destroy")},".my-redactor-8":function(a){a.destroyEditor(),a.removeClass("my-redactor-8")},"div.select2-container+input,div.select2-container+select":function(a){a.select2("destroy")},".my-form":function(a){a.my("remove")},textarea:{".my-codemirror":function(a){a[0].nextSibling.CodeMirror.toTextArea(),a.removeClass("my-codemirror")}}}};Cb.params={container:function(a){return N(a,Cb.containers)(a)},change:wb,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:Y,messages:Object.map(Cb.msg,function(a,b){return b[Y]||b.en}),errorTip:".my-error-tip",errorCss:"my-error",animate:0,effect:function(a,b,c){return b?a.fadeIn(c):(a.fadeOut(c),void 0)},remember:0,silent:!1,history:{},historyDelay:100,loader:function(a){var b=ub(),c=zb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Db={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:z,overlap:n,patch:m,kickoff:o,sdbmCode:l,tojson:function(){function a(a){return 10>a?"0"+a:a}function b(a,f,g){var h,i,j,k,l=0,m=f||0,n=d;switch(g&&ib(g)&&(l=String(g).length,n=String(g).repeat(10)),(typeof a).substr(0,3)){case"str":return e(a).replace(/<\/scri/gi,"<\\u002fscri");case"num":return isFinite(a)?""+String(a):"null";case"boo":case"nul":return String(a);case"fun":return e(c(a.toString()).replace(/<\/scri/gi,"<\\u002fscri"));case"obj":if(!a)return"null";if(typeof a.toJSON===db)return b(a.toJSON(),m+(g?1:0),g);if(h=[],gb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),mb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=ib(b)?b:a.my.tojson(b),g=ib(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Db.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:L,css2json:function(a){var b="",c=(a+"").replace(/\/\*[\s\S]+\*\//gm,"").replace(/@charset[^;]+;/gim,"").replace(/[\n\t\s]+/g," ").replace(/\s*@media[^{]*\{/g,function(a){return a.to(-1).trim()+"ᴥ"}).replace(/\}/g,"}ᴥ").replace(/^\n+/g,"").replace(/[\n\s]+$/g,"").split("ᴥ").compact(!0).reduce(function(a,c){var d,e,f,g=c.trim();return"}"==g?b="":/^[^{]+\{[^\}]+\}$/.test(g)?(d=g.to(-1).split("{"),e=" "+d[0].trim(),f=d[1].trim(),";"!=f.last()&&(f+=";"),b?a[b][e]=(a[b][e]||"")+f:a[e]=(a[e]||"")+f):/^@media/.test(g)&&(a[g]={},b=g),a},{});return c}},Eb={container:function(a){return N(a,Cb.containers)(a)},data:function(a,b){var c=this;return jb(a)&&(c.my().data=n(c.my().data,a),this.my("redraw",b)),c.my().data},disabled:function(a){var b,c,d,e,f=this,g=f.my();if(!g)return void 0;if(a==wb)return g.disabled;if(a){for(c in g.ui)b=p(f,c),d=b.my(),d&&(d.predisabled=d.disabled),y(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=p(f,c),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),y(e,b,":disabled");f.removeClass("my-disabled"),f.my("redraw")}},errors:function(){var b=a(this).my().errors,c={};for(var d in b)b[d]&&ib(b[d])&&(c[d]=b[d]),jb(b[d])&&sb(b[d]).length&&(c[d]=b[d]);return c},find:function(a){var b=this,c=b.my();return c&&c.root&&(b=c.root),b.find(a)},history:function(a,b){return B(a,this.my().params,b)},id:function(a,b){if(ib(a))return zb(a,b);var c=this.my();return c&&c.id?c.id:wb},index:function(){var a=this.my().root&&!this.my().ddata?this.my().root:this;return(a.data("formlist")||{}).index},indom:function(){return e(this)},init:K,insert:function(a,b){var c,d,e=this.hasClass("my-form-list")?this:this.my().root||this,f=e.hasClass("my-form-list")?e:e.parent(".my-form-list"),g=(e.data("formlist")||{}).index,i=b,j=f.data("formlist").generator;if(null==g&&(g=0),c=fb.test(j.bind)?h(f.my().manifest,j.bind.replace(fb,"")):h(f.my().data,j.bind),!jb(i))if(jb(j.manifest))i=rb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=rb(e.my().manifest.data,!0)}if("before"===a)d=g;else if("after"===a)d=g+1;else{if(isNaN(a))throw"Invalid position for insertion";d=(1*a).clamp(0,c.length)}c.add(i,d),f.trigger("redraw")},manifest:function(a){return"json"==a?Db.tojson(this.my().manifest):this.my().manifest},promise:function(a){return mb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",ib(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my(),e=2;return d&&jb(d.ui)&&(e=d.params.recalcDepth,Object.keys(d.ui).forEach(function(b){var d=p(c,b);O(d,a?wb:void 0,e),a||(d.hasClass("my-form")&&d.my("redraw"),d.trigger(d.hasClass("my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(eb)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return wb;if(this.my().root&&!this.my().ddata&&(j=this.my().root),d=j.my(),f=d.data,h=d.cid,i=d.mid,j.unbind(".my"),jb(d)&&d.manifest&&mb(d.manifest.die))try{d.manifest.die.call(d.manifest,j,d.manifest)}catch(k){}if(b=d.style)if("1"==b.data("count"))try{b.remove()}catch(k){}else b.data("count",b.data("count")-1);if(c=d.localStyle)try{delete pb[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?wb:(d.params.errors&&d.params.errors.values().compact(!0).length?Object.equal(d.data,d.lastCorrect)||(g+=1):Object.equal(e[f.last()],d.data)&&(g+=1),b=B(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return A(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&ib(b[d])?c++:jb(b[d])&&sb(b[d]).length&&c++;return!c},version:function(){return V}},Fb=Object.keys(Eb);a.my||(a.my={}),tb(a.my,{f:a.extend({},Db),tojson:Db.tojson,fromjson:Db.fromjson,radio:function(b,c){w(a(document),ib(b)?{channel:b,message:c}:b)},rules:Cb,locale:function(a){return ib(a)?(Y=a.toLowerCase(),Cb.params.locale=Y,void 0):Y},ajax:function(a){return mb(a)?yb=a:yb.apply(this,f(arguments,0))},cache:function(a,b){return mb(a)?zb=a:zb(a,b)},now:function(a){return mb(a)?(Ab=a,void 0):Ab()},require:function(a){return mb(a)?Bb=a:Bb.apply(this,f(arguments,0))},chain:function(){function a(){if(d.length&&e){var b,c=d.shift(),f=function(){a.delay(c[1])}.once();try{b=c[0]()}catch(g){f()}nb(b)?(b.then(f,f),f.delay(c[1])):f()}}var b=1,c=1e3,d=[],e=!1,f=function(e,f,g){d.push([e,f||b,g||c]),a()};return f.delay=function(a){return isNaN(a)||(b=(a-0).clamp(0,1e6)),b},f.timeout=function(a){return isNaN(a)||(c=(a-0).clamp(1,1e6)),c},f.start=function(){e=!0,a()},f.stop=function(){e=!1},f}(),version:function(){return V}}),a.my.version.toString=function(){return V},a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(ib(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Eb.init.apply(this,[c].add(f(arguments,1)))}return ib(b)&&Eb[b]?Eb[b].apply(this,f(arguments,1)):ib(b)&&zb(b,"exist")?Eb.init.apply(this,arguments):typeof b!==_&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Eb.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),w(a(document),c)}).on("resize.my",function(){for(var a in pb)try{pb[a]()}catch(b){}}.debounce(67))}(jQuery),function(a){function b(a,b,c){if(i(b))return a+b;if(j(b))return c=e(!0,c,b),a;if(h(b)&&b.length>1&&i(b[1])){for(var d,k,m,n,o,p,q,r,s=b[0],t="",u=1;u'+(s?"<"+c.labelTag+' class="'+c.labelCss+'" '+(c.label?'style="display:inline-block;width:'+c.label+";margin-left:-"+c.label+'" ':"")+">"+s+"":"")+t+""),a+t}return a}function c(a){var b=a;if(i(b)&&(b=b.split(/[\s,]/).compact(!0)),h(b)){for(var c={},d=0;d',inp:k+'text" {ext}/>',sli:k+'range" {ext}/>',dat:k+'date" {ext}/>',btn:k+'button" {ext}/>',pwd:k+'password" {ext}/>',but:"",div:"
{txt}
",spn:"{txt}",sel:"",mul:'',txt:"",err:' {txt}',msg:'
{txt}
',val:function(a){if(!h(a.vals))return"";var b=e({style:"",css:""},a);return b.txt=a.vals.reduce(function(a,b){return a+""+b+" "}," "),'{txt}'.assign(b)},"":"<{_tag} {ext}>{txt}"},txt:{sel:function(a){if(!a.vals)return"";var b=c(a.vals);return Object.keys(b).reduce(function(a,c){return a+'"},"")}},params:{styles:{num:"width:30%;",dat:"width:30%;",inp:"width:100%",pwd:"width:100%",but:"width:30%",txt:"width:100%;max-width:100%;min-height:1px;word-break:break-word;",err:"display:none",msg:"display:none"},alias:{number:"num",date:"dat",slider:"sli",textarea:"txt",input:"inp",span:"spn",select:"select",vals:"val"},row:"",rowTag:"div",rowCss:"my-row",label:"",labelTag:"span",labelCss:"my-label"},defaults:{id:"","class":"",style:"",placeholder:"",value:"",rows:1},attnames:{css:"class",plc:"placeholder",val:"value",txt:"",vals:"",tip:"title"}},m={init:function(b,c){return a(this).html(d(b,c))}};a.my||(a.my={}),a.my.formgen=d,a.fn.formgen=function(b){return i(b)&&m[b]?m[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?(a.error("Method "+b+" does not exist on jQuery.formgen"),void 0):m.init.apply(this,arguments)}}(jQuery),function(a){function b(b,c,d,e){var f,g,i,j,k,n,o;if("object"==typeof c&&c.jquery)c.is("img")&&(n=c,k=c.attr("alt")||c.attr("title")||c.data("text")||"",g=n[0].naturalWidth||n[0].width,f=n[0].naturalHeight||n[0].height,1>f&&(f=1),1>g&&(g=1),j=a(window).width()-90,i=a(window).height()-90,f>i&&(g=g*(i/f)|0,f=i),g>j&&(g=j,f=f*(j/g)|0),o=300>g?300:g,h(b,{source:"image",manifest:{init:function(a){a.html(this.HTML),a.on("click.my","img:eq(0)",function(){a.trigger("cancel")})},HTML:'

',ui:{"img:eq(0)":"img",h4:{bind:"text",css:{hide:function(a,b){return!b}}}}},data:{img:n.attr("src"),text:k},esc:!0,screen:!0,width:e||o,focus:!1,global:!0,z:"1995"},d));else if(m(c)&&c.manifest)h(b,c,d);else{if(!l(c))return null;h(b,{source:"html",manifest:{init:function(a){a.html(this.HTML)},HTML:c,ui:{"div:eq(0)":function(){}}},data:{},esc:!0,focus:!1,width:e},d)}return b}var c,d,e={},f="body",g=!1,h=a.extend,i={},j=a.my.f.indom,k=(Object.isArray,Object.isBoolean),l=Object.isString,m=Object.isObject,n=Object.isNumber,o=(Object.isRegExp,Object.isFunction);if(a.fn.modal&&o(a().emulateTransitionEnd)&&(d=a.fn.modal),a(document).off(".modal"),a(document).on("keydown.modal",function(a){var b,c,d=a.keyCode;if(!1!==g&&(13===d||27===d)){if(c=g.data("modal"),b=c.form,27==d&&(c.esc||Object.equal(b.data("my").initial,b.my("data"))))return g.modal(!0),!1;if(13==d&&c.enter)return function(a){a.modal()}.fill(g).delay(50),!1}}),o(a.my.f.getref(a,"my.modal.parent"))){var p=a.my.f.getref(a,"my.modal.parent")().attr("id");p&&(f="#"+p)}e.modal=function(c,d,e){var h,i={},j=a(f),l=j.find(">.my-modal-proxy"),m={global:!0,screen:!0,done:o(d)?d:void 0,z:"1995"};return k(c)||null==c?l.modal(c):(h=a.Deferred(),b(i,c,m,e)?g?h.reject("Locked").promise():(l.length||(l=a('
').prependTo(j),l.css({position:"absolute",top:"0",left:"0",margin:"0",padding:"0",width:"1px",height:"0"})),l.modal(i)):h.reject("Invalid data").promise())},e.modal.loading=function(b){a(f).find(">.my-modal").toggleClass("my-modal-loading",!!b)},e.modal.parent=function(b){return b&&a(b).length?(f=b,void 0):a(f)},e.modal.parentBack=function(b){return b&&a(b).length?(c=b,void 0):a(c||f)},e.modal.visible=function(){return!!g},a.my||(a.my={}),a.my.modal=e.modal,a.fn.modal=function(e,p,q){function r(a){if(x=K.form,z=K.bg,y=K.root,I=K.done,B=x.my("data"),C=!1,a){try{I.call(x.my("manifest"),null,null)}catch(b){}try{j(x)?u():""}catch(b){}if(j(F)&&F.removeData("modal"),i[K.cid])try{i[K.cid].reject("Cancelled")}catch(b){}delete i[K.cid],K=null}else{try{C=I.call(x.my("manifest"),x.my("valid")?null:x.my("errors"),B)}catch(b){}if(!C){try{j(x)?u():""}catch(b){}j(F)&&F.removeData("modal"),function(){if(i[K.cid])try{i[K.cid].resolve(B)}catch(a){}delete i[K.cid],K=null}.delay(0)}}}function s(){var b,c,d=window,e=!!K.global,f=y.offset(),g=F.offset(),h=y.scrollTop();K.pos={px:f.left,py:f.top,pw:y.outerWidth(),ph:y.outerHeight(),ox:g.left,oy:g.top,ow:F.outerWidth(),oh:F.outerHeight(),ww:c,wh:b};var i=1*(K.x.match(/\-?\d+(\.\d+)?/)||[0])[0],j=1*(K.y.match(/\-?\d+(\.\d+)?/)||[0])[0],k=K.x.has("left")?-1:K.x.has("right")?1:0,l=K.y.has("top")?-1:K.y.has("bottom")?1:0,m=K.pos.ox+K.pos.ow/2-K.pos.px,o=K.pos.oy+K.pos.oh/2-K.pos.py;if(e&&(K.pos.wh=b=d.innerHeight||a(d).height(),K.pos.ww=c=d.innerWidth||a(d).width(),m=c/2,o=b/2.5),i=K.x.has("%")?K.pos.ow/100*i:i,j=K.y.has("%")?K.pos.oh/100*j:j,K.pos.pix=m,K.pos.piy=o,m=m+k*(K.pos.ow/2)+i*(k>0?-1:1)-(K.width+G)*(k+1)/2,e?(o=(b-K.height-20)/3,10>o&&(o=10)):o=o+l*(K.pos.oh/2)+j*(l>0?-1:1)-(K.height||0)*(l+1)/2,m=m.round(1),o=(o+h).round(1),K.pos.vx=m,K.pos.vy=o,K.bound!==!1&&!K.global){var p=(n(K.bound)?K.bound:0).clamp(-100,100);K.pos.pw-2*pK.pos.pw-p?K.pos.vx=K.pos.pw-p-K.width-G:K.pos.vxK.pos.ph-p?K.pos.vy=K.pos.ph-p-K.height:K.pos.vy');var c="",d=a("style#my-modal-style-"+K.cid);"top"==K.nose||"bottom"==K.nose?(c+="div.my-modal-"+K.cid+".nose-"+K.nose+":before {left:"+(K.pos.ox-K.pos.px+K.pos.ow/2-K.pos.vx)+"px!important;}",d.text(c)):("left"==K.nose||"right"==K.nose)&&(c+="div.my-modal-"+K.cid+".nose-"+K.nose+":before {top:"+(K.pos.oy-K.pos.py+K.pos.oh/2-K.pos.vy)+"px!important;}",d.text(c))}K.screen?K.global?(z.css({top:0,left:0,width:"100%",height:"100%",display:"block",position:"fixed","z-index":K.z-1}),z.css(l(K.screen)?{background:K.screen?K.screen:"rgba(18,41,72,0.88)"}:{background:K.screen?"rgba(18,41,72,0.88)":""})):z.css({top:0,left:0,position:"absolute",width:z.parent().outerWidth()+"px",height:z.parent().outerHeight()+"px",display:"block",background:l(K.screen)?K.screen:"rgba(255,255,255,0.6)","z-index":K.z-1}):z.length&&z.hide(),K.height>K.pos.wh?(w.height(K.pos.wh-30),x.css({"overflow-y":"scroll"})):x.css({"overflow-y":""}),w.animate({top:K.pos.vy+"px",opacity:"1"},K.animate)}function u(){try{x.my("remove")}catch(b){}try{y.data("modals")[K.cid]=null}catch(b){}x.parent().off(".my").remove(),j(z)&&z.off(".my"+K.cid),K.screen&&j(z)&&function(a){a&&g||z.hide(),a&&!g&&z.css({background:"rgba(18,41,72,0.88)"})}.delay(50,K.global),K.global&&(g=!1,a(document.body).css({overflow:""}))}function v(a){try{I(null,null)}catch(b){}(function(){D.reject(a)}).delay(0)}if(d){if(void 0===e&&void 0===p&&void 0===q)return d.call(this);if(m(e)&&(e.hasOwnProperty("backdrop")||e.hasOwnProperty("keyborad")||e.hasOwnProperty("show")))return d.call(this,e,p);if(l(e)&&/^(toggle|show|hide|handleUpdate)$/.test(e))return d.call(this,e,p)}var w,x,y,z,A,B,C,D=a.Deferred(),E={},F=this,G=0,H=0,I=o(p)?p:function(){return!1},J=m(e)?e:{},K=F.data("modal");if(h(F,D.promise()),K){if(null==e||k(e))return r(e),F;if(J)return v("Locked"),F}return F.is(":visible")?(J=b(E,e,{}))?J.global&&g?(v("Locked"),F):(K=h({type:"DOM",source:"manifest",form:null,modal:null,root:null,bgroot:null,caller:F,manifest:{},data:{},global:!1,screen:!1,drag:!1,focus:!0,close:!0,silent:!0,esc:!1,enter:!1,bound:!1,hardClose:!0,nose:"",width:q||300,height:null,x:"0",y:"0",z:"1901",background:"white",css:"",animate:200},J,{promise:D.promise(),cid:Number.random(268435456,4294967295).toString(16)}),K.done=o(K.done)?K.done:I,l(K.align)&&K.align&&(K.x=(K.align.match(/(left|right):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0],K.y=(K.align.match(/(top|bottom):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0]),K.width=1*(a.my.f.getref(l(K.manifest)?a.my.cache(K.manifest):K.manifest,"params.width")||K.width),K.type="DOM",F.hasClass("my-form")?(K.type="form",K.root=K.root||F):F.data("my")?(K.type="control",K.root=K.root||F.my().root):(K.root=K.root||F.parents(".my-form").eq(0),K.root.length||(K.root=a(f))),K.global?(K.root=a(f),K.bgroot=a(c||f)):K.bgroot=K.bgroot?a(K.bgroot):K.root,y=K.root,y.data("modals")||y.data("modals",{}),s(),w=a('
'),K.root.find(">.my-modal").length?w.insertAfter(K.root.find(">.my-modal").last()):w.prependTo(K.root),w.addClass("my-modal-"+K.cid),G=w.outerWidth(),H=w.outerHeight(),w.hide(),w.html('
'),x=w.find(".my-modal-form"),K.close&&(A=a(l(K.close)?K.close:'
×
').prependTo(w).on("click.my",function(){r(K.hardClose)}),A.css({"z-index":("+"===(K.z+"").to(1)?"+":"")+(1*K.z+1)})),z=K.bgroot.find(">.my-modal-screen"),K.screen&&(z.length||(z=a('').prependTo(K.bgroot)),K.esc&&z.on("click.my"+K.cid,function(){F.modal(!0)}),z.toggleClass("my-modal-screen-global",!!K.global)),F.data("modal",K),K.silent&&w.on("change.my",function(){return!1}),w.css({display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto"}),w.css(K.global?{position:"fixed",left:"50%",top:K.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto","margin-left":"-"+((K.width+G)/2).round(0)+"px"}:{position:"absolute",left:K.pos.vx+"px",top:K.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto"}),x.my(K.manifest,K.data).then(function(){var b,c,d,e,f;if(h(K,{form:x,bg:z,cancel:function(){r(!0)},commit:function(){r()}}),w.data("modal",K),K.height=w.outerHeight(),"manifest"!==K.source&&(K.width=w.width()),s(),w.css({top:K.pos.vy+"px"}),t(!0),w.removeClass("my-modal-init"),y.data("modals")[K.cid]=K,i[K.cid]=D,x.on("commit.my",function(){return K.commit.delay(30),!1}).on("cancel.my",function(){return K.cancel.delay(30),!1}),w.on("layout.my",function(){t()}.debounce(30)),K.global&&(g=F,a(document.body).css({overflow:"hidden"})),K.global||!K.esc&&!K.enter||x.on("keydown.my",function(b){var c=b.keyCode;return 27==c&&K.esc?(K.cancel(),!1):13==c&&K.enter&&!a(b.target).is("textarea")?(K.commit.delay(50),!1):void 0}),K.focus===!0){e=!1,f=K.manifest.ui;for(d in f)e||(c=x.find(d),c.length&&c.is("input, textarea","button")&&(e=!0,c.focus()))}else l(K.focus)&&x.find(K.focus).focus();if(b=x.find("img").filter(function(){return""!=a(this).attr("src")}),b.length){var j=function(){"manifest"!==K.source&&w.css({width:"auto"}),t()}.after(b.length);b.each(function(){a(this).bind("load",j)})}K.drag&&a.fn.draggable&&(l(K.drag)?w.draggable({handle:K.drag}):w.draggable(),K.nose&&w.on("dragstart.my",function(){w.removeClass("nose-"+K.nose)})),w.on("mousedown.my",function(b){var c,d=[],e=a(b.currentTarget),f=e.parent(),g=+e.css("z-index"),h=g;f.length&&(c=f.find(">.my-modal").each(function(c,e){var f=+a(e).css("z-index");e!=b.currentTarget&&f>=g&&d.push([f,a(e)]),f>h&&(h=f)}),d.forEach(function(a){a[1].css("z-index",a[0]-1+"")}),e.css("z-index",h+""))}),D.notify("Ready")}).fail(function(a){try{u()}catch(b){}F.data("modal",null),D.reject(a)}),F):(v("Invalid data"),F):(v("Object must be visible"),F)}}(jQuery); \ No newline at end of file diff --git a/bower.json b/bower.json index a26d2fd..b2500bf 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jquerymy", - "version": "1.2.10", + "version": "1.2.11", "description": "A lightweight jQuery plugin for complex two-way data binding in real time.", "main": "./jquerymy.js", "authors": [ diff --git a/jquerymy.js b/jquerymy.js index 1018c9b..1a0e4a3 100644 --- a/jquerymy.js +++ b/jquerymy.js @@ -1,18 +1,20 @@ /* - * jQuery.my 1.2.10 + * jQuery.my 1.2.11 * Requires jQuery 2.0+, SugarJS 1.3.9-1.4.x * - * — fixes #38, #39 + * — fixed inability of $.my.modal to close popup + * when source pivot DOM node was removed + * — other minor fixes in $.my.modal * * More details at jquerymy.com * * (c) @ermouth, thanks @carpogoryanin, @ftescht - * 2017-04-09 + * 2017-10-10 */ ;(function ($) { - var _version = "1.2.10"; + var _version = "1.2.11"; // Some shortcuts and constants var TMP, lang = "en", @@ -3426,7 +3428,7 @@ //############################################################################################# -/* jQuery.formgen 0.5.0 +/* jQuery.formgen 0.6.0 * Generates forms markup for $.my from lean-syntax DSL. * Returns html string. * @@ -3459,11 +3461,23 @@ (function ($){ //Some shortcuts and constants - var $E = $.extend, n = function (o) {return o!==null && o!==undefined;}, N = null, - Ob="object", Da="data", Ar = "array", St = "string", Fu="function", Ch = "change", - isA = Object.isArray, isB = Object.isBoolean, isS = Object.isString, isO = Object.isObject, - isN = Object.isNumber, isR = Object.isRegExp, isF = Object.isFunction; - var iHead = '1 && isS(b[1])) { - var lbl = b[0],html="",key,type,a0,b0,i=1,j,p,tmpl,ext; + var lbl = b[0], + html="", + key, + type, + a0,b0, + i=1,j,p, + tmpl, + ext; - //iterate through row's inside items + //iterate through row inner items while (i' +(lbl?( '<'+sys.labelTag+' class="'+sys.labelCss+'" ' @@ -3652,8 +3689,8 @@ //############################################################################################# -/* jQuery.my.modal 1.2.0 - * Requires Sugar 1.4.~, jQuery 2.0+, $.my 1.2.8+ +/* jQuery.my.modal 1.2.4 + * Requires Sugar 1.4.~, jQuery 2.0+, $.my 1.2.10+ * * Modal dialog constructor/manager. * @@ -3888,7 +3925,6 @@ $.fn.modal = function (obj0, done0, width0) { // Detect Bootstrap - if (BTmodal) { if (obj0 === void 0 && done0 === void 0 && width0 === void 0) return BTmodal.call(this); else if (isO(obj0) && ( @@ -3913,46 +3949,8 @@ if (m) { if (obj0==null || isB(obj0)) { - - // ##### CLOSE MODAL ########## - - $f = m.form; - $bg = m.bg; $r = m.root; done = m.done; - md = $f.my("data"); - stop = false; - - if (!obj0) { - // check if we can close - try{ - stop = done.call ($f.my("manifest"), $f.my("valid")?null:$f.my("errors"), md); - }catch(e){} - if (!stop) { - try {_indom($f)?_remove():"";} catch(e){} - $o.removeData("modal"); - // async resolve - (function () { - if (M[m.cid]) M[m.cid].resolve(md); - delete M[m.cid]; - m=null; - }).delay(0); - } - } else { - // force close - try {done.call($f.my("manifest"),null, null);} catch(e){} - try {_indom($f)?_remove():"";} catch(e){} - $o.removeData("modal"); - if (M[m.cid]) { - try { - M[m.cid].reject("Cancelled"); - } catch (e) {} - } - delete M[m.cid]; - m=null; - } - + _close(obj0); return $o; - - } else if (obj) { // reinit is not allowed _f("Locked"); @@ -4083,7 +4081,7 @@ // close btn if (m.close) { $cl = $(isS(m.close)? m.close:'
×
') - .prependTo($m).on("click.my",function () {$o.modal(m.hardClose);}); + .prependTo($m).on("click.my",function () {_close(m.hardClose);}); $cl.css({"z-index":((m.z+"").to(1)==="+"?"+":"")+(m.z*1+1)}); } @@ -4093,8 +4091,8 @@ if (!$bg.length) { $bg = $('').prependTo(m.bgroot); } - if (m.esc) $bg.on("click.my"+ m.cid, function () { $o.modal(true); }); + $bg.toggleClass('my-modal-screen-global', !!m.global); } // mount data @@ -4143,8 +4141,8 @@ $E(m,{ form: $f, bg:$bg, - cancel: function(){$o.modal(true);}, - commit: function(){$o.modal();} + cancel: function(){_close(true);}, + commit: function(){_close();} }); $m.data("modal",m); @@ -4165,16 +4163,16 @@ // bind event listeners $f.on("commit.my", function(){ - m.commit.delay(50); + m.commit.delay(30); return false; }).on("cancel.my", function(){ - m.cancel.delay(50); + m.cancel.delay(30); return false; }); $m.on("layout.my", function(){ _adjust(); - }.debounce(50)); + }.debounce(30)); // fullscreen tuneups if (m.global) { @@ -4263,6 +4261,47 @@ //### Helpers + + function _close(obj0) { + // closes modal + $f = m.form; + $bg = m.bg; + $r = m.root; + done = m.done; + md = $f.my('data'); + stop = false; + + if (!obj0) { + // check if we can close + try{ + stop = done.call ($f.my('manifest'), $f.my('valid')?null:$f.my('errors'), md); + }catch(e){} + if (!stop) { + try {_indom($f)?_remove():'';} catch(e){} + if (_indom($o)) $o.removeData('modal'); + // async resolve + (function () { + if (M[m.cid]) { + try { M[m.cid].resolve(md); } catch (e) {} + } + delete M[m.cid]; + m = null; + }).delay(0); + } + } else { + // force close + try {done.call($f.my('manifest'),null, null);} catch(e){} + try {_indom($f)?_remove():'';} catch(e){} + if (_indom($o)) $o.removeData('modal'); + if (M[m.cid]) { + try { M[m.cid].reject('Cancelled'); } catch (e) {} + } + delete M[m.cid]; + m = null; + } + } + + // - - - - - - - - - - - - - - - - - - function _measure(){ // measure $o, its pos @@ -4283,15 +4322,14 @@ ww:w, wh:h }; - //if (m.width> m.pos.pw) m.width= m.pos.pw; // calculate offsets var dx = (m.x.match(/\-?\d+(\.\d+)?/)||[0])[0]* 1, dy = (m.y.match(/\-?\d+(\.\d+)?/)||[0])[0]* 1, - sx = m.x.has("left")?-1: m.x.has("right")?1: 0, - sy = m.y.has("top")?-1: m.y.has("bottom")?1: 0, - vx = m.pos.ox + m.pos.ow/2 - m.pos.px, - vy = m.pos.oy + m.pos.oh/2 - m.pos.py; + sx = m.x.has('left') ? -1 : m.x.has('right') ? 1 : 0, + sy = m.y.has('top') ? -1 : m.y.has('bottom') ? 1 : 0, + vx = m.pos.ox + m.pos.ow/2 - m.pos.px, + vy = m.pos.oy + m.pos.oh/2 - m.pos.py; if (isfs) { m.pos.wh = h = W.innerHeight || $(W).height(); @@ -4304,18 +4342,13 @@ m.pos.pix = vx; m.pos.piy = vy; - - vx = vx + sx*(m.pos.ow/2) - + dx*(sx>0?-1:1) - - (m.width+padx)*(sx+1)/2; + vx = vx + sx*(m.pos.ow/2) + dx*(sx>0?-1:1) - (m.width+padx)*(sx+1)/2; if (isfs) { vy = (h - m.height-20)/3; if (vy<10) vy=10; } else { - vy = vy + sy*(m.pos.oh/2) - + dy*(sy>0?-1:1) - - ((m.height||0)/*+pady*/)*(sy+1)/2; + vy = vy + sy*(m.pos.oh/2) + dy*(sy>0?-1:1) - ((m.height||0)/*+pady*/)*(sy+1)/2; } vx = vx.round(1); vy = (vy+rs).round(1); @@ -4415,7 +4448,10 @@ "z-index":m.z-1 }); if (isS(m.screen)) $bg.css({ - background:m.screen? m.screen:'rgba(25, 39, 59, 0.88)' + background:m.screen? m.screen:'rgba(18,41,72,0.88)' + }); + else $bg.css({ + background:m.screen?'rgba(18,41,72,0.88)':'' }); } } @@ -4440,13 +4476,13 @@ $r.data('modals')[m.cid] = null; } catch(e){} $f.parent().off('.my').remove(); - $bg.off('.my'+ m.cid); - if (m.screen) { + if (_indom($bg)) $bg.off('.my'+ m.cid); + if (m.screen && _indom($bg)) { (function(g){ if (!g || !isOpen) $bg.hide(); if (!!g && !isOpen) { // repair screen color - $bg.css({background:'rgba(25, 39, 59, 0.88)'}); + $bg.css({background:'rgba(18,41,72,0.88)'}); } }).delay(50, m.global); // curry m.global } @@ -4463,6 +4499,6 @@ (function () { pi.reject(msg); }).delay(0); } - }; + }; // -- end $.fn.modal })(jQuery); \ No newline at end of file diff --git a/jquerymy.min.js b/jquerymy.min.js index 2fb7371..edbc6f4 100644 --- a/jquerymy.min.js +++ b/jquerymy.min.js @@ -1,5 +1,5 @@ -/* jQuery.my 1.2.10, © ermouth +/* jQuery.my 1.2.11, (c) 2017 ermouth * Requires jQuery 2.0+, SugarJS 1.3.9-1.4.x * More details at jquerymy.com */ -!function(a){function b(){window.console&&console.error.apply(console,arguments)}function c(){window.console&&console.log.apply(console,arguments)}function d(a,b){return a.hasOwnProperty(b)}function e(b){return a.contains(document.documentElement,b[0])}function f(a,b){return Array.prototype.slice.call(a,b||0)}function g(a,b,c){var d=0,e=a.length,f=!0;if(a===b)return"===";if("==="==c)return"";if(e!=b.length)return"";for(;e>d&&f;d++)f=a[d]===b[d];if(f)return"==";if("=="==c)return"";for(f=!0;e>d&&f;d++)f=Object.equal(a[d],b[d]);return f?"=":""}function h(a,b){return(ib(b)?b.split("."):gb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return jb(a)?Object.values(a).find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):gb(a)?a.find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):void 0}if(null!=a&&null!=a[b])return a[b]}return void 0},a)}function i(a){var b=a.my();return b?b.root?b.root.my():b:null}function j(a){var b,c={},d=function(){return null};if(ib(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(gb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(jb(a))for(b in a)c[b]=mb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(ib(c)&&(c=c.split(/[,\s]+/)),gb(c)){for(c=c.compact(!0),b=0;b$/.test(y.list)?f=y.list:i=y.list||i,!f){var l=">*"==i?a(d[0].children):p(d,i,!0);f="
",l.length&&(f=a(f).append(l.eq(0).clone(!0)).html(),l.eq(0).remove())}d.data("formlist")||d.data("formlist",{}),d.data("formlist").generator={manifest:t,delay:(y.delay||w.delay||10)/1.3,template:f,selector:i,parent:B,bind:y.bind,merge:mb(y.merge)?y.merge.bind(B):y.merge?n:!1,hash:mb(y.hash)?y.hash.bind(B):ib(y.hash)?k.fill(void 0,y.hash):gb(y.hash)?m.fill(void 0,y.hash.slice(0)):null,id:mb(y.id)?y.id.bind(B):ib(y.id)?k.fill(void 0,y.id):gb(y.id)?m.fill(void 0,y.id.slice(0)):null,ext:!(!y.id&&!y.hash),stamp:0},d.on("insert.my",function(b,c){b.stopPropagation();var d={what:void 0,where:0};null==c?d.where=1e6:jb(c)?qb(d,c):(ib(c)||kb(c))&&(d.where=c),a(b.target).my("insert",d.where,d.what)}),d.on("remove.my",function(b){b.stopPropagation(),a(b.target).my("remove")})}else try{b=K.call(d,r(B,t),jb(e)?e:void 0)}catch(q){j("$.my subform init of "+g+" failed: "+q.message,q.stack)}}nb(b)?b.then(o,function(a,b){j("Init of subform "+g+" failed with error: "+a,b)}):o()}function j(a,c){b(a,c),z&&z.reject(a,c)}function k(a,b){var c=h(a,b)||"";return"string"==typeof c?c:l(c)}function m(a,b){return l(D(a,b))}function o(){d.each(function(){var b,c,h,i=a(this),j=i[0].nodeName,k=!1;if("TEXTAREA"==j&&(h=i[0].nextSibling,c=h&&h.CodeMirror?h.CodeMirror:null,c&&i.addClass("my-codemirror")),b=y.events||N(i,Cb.events),i.hasClass("my-form")?tb(i.data("my"),{dui:y,root:e,selector:g,dparams:w,devents:b,ddata:v.data,container:w.container(i),derrors:v.errors,single:!0}):(i.data("my",{events:b,selector:g,initial:s,previous:s,root:e,container:w.container(i),id:v.id,ui:y,data:v.data,params:w,errors:v.errors,single:1==C}),f._update=y.delay?O.debounce(y.delay):wb,k=!0),k)if(i.cleditor&&i.parent().hasClass("cleditorMain")){var l=i.cleditor()[0];if(l&&l.$frame&&l.$frame[0]){i.addClass("my-cleditor"),tb(i.data("my"),{container:w.container(i)});var m,n=function(a){i.val(a).trigger(eb)},o=Number.random(1e5,1e6-1);a(l.$frame[0]).attr("id","cleditCool"+o),m=document.frames?document.frames["cleditCool"+o].document:a("#cleditCool"+o)[0].contentWindow.document;var p=a(m).find("body");a(m).on("keyup.my",function(){n(a(this).find("body").html())}),i.parent().find("div.cleditorToolbar").on("click.my mouseup.my",function(){n(p.html())}),a("body").on("click","div.cleditorPopup",function(){n(p.html())})}}else if("TEXTAREA"==j&&i.parent().hasClass("redactor_box")){var q,r="my-redactor-9";try{q=i.getEditor(),r="my-redactor-8"}catch(t){q=i.redactor("getEditor")}q&&(i.addClass(r),q.on("input.my keyup.my blur.my",function(a){a.trigger("redactor")}.fill(i)))}else i.hasClass("ace_editor")?ace.edit(d[0]).on(eb,function(a){a.trigger("ace")}.fill(i)):c&&c.on(eb,function(a){a.trigger("codemirror")}.fill(i));i.my()._changed=x.debounce(u),i.my()._recalc=I.debounce(u),i.on(b,function(a){a.type==eb&&a.stopPropagation(),k&&(v.locktill=Ab()+f.delay),i.my()._changed(i,e,f,w)}),/check(\.my)?/.test(b+"")||i.on("check.my",function(){return i.my()._changed(i,e,f,w,!0),!1}),k||i.off("redraw.my"),i.on("recalc.my, redraw.my",function(a){a.stopPropagation(),i.my()._recalc(i,e,f,w)})}),z&&z.resolve()}var q,s,t,u,v=e.my(),w=(v||{}).params,y=f,z=null,A=0,B=v.manifest,C=0|d.length;return v?(u=f.delay,C?(y.init!=wb&&(q=H(B,y.init,d,v)),nb(q)?(A+=1,z=ub(),q.then(i,function(a,b){j("Init of "+g+" failed: "+a,b)})):i()):c("Not found "+g+" selector.",e),z):(b("Failed to find $root building "+g+" selector."),null)}function w(c,d){jb(d)&&d.channel&&d.message&&p(c,".my-listen-"+l(d.channel),!0).each(function(){var c,e=a(this),f=e.data("my"),g=void 0;if(f&&f.ui.listen&&mb(f.ui.listen[d.channel])){c=f.ui.listen[d.channel];try{g=c.call(f.manifest||f.root.my().manifest,f.data,d.message,e)}catch(h){b("Listener failed",h.message,h.stack)}void 0!==g&&(null===g?e.trigger("check"):g&&e.trigger("recalc"))}})}function x(a,b,c,d,e){{var f,g=a.data("my");b.data("my")}g&&(g.disabled?g.ddata||O(a,wb,c.recalcDepth||d.recalcDepth):(B(g.ddata||g.data,g.dparams||g.params),e||(f=g.single?a:p(b,g.selector)),O(a,e?wb:A(f,wb),c.recalcDepth||d.recalcDepth),d.change&&d.change.call(a)))}function y(b,c,d){var e=d.compact(),f=e.replace(/:disabled/g,""),g=f!==e,h="self:"===f.to(5);return h&&(f=f.replace(/^self:/g,"")),c.each(function(){var d=a(this),e=d.my(),i=!h&&e?e.container:d;i.toggleClass(f,!!b),g&&void 0!==e&&!!b!=!!e.disabled&&(d.my().disabled=!!b,e._disable||(d.my()._disable=N(c,Cb.offon).fill(void 0,c)),e._disable(!!b))}),c}function z(a,b,c){return a[b](c?"disable":"enable")}function A(a,b){var c,d,e=a.data("myval");return e||(d=N(a,Cb.vals),mb(d)&&(c=d(a,wb),void 0===c?a.data("myval",function(a,b){return wb!=b&&d(a,b),a.val()}.fill(a,void 0)):a.data("myval",d.fill(a,void 0))),e=a.data("myval")),mb(e)?(c=e(),(c!==b&&(0==b||0==c)||c!=b||jb(b))&&(c=e(b)),c):wb}function B(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=b;if(!jb(n)||isNaN(h=n.remember)||!jb(e=n.history))return wb;if(jb(a)&&h){if(j=rb(a,!0),k=Ab(),g=sb(e).sort(),g.length&&(k-g.last()=2*h){for(m={},f=h;2*h>f;f++)m[g[f]]=e[g[f]];b.history=m}return d||n.form.trigger(eb),n.history[g.last()]}if(!isNaN(a)||a===wb){if(i=parseInt(a)||0,0>i)return wb;if(g=sb(e).sort(),i>=g.length&&(i=g.length-1),l=rb(n.history[g[g.length-i-1]],!0),c){for(m={},f=0;f=i;i++)if(i===h){if(d)return wb!=b?e[f[i]]=b:void 0===e[f[i]]&&(e[f[i]]=wb),e[f[i]];e[f[i]]=b}else 0===i?(e=a[f[0]],g=a):(g=g[f[i-1]],e=e[f[i]]),(null==e||!jb(e)&&(gb(e)&&!isNaN(f[i+1])&&+f[i]>-1))&&(e=g[f[i]]={});return a}function G(a,b,c){var e=jb(b)?b:null;return Object.each(a,function(b,c){var d=typeof c;/^str|^fu/.test(d)&&(a[b]={bind:c})}),Object.each(a,function(b,f){var g,i,k,l=[],m=[],n=/\s?[,;]\s?/;f.recalc&&(ib(f.recalc)?l=f.recalc.split(n):gb(f.recalc)&&(l=f.recalc),l=l.compact(!0).unique()),l.length&&(a[b].recalc=l),null==f.bind&&(f.bind=function(){});var o;if(f.listen&&(o=j(f.listen),f.listen=Object.size(o)?o:void 0),d(f,"events")&&(f.events=(f.events+"").replace(/,\s*|\s+/g," ")),d(f,"watch"))for(ib(f.watch)?m=f.watch.split(n):gb(f.watch)&&(m=f.watch.slice(0)),m=m.compact(!0).unique(),k=0;ki&&h.resolve()}var d,e,f,g=!1,h=ub(),i=a.length;for(e=0;i>e;e++)d=a[e],f=ib(d.ajax)?w.loader:yb,f(d.ajax).then(function(a,d){fb.test(d.ref)&&(null!=a?tb(!0,b,E(a,d.ref.from(5))):(g=!0,v.push("Invalid data for ‘"+d.ref+"’ resource."))),c()}.fill(void 0,d)).fail(function(a,b){v.push("Failed to load ‘"+b.ref+"’ resource."),g=!0,c()}.fill(void 0,d));return h.promise()}function i(a){var c=!1;return fb.test(a)?null!=h(b,a.from(5))&&(c=!0):null!=h(window,a)&&(c=!0),c}function j(a){for(var b in a)a[b]===!1&&(a[b]=i(b));return a}var k,l,m,n,o,p,q,r,s=ub(),t=[],u={},v=[],w=tb(!0,{ajaxTimeout:1e4,loader:Cb.params.loader},c||{}),x={ref:null,ajax:{type:"GET",async:!0,timeout:w.ajaxTimeout}};if(jb(b))if(gb(b.require)){for(n=b.require,k=0;k'+f+""}!_.style||b&&!sb.is(":visible")||(S=L(sb,_),S&&S[0].length&&!b&&(V=a("style#"+T),V.length||(V=a(c(S[0],T)).appendTo(a("body"))),V.data("count",1*V.data("count")+1),sb.data("my").style=V),S&&S[1].length&&(Z=a("style#"+U),Z.length?b&&(a(c(S[1],U)).replaceAll(Z),Z=a("style#"+U)):(Z=a(c(S[1],U)).appendTo(a("body")),Q.restyle>-1&&!pb[J]&&(pb[J]=function(){q(!0)}.debounce(Q.restyle)),sb.data("my").restyle=q.fill(!0).debounce(0)),sb.data("my").localStyle=Z,b||sb.addClass("my-restyle")))}function r(){var a,b,c=!0;if(b=t(_),ib(b))B("Error decoding base64 to local Blob/URL",b),c=!1;else{if(W)for(a=0;a*").clone();try{$=H(_,R.init,sb,R)}catch(b){return B(ib(b)?b:b.message,b.stack),sb}}if(nb($)?$.then(function(){x()},function(a,b){B(a,b)}):x(),!hb){if(!sb.my())return B("Internal error initializing controls.",""),sb;sb.data("my").initial=tb(!0,{},bb),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function x(){function a(a){hb||(b[a]=A(p(sb,a),wb),d-=1,.5>d&&y(b))}var b={},c=Object.keys(O),d=c.length;0===d?z():(sb.addClass(lb),c.forEach(function(b){if(!hb){var c=p(sb,b),d=v(c,sb,O[b],b);rb[b]=c,nb(d)?d.then(a.fill(b)).fail(function(a,c){B("Error building "+b+", "+a,c)}):hb||a(b)}}))}function y(a){var c,d,e,f,g;for(g in O){if(hb)return;if(c=O[g],e=rb[g],f=e.length){c.listen&&(eb[g]=e.eq(0));try{d=u(bb,wb,c,e),d==wb&&a[g]!=wb&&void 0!==d&&u(bb,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+J+"')",h.message,h.stack)}try{d!=wb&&A(e,d),e.eq(0).trigger("check.my")}catch(h){B("Error linking "+g,h.message,h.stack)}}}z()}function z(){sb.removeClass(lb),sb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),sb.my("redraw")}),qb=null,fb.resolve(bb)}function B(a,c){var d;if(hb=!0,b("Form "+I+" failed to initialize.",a,c),Object.keys(rb).forEach(function(a){delete rb[a]}),sb.removeClass(lb),d=kb(a,c),ib(d)||jb(d)&&d.jquery?sb.html(d):d===!0&&sb.html(qb),Q.silent)fb.resolve(bb);else{if(!sb.my().ddata){if(sb.removeData("my"),sb.removeClass("my-form"),V)if("1"==V.data("count"))try{V.remove()}catch(e){}else V.data("count",V.data("count")-1);if(Z)try{delete pb[J],Z.remove()}catch(e){}}fb.reject("Form "+I+" failed to initialize: "+a,c)}}var D,F,I,J,K,N,O,Q,R,S,T,U,V,Z,$,_={},bb={},cb=null,db=[],eb={},fb=ub(),hb=!1,kb=function(){},lb="my-form-init",ob="std",qb="",rb={};if(ib(d)){if(D=zb(d),!D)return fb.reject("No manifest with id "+d+" found in repo."),fb.promise();jb(f)&&jb(e)?(D=tb(D,e),F=f):F=e,ob="repo"}else D=d,F=e;if(!D)return this;R=jb(F)&&"repo"!=ob?tb(!0,{},D):D;var sb=this.eq(0),vb=sb.my();return jb(vb)&&vb.id&&vb.ui?(c("jQuery.my is already bound.",sb),sb.my("ui",R.ui),sb.my(ab,R.data),fb.resolve(sb.my(ab)).promise()):(Q=R.params||{},Q.strict||mb(R.init)||(Q=tb(!0,{},Q),P(Q)),Q=tb(!0,{},Cb.params,Q),fb.fail(function(){sb.removeClass(U+" "+T)}),tb(sb,fb.promise()),jb(F)?(bb=m(F,R.data||{}),R.data=bb):bb=R.data||{},_.data=bb,sb.data("my",{data:bb,params:Q,promise:fb.promise(),locktill:0}),sb.addClass(lb),R.inherit&&i(R),gb(R.require)?Bb(R,Q).then(g).fail(function(a){o(),B("Linker of the ‘require’ property failed.",a)}):g(),fb.then(n),sb)}function L(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=mb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),ib(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Db.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),gb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==_&&c(a,i,g+1)}wb!=b[""]&&typeof b[""]!=_&&g>e&&(d=b[""],e=g)}var d=wb,e=0,f="";return c(a,b,1),d}function O(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,q,r=!1,s=!1,t=a,v=t.my(),w="";if(v){if(m=v.selector,n=v.root,n.hasClass("my-form-init"))return{};if(o=p(n,m),q=n.my().ui,r=a.hasClass("my-form"),r?(f=a,g=v.ddata,h=v.dui,i=v.dparams):(f=v.container,g=v.data,h=v.ui,i=v.params),h.bind!=wb){if(j=xb(c)?c:A(o,u(g,wb,h,o)),wb!=h.check){w="Unknown error";try{w=U(g,j,h,o)}catch(x){b("Error "+x.message+" in .check validator for "+m,n,x.stack)}}var z=i.errorCss,B="ui-state-error";try{wb!=c&&(j=A(o,u(g,c,h,o)))}catch(x){w=i.messages.formError||"Error"}if(wb!=h.check)if(s=a.hasClass("my-form-list"),""==w&&(r||f.hasClass(z)))r?v.derrors[m]="":v.errors[m]="",f.removeClass(z),f.attr("title")&&f.attr("title",""),r||s||i.effect(p(f,i.errorTip),!1,i.animate/2),t.removeClass(B),p(t,".ui-widget").removeClass(B);else if(w){if(r)v.derrors[m]=w;else if(s)v.errors[m]=w;else{f.addClass(z),v.errors[m]=w;var C=p(f,i.errorTip);C.length?i.effect(C.addClass(z).html(ib(w)?w:"Error"),!0,i.animate):f.attr("title",(ib(w)?w:"Error").stripTags())}t.hasClass("hasDatepicker")&&(t.is("input")?t.addClass(B):p(t,".ui-widget").addClass(B)),t.hasClass("ui-slider")&&t.addClass(B)}}var D=c==wb?j:c;if(h.css)for(k in h.css)l=h.css[k],lb(l)?y(l.test(D),o,k):mb(l)&&y(l.call(n.my().manifest,g,D,o),o,k);var e,E,F=h.recalc,G=[],H={};if(d&&h.recalc&&n.my()){for(q=n.my().ui,e=0;e-1?"":o;case"s":return c==k?"":o;case"o":return k[c]?"":o;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},l=0,(">*"==h?a(e[0].children):p(e,h,!0)).each(function(){var b=a(this);b.hasClass("ui-sortable-placeholder")||(b.data("my")&&!b.my("valid")&&(j[l]=b.my("errors")),l+=1)}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return m.formError||"Error"}return""}var V="1.2.10",W=window.URL||window.webkitURL,X=!document.addEventListener,Y=((window.navigator.language||window.navigator.userLanguage||"en")+"").split("-")[0].toLowerCase(),Z="{yyyy}-{MM}-{dd}",$="{HH}:{mm}",_="object",ab="data",bb="array",cb="string",db="function",eb="change",fb=/^this\./,gb=Object.isArray,hb=Object.isBoolean,ib=Object.isString,jb=Object.isObject,kb=Object.isNumber,lb=Object.isRegExp,mb=Object.isFunction,nb=function(a){return null!=a&&typeof a==_&&mb(a.then)},ob=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},pb=h(a,"my.f.restyles")?a.my.f.restyles():{},qb=Object.merge,rb=Object.clone,sb=Object.keys,tb=a.extend,ub=a.Deferred,vb=a.type,wb=null,xb=function(a){return null!==a&&void 0!==a},yb=a.ajax,zb=q,Ab=Date.now,Bb=J,Cb={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my(ab);return Object.equal(c,b)?c:a.my(ab,b,!0)}return b||wb},".hasDatepicker":function(a,b){xb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(Z):""},".my-tags":function(a,b){return xb(b)&&(ib(b)||kb(b)?a.tags(ab,[b+""]):gb(b)&&a.tags(ab,b)),a.tags(ab)},".ui-draggable":function(a,b){if(xb(b)&&jb(b)){var c={};isNaN(b.left)||(c.left=Number(b.left).ceil(2)+"px"),isNaN(b.top)||(c.top=Number(b.top).ceil(2)+"px"),(c.left||c.top)&&a.css(c)}var d=a.position();return{left:b&&!isNaN(b.left)?(1*b.left).ceil(2):d.left.ceil(2),top:b&&!isNaN(b.top)?(1*b.top).ceil(2):d.top.ceil(2)}},".my-form-list":function(b,c){function e(){var c,d,e=a(this),f=e.data("my");f&&(c=e.data("formlist"),d=c.index,c.hash=w(f.data,d)+"",c.oid=x!==w?x(f.data,d)+"":c.hash),b.trigger("check.my")}function f(a){a.data("my").locktill+z/1.3.my-form",t=!!q.merge,u=q.template||"
",v=/\{/.test(u),w=q.hash||l,x=q.id||l,y=q.ext,z=q.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).length,E=[],F=[],G=Ab(),H=b.find(C?b.sortable("option","items"):s);if(xb(c)&&gb(c)){if(D)return c;if(i=[],j={},H.each(function(){var b,c=a(this),d=c.data("my");d&&(i.push(d.data),!t&&(b=c.data("formlist"))&&(j[b.oid]=d.data))}),m=g(i,c,"=="),!m){var I=[],J=[],L={},M={};for(F=[],h=0;h1.4*z||G-q.stamp>100||!q.stashed||q.stashed.length!==H.length-(D?1:0)){D&&(o=b.find(">."+A+"-helper"));var N=0;for(H.each(function(b,c){var d,e,f,g=a(c),h=!1;D&&g.hasClass(A+"-helper")||(D&&g.hasClass(A+"-placeholder")&&(g=o),d=g.data("my"),e=g.data("formlist"),d&&e&&(E.push(d.data),N!=e.index&&(e.index=N,h=!0),y&&(f=w(d.data,N)+"",f!==e.hash&&(e.hash=f,h=!0)),N+=1,h&&F.push(g)))}),h=0;h-1){var f=b.eq(d);f.is(":checked")||(f.prop("checked",!0),e&&f.checkboxradio("refresh"))}else e||b.each(function(){a(this).prop("checked",!1)})}if(-1==d)for(var g=0;gForm init failed

',ru:'

Ошибка инициализации формы

'},badInput:{en:"Invalid input",ru:"Неверное значение"},patternMismatch:{en:"Pattern mismatch",ru:"Не соответствует шаблону"},rangeOverflow:{en:"Over maximum",ru:"Больше максимума"},rangeUnderflow:{en:"Under minimum",ru:"Меньше минимума"},stepMismatch:{en:"Step mismatch",ru:"Не кратно шагу"},tooLong:{en:"Too long",ru:"Слишком длинно"},typeMismatch:{en:"Invalid type",ru:"Неверный тип"},valueMissing:{en:"Required",ru:"Обязательное поле"}},events:{".hasDatepicker":"change.my check.my",".my-form,.my-tags":"change.my check.my",".ui-slider":"slide.my check.my","div.redactor_box textarea":"redactor.my check.my",".my-codemirror":"codemirror.my check.my",".ace_editor":"ace.my check.my",".my-form-list":"sortupdate.my check.my",".ui-sortable":"sortchange.my sortupdate.my check.my",".ui-draggable":"drag.my dragstop.my check.my","a, .pseudolink, input[type=button], button":"click.my","img, :radio, :checkbox":"click.my check.my","div.select2-container+input,div.select2-container+select":"change.my check.my input.my",".ui-buttonset,input, select, textarea":"blur.my change.my check.my"+("Micro"===navigator.appName.to(5)?" keyup.my":" input.my"),"":"check.my"},containers:{"*[data-role='fieldcontain'] *":{"input,textarea,select,button,:radio":function(a){return a.parents('[data-role="fieldcontain"]').eq(0)}},".tagstrip *.value":function(a){return a.parents(".tagstrip").eq(0)},"div.redactor_box textarea":function(a){return a.parents("div.redactor_box").eq(0).parent()},".my-tags,.hasDatepicker,.ui-widget,input,textarea,select,button":{".my-cleditor":function(a){return a.parents("div.cleditorMain").eq(0).parent()},"":function(b){var c=b[0].parentNode,d=c.nodeName;return/^(div|span|a|p|form|fieldset|li|ul|td|th|h\d)$/i.test(d)?a(c):b.parents("div,span,a,p,form,fieldset,li,ul,td,th,h1,h2,h3,h4,h5,h6").eq(0)}},"":function(a){return a}},offon:{".ace_editor":function(a,b){ace.edit(b[0]).setReadOnly(a)},".ui-selectable":function(a,b){z(b,"selectable",a)},".ui-slider":function(a,b){z(b,"slider",a)},".ui-draggable":function(a,b){z(b,"draggable",a)},".ui-buttonset":function(a,b){z(b,"buttonset",a)},".hasDatepicker":function(a,b){z(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){z(b,"select2",a)},".my-cleditor":function(a,b){b.cleditor()[0].disable(!!a)},"":function(a,b){b.attr("disabled",!!a)}},destroy:{".hasDatepicker":function(a){a.datepicker("destroy")},".ui-slider":function(a){a.slider("destroy")},".ui-sortable":{".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")}),b.removeClass("my-form-list"),b.sortable("destroy")},"":function(a){a.sortable("destroy")}},".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")})},".ui-draggable":function(a){a.draggable("destroy")},".my-redactor-8":function(a){a.destroyEditor(),a.removeClass("my-redactor-8")},"div.select2-container+input,div.select2-container+select":function(a){a.select2("destroy")},".my-form":function(a){a.my("remove")},textarea:{".my-codemirror":function(a){a[0].nextSibling.CodeMirror.toTextArea(),a.removeClass("my-codemirror")}}}};Cb.params={container:function(a){return N(a,Cb.containers)(a)},change:wb,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:Y,messages:Object.map(Cb.msg,function(a,b){return b[Y]||b.en}),errorTip:".my-error-tip",errorCss:"my-error",animate:0,effect:function(a,b,c){return b?a.fadeIn(c):(a.fadeOut(c),void 0)},remember:0,silent:!1,history:{},historyDelay:100,loader:function(a){var b=ub(),c=zb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Db={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:z,overlap:n,patch:m,kickoff:o,sdbmCode:l,tojson:function(){function a(a){return 10>a?"0"+a:a}function b(a,f,g){var h,i,j,k,l=0,m=f||0,n=d;switch(g&&ib(g)&&(l=String(g).length,n=String(g).repeat(10)),(typeof a).substr(0,3)){case"str":return e(a).replace(/<\/scri/gi,"<\\u002fscri");case"num":return isFinite(a)?""+String(a):"null";case"boo":case"nul":return String(a);case"fun":return e(c(a.toString()).replace(/<\/scri/gi,"<\\u002fscri"));case"obj":if(!a)return"null";if(typeof a.toJSON===db)return b(a.toJSON(),m+(g?1:0),g);if(h=[],gb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),mb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=ib(b)?b:a.my.tojson(b),g=ib(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Db.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:L,css2json:function(a){var b="",c=(a+"").replace(/\/\*[\s\S]+\*\//gm,"").replace(/@charset[^;]+;/gim,"").replace(/[\n\t\s]+/g," ").replace(/\s*@media[^{]*\{/g,function(a){return a.to(-1).trim()+"ᴥ"}).replace(/\}/g,"}ᴥ").replace(/^\n+/g,"").replace(/[\n\s]+$/g,"").split("ᴥ").compact(!0).reduce(function(a,c){var d,e,f,g=c.trim();return"}"==g?b="":/^[^{]+\{[^\}]+\}$/.test(g)?(d=g.to(-1).split("{"),e=" "+d[0].trim(),f=d[1].trim(),";"!=f.last()&&(f+=";"),b?a[b][e]=(a[b][e]||"")+f:a[e]=(a[e]||"")+f):/^@media/.test(g)&&(a[g]={},b=g),a},{});return c}},Eb={container:function(a){return N(a,Cb.containers)(a)},data:function(a,b){var c=this;return jb(a)&&(c.my().data=n(c.my().data,a),this.my("redraw",b)),c.my().data},disabled:function(a){var b,c,d,e,f=this,g=f.my();if(!g)return void 0;if(a==wb)return g.disabled;if(a){for(c in g.ui)b=p(f,c),d=b.my(),d&&(d.predisabled=d.disabled),y(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=p(f,c),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),y(e,b,":disabled");f.removeClass("my-disabled"),f.my("redraw")}},errors:function(){var b=a(this).my().errors,c={};for(var d in b)b[d]&&ib(b[d])&&(c[d]=b[d]),jb(b[d])&&sb(b[d]).length&&(c[d]=b[d]);return c},find:function(a){var b=this,c=b.my();return c&&c.root&&(b=c.root),b.find(a)},history:function(a,b){return B(a,this.my().params,b)},id:function(a,b){if(ib(a))return zb(a,b);var c=this.my();return c&&c.id?c.id:wb},index:function(){var a=this.my().root&&!this.my().ddata?this.my().root:this;return(a.data("formlist")||{}).index},indom:function(){return e(this)},init:K,insert:function(a,b){var c,d,e=this.hasClass("my-form-list")?this:this.my().root||this,f=e.hasClass("my-form-list")?e:e.parent(".my-form-list"),g=(e.data("formlist")||{}).index,i=b,j=f.data("formlist").generator;if(null==g&&(g=0),c=fb.test(j.bind)?h(f.my().manifest,j.bind.replace(fb,"")):h(f.my().data,j.bind),!jb(i))if(jb(j.manifest))i=rb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=rb(e.my().manifest.data,!0)}if("before"===a)d=g;else if("after"===a)d=g+1;else{if(isNaN(a))throw"Invalid position for insertion";d=(1*a).clamp(0,c.length)}c.add(i,d),f.trigger("redraw")},manifest:function(a){return"json"==a?Db.tojson(this.my().manifest):this.my().manifest},promise:function(a){return mb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",ib(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my(),e=2;return d&&jb(d.ui)&&(e=d.params.recalcDepth,Object.keys(d.ui).forEach(function(b){var d=p(c,b);O(d,a?wb:void 0,e),a||(d.hasClass("my-form")&&d.my("redraw"),d.trigger(d.hasClass("my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(eb)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return wb;if(this.my().root&&!this.my().ddata&&(j=this.my().root),d=j.my(),f=d.data,h=d.cid,i=d.mid,j.unbind(".my"),jb(d)&&d.manifest&&mb(d.manifest.die))try{d.manifest.die.call(d.manifest,j,d.manifest)}catch(k){}if(b=d.style)if("1"==b.data("count"))try{b.remove()}catch(k){}else b.data("count",b.data("count")-1);if(c=d.localStyle)try{delete pb[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?wb:(d.params.errors&&d.params.errors.values().compact(!0).length?Object.equal(d.data,d.lastCorrect)||(g+=1):Object.equal(e[f.last()],d.data)&&(g+=1),b=B(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return A(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&ib(b[d])?c++:jb(b[d])&&sb(b[d]).length&&c++;return!c},version:function(){return V}},Fb=Object.keys(Eb);a.my||(a.my={}),tb(a.my,{f:a.extend({},Db),tojson:Db.tojson,fromjson:Db.fromjson,radio:function(b,c){w(a(document),ib(b)?{channel:b,message:c}:b)},rules:Cb,locale:function(a){return ib(a)?(Y=a.toLowerCase(),Cb.params.locale=Y,void 0):Y},ajax:function(a){return mb(a)?yb=a:yb.apply(this,f(arguments,0))},cache:function(a,b){return mb(a)?zb=a:zb(a,b)},now:function(a){return mb(a)?(Ab=a,void 0):Ab()},require:function(a){return mb(a)?Bb=a:Bb.apply(this,f(arguments,0))},chain:function(){function a(){if(d.length&&e){var b,c=d.shift(),f=function(){a.delay(c[1])}.once();try{b=c[0]()}catch(g){f()}nb(b)?(b.then(f,f),f.delay(c[1])):f()}}var b=1,c=1e3,d=[],e=!1,f=function(e,f,g){d.push([e,f||b,g||c]),a()};return f.delay=function(a){return isNaN(a)||(b=(a-0).clamp(0,1e6)),b},f.timeout=function(a){return isNaN(a)||(c=(a-0).clamp(1,1e6)),c},f.start=function(){e=!0,a()},f.stop=function(){e=!1},f}(),version:function(){return V}}),a.my.version.toString=function(){return V},a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(ib(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Eb.init.apply(this,[c].add(f(arguments,1)))}return ib(b)&&Eb[b]?Eb[b].apply(this,f(arguments,1)):ib(b)&&zb(b,"exist")?Eb.init.apply(this,arguments):typeof b!==_&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Eb.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),w(a(document),c)}).on("resize.my",function(){for(var a in pb)try{pb[a]()}catch(b){}}.debounce(67))}(jQuery),function(a){function b(a,b,c){if(i(b))return a+b;if(j(b))return c=e(!0,c,b),a;if(h(b)&&b.length>1&&i(b[1])){for(var d,k,m,n,o,p,q,r,s=b[0],t="",u=1;u'+(s?"<"+c.labelTag+' class="'+c.labelCss+'" '+(c.label?'style="display:inline-block;width:'+c.label+";margin-left:-"+c.label+'" ':"")+">"+s+"":"")+t+""),a+t}return a}function c(a){var b=a;if(i(b)&&(b=b.split(/[\s,]/).compact(!0)),h(b)){for(var c={},d=0;d',inp:k+'text" {ext}/>',sli:k+'range" {ext}/>',dat:k+'date" {ext}/>',btn:k+'button" {ext}/>',pwd:k+'password" {ext}/>',but:"",div:"
{txt}
",spn:"{txt}",sel:"",mul:'',txt:"",err:' {txt}',msg:'
{txt}
',val:function(a){if(!h(a.vals))return"";var b=e({style:"",css:""},a);return b.txt=a.vals.reduce(function(a,b){return a+""+b+" "}," "),'{txt}'.assign(b)},"":"<{_tag} {ext}>{txt}"},txt:{sel:function(a){if(!a.vals)return"";var b=c(a.vals);return Object.keys(b).reduce(function(a,c){return a+'"},"")}},params:{styles:{num:"width:30%;",dat:"width:30%;",inp:"width:100%",pwd:"width:100%",but:"width:30%",txt:"width:100%;max-width:100%;min-height:1px;word-break:break-word;",err:"display:none",msg:"display:none"},alias:{number:"num",date:"dat",slider:"sli",textarea:"txt",input:"inp",span:"spn",select:"select",vals:"val"},row:"",rowTag:"div",rowCss:"my-row",label:"",labelTag:"span",labelCss:"my-label"},defaults:{id:"","class":"",style:"",placeholder:"",value:"",rows:1},attnames:{css:"class",plc:"placeholder",val:"value",txt:"",vals:"",tip:"title"}},m={init:function(b,c){return a(this).html(d(b,c))}};a.my||(a.my={}),a.my.formgen=d,a.fn.formgen=function(b){return i(b)&&m[b]?m[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?(a.error("Method "+b+" does not exist on jQuery.formgen"),void 0):m.init.apply(this,arguments)}}(jQuery),function(a){function b(b,c,d,e){var f,g,i,j,k,n,o;if("object"==typeof c&&c.jquery)c.is("img")&&(n=c,k=c.attr("alt")||c.attr("title")||c.data("text")||"",g=n[0].naturalWidth||n[0].width,f=n[0].naturalHeight||n[0].height,1>f&&(f=1),1>g&&(g=1),j=a(window).width()-90,i=a(window).height()-90,f>i&&(g=g*(i/f)|0,f=i),g>j&&(g=j,f=f*(j/g)|0),o=300>g?300:g,h(b,{source:"image",manifest:{init:function(a){a.html(this.HTML),a.on("click.my","img:eq(0)",function(){a.trigger("cancel")})},HTML:'

',ui:{"img:eq(0)":"img",h4:{bind:"text",css:{hide:function(a,b){return!b}}}}},data:{img:n.attr("src"),text:k},esc:!0,screen:!0,width:e||o,focus:!1,global:!0,z:"1995"},d));else if(m(c)&&c.manifest)h(b,c,d);else{if(!l(c))return null;h(b,{source:"html",manifest:{init:function(a){a.html(this.HTML)},HTML:c,ui:{"div:eq(0)":function(){}}},data:{},esc:!0,focus:!1,width:e},d)}return b}var c,d,e={},f="body",g=!1,h=a.extend,i={},j=a.my.f.indom,k=(Object.isArray,Object.isBoolean),l=Object.isString,m=Object.isObject,n=Object.isNumber,o=(Object.isRegExp,Object.isFunction);if(a.fn.modal&&o(a().emulateTransitionEnd)&&(d=a.fn.modal),a(document).off(".modal"),a(document).on("keydown.modal",function(a){var b,c,d=a.keyCode;if(!1!==g&&(13===d||27===d)){if(c=g.data("modal"),b=c.form,27==d&&(c.esc||Object.equal(b.data("my").initial,b.my("data"))))return g.modal(!0),!1;if(13==d&&c.enter)return function(a){a.modal()}.fill(g).delay(50),!1}}),o(a.my.f.getref(a,"my.modal.parent"))){var p=a.my.f.getref(a,"my.modal.parent")().attr("id");p&&(f="#"+p)}e.modal=function(c,d,e){var h,i={},j=a(f),l=j.find(">.my-modal-proxy"),m={global:!0,screen:!0,done:o(d)?d:void 0,z:"1995"};return k(c)||null==c?l.modal(c):(h=a.Deferred(),b(i,c,m,e)?g?h.reject("Locked").promise():(l.length||(l=a('
').prependTo(j),l.css({position:"absolute",top:"0",left:"0",margin:"0",padding:"0",width:"1px",height:"0"})),l.modal(i)):h.reject("Invalid data").promise())},e.modal.loading=function(b){a(f).find(">.my-modal").toggleClass("my-modal-loading",!!b)},e.modal.parent=function(b){return b&&a(b).length?(f=b,void 0):a(f)},e.modal.parentBack=function(b){return b&&a(b).length?(c=b,void 0):a(c||f)},e.modal.visible=function(){return!!g},a.my||(a.my={}),a.my.modal=e.modal,a.fn.modal=function(e,p,q){function r(){var b,c,d=window,e=!!J.global,f=x.offset(),g=E.offset(),h=x.scrollTop();J.pos={px:f.left,py:f.top,pw:x.outerWidth(),ph:x.outerHeight(),ox:g.left,oy:g.top,ow:E.outerWidth(),oh:E.outerHeight(),ww:c,wh:b};var i=1*(J.x.match(/\-?\d+(\.\d+)?/)||[0])[0],j=1*(J.y.match(/\-?\d+(\.\d+)?/)||[0])[0],k=J.x.has("left")?-1:J.x.has("right")?1:0,l=J.y.has("top")?-1:J.y.has("bottom")?1:0,m=J.pos.ox+J.pos.ow/2-J.pos.px,o=J.pos.oy+J.pos.oh/2-J.pos.py;if(e&&(J.pos.wh=b=d.innerHeight||a(d).height(),J.pos.ww=c=d.innerWidth||a(d).width(),m=c/2,o=b/2.5),i=J.x.has("%")?J.pos.ow/100*i:i,j=J.y.has("%")?J.pos.oh/100*j:j,J.pos.pix=m,J.pos.piy=o,m=m+k*(J.pos.ow/2)+i*(k>0?-1:1)-(J.width+F)*(k+1)/2,e?(o=(b-J.height-20)/3,10>o&&(o=10)):o=o+l*(J.pos.oh/2)+j*(l>0?-1:1)-(J.height||0)*(l+1)/2,m=m.round(1),o=(o+h).round(1),J.pos.vx=m,J.pos.vy=o,J.bound!==!1&&!J.global){var p=(n(J.bound)?J.bound:0).clamp(-100,100);J.pos.pw-2*pJ.pos.pw-p?J.pos.vx=J.pos.pw-p-J.width-F:J.pos.vxJ.pos.ph-p?J.pos.vy=J.pos.ph-p-J.height:J.pos.vy');var c="",d=a("style#my-modal-style-"+J.cid);"top"==J.nose||"bottom"==J.nose?(c+="div.my-modal-"+J.cid+".nose-"+J.nose+":before {left:"+(J.pos.ox-J.pos.px+J.pos.ow/2-J.pos.vx)+"px!important;}",d.text(c)):("left"==J.nose||"right"==J.nose)&&(c+="div.my-modal-"+J.cid+".nose-"+J.nose+":before {top:"+(J.pos.oy-J.pos.py+J.pos.oh/2-J.pos.vy)+"px!important;}",d.text(c))}J.screen?J.global?(y.css({top:0,left:0,width:"100%",height:"100%",display:"block",position:"fixed","z-index":J.z-1}),l(J.screen)&&y.css({background:J.screen?J.screen:"rgba(25, 39, 59, 0.88)"})):y.css({top:0,left:0,position:"absolute",width:y.parent().outerWidth()+"px",height:y.parent().outerHeight()+"px",display:"block",background:l(J.screen)?J.screen:"rgba(255,255,255,0.6)","z-index":J.z-1}):y.length&&y.hide(),J.height>J.pos.wh?(v.height(J.pos.wh-30),w.css({"overflow-y":"scroll"})):w.css({"overflow-y":""}),v.animate({top:J.pos.vy+"px",opacity:"1"},J.animate)}function t(){try{w.my("remove")}catch(b){}try{x.data("modals")[J.cid]=null}catch(b){}w.parent().off(".my").remove(),y.off(".my"+J.cid),J.screen&&function(a){a&&g||y.hide(),a&&!g&&y.css({background:"rgba(25, 39, 59, 0.88)"})}.delay(50,J.global),J.global&&(g=!1,a(document.body).css({overflow:""}))}function u(a){try{H(null,null)}catch(b){}(function(){C.reject(a)}).delay(0)}if(d){if(void 0===e&&void 0===p&&void 0===q)return d.call(this);if(m(e)&&(e.hasOwnProperty("backdrop")||e.hasOwnProperty("keyborad")||e.hasOwnProperty("show")))return d.call(this,e,p);if(l(e)&&/^(toggle|show|hide|handleUpdate)$/.test(e))return d.call(this,e,p)}var v,w,x,y,z,A,B,C=a.Deferred(),D={},E=this,F=0,G=0,H=o(p)?p:function(){return!1},I=m(e)?e:{},J=E.data("modal");if(h(E,C.promise()),J){if(null==e||k(e)){if(w=J.form,y=J.bg,x=J.root,H=J.done,A=w.my("data"),B=!1,e){try{H.call(w.my("manifest"),null,null)}catch(K){}try{j(w)?t():""}catch(K){}if(E.removeData("modal"),i[J.cid])try{i[J.cid].reject("Cancelled")}catch(K){}delete i[J.cid],J=null}else{try{B=H.call(w.my("manifest"),w.my("valid")?null:w.my("errors"),A)}catch(K){}if(!B){try{j(w)?t():""}catch(K){}E.removeData("modal"),function(){i[J.cid]&&i[J.cid].resolve(A),delete i[J.cid],J=null}.delay(0)}}return E}if(I)return u("Locked"),E}return E.is(":visible")?(I=b(D,e,{}))?I.global&&g?(u("Locked"),E):(J=h({type:"DOM",source:"manifest",form:null,modal:null,root:null,bgroot:null,caller:E,manifest:{},data:{},global:!1,screen:!1,drag:!1,focus:!0,close:!0,silent:!0,esc:!1,enter:!1,bound:!1,hardClose:!0,nose:"",width:q||300,height:null,x:"0",y:"0",z:"1901",background:"white",css:"",animate:200},I,{promise:C.promise(),cid:Number.random(268435456,4294967295).toString(16)}),J.done=o(J.done)?J.done:H,l(J.align)&&J.align&&(J.x=(J.align.match(/(left|right):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0],J.y=(J.align.match(/(top|bottom):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0]),J.width=1*(a.my.f.getref(l(J.manifest)?a.my.cache(J.manifest):J.manifest,"params.width")||J.width),J.type="DOM",E.hasClass("my-form")?(J.type="form",J.root=J.root||E):E.data("my")?(J.type="control",J.root=J.root||E.my().root):(J.root=J.root||E.parents(".my-form").eq(0),J.root.length||(J.root=a(f))),J.global?(J.root=a(f),J.bgroot=a(c||f)):J.bgroot=J.bgroot?a(J.bgroot):J.root,x=J.root,x.data("modals")||x.data("modals",{}),r(),v=a('
'),J.root.find(">.my-modal").length?v.insertAfter(J.root.find(">.my-modal").last()):v.prependTo(J.root),v.addClass("my-modal-"+J.cid),F=v.outerWidth(),G=v.outerHeight(),v.hide(),v.html('
'),w=v.find(".my-modal-form"),J.close&&(z=a(l(J.close)?J.close:'
×
').prependTo(v).on("click.my",function(){E.modal(J.hardClose)}),z.css({"z-index":("+"===(J.z+"").to(1)?"+":"")+(1*J.z+1)})),y=J.bgroot.find(">.my-modal-screen"),J.screen&&(y.length||(y=a('').prependTo(J.bgroot)),J.esc&&y.on("click.my"+J.cid,function(){E.modal(!0)})),E.data("modal",J),J.silent&&v.on("change.my",function(){return!1}),v.css({display:"block",height:"none",opacity:"0.005","z-index":J.z,width:"auto"}),v.css(J.global?{position:"fixed",left:"50%",top:J.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":J.z,width:"auto","margin-left":"-"+((J.width+F)/2).round(0)+"px"}:{position:"absolute",left:J.pos.vx+"px",top:J.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":J.z,width:"auto"}),w.my(J.manifest,J.data).then(function(){var b,c,d,e,f;if(h(J,{form:w,bg:y,cancel:function(){E.modal(!0)},commit:function(){E.modal()}}),v.data("modal",J),J.height=v.outerHeight(),"manifest"!==J.source&&(J.width=v.width()),r(),v.css({top:J.pos.vy+"px"}),s(!0),v.removeClass("my-modal-init"),x.data("modals")[J.cid]=J,i[J.cid]=C,w.on("commit.my",function(){return J.commit.delay(50),!1}).on("cancel.my",function(){return J.cancel.delay(50),!1}),v.on("layout.my",function(){s()}.debounce(50)),J.global&&(g=E,a(document.body).css({overflow:"hidden"})),J.global||!J.esc&&!J.enter||w.on("keydown.my",function(b){var c=b.keyCode;return 27==c&&J.esc?(J.cancel(),!1):13==c&&J.enter&&!a(b.target).is("textarea")?(J.commit.delay(50),!1):void 0}),J.focus===!0){e=!1,f=J.manifest.ui;for(d in f)e||(c=w.find(d),c.length&&c.is("input, textarea","button")&&(e=!0,c.focus()))}else l(J.focus)&&w.find(J.focus).focus();if(b=w.find("img").filter(function(){return""!=a(this).attr("src")}),b.length){var j=function(){"manifest"!==J.source&&v.css({width:"auto"}),s()}.after(b.length);b.each(function(){a(this).bind("load",j)})}J.drag&&a.fn.draggable&&(l(J.drag)?v.draggable({handle:J.drag}):v.draggable(),J.nose&&v.on("dragstart.my",function(){v.removeClass("nose-"+J.nose)})),v.on("mousedown.my",function(b){var c,d=[],e=a(b.currentTarget),f=e.parent(),g=+e.css("z-index"),h=g;f.length&&(c=f.find(">.my-modal").each(function(c,e){var f=+a(e).css("z-index");e!=b.currentTarget&&f>=g&&d.push([f,a(e)]),f>h&&(h=f)}),d.forEach(function(a){a[1].css("z-index",a[0]-1+"")}),e.css("z-index",h+""))}),C.notify("Ready")}).fail(function(a){try{t()}catch(b){}E.data("modal",null),C.reject(a)}),E):(u("Invalid data"),E):(u("Object must be visible"),E)}}(jQuery); \ No newline at end of file +!function(a){function b(){window.console&&console.error.apply(console,arguments)}function c(){window.console&&console.log.apply(console,arguments)}function d(a,b){return a.hasOwnProperty(b)}function e(b){return a.contains(document.documentElement,b[0])}function f(a,b){return Array.prototype.slice.call(a,b||0)}function g(a,b,c){var d=0,e=a.length,f=!0;if(a===b)return"===";if("==="==c)return"";if(e!=b.length)return"";for(;e>d&&f;d++)f=a[d]===b[d];if(f)return"==";if("=="==c)return"";for(f=!0;e>d&&f;d++)f=Object.equal(a[d],b[d]);return f?"=":""}function h(a,b){return(ib(b)?b.split("."):gb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return jb(a)?Object.values(a).find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):gb(a)?a.find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):void 0}if(null!=a&&null!=a[b])return a[b]}return void 0},a)}function i(a){var b=a.my();return b?b.root?b.root.my():b:null}function j(a){var b,c={},d=function(){return null};if(ib(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(gb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(jb(a))for(b in a)c[b]=mb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(ib(c)&&(c=c.split(/[,\s]+/)),gb(c)){for(c=c.compact(!0),b=0;b$/.test(y.list)?f=y.list:i=y.list||i,!f){var l=">*"==i?a(d[0].children):p(d,i,!0);f="
",l.length&&(f=a(f).append(l.eq(0).clone(!0)).html(),l.eq(0).remove())}d.data("formlist")||d.data("formlist",{}),d.data("formlist").generator={manifest:t,delay:(y.delay||w.delay||10)/1.3,template:f,selector:i,parent:B,bind:y.bind,merge:mb(y.merge)?y.merge.bind(B):y.merge?n:!1,hash:mb(y.hash)?y.hash.bind(B):ib(y.hash)?k.fill(void 0,y.hash):gb(y.hash)?m.fill(void 0,y.hash.slice(0)):null,id:mb(y.id)?y.id.bind(B):ib(y.id)?k.fill(void 0,y.id):gb(y.id)?m.fill(void 0,y.id.slice(0)):null,ext:!(!y.id&&!y.hash),stamp:0},d.on("insert.my",function(b,c){b.stopPropagation();var d={what:void 0,where:0};null==c?d.where=1e6:jb(c)?qb(d,c):(ib(c)||kb(c))&&(d.where=c),a(b.target).my("insert",d.where,d.what)}),d.on("remove.my",function(b){b.stopPropagation(),a(b.target).my("remove")})}else try{b=K.call(d,r(B,t),jb(e)?e:void 0)}catch(q){j("$.my subform init of "+g+" failed: "+q.message,q.stack)}}nb(b)?b.then(o,function(a,b){j("Init of subform "+g+" failed with error: "+a,b)}):o()}function j(a,c){b(a,c),z&&z.reject(a,c)}function k(a,b){var c=h(a,b)||"";return"string"==typeof c?c:l(c)}function m(a,b){return l(D(a,b))}function o(){d.each(function(){var b,c,h,i=a(this),j=i[0].nodeName,k=!1;if("TEXTAREA"==j&&(h=i[0].nextSibling,c=h&&h.CodeMirror?h.CodeMirror:null,c&&i.addClass("my-codemirror")),b=y.events||N(i,Cb.events),i.hasClass("my-form")?tb(i.data("my"),{dui:y,root:e,selector:g,dparams:w,devents:b,ddata:v.data,container:w.container(i),derrors:v.errors,single:!0}):(i.data("my",{events:b,selector:g,initial:s,previous:s,root:e,container:w.container(i),id:v.id,ui:y,data:v.data,params:w,errors:v.errors,single:1==C}),f._update=y.delay?O.debounce(y.delay):wb,k=!0),k)if(i.cleditor&&i.parent().hasClass("cleditorMain")){var l=i.cleditor()[0];if(l&&l.$frame&&l.$frame[0]){i.addClass("my-cleditor"),tb(i.data("my"),{container:w.container(i)});var m,n=function(a){i.val(a).trigger(eb)},o=Number.random(1e5,1e6-1);a(l.$frame[0]).attr("id","cleditCool"+o),m=document.frames?document.frames["cleditCool"+o].document:a("#cleditCool"+o)[0].contentWindow.document;var p=a(m).find("body");a(m).on("keyup.my",function(){n(a(this).find("body").html())}),i.parent().find("div.cleditorToolbar").on("click.my mouseup.my",function(){n(p.html())}),a("body").on("click","div.cleditorPopup",function(){n(p.html())})}}else if("TEXTAREA"==j&&i.parent().hasClass("redactor_box")){var q,r="my-redactor-9";try{q=i.getEditor(),r="my-redactor-8"}catch(t){q=i.redactor("getEditor")}q&&(i.addClass(r),q.on("input.my keyup.my blur.my",function(a){a.trigger("redactor")}.fill(i)))}else i.hasClass("ace_editor")?ace.edit(d[0]).on(eb,function(a){a.trigger("ace")}.fill(i)):c&&c.on(eb,function(a){a.trigger("codemirror")}.fill(i));i.my()._changed=x.debounce(u),i.my()._recalc=I.debounce(u),i.on(b,function(a){a.type==eb&&a.stopPropagation(),k&&(v.locktill=Ab()+f.delay),i.my()._changed(i,e,f,w)}),/check(\.my)?/.test(b+"")||i.on("check.my",function(){return i.my()._changed(i,e,f,w,!0),!1}),k||i.off("redraw.my"),i.on("recalc.my, redraw.my",function(a){a.stopPropagation(),i.my()._recalc(i,e,f,w)})}),z&&z.resolve()}var q,s,t,u,v=e.my(),w=(v||{}).params,y=f,z=null,A=0,B=v.manifest,C=0|d.length;return v?(u=f.delay,C?(y.init!=wb&&(q=H(B,y.init,d,v)),nb(q)?(A+=1,z=ub(),q.then(i,function(a,b){j("Init of "+g+" failed: "+a,b)})):i()):c("Not found "+g+" selector.",e),z):(b("Failed to find $root building "+g+" selector."),null)}function w(c,d){jb(d)&&d.channel&&d.message&&p(c,".my-listen-"+l(d.channel),!0).each(function(){var c,e=a(this),f=e.data("my"),g=void 0;if(f&&f.ui.listen&&mb(f.ui.listen[d.channel])){c=f.ui.listen[d.channel];try{g=c.call(f.manifest||f.root.my().manifest,f.data,d.message,e)}catch(h){b("Listener failed",h.message,h.stack)}void 0!==g&&(null===g?e.trigger("check"):g&&e.trigger("recalc"))}})}function x(a,b,c,d,e){{var f,g=a.data("my");b.data("my")}g&&(g.disabled?g.ddata||O(a,wb,c.recalcDepth||d.recalcDepth):(B(g.ddata||g.data,g.dparams||g.params),e||(f=g.single?a:p(b,g.selector)),O(a,e?wb:A(f,wb),c.recalcDepth||d.recalcDepth),d.change&&d.change.call(a)))}function y(b,c,d){var e=d.compact(),f=e.replace(/:disabled/g,""),g=f!==e,h="self:"===f.to(5);return h&&(f=f.replace(/^self:/g,"")),c.each(function(){var d=a(this),e=d.my(),i=!h&&e?e.container:d;i.toggleClass(f,!!b),g&&void 0!==e&&!!b!=!!e.disabled&&(d.my().disabled=!!b,e._disable||(d.my()._disable=N(c,Cb.offon).fill(void 0,c)),e._disable(!!b))}),c}function z(a,b,c){return a[b](c?"disable":"enable")}function A(a,b){var c,d,e=a.data("myval");return e||(d=N(a,Cb.vals),mb(d)&&(c=d(a,wb),void 0===c?a.data("myval",function(a,b){return wb!=b&&d(a,b),a.val()}.fill(a,void 0)):a.data("myval",d.fill(a,void 0))),e=a.data("myval")),mb(e)?(c=e(),(c!==b&&(0==b||0==c)||c!=b||jb(b))&&(c=e(b)),c):wb}function B(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=b;if(!jb(n)||isNaN(h=n.remember)||!jb(e=n.history))return wb;if(jb(a)&&h){if(j=rb(a,!0),k=Ab(),g=sb(e).sort(),g.length&&(k-g.last()=2*h){for(m={},f=h;2*h>f;f++)m[g[f]]=e[g[f]];b.history=m}return d||n.form.trigger(eb),n.history[g.last()]}if(!isNaN(a)||a===wb){if(i=parseInt(a)||0,0>i)return wb;if(g=sb(e).sort(),i>=g.length&&(i=g.length-1),l=rb(n.history[g[g.length-i-1]],!0),c){for(m={},f=0;f=i;i++)if(i===h){if(d)return wb!=b?e[f[i]]=b:void 0===e[f[i]]&&(e[f[i]]=wb),e[f[i]];e[f[i]]=b}else 0===i?(e=a[f[0]],g=a):(g=g[f[i-1]],e=e[f[i]]),(null==e||!jb(e)&&(gb(e)&&!isNaN(f[i+1])&&+f[i]>-1))&&(e=g[f[i]]={});return a}function G(a,b,c){var e=jb(b)?b:null;return Object.each(a,function(b,c){var d=typeof c;/^str|^fu/.test(d)&&(a[b]={bind:c})}),Object.each(a,function(b,f){var g,i,k,l=[],m=[],n=/\s?[,;]\s?/;f.recalc&&(ib(f.recalc)?l=f.recalc.split(n):gb(f.recalc)&&(l=f.recalc),l=l.compact(!0).unique()),l.length&&(a[b].recalc=l),null==f.bind&&(f.bind=function(){});var o;if(f.listen&&(o=j(f.listen),f.listen=Object.size(o)?o:void 0),d(f,"events")&&(f.events=(f.events+"").replace(/,\s*|\s+/g," ")),d(f,"watch"))for(ib(f.watch)?m=f.watch.split(n):gb(f.watch)&&(m=f.watch.slice(0)),m=m.compact(!0).unique(),k=0;ki&&h.resolve()}var d,e,f,g=!1,h=ub(),i=a.length;for(e=0;i>e;e++)d=a[e],f=ib(d.ajax)?w.loader:yb,f(d.ajax).then(function(a,d){fb.test(d.ref)&&(null!=a?tb(!0,b,E(a,d.ref.from(5))):(g=!0,v.push("Invalid data for ‘"+d.ref+"’ resource."))),c()}.fill(void 0,d)).fail(function(a,b){v.push("Failed to load ‘"+b.ref+"’ resource."),g=!0,c()}.fill(void 0,d));return h.promise()}function i(a){var c=!1;return fb.test(a)?null!=h(b,a.from(5))&&(c=!0):null!=h(window,a)&&(c=!0),c}function j(a){for(var b in a)a[b]===!1&&(a[b]=i(b));return a}var k,l,m,n,o,p,q,r,s=ub(),t=[],u={},v=[],w=tb(!0,{ajaxTimeout:1e4,loader:Cb.params.loader},c||{}),x={ref:null,ajax:{type:"GET",async:!0,timeout:w.ajaxTimeout}};if(jb(b))if(gb(b.require)){for(n=b.require,k=0;k'+f+""}!_.style||b&&!sb.is(":visible")||(S=L(sb,_),S&&S[0].length&&!b&&(V=a("style#"+T),V.length||(V=a(c(S[0],T)).appendTo(a("body"))),V.data("count",1*V.data("count")+1),sb.data("my").style=V),S&&S[1].length&&(Z=a("style#"+U),Z.length?b&&(a(c(S[1],U)).replaceAll(Z),Z=a("style#"+U)):(Z=a(c(S[1],U)).appendTo(a("body")),Q.restyle>-1&&!pb[J]&&(pb[J]=function(){q(!0)}.debounce(Q.restyle)),sb.data("my").restyle=q.fill(!0).debounce(0)),sb.data("my").localStyle=Z,b||sb.addClass("my-restyle")))}function r(){var a,b,c=!0;if(b=t(_),ib(b))B("Error decoding base64 to local Blob/URL",b),c=!1;else{if(W)for(a=0;a*").clone();try{$=H(_,R.init,sb,R)}catch(b){return B(ib(b)?b:b.message,b.stack),sb}}if(nb($)?$.then(function(){x()},function(a,b){B(a,b)}):x(),!hb){if(!sb.my())return B("Internal error initializing controls.",""),sb;sb.data("my").initial=tb(!0,{},bb),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function x(){function a(a){hb||(b[a]=A(p(sb,a),wb),d-=1,.5>d&&y(b))}var b={},c=Object.keys(O),d=c.length;0===d?z():(sb.addClass(lb),c.forEach(function(b){if(!hb){var c=p(sb,b),d=v(c,sb,O[b],b);rb[b]=c,nb(d)?d.then(a.fill(b)).fail(function(a,c){B("Error building "+b+", "+a,c)}):hb||a(b)}}))}function y(a){var c,d,e,f,g;for(g in O){if(hb)return;if(c=O[g],e=rb[g],f=e.length){c.listen&&(eb[g]=e.eq(0));try{d=u(bb,wb,c,e),d==wb&&a[g]!=wb&&void 0!==d&&u(bb,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+J+"')",h.message,h.stack)}try{d!=wb&&A(e,d),e.eq(0).trigger("check.my")}catch(h){B("Error linking "+g,h.message,h.stack)}}}z()}function z(){sb.removeClass(lb),sb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),sb.my("redraw")}),qb=null,fb.resolve(bb)}function B(a,c){var d;if(hb=!0,b("Form "+I+" failed to initialize.",a,c),Object.keys(rb).forEach(function(a){delete rb[a]}),sb.removeClass(lb),d=kb(a,c),ib(d)||jb(d)&&d.jquery?sb.html(d):d===!0&&sb.html(qb),Q.silent)fb.resolve(bb);else{if(!sb.my().ddata){if(sb.removeData("my"),sb.removeClass("my-form"),V)if("1"==V.data("count"))try{V.remove()}catch(e){}else V.data("count",V.data("count")-1);if(Z)try{delete pb[J],Z.remove()}catch(e){}}fb.reject("Form "+I+" failed to initialize: "+a,c)}}var D,F,I,J,K,N,O,Q,R,S,T,U,V,Z,$,_={},bb={},cb=null,db=[],eb={},fb=ub(),hb=!1,kb=function(){},lb="my-form-init",ob="std",qb="",rb={};if(ib(d)){if(D=zb(d),!D)return fb.reject("No manifest with id "+d+" found in repo."),fb.promise();jb(f)&&jb(e)?(D=tb(D,e),F=f):F=e,ob="repo"}else D=d,F=e;if(!D)return this;R=jb(F)&&"repo"!=ob?tb(!0,{},D):D;var sb=this.eq(0),vb=sb.my();return jb(vb)&&vb.id&&vb.ui?(c("jQuery.my is already bound.",sb),sb.my("ui",R.ui),sb.my(ab,R.data),fb.resolve(sb.my(ab)).promise()):(Q=R.params||{},Q.strict||mb(R.init)||(Q=tb(!0,{},Q),P(Q)),Q=tb(!0,{},Cb.params,Q),fb.fail(function(){sb.removeClass(U+" "+T)}),tb(sb,fb.promise()),jb(F)?(bb=m(F,R.data||{}),R.data=bb):bb=R.data||{},_.data=bb,sb.data("my",{data:bb,params:Q,promise:fb.promise(),locktill:0}),sb.addClass(lb),R.inherit&&i(R),gb(R.require)?Bb(R,Q).then(g).fail(function(a){o(),B("Linker of the ‘require’ property failed.",a)}):g(),fb.then(n),sb)}function L(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=mb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),ib(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Db.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),gb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==_&&c(a,i,g+1)}wb!=b[""]&&typeof b[""]!=_&&g>e&&(d=b[""],e=g)}var d=wb,e=0,f="";return c(a,b,1),d}function O(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,q,r=!1,s=!1,t=a,v=t.my(),w="";if(v){if(m=v.selector,n=v.root,n.hasClass("my-form-init"))return{};if(o=p(n,m),q=n.my().ui,r=a.hasClass("my-form"),r?(f=a,g=v.ddata,h=v.dui,i=v.dparams):(f=v.container,g=v.data,h=v.ui,i=v.params),h.bind!=wb){if(j=xb(c)?c:A(o,u(g,wb,h,o)),wb!=h.check){w="Unknown error";try{w=U(g,j,h,o)}catch(x){b("Error "+x.message+" in .check validator for "+m,n,x.stack)}}var z=i.errorCss,B="ui-state-error";try{wb!=c&&(j=A(o,u(g,c,h,o)))}catch(x){w=i.messages.formError||"Error"}if(wb!=h.check)if(s=a.hasClass("my-form-list"),""==w&&(r||f.hasClass(z)))r?v.derrors[m]="":v.errors[m]="",f.removeClass(z),f.attr("title")&&f.attr("title",""),r||s||i.effect(p(f,i.errorTip),!1,i.animate/2),t.removeClass(B),p(t,".ui-widget").removeClass(B);else if(w){if(r)v.derrors[m]=w;else if(s)v.errors[m]=w;else{f.addClass(z),v.errors[m]=w;var C=p(f,i.errorTip);C.length?i.effect(C.addClass(z).html(ib(w)?w:"Error"),!0,i.animate):f.attr("title",(ib(w)?w:"Error").stripTags())}t.hasClass("hasDatepicker")&&(t.is("input")?t.addClass(B):p(t,".ui-widget").addClass(B)),t.hasClass("ui-slider")&&t.addClass(B)}}var D=c==wb?j:c;if(h.css)for(k in h.css)l=h.css[k],lb(l)?y(l.test(D),o,k):mb(l)&&y(l.call(n.my().manifest,g,D,o),o,k);var e,E,F=h.recalc,G=[],H={};if(d&&h.recalc&&n.my()){for(q=n.my().ui,e=0;e-1?"":o;case"s":return c==k?"":o;case"o":return k[c]?"":o;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},l=0,(">*"==h?a(e[0].children):p(e,h,!0)).each(function(){var b=a(this);b.hasClass("ui-sortable-placeholder")||(b.data("my")&&!b.my("valid")&&(j[l]=b.my("errors")),l+=1)}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return m.formError||"Error"}return""}var V="1.2.11",W=window.URL||window.webkitURL,X=!document.addEventListener,Y=((window.navigator.language||window.navigator.userLanguage||"en")+"").split("-")[0].toLowerCase(),Z="{yyyy}-{MM}-{dd}",$="{HH}:{mm}",_="object",ab="data",bb="array",cb="string",db="function",eb="change",fb=/^this\./,gb=Object.isArray,hb=Object.isBoolean,ib=Object.isString,jb=Object.isObject,kb=Object.isNumber,lb=Object.isRegExp,mb=Object.isFunction,nb=function(a){return null!=a&&typeof a==_&&mb(a.then)},ob=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},pb=h(a,"my.f.restyles")?a.my.f.restyles():{},qb=Object.merge,rb=Object.clone,sb=Object.keys,tb=a.extend,ub=a.Deferred,vb=a.type,wb=null,xb=function(a){return null!==a&&void 0!==a},yb=a.ajax,zb=q,Ab=Date.now,Bb=J,Cb={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my(ab);return Object.equal(c,b)?c:a.my(ab,b,!0)}return b||wb},".hasDatepicker":function(a,b){xb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(Z):""},".my-tags":function(a,b){return xb(b)&&(ib(b)||kb(b)?a.tags(ab,[b+""]):gb(b)&&a.tags(ab,b)),a.tags(ab)},".ui-draggable":function(a,b){if(xb(b)&&jb(b)){var c={};isNaN(b.left)||(c.left=Number(b.left).ceil(2)+"px"),isNaN(b.top)||(c.top=Number(b.top).ceil(2)+"px"),(c.left||c.top)&&a.css(c)}var d=a.position();return{left:b&&!isNaN(b.left)?(1*b.left).ceil(2):d.left.ceil(2),top:b&&!isNaN(b.top)?(1*b.top).ceil(2):d.top.ceil(2)}},".my-form-list":function(b,c){function e(){var c,d,e=a(this),f=e.data("my");f&&(c=e.data("formlist"),d=c.index,c.hash=w(f.data,d)+"",c.oid=x!==w?x(f.data,d)+"":c.hash),b.trigger("check.my")}function f(a){a.data("my").locktill+z/1.3.my-form",t=!!q.merge,u=q.template||"
",v=/\{/.test(u),w=q.hash||l,x=q.id||l,y=q.ext,z=q.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).length,E=[],F=[],G=Ab(),H=b.find(C?b.sortable("option","items"):s);if(xb(c)&&gb(c)){if(D)return c;if(i=[],j={},H.each(function(){var b,c=a(this),d=c.data("my");d&&(i.push(d.data),!t&&(b=c.data("formlist"))&&(j[b.oid]=d.data))}),m=g(i,c,"=="),!m){var I=[],J=[],L={},M={};for(F=[],h=0;h1.4*z||G-q.stamp>100||!q.stashed||q.stashed.length!==H.length-(D?1:0)){D&&(o=b.find(">."+A+"-helper"));var N=0;for(H.each(function(b,c){var d,e,f,g=a(c),h=!1;D&&g.hasClass(A+"-helper")||(D&&g.hasClass(A+"-placeholder")&&(g=o),d=g.data("my"),e=g.data("formlist"),d&&e&&(E.push(d.data),N!=e.index&&(e.index=N,h=!0),y&&(f=w(d.data,N)+"",f!==e.hash&&(e.hash=f,h=!0)),N+=1,h&&F.push(g)))}),h=0;h-1){var f=b.eq(d);f.is(":checked")||(f.prop("checked",!0),e&&f.checkboxradio("refresh"))}else e||b.each(function(){a(this).prop("checked",!1)})}if(-1==d)for(var g=0;gForm init failed

',ru:'

Ошибка инициализации формы

'},badInput:{en:"Invalid input",ru:"Неверное значение"},patternMismatch:{en:"Pattern mismatch",ru:"Не соответствует шаблону"},rangeOverflow:{en:"Over maximum",ru:"Больше максимума"},rangeUnderflow:{en:"Under minimum",ru:"Меньше минимума"},stepMismatch:{en:"Step mismatch",ru:"Не кратно шагу"},tooLong:{en:"Too long",ru:"Слишком длинно"},typeMismatch:{en:"Invalid type",ru:"Неверный тип"},valueMissing:{en:"Required",ru:"Обязательное поле"}},events:{".hasDatepicker":"change.my check.my",".my-form,.my-tags":"change.my check.my",".ui-slider":"slide.my check.my","div.redactor_box textarea":"redactor.my check.my",".my-codemirror":"codemirror.my check.my",".ace_editor":"ace.my check.my",".my-form-list":"sortupdate.my check.my",".ui-sortable":"sortchange.my sortupdate.my check.my",".ui-draggable":"drag.my dragstop.my check.my","a, .pseudolink, input[type=button], button":"click.my","img, :radio, :checkbox":"click.my check.my","div.select2-container+input,div.select2-container+select":"change.my check.my input.my",".ui-buttonset,input, select, textarea":"blur.my change.my check.my"+("Micro"===navigator.appName.to(5)?" keyup.my":" input.my"),"":"check.my"},containers:{"*[data-role='fieldcontain'] *":{"input,textarea,select,button,:radio":function(a){return a.parents('[data-role="fieldcontain"]').eq(0)}},".tagstrip *.value":function(a){return a.parents(".tagstrip").eq(0)},"div.redactor_box textarea":function(a){return a.parents("div.redactor_box").eq(0).parent()},".my-tags,.hasDatepicker,.ui-widget,input,textarea,select,button":{".my-cleditor":function(a){return a.parents("div.cleditorMain").eq(0).parent()},"":function(b){var c=b[0].parentNode,d=c.nodeName;return/^(div|span|a|p|form|fieldset|li|ul|td|th|h\d)$/i.test(d)?a(c):b.parents("div,span,a,p,form,fieldset,li,ul,td,th,h1,h2,h3,h4,h5,h6").eq(0)}},"":function(a){return a}},offon:{".ace_editor":function(a,b){ace.edit(b[0]).setReadOnly(a)},".ui-selectable":function(a,b){z(b,"selectable",a)},".ui-slider":function(a,b){z(b,"slider",a)},".ui-draggable":function(a,b){z(b,"draggable",a)},".ui-buttonset":function(a,b){z(b,"buttonset",a)},".hasDatepicker":function(a,b){z(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){z(b,"select2",a)},".my-cleditor":function(a,b){b.cleditor()[0].disable(!!a)},"":function(a,b){b.attr("disabled",!!a)}},destroy:{".hasDatepicker":function(a){a.datepicker("destroy")},".ui-slider":function(a){a.slider("destroy")},".ui-sortable":{".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")}),b.removeClass("my-form-list"),b.sortable("destroy")},"":function(a){a.sortable("destroy")}},".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")})},".ui-draggable":function(a){a.draggable("destroy")},".my-redactor-8":function(a){a.destroyEditor(),a.removeClass("my-redactor-8")},"div.select2-container+input,div.select2-container+select":function(a){a.select2("destroy")},".my-form":function(a){a.my("remove")},textarea:{".my-codemirror":function(a){a[0].nextSibling.CodeMirror.toTextArea(),a.removeClass("my-codemirror")}}}};Cb.params={container:function(a){return N(a,Cb.containers)(a)},change:wb,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:Y,messages:Object.map(Cb.msg,function(a,b){return b[Y]||b.en}),errorTip:".my-error-tip",errorCss:"my-error",animate:0,effect:function(a,b,c){return b?a.fadeIn(c):(a.fadeOut(c),void 0)},remember:0,silent:!1,history:{},historyDelay:100,loader:function(a){var b=ub(),c=zb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Db={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:z,overlap:n,patch:m,kickoff:o,sdbmCode:l,tojson:function(){function a(a){return 10>a?"0"+a:a}function b(a,f,g){var h,i,j,k,l=0,m=f||0,n=d;switch(g&&ib(g)&&(l=String(g).length,n=String(g).repeat(10)),(typeof a).substr(0,3)){case"str":return e(a).replace(/<\/scri/gi,"<\\u002fscri");case"num":return isFinite(a)?""+String(a):"null";case"boo":case"nul":return String(a);case"fun":return e(c(a.toString()).replace(/<\/scri/gi,"<\\u002fscri"));case"obj":if(!a)return"null";if(typeof a.toJSON===db)return b(a.toJSON(),m+(g?1:0),g);if(h=[],gb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),mb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=ib(b)?b:a.my.tojson(b),g=ib(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Db.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:L,css2json:function(a){var b="",c=(a+"").replace(/\/\*[\s\S]+\*\//gm,"").replace(/@charset[^;]+;/gim,"").replace(/[\n\t\s]+/g," ").replace(/\s*@media[^{]*\{/g,function(a){return a.to(-1).trim()+"ᴥ"}).replace(/\}/g,"}ᴥ").replace(/^\n+/g,"").replace(/[\n\s]+$/g,"").split("ᴥ").compact(!0).reduce(function(a,c){var d,e,f,g=c.trim();return"}"==g?b="":/^[^{]+\{[^\}]+\}$/.test(g)?(d=g.to(-1).split("{"),e=" "+d[0].trim(),f=d[1].trim(),";"!=f.last()&&(f+=";"),b?a[b][e]=(a[b][e]||"")+f:a[e]=(a[e]||"")+f):/^@media/.test(g)&&(a[g]={},b=g),a},{});return c}},Eb={container:function(a){return N(a,Cb.containers)(a)},data:function(a,b){var c=this;return jb(a)&&(c.my().data=n(c.my().data,a),this.my("redraw",b)),c.my().data},disabled:function(a){var b,c,d,e,f=this,g=f.my();if(!g)return void 0;if(a==wb)return g.disabled;if(a){for(c in g.ui)b=p(f,c),d=b.my(),d&&(d.predisabled=d.disabled),y(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=p(f,c),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),y(e,b,":disabled");f.removeClass("my-disabled"),f.my("redraw")}},errors:function(){var b=a(this).my().errors,c={};for(var d in b)b[d]&&ib(b[d])&&(c[d]=b[d]),jb(b[d])&&sb(b[d]).length&&(c[d]=b[d]);return c},find:function(a){var b=this,c=b.my();return c&&c.root&&(b=c.root),b.find(a)},history:function(a,b){return B(a,this.my().params,b)},id:function(a,b){if(ib(a))return zb(a,b);var c=this.my();return c&&c.id?c.id:wb},index:function(){var a=this.my().root&&!this.my().ddata?this.my().root:this;return(a.data("formlist")||{}).index},indom:function(){return e(this)},init:K,insert:function(a,b){var c,d,e=this.hasClass("my-form-list")?this:this.my().root||this,f=e.hasClass("my-form-list")?e:e.parent(".my-form-list"),g=(e.data("formlist")||{}).index,i=b,j=f.data("formlist").generator;if(null==g&&(g=0),c=fb.test(j.bind)?h(f.my().manifest,j.bind.replace(fb,"")):h(f.my().data,j.bind),!jb(i))if(jb(j.manifest))i=rb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=rb(e.my().manifest.data,!0)}if("before"===a)d=g;else if("after"===a)d=g+1;else{if(isNaN(a))throw"Invalid position for insertion";d=(1*a).clamp(0,c.length)}c.add(i,d),f.trigger("redraw")},manifest:function(a){return"json"==a?Db.tojson(this.my().manifest):this.my().manifest},promise:function(a){return mb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",ib(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my(),e=2;return d&&jb(d.ui)&&(e=d.params.recalcDepth,Object.keys(d.ui).forEach(function(b){var d=p(c,b);O(d,a?wb:void 0,e),a||(d.hasClass("my-form")&&d.my("redraw"),d.trigger(d.hasClass("my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(eb)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return wb;if(this.my().root&&!this.my().ddata&&(j=this.my().root),d=j.my(),f=d.data,h=d.cid,i=d.mid,j.unbind(".my"),jb(d)&&d.manifest&&mb(d.manifest.die))try{d.manifest.die.call(d.manifest,j,d.manifest)}catch(k){}if(b=d.style)if("1"==b.data("count"))try{b.remove()}catch(k){}else b.data("count",b.data("count")-1);if(c=d.localStyle)try{delete pb[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?wb:(d.params.errors&&d.params.errors.values().compact(!0).length?Object.equal(d.data,d.lastCorrect)||(g+=1):Object.equal(e[f.last()],d.data)&&(g+=1),b=B(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return A(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&ib(b[d])?c++:jb(b[d])&&sb(b[d]).length&&c++;return!c},version:function(){return V}},Fb=Object.keys(Eb);a.my||(a.my={}),tb(a.my,{f:a.extend({},Db),tojson:Db.tojson,fromjson:Db.fromjson,radio:function(b,c){w(a(document),ib(b)?{channel:b,message:c}:b)},rules:Cb,locale:function(a){return ib(a)?(Y=a.toLowerCase(),Cb.params.locale=Y,void 0):Y},ajax:function(a){return mb(a)?yb=a:yb.apply(this,f(arguments,0))},cache:function(a,b){return mb(a)?zb=a:zb(a,b)},now:function(a){return mb(a)?(Ab=a,void 0):Ab()},require:function(a){return mb(a)?Bb=a:Bb.apply(this,f(arguments,0))},chain:function(){function a(){if(d.length&&e){var b,c=d.shift(),f=function(){a.delay(c[1])}.once();try{b=c[0]()}catch(g){f()}nb(b)?(b.then(f,f),f.delay(c[1])):f()}}var b=1,c=1e3,d=[],e=!1,f=function(e,f,g){d.push([e,f||b,g||c]),a()};return f.delay=function(a){return isNaN(a)||(b=(a-0).clamp(0,1e6)),b},f.timeout=function(a){return isNaN(a)||(c=(a-0).clamp(1,1e6)),c},f.start=function(){e=!0,a()},f.stop=function(){e=!1},f}(),version:function(){return V}}),a.my.version.toString=function(){return V},a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(ib(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Eb.init.apply(this,[c].add(f(arguments,1)))}return ib(b)&&Eb[b]?Eb[b].apply(this,f(arguments,1)):ib(b)&&zb(b,"exist")?Eb.init.apply(this,arguments):typeof b!==_&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Eb.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),w(a(document),c)}).on("resize.my",function(){for(var a in pb)try{pb[a]()}catch(b){}}.debounce(67))}(jQuery),function(a){function b(a,b,c){if(i(b))return a+b;if(j(b))return c=e(!0,c,b),a;if(h(b)&&b.length>1&&i(b[1])){for(var d,k,m,n,o,p,q,r,s=b[0],t="",u=1;u'+(s?"<"+c.labelTag+' class="'+c.labelCss+'" '+(c.label?'style="display:inline-block;width:'+c.label+";margin-left:-"+c.label+'" ':"")+">"+s+"":"")+t+""),a+t}return a}function c(a){var b=a;if(i(b)&&(b=b.split(/[\s,]/).compact(!0)),h(b)){for(var c={},d=0;d',inp:k+'text" {ext}/>',sli:k+'range" {ext}/>',dat:k+'date" {ext}/>',btn:k+'button" {ext}/>',pwd:k+'password" {ext}/>',but:"",div:"
{txt}
",spn:"{txt}",sel:"",mul:'',txt:"",err:' {txt}',msg:'
{txt}
',val:function(a){if(!h(a.vals))return"";var b=e({style:"",css:""},a);return b.txt=a.vals.reduce(function(a,b){return a+""+b+" "}," "),'{txt}'.assign(b)},"":"<{_tag} {ext}>{txt}"},txt:{sel:function(a){if(!a.vals)return"";var b=c(a.vals);return Object.keys(b).reduce(function(a,c){return a+'"},"")}},params:{styles:{num:"width:30%;",dat:"width:30%;",inp:"width:100%",pwd:"width:100%",but:"width:30%",txt:"width:100%;max-width:100%;min-height:1px;word-break:break-word;",err:"display:none",msg:"display:none"},alias:{number:"num",date:"dat",slider:"sli",textarea:"txt",input:"inp",span:"spn",select:"select",vals:"val"},row:"",rowTag:"div",rowCss:"my-row",label:"",labelTag:"span",labelCss:"my-label"},defaults:{id:"","class":"",style:"",placeholder:"",value:"",rows:1},attnames:{css:"class",plc:"placeholder",val:"value",txt:"",vals:"",tip:"title"}},m={init:function(b,c){return a(this).html(d(b,c))}};a.my||(a.my={}),a.my.formgen=d,a.fn.formgen=function(b){return i(b)&&m[b]?m[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?(a.error("Method "+b+" does not exist on jQuery.formgen"),void 0):m.init.apply(this,arguments)}}(jQuery),function(a){function b(b,c,d,e){var f,g,i,j,k,n,o;if("object"==typeof c&&c.jquery)c.is("img")&&(n=c,k=c.attr("alt")||c.attr("title")||c.data("text")||"",g=n[0].naturalWidth||n[0].width,f=n[0].naturalHeight||n[0].height,1>f&&(f=1),1>g&&(g=1),j=a(window).width()-90,i=a(window).height()-90,f>i&&(g=g*(i/f)|0,f=i),g>j&&(g=j,f=f*(j/g)|0),o=300>g?300:g,h(b,{source:"image",manifest:{init:function(a){a.html(this.HTML),a.on("click.my","img:eq(0)",function(){a.trigger("cancel")})},HTML:'

',ui:{"img:eq(0)":"img",h4:{bind:"text",css:{hide:function(a,b){return!b}}}}},data:{img:n.attr("src"),text:k},esc:!0,screen:!0,width:e||o,focus:!1,global:!0,z:"1995"},d));else if(m(c)&&c.manifest)h(b,c,d);else{if(!l(c))return null;h(b,{source:"html",manifest:{init:function(a){a.html(this.HTML)},HTML:c,ui:{"div:eq(0)":function(){}}},data:{},esc:!0,focus:!1,width:e},d)}return b}var c,d,e={},f="body",g=!1,h=a.extend,i={},j=a.my.f.indom,k=(Object.isArray,Object.isBoolean),l=Object.isString,m=Object.isObject,n=Object.isNumber,o=(Object.isRegExp,Object.isFunction);if(a.fn.modal&&o(a().emulateTransitionEnd)&&(d=a.fn.modal),a(document).off(".modal"),a(document).on("keydown.modal",function(a){var b,c,d=a.keyCode;if(!1!==g&&(13===d||27===d)){if(c=g.data("modal"),b=c.form,27==d&&(c.esc||Object.equal(b.data("my").initial,b.my("data"))))return g.modal(!0),!1;if(13==d&&c.enter)return function(a){a.modal()}.fill(g).delay(50),!1}}),o(a.my.f.getref(a,"my.modal.parent"))){var p=a.my.f.getref(a,"my.modal.parent")().attr("id");p&&(f="#"+p)}e.modal=function(c,d,e){var h,i={},j=a(f),l=j.find(">.my-modal-proxy"),m={global:!0,screen:!0,done:o(d)?d:void 0,z:"1995"};return k(c)||null==c?l.modal(c):(h=a.Deferred(),b(i,c,m,e)?g?h.reject("Locked").promise():(l.length||(l=a('
').prependTo(j),l.css({position:"absolute",top:"0",left:"0",margin:"0",padding:"0",width:"1px",height:"0"})),l.modal(i)):h.reject("Invalid data").promise())},e.modal.loading=function(b){a(f).find(">.my-modal").toggleClass("my-modal-loading",!!b)},e.modal.parent=function(b){return b&&a(b).length?(f=b,void 0):a(f)},e.modal.parentBack=function(b){return b&&a(b).length?(c=b,void 0):a(c||f)},e.modal.visible=function(){return!!g},a.my||(a.my={}),a.my.modal=e.modal,a.fn.modal=function(e,p,q){function r(a){if(x=K.form,z=K.bg,y=K.root,I=K.done,B=x.my("data"),C=!1,a){try{I.call(x.my("manifest"),null,null)}catch(b){}try{j(x)?u():""}catch(b){}if(j(F)&&F.removeData("modal"),i[K.cid])try{i[K.cid].reject("Cancelled")}catch(b){}delete i[K.cid],K=null}else{try{C=I.call(x.my("manifest"),x.my("valid")?null:x.my("errors"),B)}catch(b){}if(!C){try{j(x)?u():""}catch(b){}j(F)&&F.removeData("modal"),function(){if(i[K.cid])try{i[K.cid].resolve(B)}catch(a){}delete i[K.cid],K=null}.delay(0)}}}function s(){var b,c,d=window,e=!!K.global,f=y.offset(),g=F.offset(),h=y.scrollTop();K.pos={px:f.left,py:f.top,pw:y.outerWidth(),ph:y.outerHeight(),ox:g.left,oy:g.top,ow:F.outerWidth(),oh:F.outerHeight(),ww:c,wh:b};var i=1*(K.x.match(/\-?\d+(\.\d+)?/)||[0])[0],j=1*(K.y.match(/\-?\d+(\.\d+)?/)||[0])[0],k=K.x.has("left")?-1:K.x.has("right")?1:0,l=K.y.has("top")?-1:K.y.has("bottom")?1:0,m=K.pos.ox+K.pos.ow/2-K.pos.px,o=K.pos.oy+K.pos.oh/2-K.pos.py;if(e&&(K.pos.wh=b=d.innerHeight||a(d).height(),K.pos.ww=c=d.innerWidth||a(d).width(),m=c/2,o=b/2.5),i=K.x.has("%")?K.pos.ow/100*i:i,j=K.y.has("%")?K.pos.oh/100*j:j,K.pos.pix=m,K.pos.piy=o,m=m+k*(K.pos.ow/2)+i*(k>0?-1:1)-(K.width+G)*(k+1)/2,e?(o=(b-K.height-20)/3,10>o&&(o=10)):o=o+l*(K.pos.oh/2)+j*(l>0?-1:1)-(K.height||0)*(l+1)/2,m=m.round(1),o=(o+h).round(1),K.pos.vx=m,K.pos.vy=o,K.bound!==!1&&!K.global){var p=(n(K.bound)?K.bound:0).clamp(-100,100);K.pos.pw-2*pK.pos.pw-p?K.pos.vx=K.pos.pw-p-K.width-G:K.pos.vxK.pos.ph-p?K.pos.vy=K.pos.ph-p-K.height:K.pos.vy');var c="",d=a("style#my-modal-style-"+K.cid);"top"==K.nose||"bottom"==K.nose?(c+="div.my-modal-"+K.cid+".nose-"+K.nose+":before {left:"+(K.pos.ox-K.pos.px+K.pos.ow/2-K.pos.vx)+"px!important;}",d.text(c)):("left"==K.nose||"right"==K.nose)&&(c+="div.my-modal-"+K.cid+".nose-"+K.nose+":before {top:"+(K.pos.oy-K.pos.py+K.pos.oh/2-K.pos.vy)+"px!important;}",d.text(c))}K.screen?K.global?(z.css({top:0,left:0,width:"100%",height:"100%",display:"block",position:"fixed","z-index":K.z-1}),z.css(l(K.screen)?{background:K.screen?K.screen:"rgba(18,41,72,0.88)"}:{background:K.screen?"rgba(18,41,72,0.88)":""})):z.css({top:0,left:0,position:"absolute",width:z.parent().outerWidth()+"px",height:z.parent().outerHeight()+"px",display:"block",background:l(K.screen)?K.screen:"rgba(255,255,255,0.6)","z-index":K.z-1}):z.length&&z.hide(),K.height>K.pos.wh?(w.height(K.pos.wh-30),x.css({"overflow-y":"scroll"})):x.css({"overflow-y":""}),w.animate({top:K.pos.vy+"px",opacity:"1"},K.animate)}function u(){try{x.my("remove")}catch(b){}try{y.data("modals")[K.cid]=null}catch(b){}x.parent().off(".my").remove(),j(z)&&z.off(".my"+K.cid),K.screen&&j(z)&&function(a){a&&g||z.hide(),a&&!g&&z.css({background:"rgba(18,41,72,0.88)"})}.delay(50,K.global),K.global&&(g=!1,a(document.body).css({overflow:""}))}function v(a){try{I(null,null)}catch(b){}(function(){D.reject(a)}).delay(0)}if(d){if(void 0===e&&void 0===p&&void 0===q)return d.call(this);if(m(e)&&(e.hasOwnProperty("backdrop")||e.hasOwnProperty("keyborad")||e.hasOwnProperty("show")))return d.call(this,e,p);if(l(e)&&/^(toggle|show|hide|handleUpdate)$/.test(e))return d.call(this,e,p)}var w,x,y,z,A,B,C,D=a.Deferred(),E={},F=this,G=0,H=0,I=o(p)?p:function(){return!1},J=m(e)?e:{},K=F.data("modal");if(h(F,D.promise()),K){if(null==e||k(e))return r(e),F;if(J)return v("Locked"),F}return F.is(":visible")?(J=b(E,e,{}))?J.global&&g?(v("Locked"),F):(K=h({type:"DOM",source:"manifest",form:null,modal:null,root:null,bgroot:null,caller:F,manifest:{},data:{},global:!1,screen:!1,drag:!1,focus:!0,close:!0,silent:!0,esc:!1,enter:!1,bound:!1,hardClose:!0,nose:"",width:q||300,height:null,x:"0",y:"0",z:"1901",background:"white",css:"",animate:200},J,{promise:D.promise(),cid:Number.random(268435456,4294967295).toString(16)}),K.done=o(K.done)?K.done:I,l(K.align)&&K.align&&(K.x=(K.align.match(/(left|right):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0],K.y=(K.align.match(/(top|bottom):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0]),K.width=1*(a.my.f.getref(l(K.manifest)?a.my.cache(K.manifest):K.manifest,"params.width")||K.width),K.type="DOM",F.hasClass("my-form")?(K.type="form",K.root=K.root||F):F.data("my")?(K.type="control",K.root=K.root||F.my().root):(K.root=K.root||F.parents(".my-form").eq(0),K.root.length||(K.root=a(f))),K.global?(K.root=a(f),K.bgroot=a(c||f)):K.bgroot=K.bgroot?a(K.bgroot):K.root,y=K.root,y.data("modals")||y.data("modals",{}),s(),w=a('
'),K.root.find(">.my-modal").length?w.insertAfter(K.root.find(">.my-modal").last()):w.prependTo(K.root),w.addClass("my-modal-"+K.cid),G=w.outerWidth(),H=w.outerHeight(),w.hide(),w.html('
'),x=w.find(".my-modal-form"),K.close&&(A=a(l(K.close)?K.close:'
×
').prependTo(w).on("click.my",function(){r(K.hardClose)}),A.css({"z-index":("+"===(K.z+"").to(1)?"+":"")+(1*K.z+1)})),z=K.bgroot.find(">.my-modal-screen"),K.screen&&(z.length||(z=a('').prependTo(K.bgroot)),K.esc&&z.on("click.my"+K.cid,function(){F.modal(!0)}),z.toggleClass("my-modal-screen-global",!!K.global)),F.data("modal",K),K.silent&&w.on("change.my",function(){return!1}),w.css({display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto"}),w.css(K.global?{position:"fixed",left:"50%",top:K.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto","margin-left":"-"+((K.width+G)/2).round(0)+"px"}:{position:"absolute",left:K.pos.vx+"px",top:K.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto"}),x.my(K.manifest,K.data).then(function(){var b,c,d,e,f;if(h(K,{form:x,bg:z,cancel:function(){r(!0)},commit:function(){r()}}),w.data("modal",K),K.height=w.outerHeight(),"manifest"!==K.source&&(K.width=w.width()),s(),w.css({top:K.pos.vy+"px"}),t(!0),w.removeClass("my-modal-init"),y.data("modals")[K.cid]=K,i[K.cid]=D,x.on("commit.my",function(){return K.commit.delay(30),!1}).on("cancel.my",function(){return K.cancel.delay(30),!1}),w.on("layout.my",function(){t()}.debounce(30)),K.global&&(g=F,a(document.body).css({overflow:"hidden"})),K.global||!K.esc&&!K.enter||x.on("keydown.my",function(b){var c=b.keyCode;return 27==c&&K.esc?(K.cancel(),!1):13==c&&K.enter&&!a(b.target).is("textarea")?(K.commit.delay(50),!1):void 0}),K.focus===!0){e=!1,f=K.manifest.ui;for(d in f)e||(c=x.find(d),c.length&&c.is("input, textarea","button")&&(e=!0,c.focus()))}else l(K.focus)&&x.find(K.focus).focus();if(b=x.find("img").filter(function(){return""!=a(this).attr("src")}),b.length){var j=function(){"manifest"!==K.source&&w.css({width:"auto"}),t()}.after(b.length);b.each(function(){a(this).bind("load",j)})}K.drag&&a.fn.draggable&&(l(K.drag)?w.draggable({handle:K.drag}):w.draggable(),K.nose&&w.on("dragstart.my",function(){w.removeClass("nose-"+K.nose)})),w.on("mousedown.my",function(b){var c,d=[],e=a(b.currentTarget),f=e.parent(),g=+e.css("z-index"),h=g;f.length&&(c=f.find(">.my-modal").each(function(c,e){var f=+a(e).css("z-index");e!=b.currentTarget&&f>=g&&d.push([f,a(e)]),f>h&&(h=f)}),d.forEach(function(a){a[1].css("z-index",a[0]-1+"")}),e.css("z-index",h+""))}),D.notify("Ready")}).fail(function(a){try{u()}catch(b){}F.data("modal",null),D.reject(a)}),F):(v("Invalid data"),F):(v("Object must be visible"),F)}}(jQuery); \ No newline at end of file diff --git a/my.jquery.json b/my.jquery.json index 3cac853..8770026 100644 --- a/my.jquery.json +++ b/my.jquery.json @@ -5,7 +5,7 @@ "keywords": [ "MVVM", "framework", "ui", "form", "validation", "data binding" ], - "version": "1.2.10", + "version": "1.2.11", "author": { "name": "ermouth", "url": "https://github.com/ermouth" diff --git a/package.json b/package.json index 0da2a95..17ae56f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jquerymy", - "version": "1.2.10", + "version": "1.2.11", "description": "A lightweight jQuery plugin for complex two-way data binding in real time.", "homepage": "http://jquerymy.com/", "author": "ermouth ",