diff --git a/Release/1.2/jquerymy-1.2.6.js b/Release/1.2/jquerymy-1.2.6.js new file mode 100644 index 0000000..1934e4c --- /dev/null +++ b/Release/1.2/jquerymy-1.2.6.js @@ -0,0 +1,4394 @@ +/* + * jQuery.my 1.2.6 + * Requires jQuery 1.11.0+, SugarJS 1.3.9-1.4.x + * + * — fixes #17, modal detects Bootstrap and pass request through if seems BT needed + * — added beta support for .lang field + * — forms with empty .ui section are initialzed bit more fast + * + * More details at jquerymy.com + * + * (c) @ermouth, thanks @carpogoryanin, @ftescht + * 2016-06-27 + */ + +;(function ($) { + + var _version = "jQuery.my 1.2.6"; + + // 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).size(), + 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.size()-(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.size(); 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.size() && 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) { // container getter + return _traverse($o, MY.containers)($o); + }, + change:N, + recalcDepth:2, // depth of dependencies resolver tree + delay:0, // default delay of bind invocation + strict:false, // if true form assumed unjsonned + restyle:-1, // 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); + } + 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: m.pos.pw+"px", + height: m.pos.ph+"px", + display:"block", + background:isS(m.screen)? m.screen:'rgba(40,80,120,0.6)', + "z-index":m.z-1 + }); + else { + $bg.css({ + top:0, left:0, + //width:(m.pos.ww*2)+"px", + //height:(m.pos.wh*2)+"px", + 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(25, 39, 59, 0.88)' + }); + } + } + else if ($bg.size()) $bg.hide(); + + if (m.height> m.pos.wh) { + $m.height(m.pos.wh-30); + $f.css({"overflow-y":$.browser.webkit?"overlay":"scroll"}); + } else { + $f.css({"overflow-y":"none"}); + } + + $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(); + $bg.off(".my"+ m.cid); + if (m.screen) { + (function(g){ + if (!g || !isOpen) $bg.hide(); + if (!!g && !isOpen) { + // repair screen color + $bg.css({background:'rgba(25, 39, 59, 0.88)'}); + } + }).delay(50, m.global); // curry m.global + } + if (m.global) { + isOpen = false; + $("body")[0].style.overflow = null; + } + } + + // - - - - - - - - - - - - - - - - - - + + function _f(msg) { + try { done(null, null); } catch(e) {} + (function () { pi.reject(msg); }).delay(0); + } + + }; + +})(jQuery); \ No newline at end of file diff --git a/Release/1.2/jquerymy-1.2.6.min.js b/Release/1.2/jquerymy-1.2.6.min.js new file mode 100644 index 0000000..7f0c7f1 --- /dev/null +++ b/Release/1.2/jquerymy-1.2.6.min.js @@ -0,0 +1,5 @@ +/* jQuery.my 1.2.6 + * 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(hb(b)?b.split("."):fb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return ib(a)?Object.values(a).find(function(a){return ib(a)||fb(a)?a[c[0]]==c[1]:!1}):fb(a)?a.find(function(a){return ib(a)||fb(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(hb(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(fb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(ib(a))for(b in a)c[b]=lb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(hb(c)&&(c=c.split(/[,\s]+/)),fb(c)){for(c=c.compact(!0),b=0;b$/.test(x.list)?f=x.list:i=x.list||i,!f){var l=d.find(i);f="
",l.size()&&(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:s,delay:(x.delay||v.delay||10)/1.3,template:f,selector:i,parent:A,bind:x.bind,merge:lb(x.merge)?x.merge.bind(A):x.merge?n:!1,hash:lb(x.hash)?x.hash.bind(A):hb(x.hash)?k.fill(void 0,x.hash):fb(x.hash)?m.fill(void 0,x.hash.slice(0)):null,id:lb(x.id)?x.id.bind(A):hb(x.id)?k.fill(void 0,x.id):fb(x.id)?m.fill(void 0,x.id.slice(0)):null,ext:!(!x.id&&!x.hash),stamp:0},d.on("insert.my",function(b,c){b.stopPropagation();var d={what:void 0,where:0};null==c?d.where=1e6:ib(c)?pb(d,c):(hb(c)||jb(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=J.call(d,q(A,s),ib(e)?e:void 0)}catch(p){j("$.my subform init of "+g+" failed: "+p.message,p.stack)}}mb(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),y&&y.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(C(a,b))}function o(){d.each(function(){var b,c,h,i=a(this),j=!1;if("TEXTAREA"==i[0].nodeName&&(h=i[0].nextSibling,c=h&&h.CodeMirror?h.CodeMirror:null,c&&i.addClass("my-codemirror")),b=x.events||M(i,Bb.events),i.hasClass("my-form")?sb(i.data("my"),{dui:x,root:e,selector:g,dparams:v,devents:b,ddata:u.data,container:v.container(i),derrors:u.errors,single:!0}):(i.data("my",{events:b,selector:g,initial:r,previous:r,root:e,container:v.container(i),id:u.id,ui:x,data:u.data,params:v,errors:u.errors,single:1==B}),f._update=x.delay?N.debounce(x.delay):vb,j=!0),j)if(i.cleditor&&i.parent().hasClass("cleditorMain")){var k=i.cleditor()[0];if(k&&k.$frame&&k.$frame[0]){i.addClass("my-cleditor"),sb(i.data("my"),{container:v.container(i)});var l,m=function(a){i.val(a).trigger(db)},n=Number.random(1e5,1e6-1);a(k.$frame[0]).attr("id","cleditCool"+n),l=document.frames?document.frames["cleditCool"+n].document:a("#cleditCool"+n)[0].contentWindow.document;var o=a(l).find("body");a(l).bind("keyup.my",function(){m(a(this).find("body").html())}),i.parent().find("div.cleditorToolbar").bind("click.my mouseup.my",function(){m(o.html())}),a("body").on("click","div.cleditorPopup",function(){m(o.html())})}}else if(i.is("div.redactor_box textarea")){var p,q="my-redactor-9";try{p=i.getEditor(),q="my-redactor-8"}catch(s){p=i.redactor("getEditor")}p&&(i.addClass(q),p.bind("input.my keyup.my blur.my",function(a){a.trigger("redactor")}.fill(i)))}else i.hasClass("ace_editor")?ace.edit(d[0]).on(db,function(a){a.trigger("ace")}.fill(i)):c&&c.on(db,function(a){a.trigger("codemirror")}.fill(i));i.my()._changed=w.debounce(t),i.my()._recalc=H.debounce(t),i.bind(b,function(a){a.type==db&&a.stopPropagation(),j&&(u.locktill=zb()+f.delay),i.my()._changed(i,e,f,v)}),/check(\.my)?/.test(b+"")||i.on("check.my",function(){return i.my()._changed(i,e,f,v,!0),!1}),j||i.off("redraw.my"),i.on("recalc.my, redraw.my",function(a){a.stopPropagation(),i.my()._recalc(i,e,f,v)})}),y&&y.resolve()}var p,r,s,t,u=e.my(),v=(u||{}).params,x=f,y=null,z=0,A=u.manifest,B=d.size();return u?(t=f.delay,B?(x.init!=vb&&(p=G(A,x.init,d,u)),mb(p)?(z+=1,y=tb(),p.then(i,function(a,b){j("Init of "+g+" failed: "+a,b)})):i()):c("Not found "+g+" selector.",e),y):(b("Failed to find $root building "+g+" selector."),null)}function v(c,d){ib(d)&&d.channel&&d.message&&c.find(".my-listen-"+l(d.channel)).each(function(){var c,e=a(this),f=e.data("my"),g=void 0;if(f&&f.ui.listen&&lb(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 w(a,b,c,d,e){{var f,g=a.data("my");b.data("my")}g&&(g.disabled?g.ddata||N(a,vb,c.recalcDepth||d.recalcDepth):(A(g.ddata||g.data,g.dparams||g.params),e||(f=g.single?a:b.find(g.selector)),N(a,e?vb:z(f,vb),c.recalcDepth||d.recalcDepth),d.change&&d.change.call(a)))}function x(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=M(c,Bb.offon).fill(void 0,c)),e._disable(!!b))}),c}function y(a,b,c){return a[b](c?"disable":"enable")}function z(a,b){var c,d,e=a.data("myval");return e||(d=M(a,Bb.vals),lb(d)&&(c=d(a,vb),void 0===c?a.data("myval",function(a,b){return vb!=b&&d(a,b),a.val()}.fill(a,void 0)):a.data("myval",d.fill(a,void 0))),e=a.data("myval")),lb(e)?(c=e(),(c!==b&&(0==b||0==c)||c!=b||ib(b))&&(c=e(b)),c):vb}function A(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=b;if(!ib(n)||isNaN(h=n.remember)||!ib(e=n.history))return vb;if(ib(a)&&h){if(j=qb(a,!0),k=zb(),g=rb(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(db),n.history[g.last()]}if(!isNaN(a)||a===vb){if(i=parseInt(a)||0,0>i)return vb;if(g=rb(e).sort(),i>=g.length&&(i=g.length-1),l=qb(n.history[g[g.length-i-1]],!0),c){for(m={},f=0;f=i;i++)if(i===h){if(d)return vb!=b?e[f[i]]=b:void 0===e[f[i]]&&(e[f[i]]=vb),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||!ib(e)&&(fb(e)&&!isNaN(f[i+1])&&+f[i]>-1))&&(e=g[f[i]]={});return a}function F(a,b,c){var e=ib(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&&(hb(f.recalc)?l=f.recalc.split(n):fb(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,"watch"))for(hb(f.watch)?m=f.watch.split(n):fb(f.watch)&&(m=f.watch.slice(0)),m=m.compact(!0).unique(),k=0;ki&&h.resolve()}var d,e,f,g=!1,h=tb(),i=a.length;for(e=0;i>e;e++)d=a[e],f=hb(d.ajax)?w.loader:xb,f(d.ajax).then(function(a,d){eb.test(d.ref)&&(null!=a?sb(!0,b,D(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 eb.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=tb(),t=[],u={},v=[],w=sb(!0,{ajaxTimeout:1e4,loader:Bb.params.loader},c||{}),x={ref:null,ajax:{type:"GET",async:!0,timeout:w.ajaxTimeout}};if(ib(b))if(fb(b.require)){for(n=b.require,k=0;k'+d+""}!$.style||b&&!rb.is(":visible")||(R=K(rb,$,S,T),R&&R[0].length&&!b&&(U=a("style#"+S),U.size()||(U=a(c(R[0],S)).appendTo(a("body"))),U.data("count",1*U.data("count")+1),rb.data("my").style=U),R&&R[1].length&&(Y=a("style#"+T),Y.size()?b&&(a(c(R[1],T)).replaceAll(Y),Y=a("style#"+T)):(Y=a(c(R[1],T)).appendTo(a("body")),P.restyle>-1&&!ob[I]&&(ob[I]=function(){p(!0)}.debounce(P.restyle)),rb.data("my").restyle=p.fill(!0).debounce(0)),rb.data("my").localStyle=Y,b||rb.addClass("my-restyle")))}function q(){var a,b,c=!0;if(b=s($),hb(b))A("Error decoding base64 to local Blob/URL",b),c=!1;else{if(V)for(a=0;a*").clone();try{Z=G($,Q.init,rb,Q)}catch(b){return A(hb(b)?b:b.message,b.stack),rb}}if(mb(Z)?Z.then(function(){w()},function(a,b){A(a,b)}):w(),!gb){if(!rb.my())return A("Internal error initializing controls.",""),rb;rb.data("my").initial=sb(!0,{},ab),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function w(){function a(a){gb||(b[a]=z(rb.find(a),vb),d-=1,.5>d&&x(b))}var b={},c=Object.keys(N),d=c.length;0===d?y():(rb.addClass(kb),c.forEach(function(b){if(!gb){var c=rb.find(b),d=u(c,rb,N[b],b);qb[b]=c,mb(d)?d.then(a.fill(b)).fail(function(a,c){A("Error building "+b+", "+a,c)}):gb||a(b)}}))}function x(a){var c,d,e,f,g;for(g in N){if(gb)return;if(c=N[g],e=qb[g],f=e.size()){c.listen&&(db[g]=e.eq(0));try{d=t(ab,vb,c,e),d==vb&&a[g]!=vb&&void 0!==d&&t(ab,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+I+"')",h.message,h.stack)}try{d!=vb&&z(e,d),e.eq(0).trigger("check.my")}catch(h){A("Error linking "+g,h.message,h.stack)}}}y()}function y(){rb.removeClass(kb),rb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),rb.my("redraw")}),pb=null,eb.resolve(ab)}function A(a,c){var d;if(gb=!0,b("Form "+H+" failed to initialize.",a,c),Object.keys(qb).forEach(function(a){delete qb[a]}),rb.removeClass(kb),d=jb(a,c),hb(d)||ib(d)&&d.jquery?rb.html(d):d===!0&&rb.html(pb),P.silent)eb.resolve(ab);else{if(!rb.my().ddata){if(rb.removeData("my"),rb.removeClass("my-form"),U)if("1"==U.data("count"))try{U.remove()}catch(e){}else U.data("count",U.data("count")-1);if(Y)try{delete ob[I],Y.remove()}catch(e){}}eb.reject("Form "+H+" failed to initialize: "+a,c)}}var C,E,H,I,J,M,N,P,Q,R,S,T,U,Y,Z,$={},ab={},bb=null,cb=[],db={},eb=tb(),gb=!1,jb=function(){},kb="my-form-init",nb="std",pb="",qb={};if(hb(d)){if(C=yb(d),!C)return eb.reject("No manifest with id "+d+" found in repo."),eb.promise();ib(f)&&ib(e)?(C=sb(C,e),E=f):E=e,nb="repo"}else C=d,E=e;if(!C)return this;Q=ib(E)&&"repo"!=nb?sb(!0,{},C):C;var rb=this.eq(0),ub=rb.my();return ib(ub)&&ub.id&&ub.ui?(c("jQuery.my is already bound.",rb),rb.my("ui",Q.ui),rb.my(_,Q.data),eb.resolve(rb.my(_)).promise()):(P=Q.params||{},P.strict||lb(Q.init)||(P=sb(!0,{},P),O(P)),P=sb(!0,{},Bb.params,P),eb.fail(function(){rb.removeClass(T+" "+S)}),sb(rb,eb.promise()),ib(E)?(ab=m(E,Q.data||{}),Q.data=ab):ab=Q.data||{},$.data=ab,rb.data("my",{data:ab,params:P,promise:eb.promise(),locktill:0}),rb.addClass(kb),Q.inherit&&i(Q),fb(Q.require)?Ab(Q,P).then(g).fail(function(a){o(),A("Linker of the ‘require’ property failed.",a)}):g(),eb.then(n),rb)}function K(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=lb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),hb(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Cb.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),fb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==$&&c(a,i,g+1)}vb!=b[""]&&typeof b[""]!=$&&g>e&&(d=b[""],e=g)}var d=vb,e=0,f="";return c(a,b,1),d}function N(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q=!1,r=!1,s=a,u=s.my(),v="";if(u){if(m=u.selector,n=u.root,n.hasClass("my-form-init"))return{};if(o=n.find(m),p=n.my().ui,q=a.hasClass("my-form"),q?(f=a,g=u.ddata,h=u.dui,i=u.dparams):(f=u.container,g=u.data,h=u.ui,i=u.params),h.bind!=vb){if(j=wb(c)?c:z(o,t(g,vb,h,o)),vb!=h.check){v="Unknown error";try{v=T(g,j,h,o)}catch(w){b("Error "+w.message+" in .check validator for "+m,n,w.stack)}}var y=i.errorCss,A="ui-state-error";try{vb!=c&&(j=z(o,t(g,c,h,o)))}catch(w){v=i.messages.formError||"Error"}if(vb!=h.check)if(r=a.hasClass("my-form-list"),""==v&&(q||f.hasClass(y)))q?u.derrors[m]="":u.errors[m]="",f.removeClass(y),f.attr("title")&&f.attr("title",""),q||r||i.effect(f.find(i.errorTip),!1,i.animate/2),s.removeClass(A),s.find(".ui-widget").removeClass(A);else if(v){if(q)u.derrors[m]=v;else if(r)u.errors[m]=v;else{f.addClass(y),u.errors[m]=v;var B=f.find(i.errorTip).eq(0);B.size()?i.effect(B.addClass(y).html(hb(v)?v:"Error"),!0,i.animate):f.attr("title",(hb(v)?v:"Error").stripTags())}s.hasClass("hasDatepicker")&&(s.is("input")?s.addClass(A):s.find(".ui-widget").addClass(A)),s.hasClass("ui-slider")&&s.addClass(A)}}var C=c==vb?j:c;if(h.css)for(k in h.css)l=h.css[k],kb(l)?x(l.test(C),o,k):lb(l)&&x(l.call(n.my().manifest,g,C,o),o,k);var e,D,E=h.recalc,F=[],G={};if(d&&h.recalc&&n.my()){for(p=n.my().ui,e=0;e-1?"":n;case"s":return c==k?"":n;case"o":return k[c]?"":n;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},e.find(h).filter("*:not(.ui-sortable-placeholder)").each(function(b){var c=a(this);c.data("my")&&!c.my("valid")&&(j[b]=c.my("errors"))}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return l.formError||"Error"}return""}var U="jQuery.my 1.2.6",V=window.URL||window.webkitURL,W=!document.addEventListener,X=((window.navigator.language||window.navigator.userLanguage||"en")+"").split("-")[0].toLowerCase(),Y="{yyyy}-{MM}-{dd}",Z="{HH}:{mm}",$="object",_="data",ab="array",bb="string",cb="function",db="change",eb=/^this\./,fb=Object.isArray,gb=Object.isBoolean,hb=Object.isString,ib=Object.isObject,jb=Object.isNumber,kb=Object.isRegExp,lb=Object.isFunction,mb=function(a){return null!=a&&typeof a==$&&lb(a.then)},nb=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},ob=h(a,"my.f.restyles")?a.my.f.restyles():{},pb=Object.merge,qb=Object.clone,rb=Object.keys,sb=a.extend,tb=a.Deferred,ub=a.type,vb=null,wb=function(a){return null!==a&&void 0!==a},xb=a.ajax,yb=p,zb=Date.now,Ab=I,Bb={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my(_);return Object.equal(c,b)?c:a.my(_,b,!0)}return b||vb},".hasDatepicker":function(a,b){wb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(Y):""},".my-tags":function(a,b){return wb(b)&&(hb(b)||jb(b)?a.tags(_,[b+""]):fb(b)&&a.tags(_,b)),a.tags(_)},".ui-draggable":function(a,b){if(wb(b)&&ib(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=!!r.merge,u=r.template||"
",v=/\{/.test(u),w=r.hash||l,x=r.id||l,y=r.ext,z=r.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).size(),E=[],F=[],G=zb(),H=b.find(C?b.sortable("option","items"):s);if(wb(c)&&fb(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=[],K=[],L={},M={};for(F=[],h=0;h1.4*z||G-r.stamp>100||!r.stashed||r.stashed.length!==H.size()-(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){y(b,"selectable",a)},".ui-slider":function(a,b){y(b,"slider",a)},".ui-draggable":function(a,b){y(b,"draggable",a)},".ui-buttonset":function(a,b){y(b,"buttonset",a)},".hasDatepicker":function(a,b){y(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){y(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")}}}};Bb.params={container:function(a){return M(a,Bb.containers)(a)},change:vb,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:X,messages:Object.map(Bb.msg,function(a,b){return b[X]||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=tb(),c=yb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Cb={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:y,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&&hb(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===cb)return b(a.toJSON(),m+(g?1:0),g);if(h=[],fb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),lb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=hb(b)?b:a.my.tojson(b),g=hb(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Cb.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:K,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}},Db={container:function(a){return M(a,Bb.containers)(a)},data:function(a,b){var c=this;return ib(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==vb)return g.disabled;if(a){for(c in g.ui)b=f.find(c).eq(0),d=b.my(),d&&(d.predisabled=d.disabled),x(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=f.find(c).eq(0),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),x(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]&&hb(b[d])&&(c[d]=b[d]),ib(b[d])&&rb(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 A(a,this.my().params,b)},id:function(a,b){if(hb(a))return yb(a,b);var c=this.my();return c&&c.id?c.id:vb},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:J,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=eb.test(j.bind)?h(f.my().manifest,j.bind.replace(eb,"")):h(f.my().data,j.bind),!ib(i))if(ib(j.manifest))i=qb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=qb(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?Cb.tojson(this.my().manifest):this.my().manifest},promise:function(a){return lb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",hb(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my();return d&&d.ui&&(d.ui.each(function(b){var e=c.find(b);N(e,a?vb:void 0,d.params.recalcDepth),a||(e.is(".my-form")&&e.my("redraw"),e.trigger(e.is(".my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(db)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return vb;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"),ib(d)&&d.manifest&&lb(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 ob[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?vb:(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=A(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return z(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&hb(b[d])?c++:ib(b[d])&&rb(b[d]).length&&c++;return!c},version:function(){return U}},Eb=Object.keys(Db);a.my||(a.my={}),sb(a.my,{f:a.extend({},Cb),tojson:Cb.tojson,fromjson:Cb.fromjson,radio:function(b,c){v(a(document),hb(b)?{channel:b,message:c}:b)},rules:Bb,locale:function(a){return hb(a)?(X=a.toLowerCase(),void 0):X},ajax:function(a){return lb(a)?xb=a:xb.apply(this,f(arguments,0))},cache:function(a,b){return lb(a)?yb=a:yb(a,b)},now:function(a){return lb(a)?(zb=a,void 0):zb()},require:function(a){return lb(a)?Ab=a:Ab.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()}mb(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 U}}),a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(hb(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Db.init.apply(this,[c].add(f(arguments,1)))}return hb(b)&&Db[b]?Db[b].apply(this,f(arguments,1)):hb(b)&&yb(b,"exist")?Db.init.apply(this,arguments):typeof b!==$&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Db.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),v(a(document),c)}).on("resize.my",function(){for(var a in ob)try{ob[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.size()||(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).size()?(f=b,void 0):a(f)},e.modal.parentBack=function(b){return b&&a(b).size()?(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:J.pos.pw+"px",height:J.pos.ph+"px",display:"block",background:l(J.screen)?J.screen:"rgba(40,80,120,0.6)","z-index":J.z-1}):y.size()&&y.hide(),J.height>J.pos.wh?(v.height(J.pos.wh-30),w.css({"overflow-y":a.browser.webkit?"overlay":"scroll"})):w.css({"overflow-y":"none"}),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("body")[0].style.overflow=null)}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.size()||(J.root=a(f))),J.global?(J.root=a(f),J.bgroot=a(c||f)):J.bgroot=J.root,x=J.root,x.data("modals")||x.data("modals",{}),r(),v=a('
'),J.root.find(">.my-modal").size()?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.size()||(y=a('').prependTo(J.root)),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),x.data("modals")[J.cid]=J,i[J.cid]=C,w.bind("commit.my",function(){return J.commit.delay(50),!1}).bind("cancel.my",function(){return J.cancel.delay(50),!1}),v.bind("layout.my",function(){s()}.debounce(50)),J.global&&(g=E,a("body").css({overflow:"hidden"})),J.global||!J.esc&&!J.enter||w.bind("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.size()&&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.size()){var j=function(){"manifest"!==J.source&&v.css({width:"auto"}),s()}.after(b.size());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.size()&&(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 diff --git a/Release/jquery.my.last.js b/Release/jquery.my.last.js index 0db28cf..7f0c7f1 100644 --- a/Release/jquery.my.last.js +++ b/Release/jquery.my.last.js @@ -1,5 +1,5 @@ -/* jQuery.my 1.2.5 - * Requires jQuery 1.11.0+, SugarJS 1.3.9-1.4.x +/* jQuery.my 1.2.6 + * 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(gb(b)?b.split("."):eb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return hb(a)?Object.values(a).find(function(a){return hb(a)||eb(a)?a[c[0]]==c[1]:!1}):eb(a)?a.find(function(a){return hb(a)||eb(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(gb(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(eb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(hb(a))for(b in a)c[b]=kb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(gb(c)&&(c=c.split(/[,\s]+/)),eb(c)){for(c=c.compact(!0),b=0;b$/.test(x.list)?f=x.list:i=x.list||i,!f){var l=d.find(i);f="
",l.size()&&(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:s,delay:(x.delay||v.delay||10)/1.3,template:f,selector:i,parent:A,bind:x.bind,merge:kb(x.merge)?x.merge.bind(A):x.merge?n:!1,hash:kb(x.hash)?x.hash.bind(A):gb(x.hash)?k.fill(void 0,x.hash):eb(x.hash)?m.fill(void 0,x.hash.slice(0)):null,id:kb(x.id)?x.id.bind(A):gb(x.id)?k.fill(void 0,x.id):eb(x.id)?m.fill(void 0,x.id.slice(0)):null,ext:!(!x.id&&!x.hash),stamp:0},d.on("insert.my",function(b,c){b.stopPropagation();var d={what:void 0,where:0};null==c?d.where=1e6:hb(c)?ob(d,c):(gb(c)||ib(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=I.call(d,q(A,s),hb(e)?e:void 0)}catch(p){j("$.my subform init of "+g+" failed: "+p.message,p.stack)}}lb(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),y&&y.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(B(a,b))}function o(){d.each(function(){var b,c,h,i=a(this),j=!1;if("TEXTAREA"==i[0].nodeName&&(h=i[0].nextSibling,c=h&&h.CodeMirror?h.CodeMirror:null,c&&i.addClass("my-codemirror")),b=x.events||L(i,Ab.events),i.hasClass("my-form")?rb(i.data("my"),{dui:x,root:e,selector:g,dparams:v,devents:b,ddata:u.data,container:v.container(i),derrors:u.errors,single:!0}):(i.data("my",{events:b,selector:g,initial:r,previous:r,root:e,container:v.container(i),id:u.id,ui:x,data:u.data,params:v,errors:u.errors,single:1==C}),f._update=x.delay?M.debounce(x.delay):ub,j=!0),j)if(i.cleditor&&i.parent().hasClass("cleditorMain")){var k=i.cleditor()[0];if(k&&k.$frame&&k.$frame[0]){i.addClass("my-cleditor"),rb(i.data("my"),{container:v.container(i)});var l,m=function(a){i.val(a).trigger(cb)},n=Number.random(1e5,1e6-1);a(k.$frame[0]).attr("id","cleditCool"+n),l=document.frames?document.frames["cleditCool"+n].document:a("#cleditCool"+n)[0].contentWindow.document;var o=a(l).find("body");a(l).bind("keyup.my",function(){m(a(this).find("body").html())}),i.parent().find("div.cleditorToolbar").bind("click.my mouseup.my",function(){m(o.html())}),a("body").on("click","div.cleditorPopup",function(){m(o.html())})}}else if(i.is("div.redactor_box textarea")){var p,q="my-redactor-9";try{p=i.getEditor(),q="my-redactor-8"}catch(s){p=i.redactor("getEditor")}p&&(i.addClass(q),p.bind("input.my keyup.my blur.my",function(a){a.trigger("redactor")}.fill(i)))}else i.hasClass("ace_editor")?ace.edit(d[0]).on(cb,function(a){a.trigger("ace")}.fill(i)):c&&c.on(cb,function(a){a.trigger("codemirror")}.fill(i));i.my()._changed=w.debounce(t),i.my()._recalc=G.debounce(t),i.bind(b,function(a){a.type==cb&&a.stopPropagation(),j&&(u.locktill=yb()+f.delay),i.my()._changed(i,e,f,v)}),/check(\.my)?/.test(b+"")||i.on("check.my",function(){return i.my()._changed(i,e,f,v,!0),!1}),j||i.off("redraw.my"),i.on("recalc.my, redraw.my",function(a){a.stopPropagation(),i.my()._recalc(i,e,f,v)})}),y&&y.resolve()}var p,r,s,t,u=e.my(),v=(u||{}).params,x=f,y=null,z=0,A=u.manifest,C=d.size();return u?(t=f.delay,C?(x.init!=ub&&(p=F(A,x.init,d,u)),lb(p)?(z+=1,y=sb(),p.then(i,function(a,b){j("Init of "+g+" failed: "+a,b)})):i()):c("Not found "+g+" selector.",e),y):(b("Failed to find $root building "+g+" selector."),null)}function v(c,d){hb(d)&&d.channel&&d.message&&c.find(".my-listen-"+l(d.channel)).each(function(){var c,e=a(this),f=e.data("my"),g=void 0;if(f&&f.ui.listen&&kb(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 w(a,b,c,d,e){{var f,g=a.data("my");b.data("my")}g&&(g.disabled?g.ddata||M(a,ub,c.recalcDepth||d.recalcDepth):(A(g.ddata||g.data,g.dparams||g.params),e||(f=g.single?a:b.find(g.selector)),M(a,e?ub:z(f,ub),c.recalcDepth||d.recalcDepth),d.change&&d.change.call(a)))}function x(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=L(c,Ab.offon).fill(void 0,c)),e._disable(!!b))}),c}function y(a,b,c){return a[b](c?"disable":"enable")}function z(a,b){var c,d,e=a.data("myval");return e||(d=L(a,Ab.vals),kb(d)&&(c=d(a,ub),void 0===c?a.data("myval",function(a,b){return ub!=b&&d(a,b),a.val()}.fill(a,void 0)):a.data("myval",d.fill(a,void 0))),e=a.data("myval")),kb(e)?(c=e(),(c!==b&&(0==b||0==c)||c!=b||hb(b))&&(c=e(b)),c):ub}function A(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=b;if(!hb(n)||isNaN(h=n.remember)||!hb(e=n.history))return ub;if(hb(a)&&h){if(j=pb(a,!0),k=yb(),g=qb(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(cb),n.history[g.last()]}if(!isNaN(a)||a===ub){if(i=parseInt(a)||0,0>i)return ub;if(g=qb(e).sort(),i>=g.length&&(i=g.length-1),l=pb(n.history[g[g.length-i-1]],!0),c){for(m={},f=0;f=i;i++)if(i===h){if(d)return ub!=b?e[f[i]]=b:void 0===e[f[i]]&&(e[f[i]]=ub),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||!hb(e)&&(eb(e)&&!isNaN(f[i+1])&&+f[i]>-1))&&(e=g[f[i]]={});return a}function E(a,b,c){var e=hb(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&&(gb(f.recalc)?l=f.recalc.split(n):eb(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,"watch"))for(gb(f.watch)?m=f.watch.split(n):eb(f.watch)&&(m=f.watch.slice(0)),m=m.compact(!0).unique(),k=0;ki&&h.resolve()}var d,e,f,g=!1,h=sb(),i=a.length;for(e=0;i>e;e++)d=a[e],f=gb(d.ajax)?w.loader:wb,f(d.ajax).then(function(a,d){db.test(d.ref)&&(null!=a?rb(!0,b,C(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 db.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=sb(),t=[],u={},v=[],w=rb(!0,{ajaxTimeout:1e4,loader:Ab.params.loader},c||{}),x={ref:null,ajax:{type:"GET",async:!0,timeout:w.ajaxTimeout}};if(hb(b))if(eb(b.require)){for(n=b.require,k=0;k'+d+""}!Y.style||b&&!pb.is(":visible")||(Q=J(pb,Y,R,S),Q&&Q[0].length&&!b&&(T=a("style#"+R),T.size()||(T=a(c(Q[0],R)).appendTo(a("body"))),T.data("count",1*T.data("count")+1),pb.data("my").style=T),Q&&Q[1].length&&(U=a("style#"+S),U.size()?b&&(a(c(Q[1],S)).replaceAll(U),U=a("style#"+S)):(U=a(c(Q[1],S)).appendTo(a("body")),M.restyle>-1&&!nb[G]&&(nb[G]=function(){p(!0)}.debounce(M.restyle)),pb.data("my").restyle=p.fill(!0).debounce(0)),pb.data("my").localStyle=U,b||pb.addClass("my-restyle")))}function q(){var a,b,c=!0;if(b=s(Y),gb(b))y("Error decoding base64 to local Blob/URL",b),c=!1;else{if(V)for(a=0;a*").clone();try{X=F(Y,O.init,pb,O)}catch(b){return y(gb(b)?b:b.message,b.stack),pb}}if(lb(X)?X.then(function(){w()},function(a,b){y(a,b)}):w(),!db){if(!pb.my())return y("Internal error initializing controls.",""),pb;pb.data("my").initial=rb(!0,{},Z),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function w(){function a(a){db||(b[a]=z(pb.find(a),ub),c-=1,.5>c&&x(b))}var b={},c=Object.size(L);pb.addClass(ib),Object.each(L,function(b){if(!db){var c=pb.find(b),d=u(c,pb,L[b],b);ob[b]=c,lb(d)?d.then(a.fill(b)).fail(function(a,c){y("Error building "+b+", "+a,c)}):db||a(b)}})}function x(a){var c,d,e,f,g;for(g in L){if(db)return;if(c=L[g],e=ob[g],f=e.size()){c.listen&&(bb[g]=e.eq(0));try{d=t(Z,ub,c,e),d==ub&&a[g]!=ub&&void 0!==d&&t(Z,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+G+"')",h.message,h.stack)}try{d!=ub&&z(e,d),e.eq(0).trigger("check.my")}catch(h){y("Error linking "+g,h.message,h.stack)}}}pb.removeClass(ib),pb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),pb.my("redraw")}),mb=null,cb.resolve(Z)}function y(a,c){var d;if(db=!0,b("Form "+D+" failed to initialize.",a,c),Object.keys(ob).forEach(function(a){delete ob[a]}),pb.removeClass(ib),d=fb(a,c),gb(d)||hb(d)&&d.jquery?pb.html(d):d===!0&&pb.html(mb),M.silent)cb.resolve(Z);else{if(!pb.my().ddata){if(pb.removeData("my"),pb.removeClass("my-form"),T)if("1"==T.data("count"))try{T.remove()}catch(e){}else T.data("count",T.data("count")-1);if(U)try{delete nb[G],U.remove()}catch(e){}}cb.reject("Form "+D+" failed to initialize: "+a,c)}}var A,B,D,G,H,I,L,M,O,P,Q,R,S,T,U,X,Y={},Z={},_=null,ab=[],bb={},cb=sb(),db=!1,fb=function(){},ib="my-form-init",jb="std",mb="",ob={};if(gb(d)){if(A=xb(d),!A)return cb.reject("No manifest with id "+d+" found in repo."),cb.promise();hb(f)&&hb(e)?(A=rb(A,e),B=f):B=e,jb="repo"}else A=d,B=e;if(!A)return this;O=hb(B)&&"repo"!=jb?rb(!0,{},A):A;var pb=this.eq(0),qb=pb.my();return hb(qb)&&qb.id&&qb.ui?(c("jQuery.my is already bound.",pb),pb.my("ui",O.ui),pb.my($,O.data),cb.resolve(pb.my($)).promise()):(M=O.params||{},M.strict||kb(O.init)||(M=rb(!0,{},M),N(M)),M=rb(!0,{},Ab.params,M),cb.fail(function(){pb.removeClass(S+" "+R)}),rb(pb,cb.promise()),hb(B)?(Z=m(B,O.data||{}),O.data=Z):Z=O.data||{},Y.data=Z,pb.data("my",{data:Z,params:M,promise:cb.promise(),locktill:0}),pb.addClass(ib),O.inherit&&i(O),eb(O.require)?zb(O,M).then(g).fail(function(a){o(),y("Linker of the ‘require’ property failed.",a)}):g(),cb.then(n),pb)}function J(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=kb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),gb(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Bb.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),eb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==Z&&c(a,i,g+1)}ub!=b[""]&&typeof b[""]!=Z&&g>e&&(d=b[""],e=g)}var d=ub,e=0,f="";return c(a,b,1),d}function M(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q=!1,r=!1,s=a,u=s.my(),v="";if(u){if(m=u.selector,n=u.root,n.hasClass("my-form-init"))return{};if(o=n.find(m),p=n.my().ui,q=a.hasClass("my-form"),q?(f=a,g=u.ddata,h=u.dui,i=u.dparams):(f=u.container,g=u.data,h=u.ui,i=u.params),h.bind!=ub){if(j=vb(c)?c:z(o,t(g,ub,h,o)),ub!=h.check){v="Unknown error";try{v=S(g,j,h,o)}catch(w){b("Error "+w.message+" in .check validator for "+m,n,w.stack)}}var y=i.errorCss,A="ui-state-error";try{ub!=c&&(j=z(o,t(g,c,h,o)))}catch(w){v=i.messages.formError||"Error"}if(ub!=h.check)if(r=a.hasClass("my-form-list"),""==v&&(q||f.hasClass(y)))q?u.derrors[m]="":u.errors[m]="",f.removeClass(y),f.attr("title")&&f.attr("title",""),q||r||i.effect(f.find(i.errorTip),!1,i.animate/2),s.removeClass(A),s.find(".ui-widget").removeClass(A);else if(v){if(q)u.derrors[m]=v;else if(r)u.errors[m]=v;else{f.addClass(y),u.errors[m]=v;var B=f.find(i.errorTip).eq(0);B.size()?i.effect(B.addClass(y).html(gb(v)?v:"Error"),!0,i.animate):f.attr("title",(gb(v)?v:"Error").stripTags())}s.hasClass("hasDatepicker")&&(s.is("input")?s.addClass(A):s.find(".ui-widget").addClass(A)),s.hasClass("ui-slider")&&s.addClass(A)}}var C=c==ub?j:c;if(h.css)for(k in h.css)l=h.css[k],jb(l)?x(l.test(C),o,k):kb(l)&&x(l.call(n.my().manifest,g,C,o),o,k);var e,D,E=h.recalc,F=[],G={};if(d&&h.recalc&&n.my()){for(p=n.my().ui,e=0;e-1?"":n;case"s":return c==k?"":n;case"o":return k[c]?"":n;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},e.find(h).filter("*:not(.ui-sortable-placeholder)").each(function(b){var c=a(this);c.data("my")&&!c.my("valid")&&(j[b]=c.my("errors"))}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return l.formError||"Error"}return""}var T,U="jQuery.my 1.2.5",V=window.URL||window.webkitURL,W=!document.addEventListener,X="{yyyy}-{MM}-{dd}",Y="{HH}:{mm}",Z="object",$="data",_="array",ab="string",bb="function",cb="change",db=/^this\./,eb=Object.isArray,fb=Object.isBoolean,gb=Object.isString,hb=Object.isObject,ib=Object.isNumber,jb=Object.isRegExp,kb=Object.isFunction,lb=function(a){return null!=a&&typeof a==Z&&kb(a.then)},mb=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},nb=h(a,"my.f.restyles")?a.my.f.restyles():{},ob=Object.merge,pb=Object.clone,qb=Object.keys,rb=a.extend,sb=a.Deferred,tb=a.type,ub=null,vb=function(a){return null!==a&&void 0!==a},wb=a.ajax,xb=p,yb=Date.now,zb=H,Ab={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my($);return Object.equal(c,b)?c:a.my($,b,!0)}return b||ub},".hasDatepicker":function(a,b){vb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(X):""},".my-tags":function(a,b){return vb(b)&&(gb(b)||ib(b)?a.tags($,[b+""]):eb(b)&&a.tags($,b)),a.tags($)},".ui-draggable":function(a,b){if(vb(b)&&hb(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=!!r.merge,u=r.template||"
",v=/\{/.test(u),w=r.hash||l,x=r.id||l,y=r.ext,z=r.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).size(),E=[],F=[],G=yb(),H=b.find(C?b.sortable("option","items"):s);if(vb(c)&&eb(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 J=[],K=[],L={},M={};for(F=[],h=0;h1.4*z||G-r.stamp>100||!r.stashed||r.stashed.length!==H.size()-(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:T},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){y(b,"selectable",a)},".ui-slider":function(a,b){y(b,"slider",a)},".ui-draggable":function(a,b){y(b,"draggable",a)},".ui-buttonset":function(a,b){y(b,"buttonset",a)},".hasDatepicker":function(a,b){y(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){y(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")}}}};Ab.params={container:function(a){return L(a,Ab.containers)(a)},change:ub,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:T=(navigator.language||navigator.userLanguage||"en").substr(0,2),messages:Object.map(Ab.msg,function(a,b){return b[T]||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=sb(),c=xb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Bb={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:y,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&&gb(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===bb)return b(a.toJSON(),m+(g?1:0),g);if(h=[],eb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),kb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=gb(b)?b:a.my.tojson(b),g=gb(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Bb.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:J,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}},Cb={container:function(a){return L(a,Ab.containers)(a)},data:function(a,b){var c=this;return hb(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==ub)return g.disabled;if(a){for(c in g.ui)b=f.find(c).eq(0),d=b.my(),d&&(d.predisabled=d.disabled),x(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=f.find(c).eq(0),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),x(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]&&gb(b[d])&&(c[d]=b[d]),hb(b[d])&&qb(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 A(a,this.my().params,b)},id:function(a,b){if(gb(a))return xb(a,b);var c=this.my();return c&&c.id?c.id:ub},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:I,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=db.test(j.bind)?h(f.my().manifest,j.bind.replace(db,"")):h(f.my().data,j.bind),!hb(i))if(hb(j.manifest))i=pb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=pb(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?Bb.tojson(this.my().manifest):this.my().manifest},promise:function(a){return kb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",gb(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my();return d&&d.ui&&(d.ui.each(function(b){var e=c.find(b);M(e,a?ub:void 0,d.params.recalcDepth),a||(e.is(".my-form")&&e.my("redraw"),e.trigger(e.is(".my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(cb)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return ub;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"),hb(d)&&d.manifest&&kb(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 nb[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?ub:(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=A(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return z(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&gb(b[d])?c++:hb(b[d])&&qb(b[d]).length&&c++;return!c},version:function(){return U}},Db=Object.keys(Cb);a.my||(a.my={}),rb(a.my,{f:a.extend({},Bb),tojson:Bb.tojson,fromjson:Bb.fromjson,radio:function(b,c){v(a(document),gb(b)?{channel:b,message:c}:b)},rules:Ab,ajax:function(a){return kb(a)?wb=a:wb.apply(this,f(arguments,0))},cache:function(a,b){return kb(a)?xb=a:xb(a,b)},now:function(a){return kb(a)?(yb=a,void 0):yb()},require:function(a){return kb(a)?zb=a:zb.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()}lb(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 U}}),a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(gb(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Cb.init.apply(this,[c].add(f(arguments,1)))}return gb(b)&&Cb[b]?Cb[b].apply(this,f(arguments,1)):gb(b)&&xb(b,"exist")?Cb.init.apply(this,arguments):typeof b!==Z&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Cb.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),v(a(document),c)}).on("resize.my",function(){for(var a in nb)try{nb[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,h,i,j,m,n,o;if("object"==typeof c&&c.jquery)c.is("img")&&(n=c,m=c.attr("alt")||c.attr("title")||c.data("text")||"",h=n[0].naturalWidth||n[0].width,f=n[0].naturalHeight||n[0].height,1>f&&(f=1),1>h&&(h=1),j=a(window).width()-90,i=a(window).height()-90,f>i&&(h=h*(i/f)|0,f=i),h>j&&(h=j,f=f*(j/h)|0),o=300>h?300:h,g(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:m},esc:!0,screen:!0,width:e||o,focus:!1,global:!0,z:"1995"},d));else if(l(c)&&c.manifest)g(b,c,d);else{if(!k(c))return null;g(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="body",f=!1,g=a.extend,h={},i=a.my.f.indom,j=(Object.isArray,Object.isBoolean),k=Object.isString,l=Object.isObject,m=Object.isNumber,n=(Object.isRegExp,Object.isFunction);if(a(document).off(".modal"),a(document).on("keydown.modal",function(a){var b,c,d=a.keyCode;if(!1!==f&&(13===d||27===d)){if(c=f.data("modal"),b=c.form,27==d&&(c.esc||Object.equal(b.data("my").initial,b.my("data"))))return f.modal(!0),!1;if(13==d&&c.enter)return function(a){a.modal()}.fill(f).delay(50),!1}}),n(a.my.f.getref(a,"my.modal.parent"))){var o=a.my.f.getref(a,"my.modal.parent")().attr("id");o&&(e="#"+o)}d.modal=function(c,d,g){var h,i={},k=a(e),l=k.find(">.my-modal-proxy"),m={global:!0,screen:!0,done:n(d)?d:void 0,z:"1995"};return j(c)||null==c?l.modal(c):(h=a.Deferred(),b(i,c,m,g)?f?h.reject("Locked").promise():(l.size()||(l=a('
').prependTo(k),l.css({position:"absolute",top:"0",left:"0",margin:"0",padding:"0",width:"1px",height:"0"})),l.modal(i)):h.reject("Invalid data").promise())},d.modal.loading=function(b){a(e).find(">.my-modal").toggleClass("my-modal-loading",!!b)},d.modal.parent=function(b){return b&&a(b).size()?(e=b,void 0):a(e)},d.modal.parentBack=function(b){return b&&a(b).size()?(c=b,void 0):a(c||e)},d.modal.visible=function(){return!!f},a.my||(a.my={}),a.my.modal=d.modal,a.fn.modal=function(d,o,p){function q(){var b,c,d=window,e=!!I.global,f=w.offset(),g=D.offset(),h=w.scrollTop();I.pos={px:f.left,py:f.top,pw:w.outerWidth(),ph:w.outerHeight(),ox:g.left,oy:g.top,ow:D.outerWidth(),oh:D.outerHeight(),ww:c,wh:b};var i=1*(I.x.match(/\-?\d+(\.\d+)?/)||[0])[0],j=1*(I.y.match(/\-?\d+(\.\d+)?/)||[0])[0],k=I.x.has("left")?-1:I.x.has("right")?1:0,l=I.y.has("top")?-1:I.y.has("bottom")?1:0,n=I.pos.ox+I.pos.ow/2-I.pos.px,o=I.pos.oy+I.pos.oh/2-I.pos.py;if(e&&(I.pos.wh=b=d.innerHeight||a(d).height(),I.pos.ww=c=d.innerWidth||a(d).width(),n=c/2,o=b/2.5),i=I.x.has("%")?I.pos.ow/100*i:i,j=I.y.has("%")?I.pos.oh/100*j:j,I.pos.pix=n,I.pos.piy=o,n=n+k*(I.pos.ow/2)+i*(k>0?-1:1)-(I.width+E)*(k+1)/2,e?(o=(b-I.height-20)/3,10>o&&(o=10)):o=o+l*(I.pos.oh/2)+j*(l>0?-1:1)-(I.height||0)*(l+1)/2,n=n.round(1),o=(o+h).round(1),I.pos.vx=n,I.pos.vy=o,I.bound!==!1&&!I.global){var p=(m(I.bound)?I.bound:0).clamp(-100,100);I.pos.pw-2*pI.pos.pw-p?I.pos.vx=I.pos.pw-p-I.width-E:I.pos.vxI.pos.ph-p?I.pos.vy=I.pos.ph-p-I.height:I.pos.vy');var c="",d=a("style#my-modal-style-"+I.cid);("top"==I.nose||"bottom"==I.nose)&&(c+="div.my-modal-"+I.cid+".nose-"+I.nose+":before {left:"+(I.pos.ox-I.pos.px+I.pos.ow/2-I.pos.vx)+"px!important;}",d.text(c)),("left"==I.nose||"right"==I.nose)&&(c+="div.my-modal-"+I.cid+".nose-"+I.nose+":before {top:"+(I.pos.oy-I.pos.py+I.pos.oh/2-I.pos.vy)+"px!important;}",d.text(c))}I.screen?I.global?(x.css({top:0,left:0,width:"100%",height:"100%",display:"block",position:"fixed","z-index":I.z-1}),k(I.screen)&&x.css({background:I.screen?I.screen:"rgba(25, 39, 59, 0.88)"})):x.css({top:0,left:0,position:"absolute",width:I.pos.pw+"px",height:I.pos.ph+"px",display:"block",background:k(I.screen)?I.screen:"rgba(40,80,120,0.6)","z-index":I.z-1}):x.size()&&x.hide(),I.height>I.pos.wh?(u.height(I.pos.wh-30),v.css({"overflow-y":a.browser.webkit?"overlay":"scroll"})):v.css({"overflow-y":"none"}),u.animate({top:I.pos.vy+"px",opacity:"1"},I.animate)}function s(){try{v.my("remove")}catch(b){}try{w.data("modals")[I.cid]=null}catch(b){}v.parent().off(".my").remove(),x.off(".my"+I.cid),I.screen&&function(a){a&&f||x.hide(),a&&!f&&x.css({background:"rgba(25, 39, 59, 0.88)"})}.delay(50,I.global),I.global&&(f=!1,a("body")[0].style.overflow=null)}function t(a){try{G(null,null)}catch(b){}(function(){B.reject(a)}).delay(0)}var u,v,w,x,y,z,A,B=a.Deferred(),C={},D=this,E=0,F=0,G=n(o)?o:function(){return!1},H=l(d)?d:{},I=D.data("modal");if(g(D,B.promise()),I){if(null==d||j(d)){if(v=I.form,x=I.bg,w=I.root,G=I.done,z=v.my("data"),A=!1,d){try{G.call(v.my("manifest"),null,null)}catch(J){}try{i(v)?s():""}catch(J){}if(D.removeData("modal"),h[I.cid])try{h[I.cid].reject("Cancelled")}catch(J){}delete h[I.cid],I=null}else{try{A=G.call(v.my("manifest"),v.my("valid")?null:v.my("errors"),z)}catch(J){}if(!A){try{i(v)?s():""}catch(J){}D.removeData("modal"),function(){h[I.cid]&&h[I.cid].resolve(z),delete h[I.cid],I=null}.delay(0)}}return D}if(H)return t("Locked"),D}return D.is(":visible")?(H=b(C,d,{}))?H.global&&f?(t("Locked"),D):(I=g({type:"DOM",source:"manifest",form:null,modal:null,root:null,bgroot:null,caller:D,manifest:{},data:{},global:!1,screen:!1,drag:!1,focus:!0,close:!0,silent:!0,esc:!1,enter:!1,bound:!1,hardClose:!0,nose:"",width:p||300,height:null,x:"0",y:"0",z:"1901",background:"white",css:"",animate:200},H,{promise:B.promise(),cid:Number.random(268435456,4294967295).toString(16)}),I.done=n(I.done)?I.done:G,k(I.align)&&I.align&&(I.x=(I.align.match(/(left|right):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0],I.y=(I.align.match(/(top|bottom):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0]),I.width=1*(a.my.f.getref(k(I.manifest)?a.my.cache(I.manifest):I.manifest,"params.width")||I.width),I.type="DOM",D.hasClass("my-form")?(I.type="form",I.root=I.root||D):D.data("my")?(I.type="control",I.root=I.root||D.my().root):(I.root=I.root||D.parents(".my-form").eq(0),I.root.size()||(I.root=a(e))),I.global?(I.root=a(e),I.bgroot=a(c||e)):I.bgroot=I.root,w=I.root,w.data("modals")||w.data("modals",{}),q(),u=a('
'),I.root.find(">.my-modal").size()?u.insertAfter(I.root.find(">.my-modal").last()):u.prependTo(I.root),u.addClass("my-modal-"+I.cid),E=u.outerWidth(),F=u.outerHeight(),u.hide(),u.html('
'),v=u.find(".my-modal-form"),I.close&&(y=a(k(I.close)?I.close:'
×
').prependTo(u).on("click.my",function(){D.modal(I.hardClose)}),y.css({"z-index":("+"===(I.z+"").to(1)?"+":"")+(1*I.z+1)})),x=I.bgroot.find(">.my-modal-screen"),I.screen&&(x.size()||(x=a('').prependTo(I.root)),I.esc&&x.on("click.my"+I.cid,function(){D.modal(!0)})),D.data("modal",I),I.silent&&u.on("change.my",function(){return!1}),u.css({display:"block",height:"none",opacity:"0.005","z-index":I.z,width:"auto"}),u.css(I.global?{position:"fixed",left:"50%",top:I.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":I.z,width:"auto","margin-left":"-"+((I.width+E)/2).round(0)+"px"}:{position:"absolute",left:I.pos.vx+"px",top:I.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":I.z,width:"auto"}),v.my(I.manifest,I.data).then(function(){var b,c,d,e,i;if(g(I,{form:v,bg:x,cancel:function(){D.modal(!0)},commit:function(){D.modal()}}),u.data("modal",I),I.height=u.outerHeight(),"manifest"!==I.source&&(I.width=u.width()),q(),u.css({top:I.pos.vy+"px"}),r(!0),w.data("modals")[I.cid]=I,h[I.cid]=B,v.bind("commit.my",function(){return I.commit.delay(50),!1}).bind("cancel.my",function(){return I.cancel.delay(50),!1}),u.bind("layout.my",function(){r()}.debounce(50)),I.global&&(f=D,a("body").css({overflow:"hidden"})),I.global||!I.esc&&!I.enter||v.bind("keydown.my",function(b){var c=b.keyCode;return 27==c&&I.esc?(I.cancel(),!1):13==c&&I.enter&&!a(b.target).is("textarea")?(I.commit.delay(50),!1):void 0}),I.focus===!0){e=!1,i=I.manifest.ui;for(d in i)e||(c=v.find(d),c.size()&&c.is("input, textarea","button")&&(e=!0,c.focus()))}else k(I.focus)&&v.find(I.focus).focus();if(b=v.find("img").filter(function(){return""!=a(this).attr("src")}),b.size()){var j=function(){"manifest"!==I.source&&u.css({width:"auto"}),r()}.after(b.size());b.each(function(){a(this).bind("load",j)})}I.drag&&a.fn.draggable&&(k(I.drag)?u.draggable({handle:I.drag}):u.draggable(),I.nose&&u.on("dragstart.my",function(){u.removeClass("nose-"+I.nose)})),u.on("mousedown.my",function(b){var c,d=[],e=a(b.currentTarget),f=e.parent(),g=+e.css("z-index"),h=g;f.size()&&(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+""))}),B.notify("Ready")}).fail(function(a){try{s()}catch(b){}D.data("modal",null),B.reject(a)}),D):(t("Invalid data"),D):(t("Object must be visible"),D)}}(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(hb(b)?b.split("."):fb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return ib(a)?Object.values(a).find(function(a){return ib(a)||fb(a)?a[c[0]]==c[1]:!1}):fb(a)?a.find(function(a){return ib(a)||fb(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(hb(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(fb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(ib(a))for(b in a)c[b]=lb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(hb(c)&&(c=c.split(/[,\s]+/)),fb(c)){for(c=c.compact(!0),b=0;b$/.test(x.list)?f=x.list:i=x.list||i,!f){var l=d.find(i);f="
",l.size()&&(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:s,delay:(x.delay||v.delay||10)/1.3,template:f,selector:i,parent:A,bind:x.bind,merge:lb(x.merge)?x.merge.bind(A):x.merge?n:!1,hash:lb(x.hash)?x.hash.bind(A):hb(x.hash)?k.fill(void 0,x.hash):fb(x.hash)?m.fill(void 0,x.hash.slice(0)):null,id:lb(x.id)?x.id.bind(A):hb(x.id)?k.fill(void 0,x.id):fb(x.id)?m.fill(void 0,x.id.slice(0)):null,ext:!(!x.id&&!x.hash),stamp:0},d.on("insert.my",function(b,c){b.stopPropagation();var d={what:void 0,where:0};null==c?d.where=1e6:ib(c)?pb(d,c):(hb(c)||jb(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=J.call(d,q(A,s),ib(e)?e:void 0)}catch(p){j("$.my subform init of "+g+" failed: "+p.message,p.stack)}}mb(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),y&&y.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(C(a,b))}function o(){d.each(function(){var b,c,h,i=a(this),j=!1;if("TEXTAREA"==i[0].nodeName&&(h=i[0].nextSibling,c=h&&h.CodeMirror?h.CodeMirror:null,c&&i.addClass("my-codemirror")),b=x.events||M(i,Bb.events),i.hasClass("my-form")?sb(i.data("my"),{dui:x,root:e,selector:g,dparams:v,devents:b,ddata:u.data,container:v.container(i),derrors:u.errors,single:!0}):(i.data("my",{events:b,selector:g,initial:r,previous:r,root:e,container:v.container(i),id:u.id,ui:x,data:u.data,params:v,errors:u.errors,single:1==B}),f._update=x.delay?N.debounce(x.delay):vb,j=!0),j)if(i.cleditor&&i.parent().hasClass("cleditorMain")){var k=i.cleditor()[0];if(k&&k.$frame&&k.$frame[0]){i.addClass("my-cleditor"),sb(i.data("my"),{container:v.container(i)});var l,m=function(a){i.val(a).trigger(db)},n=Number.random(1e5,1e6-1);a(k.$frame[0]).attr("id","cleditCool"+n),l=document.frames?document.frames["cleditCool"+n].document:a("#cleditCool"+n)[0].contentWindow.document;var o=a(l).find("body");a(l).bind("keyup.my",function(){m(a(this).find("body").html())}),i.parent().find("div.cleditorToolbar").bind("click.my mouseup.my",function(){m(o.html())}),a("body").on("click","div.cleditorPopup",function(){m(o.html())})}}else if(i.is("div.redactor_box textarea")){var p,q="my-redactor-9";try{p=i.getEditor(),q="my-redactor-8"}catch(s){p=i.redactor("getEditor")}p&&(i.addClass(q),p.bind("input.my keyup.my blur.my",function(a){a.trigger("redactor")}.fill(i)))}else i.hasClass("ace_editor")?ace.edit(d[0]).on(db,function(a){a.trigger("ace")}.fill(i)):c&&c.on(db,function(a){a.trigger("codemirror")}.fill(i));i.my()._changed=w.debounce(t),i.my()._recalc=H.debounce(t),i.bind(b,function(a){a.type==db&&a.stopPropagation(),j&&(u.locktill=zb()+f.delay),i.my()._changed(i,e,f,v)}),/check(\.my)?/.test(b+"")||i.on("check.my",function(){return i.my()._changed(i,e,f,v,!0),!1}),j||i.off("redraw.my"),i.on("recalc.my, redraw.my",function(a){a.stopPropagation(),i.my()._recalc(i,e,f,v)})}),y&&y.resolve()}var p,r,s,t,u=e.my(),v=(u||{}).params,x=f,y=null,z=0,A=u.manifest,B=d.size();return u?(t=f.delay,B?(x.init!=vb&&(p=G(A,x.init,d,u)),mb(p)?(z+=1,y=tb(),p.then(i,function(a,b){j("Init of "+g+" failed: "+a,b)})):i()):c("Not found "+g+" selector.",e),y):(b("Failed to find $root building "+g+" selector."),null)}function v(c,d){ib(d)&&d.channel&&d.message&&c.find(".my-listen-"+l(d.channel)).each(function(){var c,e=a(this),f=e.data("my"),g=void 0;if(f&&f.ui.listen&&lb(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 w(a,b,c,d,e){{var f,g=a.data("my");b.data("my")}g&&(g.disabled?g.ddata||N(a,vb,c.recalcDepth||d.recalcDepth):(A(g.ddata||g.data,g.dparams||g.params),e||(f=g.single?a:b.find(g.selector)),N(a,e?vb:z(f,vb),c.recalcDepth||d.recalcDepth),d.change&&d.change.call(a)))}function x(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=M(c,Bb.offon).fill(void 0,c)),e._disable(!!b))}),c}function y(a,b,c){return a[b](c?"disable":"enable")}function z(a,b){var c,d,e=a.data("myval");return e||(d=M(a,Bb.vals),lb(d)&&(c=d(a,vb),void 0===c?a.data("myval",function(a,b){return vb!=b&&d(a,b),a.val()}.fill(a,void 0)):a.data("myval",d.fill(a,void 0))),e=a.data("myval")),lb(e)?(c=e(),(c!==b&&(0==b||0==c)||c!=b||ib(b))&&(c=e(b)),c):vb}function A(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=b;if(!ib(n)||isNaN(h=n.remember)||!ib(e=n.history))return vb;if(ib(a)&&h){if(j=qb(a,!0),k=zb(),g=rb(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(db),n.history[g.last()]}if(!isNaN(a)||a===vb){if(i=parseInt(a)||0,0>i)return vb;if(g=rb(e).sort(),i>=g.length&&(i=g.length-1),l=qb(n.history[g[g.length-i-1]],!0),c){for(m={},f=0;f=i;i++)if(i===h){if(d)return vb!=b?e[f[i]]=b:void 0===e[f[i]]&&(e[f[i]]=vb),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||!ib(e)&&(fb(e)&&!isNaN(f[i+1])&&+f[i]>-1))&&(e=g[f[i]]={});return a}function F(a,b,c){var e=ib(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&&(hb(f.recalc)?l=f.recalc.split(n):fb(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,"watch"))for(hb(f.watch)?m=f.watch.split(n):fb(f.watch)&&(m=f.watch.slice(0)),m=m.compact(!0).unique(),k=0;ki&&h.resolve()}var d,e,f,g=!1,h=tb(),i=a.length;for(e=0;i>e;e++)d=a[e],f=hb(d.ajax)?w.loader:xb,f(d.ajax).then(function(a,d){eb.test(d.ref)&&(null!=a?sb(!0,b,D(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 eb.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=tb(),t=[],u={},v=[],w=sb(!0,{ajaxTimeout:1e4,loader:Bb.params.loader},c||{}),x={ref:null,ajax:{type:"GET",async:!0,timeout:w.ajaxTimeout}};if(ib(b))if(fb(b.require)){for(n=b.require,k=0;k'+d+""}!$.style||b&&!rb.is(":visible")||(R=K(rb,$,S,T),R&&R[0].length&&!b&&(U=a("style#"+S),U.size()||(U=a(c(R[0],S)).appendTo(a("body"))),U.data("count",1*U.data("count")+1),rb.data("my").style=U),R&&R[1].length&&(Y=a("style#"+T),Y.size()?b&&(a(c(R[1],T)).replaceAll(Y),Y=a("style#"+T)):(Y=a(c(R[1],T)).appendTo(a("body")),P.restyle>-1&&!ob[I]&&(ob[I]=function(){p(!0)}.debounce(P.restyle)),rb.data("my").restyle=p.fill(!0).debounce(0)),rb.data("my").localStyle=Y,b||rb.addClass("my-restyle")))}function q(){var a,b,c=!0;if(b=s($),hb(b))A("Error decoding base64 to local Blob/URL",b),c=!1;else{if(V)for(a=0;a*").clone();try{Z=G($,Q.init,rb,Q)}catch(b){return A(hb(b)?b:b.message,b.stack),rb}}if(mb(Z)?Z.then(function(){w()},function(a,b){A(a,b)}):w(),!gb){if(!rb.my())return A("Internal error initializing controls.",""),rb;rb.data("my").initial=sb(!0,{},ab),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function w(){function a(a){gb||(b[a]=z(rb.find(a),vb),d-=1,.5>d&&x(b))}var b={},c=Object.keys(N),d=c.length;0===d?y():(rb.addClass(kb),c.forEach(function(b){if(!gb){var c=rb.find(b),d=u(c,rb,N[b],b);qb[b]=c,mb(d)?d.then(a.fill(b)).fail(function(a,c){A("Error building "+b+", "+a,c)}):gb||a(b)}}))}function x(a){var c,d,e,f,g;for(g in N){if(gb)return;if(c=N[g],e=qb[g],f=e.size()){c.listen&&(db[g]=e.eq(0));try{d=t(ab,vb,c,e),d==vb&&a[g]!=vb&&void 0!==d&&t(ab,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+I+"')",h.message,h.stack)}try{d!=vb&&z(e,d),e.eq(0).trigger("check.my")}catch(h){A("Error linking "+g,h.message,h.stack)}}}y()}function y(){rb.removeClass(kb),rb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),rb.my("redraw")}),pb=null,eb.resolve(ab)}function A(a,c){var d;if(gb=!0,b("Form "+H+" failed to initialize.",a,c),Object.keys(qb).forEach(function(a){delete qb[a]}),rb.removeClass(kb),d=jb(a,c),hb(d)||ib(d)&&d.jquery?rb.html(d):d===!0&&rb.html(pb),P.silent)eb.resolve(ab);else{if(!rb.my().ddata){if(rb.removeData("my"),rb.removeClass("my-form"),U)if("1"==U.data("count"))try{U.remove()}catch(e){}else U.data("count",U.data("count")-1);if(Y)try{delete ob[I],Y.remove()}catch(e){}}eb.reject("Form "+H+" failed to initialize: "+a,c)}}var C,E,H,I,J,M,N,P,Q,R,S,T,U,Y,Z,$={},ab={},bb=null,cb=[],db={},eb=tb(),gb=!1,jb=function(){},kb="my-form-init",nb="std",pb="",qb={};if(hb(d)){if(C=yb(d),!C)return eb.reject("No manifest with id "+d+" found in repo."),eb.promise();ib(f)&&ib(e)?(C=sb(C,e),E=f):E=e,nb="repo"}else C=d,E=e;if(!C)return this;Q=ib(E)&&"repo"!=nb?sb(!0,{},C):C;var rb=this.eq(0),ub=rb.my();return ib(ub)&&ub.id&&ub.ui?(c("jQuery.my is already bound.",rb),rb.my("ui",Q.ui),rb.my(_,Q.data),eb.resolve(rb.my(_)).promise()):(P=Q.params||{},P.strict||lb(Q.init)||(P=sb(!0,{},P),O(P)),P=sb(!0,{},Bb.params,P),eb.fail(function(){rb.removeClass(T+" "+S)}),sb(rb,eb.promise()),ib(E)?(ab=m(E,Q.data||{}),Q.data=ab):ab=Q.data||{},$.data=ab,rb.data("my",{data:ab,params:P,promise:eb.promise(),locktill:0}),rb.addClass(kb),Q.inherit&&i(Q),fb(Q.require)?Ab(Q,P).then(g).fail(function(a){o(),A("Linker of the ‘require’ property failed.",a)}):g(),eb.then(n),rb)}function K(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=lb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),hb(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Cb.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),fb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==$&&c(a,i,g+1)}vb!=b[""]&&typeof b[""]!=$&&g>e&&(d=b[""],e=g)}var d=vb,e=0,f="";return c(a,b,1),d}function N(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q=!1,r=!1,s=a,u=s.my(),v="";if(u){if(m=u.selector,n=u.root,n.hasClass("my-form-init"))return{};if(o=n.find(m),p=n.my().ui,q=a.hasClass("my-form"),q?(f=a,g=u.ddata,h=u.dui,i=u.dparams):(f=u.container,g=u.data,h=u.ui,i=u.params),h.bind!=vb){if(j=wb(c)?c:z(o,t(g,vb,h,o)),vb!=h.check){v="Unknown error";try{v=T(g,j,h,o)}catch(w){b("Error "+w.message+" in .check validator for "+m,n,w.stack)}}var y=i.errorCss,A="ui-state-error";try{vb!=c&&(j=z(o,t(g,c,h,o)))}catch(w){v=i.messages.formError||"Error"}if(vb!=h.check)if(r=a.hasClass("my-form-list"),""==v&&(q||f.hasClass(y)))q?u.derrors[m]="":u.errors[m]="",f.removeClass(y),f.attr("title")&&f.attr("title",""),q||r||i.effect(f.find(i.errorTip),!1,i.animate/2),s.removeClass(A),s.find(".ui-widget").removeClass(A);else if(v){if(q)u.derrors[m]=v;else if(r)u.errors[m]=v;else{f.addClass(y),u.errors[m]=v;var B=f.find(i.errorTip).eq(0);B.size()?i.effect(B.addClass(y).html(hb(v)?v:"Error"),!0,i.animate):f.attr("title",(hb(v)?v:"Error").stripTags())}s.hasClass("hasDatepicker")&&(s.is("input")?s.addClass(A):s.find(".ui-widget").addClass(A)),s.hasClass("ui-slider")&&s.addClass(A)}}var C=c==vb?j:c;if(h.css)for(k in h.css)l=h.css[k],kb(l)?x(l.test(C),o,k):lb(l)&&x(l.call(n.my().manifest,g,C,o),o,k);var e,D,E=h.recalc,F=[],G={};if(d&&h.recalc&&n.my()){for(p=n.my().ui,e=0;e-1?"":n;case"s":return c==k?"":n;case"o":return k[c]?"":n;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},e.find(h).filter("*:not(.ui-sortable-placeholder)").each(function(b){var c=a(this);c.data("my")&&!c.my("valid")&&(j[b]=c.my("errors"))}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return l.formError||"Error"}return""}var U="jQuery.my 1.2.6",V=window.URL||window.webkitURL,W=!document.addEventListener,X=((window.navigator.language||window.navigator.userLanguage||"en")+"").split("-")[0].toLowerCase(),Y="{yyyy}-{MM}-{dd}",Z="{HH}:{mm}",$="object",_="data",ab="array",bb="string",cb="function",db="change",eb=/^this\./,fb=Object.isArray,gb=Object.isBoolean,hb=Object.isString,ib=Object.isObject,jb=Object.isNumber,kb=Object.isRegExp,lb=Object.isFunction,mb=function(a){return null!=a&&typeof a==$&&lb(a.then)},nb=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},ob=h(a,"my.f.restyles")?a.my.f.restyles():{},pb=Object.merge,qb=Object.clone,rb=Object.keys,sb=a.extend,tb=a.Deferred,ub=a.type,vb=null,wb=function(a){return null!==a&&void 0!==a},xb=a.ajax,yb=p,zb=Date.now,Ab=I,Bb={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my(_);return Object.equal(c,b)?c:a.my(_,b,!0)}return b||vb},".hasDatepicker":function(a,b){wb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(Y):""},".my-tags":function(a,b){return wb(b)&&(hb(b)||jb(b)?a.tags(_,[b+""]):fb(b)&&a.tags(_,b)),a.tags(_)},".ui-draggable":function(a,b){if(wb(b)&&ib(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=!!r.merge,u=r.template||"
",v=/\{/.test(u),w=r.hash||l,x=r.id||l,y=r.ext,z=r.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).size(),E=[],F=[],G=zb(),H=b.find(C?b.sortable("option","items"):s);if(wb(c)&&fb(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=[],K=[],L={},M={};for(F=[],h=0;h1.4*z||G-r.stamp>100||!r.stashed||r.stashed.length!==H.size()-(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){y(b,"selectable",a)},".ui-slider":function(a,b){y(b,"slider",a)},".ui-draggable":function(a,b){y(b,"draggable",a)},".ui-buttonset":function(a,b){y(b,"buttonset",a)},".hasDatepicker":function(a,b){y(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){y(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")}}}};Bb.params={container:function(a){return M(a,Bb.containers)(a)},change:vb,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:X,messages:Object.map(Bb.msg,function(a,b){return b[X]||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=tb(),c=yb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Cb={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:y,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&&hb(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===cb)return b(a.toJSON(),m+(g?1:0),g);if(h=[],fb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),lb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=hb(b)?b:a.my.tojson(b),g=hb(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Cb.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:K,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}},Db={container:function(a){return M(a,Bb.containers)(a)},data:function(a,b){var c=this;return ib(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==vb)return g.disabled;if(a){for(c in g.ui)b=f.find(c).eq(0),d=b.my(),d&&(d.predisabled=d.disabled),x(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=f.find(c).eq(0),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),x(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]&&hb(b[d])&&(c[d]=b[d]),ib(b[d])&&rb(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 A(a,this.my().params,b)},id:function(a,b){if(hb(a))return yb(a,b);var c=this.my();return c&&c.id?c.id:vb},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:J,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=eb.test(j.bind)?h(f.my().manifest,j.bind.replace(eb,"")):h(f.my().data,j.bind),!ib(i))if(ib(j.manifest))i=qb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=qb(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?Cb.tojson(this.my().manifest):this.my().manifest},promise:function(a){return lb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",hb(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my();return d&&d.ui&&(d.ui.each(function(b){var e=c.find(b);N(e,a?vb:void 0,d.params.recalcDepth),a||(e.is(".my-form")&&e.my("redraw"),e.trigger(e.is(".my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(db)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return vb;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"),ib(d)&&d.manifest&&lb(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 ob[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?vb:(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=A(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return z(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&hb(b[d])?c++:ib(b[d])&&rb(b[d]).length&&c++;return!c},version:function(){return U}},Eb=Object.keys(Db);a.my||(a.my={}),sb(a.my,{f:a.extend({},Cb),tojson:Cb.tojson,fromjson:Cb.fromjson,radio:function(b,c){v(a(document),hb(b)?{channel:b,message:c}:b)},rules:Bb,locale:function(a){return hb(a)?(X=a.toLowerCase(),void 0):X},ajax:function(a){return lb(a)?xb=a:xb.apply(this,f(arguments,0))},cache:function(a,b){return lb(a)?yb=a:yb(a,b)},now:function(a){return lb(a)?(zb=a,void 0):zb()},require:function(a){return lb(a)?Ab=a:Ab.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()}mb(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 U}}),a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(hb(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Db.init.apply(this,[c].add(f(arguments,1)))}return hb(b)&&Db[b]?Db[b].apply(this,f(arguments,1)):hb(b)&&yb(b,"exist")?Db.init.apply(this,arguments):typeof b!==$&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Db.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),v(a(document),c)}).on("resize.my",function(){for(var a in ob)try{ob[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.size()||(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).size()?(f=b,void 0):a(f)},e.modal.parentBack=function(b){return b&&a(b).size()?(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:J.pos.pw+"px",height:J.pos.ph+"px",display:"block",background:l(J.screen)?J.screen:"rgba(40,80,120,0.6)","z-index":J.z-1}):y.size()&&y.hide(),J.height>J.pos.wh?(v.height(J.pos.wh-30),w.css({"overflow-y":a.browser.webkit?"overlay":"scroll"})):w.css({"overflow-y":"none"}),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("body")[0].style.overflow=null)}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.size()||(J.root=a(f))),J.global?(J.root=a(f),J.bgroot=a(c||f)):J.bgroot=J.root,x=J.root,x.data("modals")||x.data("modals",{}),r(),v=a('
'),J.root.find(">.my-modal").size()?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.size()||(y=a('').prependTo(J.root)),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),x.data("modals")[J.cid]=J,i[J.cid]=C,w.bind("commit.my",function(){return J.commit.delay(50),!1}).bind("cancel.my",function(){return J.cancel.delay(50),!1}),v.bind("layout.my",function(){s()}.debounce(50)),J.global&&(g=E,a("body").css({overflow:"hidden"})),J.global||!J.esc&&!J.enter||w.bind("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.size()&&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.size()){var j=function(){"manifest"!==J.source&&v.css({width:"auto"}),s()}.after(b.size());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.size()&&(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 diff --git a/bower.json b/bower.json index ea746de..a3165df 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jquerymy", - "version": "1.2.5", + "version": "1.2.6", "description": "A lightweight jQuery plugin for complex two-way data binding in real time.", "main": "./jquerymy.js", "authors": [ @@ -21,7 +21,7 @@ ], "dependencies": { - "jquery":"~1.11", + "jquery":"~2", "sugar":"~1.4" }, diff --git a/jquerymy.js b/jquerymy.js index e093fe0..1934e4c 100644 --- a/jquerymy.js +++ b/jquerymy.js @@ -1,25 +1,28 @@ /* - * jQuery.my 1.2.5 + * jQuery.my 1.2.6 * Requires jQuery 1.11.0+, SugarJS 1.3.9-1.4.x * - * — fixes #24, subforms propagates own validity correctly - * — fixes #25, tojson no more stringifies DOM and other non-native objects + * — fixes #17, modal detects Bootstrap and pass request through if seems BT needed + * — added beta support for .lang field + * — forms with empty .ui section are initialzed bit more fast * * More details at jquerymy.com * * (c) @ermouth, thanks @carpogoryanin, @ftescht - * 2016-05-12 + * 2016-06-27 */ ;(function ($) { - var _version = "jQuery.my 1.2.5"; + var _version = "jQuery.my 1.2.6"; // 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", @@ -519,7 +522,7 @@ //######################################################## msg:{ - "":{en:"Invalid input", ru:(TMP="Неверное значение")}, + "":{en:"Invalid input", ru:"Неверное значение"}, formError:{en:"Form error",ru:"Ошибка формы"}, initFailed:{ @@ -527,7 +530,7 @@ ru:'

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

' }, - badInput:{en:"Invalid input", ru:TMP}, + badInput:{en:"Invalid input", ru:"Неверное значение"}, patternMismatch:{en:"Pattern mismatch", ru:"Не соответствует шаблону"}, rangeOverflow:{en:"Over maximum", ru:"Больше максимума"}, rangeUnderflow:{en:"Under minimum", ru:"Меньше минимума"}, @@ -655,8 +658,8 @@ delay:0, // default delay of bind invocation strict:false, // if true form assumed unjsonned restyle:-1, // delay of "}!Y.style||b&&!pb.is(":visible")||(Q=J(pb,Y,R,S),Q&&Q[0].length&&!b&&(T=a("style#"+R),T.size()||(T=a(c(Q[0],R)).appendTo(a("body"))),T.data("count",1*T.data("count")+1),pb.data("my").style=T),Q&&Q[1].length&&(U=a("style#"+S),U.size()?b&&(a(c(Q[1],S)).replaceAll(U),U=a("style#"+S)):(U=a(c(Q[1],S)).appendTo(a("body")),M.restyle>-1&&!nb[G]&&(nb[G]=function(){p(!0)}.debounce(M.restyle)),pb.data("my").restyle=p.fill(!0).debounce(0)),pb.data("my").localStyle=U,b||pb.addClass("my-restyle")))}function q(){var a,b,c=!0;if(b=s(Y),gb(b))y("Error decoding base64 to local Blob/URL",b),c=!1;else{if(V)for(a=0;a*").clone();try{X=F(Y,O.init,pb,O)}catch(b){return y(gb(b)?b:b.message,b.stack),pb}}if(lb(X)?X.then(function(){w()},function(a,b){y(a,b)}):w(),!db){if(!pb.my())return y("Internal error initializing controls.",""),pb;pb.data("my").initial=rb(!0,{},Z),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function w(){function a(a){db||(b[a]=z(pb.find(a),ub),c-=1,.5>c&&x(b))}var b={},c=Object.size(L);pb.addClass(ib),Object.each(L,function(b){if(!db){var c=pb.find(b),d=u(c,pb,L[b],b);ob[b]=c,lb(d)?d.then(a.fill(b)).fail(function(a,c){y("Error building "+b+", "+a,c)}):db||a(b)}})}function x(a){var c,d,e,f,g;for(g in L){if(db)return;if(c=L[g],e=ob[g],f=e.size()){c.listen&&(bb[g]=e.eq(0));try{d=t(Z,ub,c,e),d==ub&&a[g]!=ub&&void 0!==d&&t(Z,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+G+"')",h.message,h.stack)}try{d!=ub&&z(e,d),e.eq(0).trigger("check.my")}catch(h){y("Error linking "+g,h.message,h.stack)}}}pb.removeClass(ib),pb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),pb.my("redraw")}),mb=null,cb.resolve(Z)}function y(a,c){var d;if(db=!0,b("Form "+D+" failed to initialize.",a,c),Object.keys(ob).forEach(function(a){delete ob[a]}),pb.removeClass(ib),d=fb(a,c),gb(d)||hb(d)&&d.jquery?pb.html(d):d===!0&&pb.html(mb),M.silent)cb.resolve(Z);else{if(!pb.my().ddata){if(pb.removeData("my"),pb.removeClass("my-form"),T)if("1"==T.data("count"))try{T.remove()}catch(e){}else T.data("count",T.data("count")-1);if(U)try{delete nb[G],U.remove()}catch(e){}}cb.reject("Form "+D+" failed to initialize: "+a,c)}}var A,B,D,G,H,I,L,M,O,P,Q,R,S,T,U,X,Y={},Z={},_=null,ab=[],bb={},cb=sb(),db=!1,fb=function(){},ib="my-form-init",jb="std",mb="",ob={};if(gb(d)){if(A=xb(d),!A)return cb.reject("No manifest with id "+d+" found in repo."),cb.promise();hb(f)&&hb(e)?(A=rb(A,e),B=f):B=e,jb="repo"}else A=d,B=e;if(!A)return this;O=hb(B)&&"repo"!=jb?rb(!0,{},A):A;var pb=this.eq(0),qb=pb.my();return hb(qb)&&qb.id&&qb.ui?(c("jQuery.my is already bound.",pb),pb.my("ui",O.ui),pb.my($,O.data),cb.resolve(pb.my($)).promise()):(M=O.params||{},M.strict||kb(O.init)||(M=rb(!0,{},M),N(M)),M=rb(!0,{},Ab.params,M),cb.fail(function(){pb.removeClass(S+" "+R)}),rb(pb,cb.promise()),hb(B)?(Z=m(B,O.data||{}),O.data=Z):Z=O.data||{},Y.data=Z,pb.data("my",{data:Z,params:M,promise:cb.promise(),locktill:0}),pb.addClass(ib),O.inherit&&i(O),eb(O.require)?zb(O,M).then(g).fail(function(a){o(),y("Linker of the ‘require’ property failed.",a)}):g(),cb.then(n),pb)}function J(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=kb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),gb(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Bb.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),eb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==Z&&c(a,i,g+1)}ub!=b[""]&&typeof b[""]!=Z&&g>e&&(d=b[""],e=g)}var d=ub,e=0,f="";return c(a,b,1),d}function M(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q=!1,r=!1,s=a,u=s.my(),v="";if(u){if(m=u.selector,n=u.root,n.hasClass("my-form-init"))return{};if(o=n.find(m),p=n.my().ui,q=a.hasClass("my-form"),q?(f=a,g=u.ddata,h=u.dui,i=u.dparams):(f=u.container,g=u.data,h=u.ui,i=u.params),h.bind!=ub){if(j=vb(c)?c:z(o,t(g,ub,h,o)),ub!=h.check){v="Unknown error";try{v=S(g,j,h,o)}catch(w){b("Error "+w.message+" in .check validator for "+m,n,w.stack)}}var y=i.errorCss,A="ui-state-error";try{ub!=c&&(j=z(o,t(g,c,h,o)))}catch(w){v=i.messages.formError||"Error"}if(ub!=h.check)if(r=a.hasClass("my-form-list"),""==v&&(q||f.hasClass(y)))q?u.derrors[m]="":u.errors[m]="",f.removeClass(y),f.attr("title")&&f.attr("title",""),q||r||i.effect(f.find(i.errorTip),!1,i.animate/2),s.removeClass(A),s.find(".ui-widget").removeClass(A);else if(v){if(q)u.derrors[m]=v;else if(r)u.errors[m]=v;else{f.addClass(y),u.errors[m]=v;var B=f.find(i.errorTip).eq(0);B.size()?i.effect(B.addClass(y).html(gb(v)?v:"Error"),!0,i.animate):f.attr("title",(gb(v)?v:"Error").stripTags())}s.hasClass("hasDatepicker")&&(s.is("input")?s.addClass(A):s.find(".ui-widget").addClass(A)),s.hasClass("ui-slider")&&s.addClass(A)}}var C=c==ub?j:c;if(h.css)for(k in h.css)l=h.css[k],jb(l)?x(l.test(C),o,k):kb(l)&&x(l.call(n.my().manifest,g,C,o),o,k);var e,D,E=h.recalc,F=[],G={};if(d&&h.recalc&&n.my()){for(p=n.my().ui,e=0;e-1?"":n;case"s":return c==k?"":n;case"o":return k[c]?"":n;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},e.find(h).filter("*:not(.ui-sortable-placeholder)").each(function(b){var c=a(this);c.data("my")&&!c.my("valid")&&(j[b]=c.my("errors"))}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return l.formError||"Error"}return""}var T,U="jQuery.my 1.2.5",V=window.URL||window.webkitURL,W=!document.addEventListener,X="{yyyy}-{MM}-{dd}",Y="{HH}:{mm}",Z="object",$="data",_="array",ab="string",bb="function",cb="change",db=/^this\./,eb=Object.isArray,fb=Object.isBoolean,gb=Object.isString,hb=Object.isObject,ib=Object.isNumber,jb=Object.isRegExp,kb=Object.isFunction,lb=function(a){return null!=a&&typeof a==Z&&kb(a.then)},mb=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},nb=h(a,"my.f.restyles")?a.my.f.restyles():{},ob=Object.merge,pb=Object.clone,qb=Object.keys,rb=a.extend,sb=a.Deferred,tb=a.type,ub=null,vb=function(a){return null!==a&&void 0!==a},wb=a.ajax,xb=p,yb=Date.now,zb=H,Ab={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my($);return Object.equal(c,b)?c:a.my($,b,!0)}return b||ub},".hasDatepicker":function(a,b){vb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(X):""},".my-tags":function(a,b){return vb(b)&&(gb(b)||ib(b)?a.tags($,[b+""]):eb(b)&&a.tags($,b)),a.tags($)},".ui-draggable":function(a,b){if(vb(b)&&hb(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=!!r.merge,u=r.template||"
",v=/\{/.test(u),w=r.hash||l,x=r.id||l,y=r.ext,z=r.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).size(),E=[],F=[],G=yb(),H=b.find(C?b.sortable("option","items"):s);if(vb(c)&&eb(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 J=[],K=[],L={},M={};for(F=[],h=0;h1.4*z||G-r.stamp>100||!r.stashed||r.stashed.length!==H.size()-(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:T},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){y(b,"selectable",a)},".ui-slider":function(a,b){y(b,"slider",a)},".ui-draggable":function(a,b){y(b,"draggable",a)},".ui-buttonset":function(a,b){y(b,"buttonset",a)},".hasDatepicker":function(a,b){y(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){y(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")}}}};Ab.params={container:function(a){return L(a,Ab.containers)(a)},change:ub,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:T=(navigator.language||navigator.userLanguage||"en").substr(0,2),messages:Object.map(Ab.msg,function(a,b){return b[T]||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=sb(),c=xb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Bb={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:y,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&&gb(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===bb)return b(a.toJSON(),m+(g?1:0),g);if(h=[],eb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),kb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=gb(b)?b:a.my.tojson(b),g=gb(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Bb.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:J,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}},Cb={container:function(a){return L(a,Ab.containers)(a)},data:function(a,b){var c=this;return hb(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==ub)return g.disabled;if(a){for(c in g.ui)b=f.find(c).eq(0),d=b.my(),d&&(d.predisabled=d.disabled),x(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=f.find(c).eq(0),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),x(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]&&gb(b[d])&&(c[d]=b[d]),hb(b[d])&&qb(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 A(a,this.my().params,b)},id:function(a,b){if(gb(a))return xb(a,b);var c=this.my();return c&&c.id?c.id:ub},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:I,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=db.test(j.bind)?h(f.my().manifest,j.bind.replace(db,"")):h(f.my().data,j.bind),!hb(i))if(hb(j.manifest))i=pb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=pb(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?Bb.tojson(this.my().manifest):this.my().manifest},promise:function(a){return kb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",gb(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my();return d&&d.ui&&(d.ui.each(function(b){var e=c.find(b);M(e,a?ub:void 0,d.params.recalcDepth),a||(e.is(".my-form")&&e.my("redraw"),e.trigger(e.is(".my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(cb)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return ub;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"),hb(d)&&d.manifest&&kb(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 nb[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?ub:(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=A(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return z(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&gb(b[d])?c++:hb(b[d])&&qb(b[d]).length&&c++;return!c},version:function(){return U}},Db=Object.keys(Cb);a.my||(a.my={}),rb(a.my,{f:a.extend({},Bb),tojson:Bb.tojson,fromjson:Bb.fromjson,radio:function(b,c){v(a(document),gb(b)?{channel:b,message:c}:b)},rules:Ab,ajax:function(a){return kb(a)?wb=a:wb.apply(this,f(arguments,0))},cache:function(a,b){return kb(a)?xb=a:xb(a,b)},now:function(a){return kb(a)?(yb=a,void 0):yb()},require:function(a){return kb(a)?zb=a:zb.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()}lb(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 U}}),a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(gb(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Cb.init.apply(this,[c].add(f(arguments,1)))}return gb(b)&&Cb[b]?Cb[b].apply(this,f(arguments,1)):gb(b)&&xb(b,"exist")?Cb.init.apply(this,arguments):typeof b!==Z&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Cb.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),v(a(document),c)}).on("resize.my",function(){for(var a in nb)try{nb[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,h,i,j,m,n,o;if("object"==typeof c&&c.jquery)c.is("img")&&(n=c,m=c.attr("alt")||c.attr("title")||c.data("text")||"",h=n[0].naturalWidth||n[0].width,f=n[0].naturalHeight||n[0].height,1>f&&(f=1),1>h&&(h=1),j=a(window).width()-90,i=a(window).height()-90,f>i&&(h=h*(i/f)|0,f=i),h>j&&(h=j,f=f*(j/h)|0),o=300>h?300:h,g(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:m},esc:!0,screen:!0,width:e||o,focus:!1,global:!0,z:"1995"},d));else if(l(c)&&c.manifest)g(b,c,d);else{if(!k(c))return null;g(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="body",f=!1,g=a.extend,h={},i=a.my.f.indom,j=(Object.isArray,Object.isBoolean),k=Object.isString,l=Object.isObject,m=Object.isNumber,n=(Object.isRegExp,Object.isFunction);if(a(document).off(".modal"),a(document).on("keydown.modal",function(a){var b,c,d=a.keyCode;if(!1!==f&&(13===d||27===d)){if(c=f.data("modal"),b=c.form,27==d&&(c.esc||Object.equal(b.data("my").initial,b.my("data"))))return f.modal(!0),!1;if(13==d&&c.enter)return function(a){a.modal()}.fill(f).delay(50),!1}}),n(a.my.f.getref(a,"my.modal.parent"))){var o=a.my.f.getref(a,"my.modal.parent")().attr("id");o&&(e="#"+o)}d.modal=function(c,d,g){var h,i={},k=a(e),l=k.find(">.my-modal-proxy"),m={global:!0,screen:!0,done:n(d)?d:void 0,z:"1995"};return j(c)||null==c?l.modal(c):(h=a.Deferred(),b(i,c,m,g)?f?h.reject("Locked").promise():(l.size()||(l=a('
').prependTo(k),l.css({position:"absolute",top:"0",left:"0",margin:"0",padding:"0",width:"1px",height:"0"})),l.modal(i)):h.reject("Invalid data").promise())},d.modal.loading=function(b){a(e).find(">.my-modal").toggleClass("my-modal-loading",!!b)},d.modal.parent=function(b){return b&&a(b).size()?(e=b,void 0):a(e)},d.modal.parentBack=function(b){return b&&a(b).size()?(c=b,void 0):a(c||e)},d.modal.visible=function(){return!!f},a.my||(a.my={}),a.my.modal=d.modal,a.fn.modal=function(d,o,p){function q(){var b,c,d=window,e=!!I.global,f=w.offset(),g=D.offset(),h=w.scrollTop();I.pos={px:f.left,py:f.top,pw:w.outerWidth(),ph:w.outerHeight(),ox:g.left,oy:g.top,ow:D.outerWidth(),oh:D.outerHeight(),ww:c,wh:b};var i=1*(I.x.match(/\-?\d+(\.\d+)?/)||[0])[0],j=1*(I.y.match(/\-?\d+(\.\d+)?/)||[0])[0],k=I.x.has("left")?-1:I.x.has("right")?1:0,l=I.y.has("top")?-1:I.y.has("bottom")?1:0,n=I.pos.ox+I.pos.ow/2-I.pos.px,o=I.pos.oy+I.pos.oh/2-I.pos.py;if(e&&(I.pos.wh=b=d.innerHeight||a(d).height(),I.pos.ww=c=d.innerWidth||a(d).width(),n=c/2,o=b/2.5),i=I.x.has("%")?I.pos.ow/100*i:i,j=I.y.has("%")?I.pos.oh/100*j:j,I.pos.pix=n,I.pos.piy=o,n=n+k*(I.pos.ow/2)+i*(k>0?-1:1)-(I.width+E)*(k+1)/2,e?(o=(b-I.height-20)/3,10>o&&(o=10)):o=o+l*(I.pos.oh/2)+j*(l>0?-1:1)-(I.height||0)*(l+1)/2,n=n.round(1),o=(o+h).round(1),I.pos.vx=n,I.pos.vy=o,I.bound!==!1&&!I.global){var p=(m(I.bound)?I.bound:0).clamp(-100,100);I.pos.pw-2*pI.pos.pw-p?I.pos.vx=I.pos.pw-p-I.width-E:I.pos.vxI.pos.ph-p?I.pos.vy=I.pos.ph-p-I.height:I.pos.vy');var c="",d=a("style#my-modal-style-"+I.cid);("top"==I.nose||"bottom"==I.nose)&&(c+="div.my-modal-"+I.cid+".nose-"+I.nose+":before {left:"+(I.pos.ox-I.pos.px+I.pos.ow/2-I.pos.vx)+"px!important;}",d.text(c)),("left"==I.nose||"right"==I.nose)&&(c+="div.my-modal-"+I.cid+".nose-"+I.nose+":before {top:"+(I.pos.oy-I.pos.py+I.pos.oh/2-I.pos.vy)+"px!important;}",d.text(c))}I.screen?I.global?(x.css({top:0,left:0,width:"100%",height:"100%",display:"block",position:"fixed","z-index":I.z-1}),k(I.screen)&&x.css({background:I.screen?I.screen:"rgba(25, 39, 59, 0.88)"})):x.css({top:0,left:0,position:"absolute",width:I.pos.pw+"px",height:I.pos.ph+"px",display:"block",background:k(I.screen)?I.screen:"rgba(40,80,120,0.6)","z-index":I.z-1}):x.size()&&x.hide(),I.height>I.pos.wh?(u.height(I.pos.wh-30),v.css({"overflow-y":a.browser.webkit?"overlay":"scroll"})):v.css({"overflow-y":"none"}),u.animate({top:I.pos.vy+"px",opacity:"1"},I.animate)}function s(){try{v.my("remove")}catch(b){}try{w.data("modals")[I.cid]=null}catch(b){}v.parent().off(".my").remove(),x.off(".my"+I.cid),I.screen&&function(a){a&&f||x.hide(),a&&!f&&x.css({background:"rgba(25, 39, 59, 0.88)"})}.delay(50,I.global),I.global&&(f=!1,a("body")[0].style.overflow=null)}function t(a){try{G(null,null)}catch(b){}(function(){B.reject(a)}).delay(0)}var u,v,w,x,y,z,A,B=a.Deferred(),C={},D=this,E=0,F=0,G=n(o)?o:function(){return!1},H=l(d)?d:{},I=D.data("modal");if(g(D,B.promise()),I){if(null==d||j(d)){if(v=I.form,x=I.bg,w=I.root,G=I.done,z=v.my("data"),A=!1,d){try{G.call(v.my("manifest"),null,null)}catch(J){}try{i(v)?s():""}catch(J){}if(D.removeData("modal"),h[I.cid])try{h[I.cid].reject("Cancelled")}catch(J){}delete h[I.cid],I=null}else{try{A=G.call(v.my("manifest"),v.my("valid")?null:v.my("errors"),z)}catch(J){}if(!A){try{i(v)?s():""}catch(J){}D.removeData("modal"),function(){h[I.cid]&&h[I.cid].resolve(z),delete h[I.cid],I=null}.delay(0)}}return D}if(H)return t("Locked"),D}return D.is(":visible")?(H=b(C,d,{}))?H.global&&f?(t("Locked"),D):(I=g({type:"DOM",source:"manifest",form:null,modal:null,root:null,bgroot:null,caller:D,manifest:{},data:{},global:!1,screen:!1,drag:!1,focus:!0,close:!0,silent:!0,esc:!1,enter:!1,bound:!1,hardClose:!0,nose:"",width:p||300,height:null,x:"0",y:"0",z:"1901",background:"white",css:"",animate:200},H,{promise:B.promise(),cid:Number.random(268435456,4294967295).toString(16)}),I.done=n(I.done)?I.done:G,k(I.align)&&I.align&&(I.x=(I.align.match(/(left|right):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0],I.y=(I.align.match(/(top|bottom):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0]),I.width=1*(a.my.f.getref(k(I.manifest)?a.my.cache(I.manifest):I.manifest,"params.width")||I.width),I.type="DOM",D.hasClass("my-form")?(I.type="form",I.root=I.root||D):D.data("my")?(I.type="control",I.root=I.root||D.my().root):(I.root=I.root||D.parents(".my-form").eq(0),I.root.size()||(I.root=a(e))),I.global?(I.root=a(e),I.bgroot=a(c||e)):I.bgroot=I.root,w=I.root,w.data("modals")||w.data("modals",{}),q(),u=a('
'),I.root.find(">.my-modal").size()?u.insertAfter(I.root.find(">.my-modal").last()):u.prependTo(I.root),u.addClass("my-modal-"+I.cid),E=u.outerWidth(),F=u.outerHeight(),u.hide(),u.html('
'),v=u.find(".my-modal-form"),I.close&&(y=a(k(I.close)?I.close:'
×
').prependTo(u).on("click.my",function(){D.modal(I.hardClose)}),y.css({"z-index":("+"===(I.z+"").to(1)?"+":"")+(1*I.z+1)})),x=I.bgroot.find(">.my-modal-screen"),I.screen&&(x.size()||(x=a('').prependTo(I.root)),I.esc&&x.on("click.my"+I.cid,function(){D.modal(!0)})),D.data("modal",I),I.silent&&u.on("change.my",function(){return!1}),u.css({display:"block",height:"none",opacity:"0.005","z-index":I.z,width:"auto"}),u.css(I.global?{position:"fixed",left:"50%",top:I.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":I.z,width:"auto","margin-left":"-"+((I.width+E)/2).round(0)+"px"}:{position:"absolute",left:I.pos.vx+"px",top:I.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":I.z,width:"auto"}),v.my(I.manifest,I.data).then(function(){var b,c,d,e,i;if(g(I,{form:v,bg:x,cancel:function(){D.modal(!0)},commit:function(){D.modal()}}),u.data("modal",I),I.height=u.outerHeight(),"manifest"!==I.source&&(I.width=u.width()),q(),u.css({top:I.pos.vy+"px"}),r(!0),w.data("modals")[I.cid]=I,h[I.cid]=B,v.bind("commit.my",function(){return I.commit.delay(50),!1}).bind("cancel.my",function(){return I.cancel.delay(50),!1}),u.bind("layout.my",function(){r()}.debounce(50)),I.global&&(f=D,a("body").css({overflow:"hidden"})),I.global||!I.esc&&!I.enter||v.bind("keydown.my",function(b){var c=b.keyCode;return 27==c&&I.esc?(I.cancel(),!1):13==c&&I.enter&&!a(b.target).is("textarea")?(I.commit.delay(50),!1):void 0}),I.focus===!0){e=!1,i=I.manifest.ui;for(d in i)e||(c=v.find(d),c.size()&&c.is("input, textarea","button")&&(e=!0,c.focus()))}else k(I.focus)&&v.find(I.focus).focus();if(b=v.find("img").filter(function(){return""!=a(this).attr("src")}),b.size()){var j=function(){"manifest"!==I.source&&u.css({width:"auto"}),r()}.after(b.size());b.each(function(){a(this).bind("load",j)})}I.drag&&a.fn.draggable&&(k(I.drag)?u.draggable({handle:I.drag}):u.draggable(),I.nose&&u.on("dragstart.my",function(){u.removeClass("nose-"+I.nose)})),u.on("mousedown.my",function(b){var c,d=[],e=a(b.currentTarget),f=e.parent(),g=+e.css("z-index"),h=g;f.size()&&(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+""))}),B.notify("Ready")}).fail(function(a){try{s()}catch(b){}D.data("modal",null),B.reject(a)}),D):(t("Invalid data"),D):(t("Object must be visible"),D)}}(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(hb(b)?b.split("."):fb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return ib(a)?Object.values(a).find(function(a){return ib(a)||fb(a)?a[c[0]]==c[1]:!1}):fb(a)?a.find(function(a){return ib(a)||fb(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(hb(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(fb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(ib(a))for(b in a)c[b]=lb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(hb(c)&&(c=c.split(/[,\s]+/)),fb(c)){for(c=c.compact(!0),b=0;b$/.test(x.list)?f=x.list:i=x.list||i,!f){var l=d.find(i);f="
",l.size()&&(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:s,delay:(x.delay||v.delay||10)/1.3,template:f,selector:i,parent:A,bind:x.bind,merge:lb(x.merge)?x.merge.bind(A):x.merge?n:!1,hash:lb(x.hash)?x.hash.bind(A):hb(x.hash)?k.fill(void 0,x.hash):fb(x.hash)?m.fill(void 0,x.hash.slice(0)):null,id:lb(x.id)?x.id.bind(A):hb(x.id)?k.fill(void 0,x.id):fb(x.id)?m.fill(void 0,x.id.slice(0)):null,ext:!(!x.id&&!x.hash),stamp:0},d.on("insert.my",function(b,c){b.stopPropagation();var d={what:void 0,where:0};null==c?d.where=1e6:ib(c)?pb(d,c):(hb(c)||jb(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=J.call(d,q(A,s),ib(e)?e:void 0)}catch(p){j("$.my subform init of "+g+" failed: "+p.message,p.stack)}}mb(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),y&&y.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(C(a,b))}function o(){d.each(function(){var b,c,h,i=a(this),j=!1;if("TEXTAREA"==i[0].nodeName&&(h=i[0].nextSibling,c=h&&h.CodeMirror?h.CodeMirror:null,c&&i.addClass("my-codemirror")),b=x.events||M(i,Bb.events),i.hasClass("my-form")?sb(i.data("my"),{dui:x,root:e,selector:g,dparams:v,devents:b,ddata:u.data,container:v.container(i),derrors:u.errors,single:!0}):(i.data("my",{events:b,selector:g,initial:r,previous:r,root:e,container:v.container(i),id:u.id,ui:x,data:u.data,params:v,errors:u.errors,single:1==B}),f._update=x.delay?N.debounce(x.delay):vb,j=!0),j)if(i.cleditor&&i.parent().hasClass("cleditorMain")){var k=i.cleditor()[0];if(k&&k.$frame&&k.$frame[0]){i.addClass("my-cleditor"),sb(i.data("my"),{container:v.container(i)});var l,m=function(a){i.val(a).trigger(db)},n=Number.random(1e5,1e6-1);a(k.$frame[0]).attr("id","cleditCool"+n),l=document.frames?document.frames["cleditCool"+n].document:a("#cleditCool"+n)[0].contentWindow.document;var o=a(l).find("body");a(l).bind("keyup.my",function(){m(a(this).find("body").html())}),i.parent().find("div.cleditorToolbar").bind("click.my mouseup.my",function(){m(o.html())}),a("body").on("click","div.cleditorPopup",function(){m(o.html())})}}else if(i.is("div.redactor_box textarea")){var p,q="my-redactor-9";try{p=i.getEditor(),q="my-redactor-8"}catch(s){p=i.redactor("getEditor")}p&&(i.addClass(q),p.bind("input.my keyup.my blur.my",function(a){a.trigger("redactor")}.fill(i)))}else i.hasClass("ace_editor")?ace.edit(d[0]).on(db,function(a){a.trigger("ace")}.fill(i)):c&&c.on(db,function(a){a.trigger("codemirror")}.fill(i));i.my()._changed=w.debounce(t),i.my()._recalc=H.debounce(t),i.bind(b,function(a){a.type==db&&a.stopPropagation(),j&&(u.locktill=zb()+f.delay),i.my()._changed(i,e,f,v)}),/check(\.my)?/.test(b+"")||i.on("check.my",function(){return i.my()._changed(i,e,f,v,!0),!1}),j||i.off("redraw.my"),i.on("recalc.my, redraw.my",function(a){a.stopPropagation(),i.my()._recalc(i,e,f,v)})}),y&&y.resolve()}var p,r,s,t,u=e.my(),v=(u||{}).params,x=f,y=null,z=0,A=u.manifest,B=d.size();return u?(t=f.delay,B?(x.init!=vb&&(p=G(A,x.init,d,u)),mb(p)?(z+=1,y=tb(),p.then(i,function(a,b){j("Init of "+g+" failed: "+a,b)})):i()):c("Not found "+g+" selector.",e),y):(b("Failed to find $root building "+g+" selector."),null)}function v(c,d){ib(d)&&d.channel&&d.message&&c.find(".my-listen-"+l(d.channel)).each(function(){var c,e=a(this),f=e.data("my"),g=void 0;if(f&&f.ui.listen&&lb(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 w(a,b,c,d,e){{var f,g=a.data("my");b.data("my")}g&&(g.disabled?g.ddata||N(a,vb,c.recalcDepth||d.recalcDepth):(A(g.ddata||g.data,g.dparams||g.params),e||(f=g.single?a:b.find(g.selector)),N(a,e?vb:z(f,vb),c.recalcDepth||d.recalcDepth),d.change&&d.change.call(a)))}function x(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=M(c,Bb.offon).fill(void 0,c)),e._disable(!!b))}),c}function y(a,b,c){return a[b](c?"disable":"enable")}function z(a,b){var c,d,e=a.data("myval");return e||(d=M(a,Bb.vals),lb(d)&&(c=d(a,vb),void 0===c?a.data("myval",function(a,b){return vb!=b&&d(a,b),a.val()}.fill(a,void 0)):a.data("myval",d.fill(a,void 0))),e=a.data("myval")),lb(e)?(c=e(),(c!==b&&(0==b||0==c)||c!=b||ib(b))&&(c=e(b)),c):vb}function A(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=b;if(!ib(n)||isNaN(h=n.remember)||!ib(e=n.history))return vb;if(ib(a)&&h){if(j=qb(a,!0),k=zb(),g=rb(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(db),n.history[g.last()]}if(!isNaN(a)||a===vb){if(i=parseInt(a)||0,0>i)return vb;if(g=rb(e).sort(),i>=g.length&&(i=g.length-1),l=qb(n.history[g[g.length-i-1]],!0),c){for(m={},f=0;f=i;i++)if(i===h){if(d)return vb!=b?e[f[i]]=b:void 0===e[f[i]]&&(e[f[i]]=vb),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||!ib(e)&&(fb(e)&&!isNaN(f[i+1])&&+f[i]>-1))&&(e=g[f[i]]={});return a}function F(a,b,c){var e=ib(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&&(hb(f.recalc)?l=f.recalc.split(n):fb(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,"watch"))for(hb(f.watch)?m=f.watch.split(n):fb(f.watch)&&(m=f.watch.slice(0)),m=m.compact(!0).unique(),k=0;ki&&h.resolve()}var d,e,f,g=!1,h=tb(),i=a.length;for(e=0;i>e;e++)d=a[e],f=hb(d.ajax)?w.loader:xb,f(d.ajax).then(function(a,d){eb.test(d.ref)&&(null!=a?sb(!0,b,D(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 eb.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=tb(),t=[],u={},v=[],w=sb(!0,{ajaxTimeout:1e4,loader:Bb.params.loader},c||{}),x={ref:null,ajax:{type:"GET",async:!0,timeout:w.ajaxTimeout}};if(ib(b))if(fb(b.require)){for(n=b.require,k=0;k'+d+""}!$.style||b&&!rb.is(":visible")||(R=K(rb,$,S,T),R&&R[0].length&&!b&&(U=a("style#"+S),U.size()||(U=a(c(R[0],S)).appendTo(a("body"))),U.data("count",1*U.data("count")+1),rb.data("my").style=U),R&&R[1].length&&(Y=a("style#"+T),Y.size()?b&&(a(c(R[1],T)).replaceAll(Y),Y=a("style#"+T)):(Y=a(c(R[1],T)).appendTo(a("body")),P.restyle>-1&&!ob[I]&&(ob[I]=function(){p(!0)}.debounce(P.restyle)),rb.data("my").restyle=p.fill(!0).debounce(0)),rb.data("my").localStyle=Y,b||rb.addClass("my-restyle")))}function q(){var a,b,c=!0;if(b=s($),hb(b))A("Error decoding base64 to local Blob/URL",b),c=!1;else{if(V)for(a=0;a*").clone();try{Z=G($,Q.init,rb,Q)}catch(b){return A(hb(b)?b:b.message,b.stack),rb}}if(mb(Z)?Z.then(function(){w()},function(a,b){A(a,b)}):w(),!gb){if(!rb.my())return A("Internal error initializing controls.",""),rb;rb.data("my").initial=sb(!0,{},ab),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function w(){function a(a){gb||(b[a]=z(rb.find(a),vb),d-=1,.5>d&&x(b))}var b={},c=Object.keys(N),d=c.length;0===d?y():(rb.addClass(kb),c.forEach(function(b){if(!gb){var c=rb.find(b),d=u(c,rb,N[b],b);qb[b]=c,mb(d)?d.then(a.fill(b)).fail(function(a,c){A("Error building "+b+", "+a,c)}):gb||a(b)}}))}function x(a){var c,d,e,f,g;for(g in N){if(gb)return;if(c=N[g],e=qb[g],f=e.size()){c.listen&&(db[g]=e.eq(0));try{d=t(ab,vb,c,e),d==vb&&a[g]!=vb&&void 0!==d&&t(ab,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+I+"')",h.message,h.stack)}try{d!=vb&&z(e,d),e.eq(0).trigger("check.my")}catch(h){A("Error linking "+g,h.message,h.stack)}}}y()}function y(){rb.removeClass(kb),rb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),rb.my("redraw")}),pb=null,eb.resolve(ab)}function A(a,c){var d;if(gb=!0,b("Form "+H+" failed to initialize.",a,c),Object.keys(qb).forEach(function(a){delete qb[a]}),rb.removeClass(kb),d=jb(a,c),hb(d)||ib(d)&&d.jquery?rb.html(d):d===!0&&rb.html(pb),P.silent)eb.resolve(ab);else{if(!rb.my().ddata){if(rb.removeData("my"),rb.removeClass("my-form"),U)if("1"==U.data("count"))try{U.remove()}catch(e){}else U.data("count",U.data("count")-1);if(Y)try{delete ob[I],Y.remove()}catch(e){}}eb.reject("Form "+H+" failed to initialize: "+a,c)}}var C,E,H,I,J,M,N,P,Q,R,S,T,U,Y,Z,$={},ab={},bb=null,cb=[],db={},eb=tb(),gb=!1,jb=function(){},kb="my-form-init",nb="std",pb="",qb={};if(hb(d)){if(C=yb(d),!C)return eb.reject("No manifest with id "+d+" found in repo."),eb.promise();ib(f)&&ib(e)?(C=sb(C,e),E=f):E=e,nb="repo"}else C=d,E=e;if(!C)return this;Q=ib(E)&&"repo"!=nb?sb(!0,{},C):C;var rb=this.eq(0),ub=rb.my();return ib(ub)&&ub.id&&ub.ui?(c("jQuery.my is already bound.",rb),rb.my("ui",Q.ui),rb.my(_,Q.data),eb.resolve(rb.my(_)).promise()):(P=Q.params||{},P.strict||lb(Q.init)||(P=sb(!0,{},P),O(P)),P=sb(!0,{},Bb.params,P),eb.fail(function(){rb.removeClass(T+" "+S)}),sb(rb,eb.promise()),ib(E)?(ab=m(E,Q.data||{}),Q.data=ab):ab=Q.data||{},$.data=ab,rb.data("my",{data:ab,params:P,promise:eb.promise(),locktill:0}),rb.addClass(kb),Q.inherit&&i(Q),fb(Q.require)?Ab(Q,P).then(g).fail(function(a){o(),A("Linker of the ‘require’ property failed.",a)}):g(),eb.then(n),rb)}function K(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=lb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),hb(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Cb.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),fb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==$&&c(a,i,g+1)}vb!=b[""]&&typeof b[""]!=$&&g>e&&(d=b[""],e=g)}var d=vb,e=0,f="";return c(a,b,1),d}function N(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q=!1,r=!1,s=a,u=s.my(),v="";if(u){if(m=u.selector,n=u.root,n.hasClass("my-form-init"))return{};if(o=n.find(m),p=n.my().ui,q=a.hasClass("my-form"),q?(f=a,g=u.ddata,h=u.dui,i=u.dparams):(f=u.container,g=u.data,h=u.ui,i=u.params),h.bind!=vb){if(j=wb(c)?c:z(o,t(g,vb,h,o)),vb!=h.check){v="Unknown error";try{v=T(g,j,h,o)}catch(w){b("Error "+w.message+" in .check validator for "+m,n,w.stack)}}var y=i.errorCss,A="ui-state-error";try{vb!=c&&(j=z(o,t(g,c,h,o)))}catch(w){v=i.messages.formError||"Error"}if(vb!=h.check)if(r=a.hasClass("my-form-list"),""==v&&(q||f.hasClass(y)))q?u.derrors[m]="":u.errors[m]="",f.removeClass(y),f.attr("title")&&f.attr("title",""),q||r||i.effect(f.find(i.errorTip),!1,i.animate/2),s.removeClass(A),s.find(".ui-widget").removeClass(A);else if(v){if(q)u.derrors[m]=v;else if(r)u.errors[m]=v;else{f.addClass(y),u.errors[m]=v;var B=f.find(i.errorTip).eq(0);B.size()?i.effect(B.addClass(y).html(hb(v)?v:"Error"),!0,i.animate):f.attr("title",(hb(v)?v:"Error").stripTags())}s.hasClass("hasDatepicker")&&(s.is("input")?s.addClass(A):s.find(".ui-widget").addClass(A)),s.hasClass("ui-slider")&&s.addClass(A)}}var C=c==vb?j:c;if(h.css)for(k in h.css)l=h.css[k],kb(l)?x(l.test(C),o,k):lb(l)&&x(l.call(n.my().manifest,g,C,o),o,k);var e,D,E=h.recalc,F=[],G={};if(d&&h.recalc&&n.my()){for(p=n.my().ui,e=0;e-1?"":n;case"s":return c==k?"":n;case"o":return k[c]?"":n;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},e.find(h).filter("*:not(.ui-sortable-placeholder)").each(function(b){var c=a(this);c.data("my")&&!c.my("valid")&&(j[b]=c.my("errors"))}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return l.formError||"Error"}return""}var U="jQuery.my 1.2.6",V=window.URL||window.webkitURL,W=!document.addEventListener,X=((window.navigator.language||window.navigator.userLanguage||"en")+"").split("-")[0].toLowerCase(),Y="{yyyy}-{MM}-{dd}",Z="{HH}:{mm}",$="object",_="data",ab="array",bb="string",cb="function",db="change",eb=/^this\./,fb=Object.isArray,gb=Object.isBoolean,hb=Object.isString,ib=Object.isObject,jb=Object.isNumber,kb=Object.isRegExp,lb=Object.isFunction,mb=function(a){return null!=a&&typeof a==$&&lb(a.then)},nb=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},ob=h(a,"my.f.restyles")?a.my.f.restyles():{},pb=Object.merge,qb=Object.clone,rb=Object.keys,sb=a.extend,tb=a.Deferred,ub=a.type,vb=null,wb=function(a){return null!==a&&void 0!==a},xb=a.ajax,yb=p,zb=Date.now,Ab=I,Bb={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my(_);return Object.equal(c,b)?c:a.my(_,b,!0)}return b||vb},".hasDatepicker":function(a,b){wb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(Y):""},".my-tags":function(a,b){return wb(b)&&(hb(b)||jb(b)?a.tags(_,[b+""]):fb(b)&&a.tags(_,b)),a.tags(_)},".ui-draggable":function(a,b){if(wb(b)&&ib(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=!!r.merge,u=r.template||"
",v=/\{/.test(u),w=r.hash||l,x=r.id||l,y=r.ext,z=r.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).size(),E=[],F=[],G=zb(),H=b.find(C?b.sortable("option","items"):s);if(wb(c)&&fb(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=[],K=[],L={},M={};for(F=[],h=0;h1.4*z||G-r.stamp>100||!r.stashed||r.stashed.length!==H.size()-(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){y(b,"selectable",a)},".ui-slider":function(a,b){y(b,"slider",a)},".ui-draggable":function(a,b){y(b,"draggable",a)},".ui-buttonset":function(a,b){y(b,"buttonset",a)},".hasDatepicker":function(a,b){y(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){y(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")}}}};Bb.params={container:function(a){return M(a,Bb.containers)(a)},change:vb,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:X,messages:Object.map(Bb.msg,function(a,b){return b[X]||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=tb(),c=yb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Cb={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:y,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&&hb(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===cb)return b(a.toJSON(),m+(g?1:0),g);if(h=[],fb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),lb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=hb(b)?b:a.my.tojson(b),g=hb(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Cb.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:K,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}},Db={container:function(a){return M(a,Bb.containers)(a)},data:function(a,b){var c=this;return ib(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==vb)return g.disabled;if(a){for(c in g.ui)b=f.find(c).eq(0),d=b.my(),d&&(d.predisabled=d.disabled),x(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=f.find(c).eq(0),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),x(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]&&hb(b[d])&&(c[d]=b[d]),ib(b[d])&&rb(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 A(a,this.my().params,b)},id:function(a,b){if(hb(a))return yb(a,b);var c=this.my();return c&&c.id?c.id:vb},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:J,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=eb.test(j.bind)?h(f.my().manifest,j.bind.replace(eb,"")):h(f.my().data,j.bind),!ib(i))if(ib(j.manifest))i=qb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=qb(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?Cb.tojson(this.my().manifest):this.my().manifest},promise:function(a){return lb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",hb(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my();return d&&d.ui&&(d.ui.each(function(b){var e=c.find(b);N(e,a?vb:void 0,d.params.recalcDepth),a||(e.is(".my-form")&&e.my("redraw"),e.trigger(e.is(".my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(db)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return vb;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"),ib(d)&&d.manifest&&lb(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 ob[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?vb:(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=A(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return z(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&hb(b[d])?c++:ib(b[d])&&rb(b[d]).length&&c++;return!c},version:function(){return U}},Eb=Object.keys(Db);a.my||(a.my={}),sb(a.my,{f:a.extend({},Cb),tojson:Cb.tojson,fromjson:Cb.fromjson,radio:function(b,c){v(a(document),hb(b)?{channel:b,message:c}:b)},rules:Bb,locale:function(a){return hb(a)?(X=a.toLowerCase(),void 0):X},ajax:function(a){return lb(a)?xb=a:xb.apply(this,f(arguments,0))},cache:function(a,b){return lb(a)?yb=a:yb(a,b)},now:function(a){return lb(a)?(zb=a,void 0):zb()},require:function(a){return lb(a)?Ab=a:Ab.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()}mb(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 U}}),a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(hb(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Db.init.apply(this,[c].add(f(arguments,1)))}return hb(b)&&Db[b]?Db[b].apply(this,f(arguments,1)):hb(b)&&yb(b,"exist")?Db.init.apply(this,arguments):typeof b!==$&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Db.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),v(a(document),c)}).on("resize.my",function(){for(var a in ob)try{ob[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.size()||(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).size()?(f=b,void 0):a(f)},e.modal.parentBack=function(b){return b&&a(b).size()?(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:J.pos.pw+"px",height:J.pos.ph+"px",display:"block",background:l(J.screen)?J.screen:"rgba(40,80,120,0.6)","z-index":J.z-1}):y.size()&&y.hide(),J.height>J.pos.wh?(v.height(J.pos.wh-30),w.css({"overflow-y":a.browser.webkit?"overlay":"scroll"})):w.css({"overflow-y":"none"}),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("body")[0].style.overflow=null)}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.size()||(J.root=a(f))),J.global?(J.root=a(f),J.bgroot=a(c||f)):J.bgroot=J.root,x=J.root,x.data("modals")||x.data("modals",{}),r(),v=a('
'),J.root.find(">.my-modal").size()?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.size()||(y=a('').prependTo(J.root)),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),x.data("modals")[J.cid]=J,i[J.cid]=C,w.bind("commit.my",function(){return J.commit.delay(50),!1}).bind("cancel.my",function(){return J.cancel.delay(50),!1}),v.bind("layout.my",function(){s()}.debounce(50)),J.global&&(g=E,a("body").css({overflow:"hidden"})),J.global||!J.esc&&!J.enter||w.bind("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.size()&&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.size()){var j=function(){"manifest"!==J.source&&v.css({width:"auto"}),s()}.after(b.size());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.size()&&(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 diff --git a/my.jquery.json b/my.jquery.json index ba47ac2..fe589d6 100644 --- a/my.jquery.json +++ b/my.jquery.json @@ -5,7 +5,7 @@ "keywords": [ "MVVM", "framework", "ui", "form", "validation", "data binding" ], - "version": "1.2.5", + "version": "1.2.6", "author": { "name": "ermouth", "url": "https://github.com/ermouth" @@ -28,7 +28,7 @@ "demo": "http://jquerymy.com/#CW-demos", "download": "http://jquerymy.com/download.html", "dependencies": { - "jquery": ">=1.11.0", + "jquery": "~2", "sugarjs": "~1.4.0" } } \ No newline at end of file diff --git a/package.json b/package.json index 2d65723..f15a37c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jquerymy", - "version": "1.2.5", + "version": "1.2.6", "description": "A lightweight jQuery plugin for complex two-way data binding in real time.", "homepage": "http://jquerymy.com/", "author": "ermouth ", @@ -27,7 +27,7 @@ }, "dependencies": { - "jquery":"~1.11", + "jquery":"~2", "sugar":"~1.4" },