scinote-web/vendor/assets/javascripts/jquerymy-1.2.14.min.js

7 lines
59 KiB
JavaScript
Raw Normal View History

/* Licensed under the MIT license
* jQuery.my 1.2.14, (c) 2017 ermouth
* Requires jQuery 2.0+, SugarJS 1.3.9-1.4.x
* More details at jquerymy.com */
!function(a){function b(){window.console&&console.error.apply(console,arguments)}function c(){window.console&&console.log.apply(console,arguments)}function d(a,b){return"hasOwnProperty"!=b?a.hasOwnProperty(b):!!("hasOwnProperty"in a)}function e(b){return a.contains(document.documentElement,b[0])}function f(a,b){return Array.prototype.slice.call(a,b||0)}function g(a,b,c){var d=0,e=a.length,f=!0;if(a===b)return"===";if("==="==c)return"";if(e!=b.length)return"";for(;e>d&&f;d++)f=a[d]===b[d];if(f)return"==";if("=="==c)return"";for(f=!0;e>d&&f;d++)f=Object.equal(a[d],b[d]);return f?"=":""}function h(a,b){return(ib(b)?b.split("."):gb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return jb(a)?Object.values(a).find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):gb(a)?a.find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):void 0}if(null!=a&&null!=a[b])return a[b]}return void 0},a)}function i(a){var b=a.my();return b?b.root?b.root.my():b:null}function j(a){var b,c={},d=function(){return null};if(ib(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(gb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(jb(a))for(b in a)c[b]=mb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(ib(c)&&(c=c.split(/[,\s]+/)),gb(c)){for(c=c.compact(!0),b=0;b<c.length;b++)d[c[b]]=!0;return d}return jb(c)?a:null}function l(a){for(var b=JSON.stringify(a),c=0,d=0;d<b.length;d++)c=b.charCodeAt(d)+(c<<6)+(c<<16)-c;return(1e11+c).toString(36)}function m(a,b){for(var c in b)d(b,c)&&(jb(b[c])?d(a,c)?m(a[c],b[c]):a[c]=rb(b[c],!0):d(a,c)||(a[c]=gb(b[c])?b[c].clone(!0):b[c]));return a}function n(a,b){function c(a,b,d){return void 0===d||null===d?b:jb(d)?qb(b,d,!1,c):d}return a?b?qb(a,b,!1,c):a:{}}function o(a,b){return sb(a).forEach(function(b){delete a[b]}),"object"==typeof b&&qb(a,b,!0),a}function p(b,c,d){return/^[#\.][a-z0-9_\-]{1,31}$/i.test(c)?a(d?b[0].querySelectorAll(c):b[0].querySelector(c)):d||/:/.test(c)||/^[a-z]{1,31}[\[\.\#][a-z]/i.test(c)?b.find(c):b.find(c).eq(0)}function q(a,b){var c,d;return ib(a)?(c=a,d=h(jb(b)?b:ob,c),"exist"===b?jb(d):d?rb(d,!0):null):jb(a)?(d=s(a,b),jb(d)?d:null):void 0===a?ob._src:null===a?Object.reject(ob,/^_/):null}function r(a,b){var c,d;if(jb(b))return b;if(ib(b)){if(c=h(a,b),null==c&&(c=rb(ob._src[b],!0)),null==c&&(c=h(ob,b),jb(c)&&jb(c._self)?c=rb(c._self,!0):jb(c)&&(c=rb(c,!0))),null==c&&h(a,"params.cache")&&(d=h(a,"params.cache"),mb(d)?c=d(b):jb(d)&&(c=zb(b,d)),jb(c)&&(jb(c._self)&&(c=rb(c._self,!0)),qb(c,{params:{cache:d}},!0))),null!=c&&jb(c))return d=d||h(a,"params.cache"),d&&qb(c,{params:{cache:d}},!0),c;throw"Component "+b+" not found."}return mb(b)?b.apply(a,f(arguments,2)):null}function s(c,e){var f,g,i,j,k,l=e||ob,m=c;if(!(jb(l)&&jb(m)&&jb(m.ui)&&ib(m.id)))return"Can’t save manifest into cache, invalid arguments.";d(l,"_src")||(l._src={}),i=m.id;try{m=rb(c,!0)}catch(n){return"Can’t save circular-referencing object into cache."}try{(!m.params||m.params&&!m.params.strict)&&P(m,!0)}catch(n){return"Invalid manifest, parse error."}if(f=t(m),ib(f))return b(f),f;if(qb(m,{params:{strict:!0}},!0),l._src[i]=m,j=D(l,i)){if(j.params&&j.params.protect)return"Can’t save manifest into cache over protected one.";j._self&&delete j._self,a.extend(!0,l,E("",i))}return a.extend(!0,l,E(m,i)),g=Object.keys(l._src).filter(function(a){return a.startsWith(i+".")}),g.sort(),g.forEach(function(b){var c;(c=D(l,b))&&(c._self&&delete c._self,a.extend(!0,l,E("",b))),a.extend(!0,l,E(l._src[b],b))}),k=h(l,i),X?k._self=l._src[i]:Object.defineProperty(k,"_self",{get:function(){return l._src[i]},set:function(){throw"Can’t change manifest cache entry directly."},enumerable:!1,configurable:!0}),k}function t(a){var b,c,d=[];if(jb(a.files)&&Object.size(a.files))for(b in a.files){if(c=a.files[b],!jb(c))return"Non-object member "+b+" in files section.";if(ib(c.data)&&!c.url)if(W)try{Db.base642blob(c.data,function(a){c.blob=a,c.url=W.createObjectURL(c.blob)},c.content_type||c.mime),d.push(b)}catch(e){return"Invalid base64 data
},"div,span":{".ui-slider":function(a,b){return xb(b)&&a.slider("option",a.slider("option","values")?"values":"value",Db.clone(b)),Db.clone(a.slider("option","values")||a.slider("option","value")||0)},".ui-buttonset":function(b,c){if(xb(c)){if(""!=c){var d=wb;if(b.find(":radio").each(function(){d=(a(this).val()||a(this).button("option","label"))==c?a(this):d}),d)return d.attr("checked",!0),b.buttonset("refresh"),c}}else{var e=b.find(":radio:checked");if(e.length&&e.button)return e.val()||e.button("option","label")}return b.find(":radio:checked").attr("checked",!1),b.buttonset("refresh"),""},".ace_editor":function(a,b){return xb(b)&&ace.edit(a[0]).setValue(b),ace.edit(a[0]).getValue(b)},"":function(a,b){return xb(b)&&a.html(b),a.html()}},"a,p,li,td,th,h1,h2,h3,h4,h5,h6,pre,code":function(a,b){return xb(b)&&a.html(b),a.html()},img:function(a,b){return xb(b)&&a.attr("src",b),a.attr("src")||""},"":function(a,b){return xb(b)&&a.html(b),a.html()||a.text()||String(a.val())||""}},msg:{"":{en:"Invalid input",ru:"Неверное значение"},formError:{en:"Form error",ru:"Ошибка формы"},initFailed:{en:'<p class="my-error">Form init failed</p>',ru:'<p class="my-error">Ошибка инициализации формы</p>'},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)}},"div.redactor_box textarea":function(a){return a.parents("div.redactor_box").eq(0).parent()},".my-tags,.hasDatepicker,.ui-widget,input,textarea,select,button":{".my-cleditor":function(a){return a.parents("div.cleditorMain").eq(0).parent()},"":function(b){var c=b[0].parentNode,d=c.nodeName;return/^(div|span|a|p|form|fieldset|li|ul|td|th|h\d)$/i.test(d)?a(c):b.parents("div,span,a,p,form,fieldset,li,ul,td,th,h1,h2,h3,h4,h5,h6").eq(0)}},"":function(a){return a}},offon:{".ace_editor":function(a,b){ace.edit(b[0]).setReadOnly(a)},".ui-selectable":function(a,b){z(b,"selectable",a)},".ui-slider":function(a,b){z(b,"slider",a)},".ui-draggable":function(a,b){z(b,"draggable",a)},".ui-buttonset":function(a,b){z(b,"buttonset",a)},".hasDatepicker":function(a,b){z(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){z(b,"select2",a)},".my-cleditor":function(a,b){b.cleditor()[0].disable(!!a)},"":function(a,b){b.attr("disabled",!!a)}},destroy:{".hasDatepicker":function(a)