Version Description
Download this release
Release Info
Developer | nsinelnikov |
Plugin | Ultimate Member – User Profile & Membership Plugin |
Version | 2.4.0 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.4.0
- assets/js/dropdown.min.js +1 -1
- assets/js/simplebar.min.js +1 -1
- assets/js/um-account.min.js +1 -1
- assets/js/um-conditional.min.js +1 -1
- assets/js/um-crop.min.js +1 -1
- assets/js/um-functions.min.js +1 -1
- assets/js/um-jquery-form.min.js +1 -1
- assets/js/um-members.min.js +1 -1
- assets/js/um-modal.min.js +1 -1
- assets/js/um-profile.min.js +1 -1
- assets/js/um-raty.min.js +1 -1
- assets/js/um-scripts.js +716 -716
- assets/js/um-scripts.min.js +1 -1
- assets/js/um-tipsy.min.js +1 -1
- includes/admin/core/class-admin-enqueue.php +1 -1
- includes/admin/core/class-admin-notices.php +715 -715
- includes/admin/core/class-admin-settings.php +18 -0
- includes/admin/core/packages/2.4.0/functions.php +50 -0
- includes/admin/core/packages/2.4.0/hooks.php +5 -0
- includes/admin/core/packages/2.4.0/init.php +30 -0
- includes/class-config.php +2 -0
- includes/core/class-fields.php +28 -0
- includes/core/class-fonticons.php +52 -52
- includes/core/class-form.php +59 -34
- includes/core/class-profile.php +9 -0
- includes/core/class-shortcodes.php +9 -7
- includes/core/class-uploader.php +2 -2
- includes/core/um-filters-fields.php +1 -1
- includes/core/um-filters-navmenu.php +3 -0
- readme.txt +17 -2
- ultimate-member.php +1 -1
assets/js/dropdown.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function um_init_new_dropdown(){jQuery(".um-new-dropdown").um_dropdownMenu()}!function(
|
1 |
+
function um_init_new_dropdown(){jQuery(".um-new-dropdown").um_dropdownMenu()}!function(p){function o(e){var i={get:function(){return i},show:function(){i.hideAll(),i.$menu=i.$element.find(".um-new-dropdown"),i.$menu.length||(i.$menu=p('div.um-new-dropdown[data-element="'+i.data.element+'"]').first()),i.$dropdown=i.$menu.clone(),i.$dropdown.on("click","li a",i.itemHandler).attr("data-cloned","1"),p(window).on("resize",i.updatePosition);var e=""!==i.data.parent?i.data.parent:document.body;return p(e).append(i.$dropdown),i.$element.trigger("um_new_dropdown_render",{dropdown_layout:i.$dropdown,trigger:i.data.trigger,element:i.data.elemen,obj:i.$element}),i.$dropdown.css(i.calculatePosition()).show(),i.$element.addClass("um-new-dropdown-shown").data("um-new-dropdown-show",!0),i},hide:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&(p(window).off("resize",i.updatePosition),i.$dropdown.remove(),i.$element.removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1)),i},hideAll:function(){return i.$element.data("um-new-dropdown-show")&&i.hide(),p('div.um-new-dropdown[data-cloned="1"]').remove(),p(".um-new-dropdown-shown").removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1),i},calculatePosition:function(){var e,t=i.$element.get(0).getBoundingClientRect(),n=i.$dropdown.innerHeight()||150,o=i.data.width||150,d="",r=(e=""!==i.data.parent?(r=p(i.data.parent).offset(),{top:(e=i.$element.offset()).top-r.top,left:e.left-r.left}):i.$element.offset(),""!==i.data.parent?p(i.data.parent)[0].offsetWidth:window.innerWidth),a={position:"absolute",width:o+"px"};switch((""!==i.data.parent?p(i.data.parent)[0].offsetHeight:window.innerHeight)-t.bottom>n?(a.top=e.top+t.height+"px",d+="bottom"):(d+="top",a.top=e.top-n+"px"),e.left>o||e.left>r/2?(a.left=e.left+t.width-o+"px",d+="-left"):(a.left=e.left+"px",d+="-right"),d){case"bottom-right":a.borderRadius="0px 5px 5px 5px";break;case"bottom-left":a.borderRadius="5px 0px 5px 5px";break;case"top-right":a.borderRadius="5px 5px 5px 0px";break;case"top-left":a.borderRadius="5px 5px 0px 5px"}return a},updatePosition:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&i.$dropdown.css(i.calculatePosition()),i},itemHandler:function(e){e.stopPropagation();e=p(e.currentTarget).attr("class");i.$menu.find('li a[class="'+e+'"]').trigger("click"),i.$element.data("um-new-dropdown-show")&&i.hide()},triggerHandler:function(e){e.stopPropagation(),i.$element=p(e.currentTarget),i.$element.data("um-new-dropdown-show")?i.hide():i.show()}};return i.$menu=p(e),i.data=i.$menu.data(),i.$element=i.$menu.closest(i.data.element),i.$element.length||(i.$element=p(i.data.element).first()),i.$dropdown=p(document.body).children('div[data-element="'+i.data.element+'"]'),void 0===i.data.initted&&(i.$menu.data("initted",!0),i.data=i.$menu.data(),void 0===o.screenTriggers&&(o.screenTriggers={}),o.screenTriggers[i.data.element]!==i.data.trigger&&(o.screenTriggers[i.data.element]=i.data.trigger,p(document.body).on(i.data.trigger,i.data.element,i.triggerHandler))),void 0===o.globalHandlersInitted&&(o.globalHandlersInitted=!0,p(document.body).on("click",function(e){p(e.target).closest(".um-new-dropdown").length||i.hideAll()})),i}p.fn.um_dropdownMenu=function(n){return"string"==typeof n&&n?this.map(function(e,t){t=o(t);return"function"==typeof t[n]?t[n]():t[n]}).toArray():this.each(function(e,t){o(t)})}}(jQuery),jQuery(document).ready(function(e){um_init_new_dropdown()});
|
assets/js/simplebar.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).SimpleBar=e()}(this,function(){"use strict";var y=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},h=function(t){try{return!!t()}catch(t){return!0}},e={}.toString,n=function(t){return e.call(t).slice(8,-1)},i="".split,x=h(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==n(t)?i.call(t,""):Object(t)}:Object,l=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},_=function(t){return Object(l(t))},r=Math.ceil,s=Math.floor,S=function(t){return isNaN(t=+t)?0:(0<t?s:r)(t)},o=Math.min,A=function(t){return 0<t?o(S(t),9007199254740991):0},a=function(t){return"object"==typeof t?null!==t:"function"==typeof t},c=Array.isArray||function(t){return"Array"==n(t)},t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(t,e){return t(e={exports:{}},e.exports),e.exports}var f,d,p,v,g="object"==typeof window&&window&&window.Math==Math?window:"object"==typeof self&&self&&self.Math==Math?self:Function("return this")(),b=!h(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),m=g.document,E=a(m)&&a(m.createElement),w=!b&&!h(function(){return 7!=Object.defineProperty(function(t){return E?m.createElement(t):{}}("div"),"a",{get:function(){return 7}}).a}),L=function(t){if(!a(t))throw TypeError(String(t)+" is not an object");return t},O=function(t,e){if(!a(t))return t;var i,r;if(e&&"function"==typeof(i=t.toString)&&!a(r=i.call(t)))return r;if("function"==typeof(i=t.valueOf)&&!a(r=i.call(t)))return r;if(!e&&"function"==typeof(i=t.toString)&&!a(r=i.call(t)))return r;throw TypeError("Can't convert object to primitive value")},M=Object.defineProperty,k={f:b?M:function(t,e,i){if(L(t),e=O(e,!0),L(i),w)try{return M(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},W=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},T=b?function(t,e,i){return k.f(t,e,W(1,i))}:function(t,e,i){return t[e]=i,t},R=function(e,i){try{T(g,e,i)}catch(t){g[e]=i}return i},j=u(function(t){var e="__core-js_shared__",i=g[e]||R(e,{});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.0.1",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),N=0,z=Math.random(),C=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++N+z).toString(36))},V=!h(function(){return!String(Symbol())}),D=j("wks"),B=g.Symbol,I=function(t){return D[t]||(D[t]=V&&B[t]||(V?B:C)("Symbol."+t))},P=I("species"),H=function(t,e){var i;return c(t)&&("function"!=typeof(i=t.constructor)||i!==Array&&!c(i.prototype)?a(i)&&null===(i=i[P])&&(i=void 0):i=void 0),new(void 0===i?Array:i)(0===e?0:e)},F=function(h,t){var f=1==h,d=2==h,p=3==h,v=4==h,g=6==h,b=5==h||g,m=t||H;return function(t,e,i){for(var r,n,s=_(t),o=x(s),a=function(r,n,t){if(y(r),void 0===n)return r;switch(t){case 0:return function(){return r.call(n)};case 1:return function(t){return r.call(n,t)};case 2:return function(t,e){return r.call(n,t,e)};case 3:return function(t,e,i){return r.call(n,t,e,i)}}return function(){return r.apply(n,arguments)}}(e,i,3),l=A(o.length),c=0,u=f?m(t,l):d?m(t,0):void 0;c<l;c++)if((b||c in o)&&(n=a(r=o[c],c,s),h))if(f)u[c]=n;else if(n)switch(h){case 3:return!0;case 5:return r;case 6:return c;case 2:u.push(r)}else if(v)return!1;return g?-1:p||v?v:u}},q=I("species"),$={}.propertyIsEnumerable,X=Object.getOwnPropertyDescriptor,Y={f:X&&!$.call({1:2},1)?function(t){var e=X(this,t);return!!e&&e.enumerable}:$},G=function(t){return x(l(t))},K={}.hasOwnProperty,U=function(t,e){return K.call(t,e)},J=Object.getOwnPropertyDescriptor,Q={f:b?J:function(t,e){if(t=G(t),e=O(e,!0),w)try{return J(t,e)}catch(t){}if(U(t,e))return W(!Y.f.call(t,e),t[e])}},Z=j("native-function-to-string",Function.toString),tt=g.WeakMap,et="function"==typeof tt&&/native code/.test(Z.call(tt)),it=j("keys"),rt={},nt=g.WeakMap;if(et){var st=new nt,ot=st.get,at=st.has,lt=st.set;f=function(t,e){return lt.call(st,t,e),e},d=function(t){return ot.call(st,t)||{}},p=function(t){return at.call(st,t)}}else{var ct=it[v="state"]||(it[v]=C(v));rt[ct]=!0,f=function(t,e){return T(t,ct,e),e},d=function(t){return U(t,ct)?t[ct]:{}},p=function(t){return U(t,ct)}}var ut,ht,ft={set:f,get:d,has:p,enforce:function(t){return p(t)?d(t):f(t,{})},getterFor:function(i){return function(t){var e;if(!a(t)||(e=d(t)).type!==i)throw TypeError("Incompatible receiver, "+i+" required");return e}}},dt=u(function(t){var e=ft.get,a=ft.enforce,l=String(Z).split("toString");j("inspectSource",function(t){return Z.call(t)}),(t.exports=function(t,e,i,r){var n=!!r&&!!r.unsafe,s=!!r&&!!r.enumerable,o=!!r&&!!r.noTargetGet;"function"==typeof i&&("string"!=typeof e||U(i,"name")||T(i,"name",e),a(i).source=l.join("string"==typeof e?e:"")),t!==g?(n?!o&&t[e]&&(s=!0):delete t[e],s?t[e]=i:T(t,e,i)):s?t[e]=i:R(e,i)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||Z.call(this)})}),pt=Math.max,vt=Math.min,gt=(ut=!1,function(t,e,i){var r,n=G(t),s=A(n.length),o=function(t,e){var i=S(t);return i<0?pt(i+e,0):vt(i,e)}(i,s);if(ut&&e!=e){for(;o<s;)if((r=n[o++])!=r)return!0}else for(;o<s;o++)if((ut||o in n)&&n[o]===e)return ut||o||0;return!ut&&-1}),bt=function(t,e){var i,r=G(t),n=0,s=[];for(i in r)!U(rt,i)&&U(r,i)&&s.push(i);for(;e.length>n;)U(r,i=e[n++])&&(~gt(s,i)||s.push(i));return s},mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yt=mt.concat("length","prototype"),xt={f:Object.getOwnPropertyNames||function(t){return bt(t,yt)}},Et={f:Object.getOwnPropertySymbols},wt=g.Reflect,Ot=wt&&wt.ownKeys||function(t){var e=xt.f(L(t)),i=Et.f;return i?e.concat(i(t)):e},_t=function(t,e){for(var i=Ot(e),r=k.f,n=Q.f,s=0;s<i.length;s++){var o=i[s];U(t,o)||r(t,o,n(e,o))}},St=/#|\.prototype\./,At=function(t,e){var i=Mt[Lt(t)];return i==Wt||i!=kt&&("function"==typeof e?h(e):!!e)},Lt=At.normalize=function(t){return String(t).replace(St,".").toLowerCase()},Mt=At.data={},kt=At.NATIVE="N",Wt=At.POLYFILL="P",Tt=At,Rt=Q.f,jt=function(t,e){var i,r,n,s,o,a=t.target,l=t.global,c=t.stat;if(i=l?g:c?g[a]||R(a,{}):(g[a]||{}).prototype)for(r in e){if(s=e[r],n=t.noTargetGet?(o=Rt(i,r))&&o.value:i[r],!Tt(l?r:a+(c?".":"#")+r,t.forced)&&void 0!==n){if(typeof s==typeof n)continue;_t(s,n)}(t.sham||n&&n.sham)&&T(s,"sham",!0),dt(i,r,s,t)}},Nt=F(2);jt({target:"Array",proto:!0,forced:!(ht="filter",!h(function(){var t=[];return(t.constructor={})[q]=function(){return{foo:1}},1!==t[ht](Boolean).foo}))},{filter:function(t){return Nt(this,t,arguments[1])}});var zt=function(t,e){var i=[][t];return!i||!h(function(){i.call(null,e||function(){throw 1},1)})},Ct=[].forEach,Vt=F(0),Dt=zt("forEach")?function(t){return Vt(this,t,arguments[1])}:Ct;jt({target:"Array",proto:!0,forced:[].forEach!=Dt},{forEach:Dt});jt({target:"Array",proto:!0,forced:zt("reduce")},{reduce:function(t){return function(t,e,i,r,n){y(e);var s=_(t),o=x(s),a=A(s.length),l=n?a-1:0,c=n?-1:1;if(i<2)for(;;){if(l in o){r=o[l],l+=c;break}if(l+=c,n?l<0:a<=l)throw TypeError("Reduce of empty array with no initial value")}for(;n?0<=l:l<a;l+=c)l in o&&(r=e(r,o[l],l,s));return r}(this,t,arguments.length,arguments[1],!1)}});var Bt=k.f,It=Function.prototype,Pt=It.toString,Ht=/^\s*function ([^ (]*)/;!b||"name"in It||Bt(It,"name",{configurable:!0,get:function(){try{return Pt.call(this).match(Ht)[1]}catch(t){return""}}});var Ft=Object.keys||function(t){return bt(t,mt)},qt=Object.assign,$t=!qt||h(function(){var t={},e={},i=Symbol(),r="abcdefghijklmnopqrst";return t[i]=7,r.split("").forEach(function(t){e[t]=t}),7!=qt({},t)[i]||Ft(qt({},e)).join("")!=r})?function(t,e){for(var i=_(t),r=arguments.length,n=1,s=Et.f,o=Y.f;n<r;)for(var a,l=x(arguments[n++]),c=s?Ft(l).concat(s(l)):Ft(l),u=c.length,h=0;h<u;)o.call(l,a=c[h++])&&(i[a]=l[a]);return i}:qt;jt({target:"Object",stat:!0,forced:Object.assign!==$t},{assign:$t});var Xt="\t\n\v\f\r \u2028\u2029\ufeff",Yt="["+Xt+"]",Gt=RegExp("^"+Yt+Yt+"*"),Kt=RegExp(Yt+Yt+"*$"),Ut=g.parseInt,Jt=/^[-+]?0[xX]/,Qt=8!==Ut(Xt+"08")||22!==Ut(Xt+"0x16")?function(t,e){var i=function(t,e){return t=String(l(t)),1&e&&(t=t.replace(Gt,"")),2&e&&(t=t.replace(Kt,"")),t}(String(t),3);return Ut(i,e>>>0||(Jt.test(i)?16:10))}:Ut;jt({global:!0,forced:parseInt!=Qt},{parseInt:Qt});var Zt,te,ee=RegExp.prototype.exec,ie=String.prototype.replace,re=ee,ne=(Zt=/a/,te=/b*/g,ee.call(Zt,"a"),ee.call(te,"a"),0!==Zt.lastIndex||0!==te.lastIndex),se=void 0!==/()??/.exec("")[1];(ne||se)&&(re=function(t){var e,i,r,n,s=this;return se&&(i=new RegExp("^"+s.source+"$(?!\\s)",function(){var t=L(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}.call(s))),ne&&(e=s.lastIndex),r=ee.call(s,t),ne&&r&&(s.lastIndex=s.global?r.index+r[0].length:e),se&&r&&1<r.length&&ie.call(r[0],i,function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(r[n]=void 0)}),r});var oe=re;jt({target:"RegExp",proto:!0,forced:/./.exec!==oe},{exec:oe});var ae=function(t,e,i){return e+(i?function(t,e,i){var r,n,s=String(l(t)),o=S(e),a=s.length;return o<0||a<=o?i?"":void 0:(r=s.charCodeAt(o))<55296||56319<r||o+1===a||(n=s.charCodeAt(o+1))<56320||57343<n?i?s.charAt(o):r:i?s.slice(o,o+2):n-56320+(r-55296<<10)+65536}(t,e,!0).length:1)},le=function(t,e){var i=t.exec;if("function"==typeof i){var r=i.call(t,e);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==n(t))throw TypeError("RegExp#exec called on incompatible receiver");return oe.call(t,e)},ce=I("species"),ue=!h(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),he=!h(function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var i="ab".split(t);return 2!==i.length||"a"!==i[0]||"b"!==i[1]}),fe=function(i,t,e,r){var n=I(i),s=!h(function(){var t={};return t[n]=function(){return 7},7!=""[i](t)}),o=s&&!h(function(){var t=!1,e=/a/;return e.exec=function(){return t=!0,null},"split"===i&&(e.constructor={},e.constructor[ce]=function(){return e}),e[n](""),!t});if(!s||!o||"replace"===i&&!ue||"split"===i&&!he){var a=/./[n],l=e(n,""[i],function(t,e,i,r,n){return e.exec===oe?s&&!n?{done:!0,value:a.call(e,i,r)}:{done:!0,value:t.call(i,e,r)}:{done:!1}}),c=l[0],u=l[1];dt(String.prototype,i,c),dt(RegExp.prototype,n,2==t?function(t,e){return u.call(t,this,e)}:function(t){return u.call(t,this)}),r&&T(RegExp.prototype[n],"sham",!0)}};fe("match",1,function(r,c,u){return[function(t){var e=l(this),i=null==t?void 0:t[r];return void 0!==i?i.call(t,e):new RegExp(t)[r](String(e))},function(t){var e=u(c,t,this);if(e.done)return e.value;var i=L(t),r=String(this);if(!i.global)return le(i,r);for(var n,s=i.unicode,o=[],a=i.lastIndex=0;null!==(n=le(i,r));){var l=String(n[0]);""===(o[a]=l)&&(i.lastIndex=ae(r,A(i.lastIndex),s)),a++}return 0===a?null:o}]});var de=Math.max,pe=Math.min,ve=Math.floor,ge=/\$([$&`']|\d\d?|<[^>]*>)/g,be=/\$([$&`']|\d\d?)/g;fe("replace",2,function(n,E,w){return[function(t,e){var i=l(this),r=null==t?void 0:t[n];return void 0!==r?r.call(t,i,e):E.call(String(i),t,e)},function(t,e){var i=w(E,t,this,e);if(i.done)return i.value;var r=L(t),n=String(this),s="function"==typeof e;s||(e=String(e));var o=r.global;if(o){var a=r.unicode;r.lastIndex=0}for(var l=[];;){var c=le(r,n);if(null===c)break;if(l.push(c),!o)break;""===String(c[0])&&(r.lastIndex=ae(n,A(r.lastIndex),a))}for(var u,h="",f=0,d=0;d<l.length;d++){c=l[d];for(var p=String(c[0]),v=de(pe(S(c.index),n.length),0),g=[],b=1;b<c.length;b++)g.push(void 0===(u=c[b])?u:String(u));var m=c.groups;if(s){var y=[p].concat(g,v,n);void 0!==m&&y.push(m);var x=String(e.apply(void 0,y))}else x=O(p,n,v,g,m,e);f<=v&&(h+=n.slice(f,v)+x,f=v+p.length)}return h+n.slice(f)}];function O(s,o,a,l,c,t){var u=a+s.length,h=l.length,e=be;return void 0!==c&&(c=_(c),e=ge),E.call(t,e,function(t,e){var i;switch(e.charAt(0)){case"$":return"$";case"&":return s;case"`":return o.slice(0,a);case"'":return o.slice(u);case"<":i=c[e.slice(1,-1)];break;default:var r=+e;if(0==r)return t;if(h<r){var n=ve(r/10);return 0===n?t:n<=h?void 0===l[n-1]?e.charAt(1):l[n-1]+e.charAt(1):t}i=l[r-1]}return void 0===i?"":i})}});for(var me in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var ye=g[me],xe=ye&&ye.prototype;if(xe&&xe.forEach!==Dt)try{T(xe,"forEach",Dt)}catch(t){xe.forEach=Dt}}var Ee=u(function(t,e){t.exports=function(){if("undefined"==typeof document)return 0;var t,e=document.body,i=document.createElement("div"),r=i.style;return r.position="absolute",r.top=r.left="-9999px",r.width=r.height="100px",r.overflow="scroll",e.appendChild(i),t=i.offsetWidth-i.clientWidth,e.removeChild(i),t}}),we="Expected a function",Oe=NaN,_e="[object Symbol]",Se=/^\s+|\s+$/g,Ae=/^[-+]0x[0-9a-f]+$/i,Le=/^0b[01]+$/i,Me=/^0o[0-7]+$/i,ke=parseInt,We="object"==typeof t&&t&&t.Object===Object&&t,Te="object"==typeof self&&self&&self.Object===Object&&self,Re=We||Te||Function("return this")(),je=Object.prototype.toString,Ne=Math.max,ze=Math.min,Ce=function(){return Re.Date.now()};function Ve(r,i,t){var n,s,o,a,l,c,u=0,h=!1,f=!1,e=!0;if("function"!=typeof r)throw new TypeError(we);function d(t){var e=n,i=s;return n=s=void 0,u=t,a=r.apply(i,e)}function p(t){var e=t-c;return void 0===c||i<=e||e<0||f&&o<=t-u}function v(){var t=Ce();if(p(t))return g(t);l=setTimeout(v,function(t){var e=i-(t-c);return f?ze(e,o-(t-u)):e}(t))}function g(t){return l=void 0,e&&n?d(t):(n=s=void 0,a)}function b(){var t=Ce(),e=p(t);if(n=arguments,s=this,c=t,e){if(void 0===l)return function(t){return u=t,l=setTimeout(v,i),h?d(t):a}(c);if(f)return l=setTimeout(v,i),d(c)}return void 0===l&&(l=setTimeout(v,i)),a}return i=Be(i)||0,De(t)&&(h=!!t.leading,o=(f="maxWait"in t)?Ne(Be(t.maxWait)||0,i):o,e="trailing"in t?!!t.trailing:e),b.cancel=function(){void 0!==l&&clearTimeout(l),n=c=s=l=void(u=0)},b.flush=function(){return void 0===l?a:g(Ce())},b}function De(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Be(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&je.call(t)==_e}(t))return Oe;if(De(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=De(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Se,"");var i=Le.test(t);return i||Me.test(t)?ke(t.slice(2),i?2:8):Ae.test(t)?Oe:+t}var Ie=function(t,e,i){var r=!0,n=!0;if("function"!=typeof t)throw new TypeError(we);return De(i)&&(r="leading"in i?!!i.leading:r,n="trailing"in i?!!i.trailing:n),Ve(t,e,{leading:r,maxWait:e,trailing:n})},Pe=NaN,He="[object Symbol]",Fe=/^\s+|\s+$/g,qe=/^[-+]0x[0-9a-f]+$/i,$e=/^0b[01]+$/i,Xe=/^0o[0-7]+$/i,Ye=parseInt,Ge="object"==typeof t&&t&&t.Object===Object&&t,Ke="object"==typeof self&&self&&self.Object===Object&&self,Ue=Ge||Ke||Function("return this")(),Je=Object.prototype.toString,Qe=Math.max,Ze=Math.min,ti=function(){return Ue.Date.now()};function ei(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ii(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&Je.call(t)==He}(t))return Pe;if(ei(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ei(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Fe,"");var i=$e.test(t);return i||Xe.test(t)?Ye(t.slice(2),i?2:8):qe.test(t)?Pe:+t}var ri=function(r,i,t){var n,s,o,a,l,c,u=0,h=!1,f=!1,e=!0;if("function"!=typeof r)throw new TypeError("Expected a function");function d(t){var e=n,i=s;return n=s=void 0,u=t,a=r.apply(i,e)}function p(t){var e=t-c;return void 0===c||i<=e||e<0||f&&o<=t-u}function v(){var t=ti();if(p(t))return g(t);l=setTimeout(v,function(t){var e=i-(t-c);return f?Ze(e,o-(t-u)):e}(t))}function g(t){return l=void 0,e&&n?d(t):(n=s=void 0,a)}function b(){var t=ti(),e=p(t);if(n=arguments,s=this,c=t,e){if(void 0===l)return function(t){return u=t,l=setTimeout(v,i),h?d(t):a}(c);if(f)return l=setTimeout(v,i),d(c)}return void 0===l&&(l=setTimeout(v,i)),a}return i=ii(i)||0,ei(t)&&(h=!!t.leading,o=(f="maxWait"in t)?Qe(ii(t.maxWait)||0,i):o,e="trailing"in t?!!t.trailing:e),b.cancel=function(){void 0!==l&&clearTimeout(l),n=c=s=l=void(u=0)},b.flush=function(){return void 0===l?a:g(ti())},b},ni="Expected a function",si="__lodash_hash_undefined__",oi="[object Function]",ai="[object GeneratorFunction]",li=/^\[object .+?Constructor\]$/,ci="object"==typeof t&&t&&t.Object===Object&&t,ui="object"==typeof self&&self&&self.Object===Object&&self,hi=ci||ui||Function("return this")();var fi,di=Array.prototype,pi=Function.prototype,vi=Object.prototype,gi=hi["__core-js_shared__"],bi=(fi=/[^.]+$/.exec(gi&&gi.keys&&gi.keys.IE_PROTO||""))?"Symbol(src)_1."+fi:"",mi=pi.toString,yi=vi.hasOwnProperty,xi=vi.toString,Ei=RegExp("^"+mi.call(yi).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wi=di.splice,Oi=Ti(hi,"Map"),_i=Ti(Object,"create");function Si(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}function Ai(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}function Li(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}function Mi(t,e){for(var i,r,n=t.length;n--;)if((i=t[n][0])===(r=e)||i!=i&&r!=r)return n;return-1}function ki(t){return!(!ji(t)||function(t){return!!bi&&bi in t}(t))&&(function(t){var e=ji(t)?xi.call(t):"";return e==oi||e==ai}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?Ei:li).test(function(t){if(null!=t){try{return mi.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function Wi(t,e){var i=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?i["string"==typeof e?"string":"hash"]:i.map}function Ti(t,e){var i=function(t,e){return null==t?void 0:t[e]}(t,e);return ki(i)?i:void 0}function Ri(n,s){if("function"!=typeof n||s&&"function"!=typeof s)throw new TypeError(ni);var o=function(){var t=arguments,e=s?s.apply(this,t):t[0],i=o.cache;if(i.has(e))return i.get(e);var r=n.apply(this,t);return o.cache=i.set(e,r),r};return o.cache=new(Ri.Cache||Li),o}function ji(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}Si.prototype.clear=function(){this.__data__=_i?_i(null):{}},Si.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Si.prototype.get=function(t){var e=this.__data__;if(_i){var i=e[t];return i===si?void 0:i}return yi.call(e,t)?e[t]:void 0},Si.prototype.has=function(t){var e=this.__data__;return _i?void 0!==e[t]:yi.call(e,t)},Si.prototype.set=function(t,e){return this.__data__[t]=_i&&void 0===e?si:e,this},Ai.prototype.clear=function(){this.__data__=[]},Ai.prototype.delete=function(t){var e=this.__data__,i=Mi(e,t);return!(i<0||(i==e.length-1?e.pop():wi.call(e,i,1),0))},Ai.prototype.get=function(t){var e=this.__data__,i=Mi(e,t);return i<0?void 0:e[i][1]},Ai.prototype.has=function(t){return-1<Mi(this.__data__,t)},Ai.prototype.set=function(t,e){var i=this.__data__,r=Mi(i,t);return r<0?i.push([t,e]):i[r][1]=e,this},Li.prototype.clear=function(){this.__data__={hash:new Si,map:new(Oi||Ai),string:new Si}},Li.prototype.delete=function(t){return Wi(this,t).delete(t)},Li.prototype.get=function(t){return Wi(this,t).get(t)},Li.prototype.has=function(t){return Wi(this,t).has(t)},Li.prototype.set=function(t,e){return Wi(this,t).set(t,e),this},Ri.Cache=Li;var Ni=Ri,zi=function(){if("undefined"!=typeof Map)return Map;function r(t,i){var r=-1;return t.some(function(t,e){return t[0]===i&&(r=e,!0)}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var e=r(this.__entries__,t),i=this.__entries__[e];return i&&i[1]},t.prototype.set=function(t,e){var i=r(this.__entries__,t);~i?this.__entries__[i][1]=e:this.__entries__.push([t,e])},t.prototype.delete=function(t){var e=this.__entries__,i=r(e,t);~i&&e.splice(i,1)},t.prototype.has=function(t){return!!~r(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var i=0,r=this.__entries__;i<r.length;i++){var n=r[i];t.call(e,n[1],n[0])}},t}()}(),Ci="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,Vi="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),Di="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(Vi):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)},Bi=2;var Ii=["top","right","bottom","left","width","height","size","weight"],Pi="undefined"!=typeof MutationObserver,Hi=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var i=!1,r=!1,n=0;function s(){i&&(i=!1,t()),r&&a()}function o(){Di(s)}function a(){var t=Date.now();if(i){if(t-n<Bi)return;r=!0}else r=!(i=!0),setTimeout(o,e);n=t}return a}(this.refresh.bind(this),20)}return t.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},t.prototype.removeObserver=function(t){var e=this.observers_,i=e.indexOf(t);~i&&e.splice(i,1),!e.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},t.prototype.updateObservers_=function(){var t=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return t.forEach(function(t){return t.broadcastActive()}),0<t.length},t.prototype.connect_=function(){Ci&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Pi?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){Ci&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,i=void 0===e?"":e;Ii.some(function(t){return!!~i.indexOf(t)})&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),Fi=function(t,e){for(var i=0,r=Object.keys(e);i<r.length;i++){var n=r[i];Object.defineProperty(t,n,{value:e[n],enumerable:!1,writable:!1,configurable:!0})}return t},qi=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||Vi},$i=Ji(0,0,0,0);function Xi(t){return parseFloat(t)||0}function Yi(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return t.reduce(function(t,e){return t+Xi(i["border-"+e+"-width"])},0)}function Gi(t){var e=t.clientWidth,i=t.clientHeight;if(!e&&!i)return $i;var r=qi(t).getComputedStyle(t),n=function(t){for(var e={},i=0,r=["top","right","bottom","left"];i<r.length;i++){var n=r[i],s=t["padding-"+n];e[n]=Xi(s)}return e}(r),s=n.left+n.right,o=n.top+n.bottom,a=Xi(r.width),l=Xi(r.height);if("border-box"===r.boxSizing&&(Math.round(a+s)!==e&&(a-=Yi(r,"left","right")+s),Math.round(l+o)!==i&&(l-=Yi(r,"top","bottom")+o)),!function(t){return t===qi(t).document.documentElement}(t)){var c=Math.round(a+s)-e,u=Math.round(l+o)-i;1!==Math.abs(c)&&(a-=c),1!==Math.abs(u)&&(l-=u)}return Ji(n.left,n.top,a,l)}var Ki="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof qi(t).SVGGraphicsElement}:function(t){return t instanceof qi(t).SVGElement&&"function"==typeof t.getBBox};function Ui(t){return Ci?Ki(t)?function(t){var e=t.getBBox();return Ji(0,0,e.width,e.height)}(t):Gi(t):$i}function Ji(t,e,i,r){return{x:t,y:e,width:i,height:r}}var Qi=function(){function t(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Ji(0,0,0,0),this.target=t}return t.prototype.isActive=function(){var t=Ui(this.target);return(this.contentRect_=t).width!==this.broadcastWidth||t.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},t}(),Zi=function(t,e){var i=function(t){var e=t.x,i=t.y,r=t.width,n=t.height,s="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,o=Object.create(s.prototype);return Fi(o,{x:e,y:i,width:r,height:n,top:i,right:e+r,bottom:n+i,left:e}),o}(e);Fi(this,{target:t,contentRect:i})},tr=function(){function t(t,e,i){if(this.activeObservations_=[],this.observations_=new zi,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=i}return t.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof qi(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new Qi(t)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof qi(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map(function(t){return new Zi(t.target,t.broadcastRect())});this.callback_.call(t,e,t),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return 0<this.activeObservations_.length},t}(),er="undefined"!=typeof WeakMap?new WeakMap:new zi,ir=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=Hi.getInstance(),r=new tr(e,i,this);er.set(this,r)};["observe","unobserve","disconnect"].forEach(function(e){ir.prototype[e]=function(){var t;return(t=er.get(this))[e].apply(t,arguments)}});var rr=void 0!==Vi.ResizeObserver?Vi.ResizeObserver:ir,nr=!("undefined"==typeof window||!window.document||!window.document.createElement),sr=function(){function l(t,e){var s=this;this.onScroll=function(){s.scrollXTicking||(window.requestAnimationFrame(s.scrollX),s.scrollXTicking=!0),s.scrollYTicking||(window.requestAnimationFrame(s.scrollY),s.scrollYTicking=!0)},this.scrollX=function(){s.axis.x.isOverflowing&&(s.showScrollbar("x"),s.positionScrollbar("x")),s.scrollXTicking=!1},this.scrollY=function(){s.axis.y.isOverflowing&&(s.showScrollbar("y"),s.positionScrollbar("y")),s.scrollYTicking=!1},this.onMouseEnter=function(){s.showScrollbar("x"),s.showScrollbar("y")},this.onMouseMove=function(t){s.mouseX=t.clientX,s.mouseY=t.clientY,(s.axis.x.isOverflowing||s.axis.x.forceVisible)&&s.onMouseMoveForAxis("x"),(s.axis.y.isOverflowing||s.axis.y.forceVisible)&&s.onMouseMoveForAxis("y")},this.onMouseLeave=function(){s.onMouseMove.cancel(),(s.axis.x.isOverflowing||s.axis.x.forceVisible)&&s.onMouseLeaveForAxis("x"),(s.axis.y.isOverflowing||s.axis.y.forceVisible)&&s.onMouseLeaveForAxis("y"),s.mouseX=-1,s.mouseY=-1},this.onWindowResize=function(){s.scrollbarWidth=Ee(),s.hideNativeScrollbar()},this.hideScrollbars=function(){s.axis.x.track.rect=s.axis.x.track.el.getBoundingClientRect(),s.axis.y.track.rect=s.axis.y.track.el.getBoundingClientRect(),s.isWithinBounds(s.axis.y.track.rect)||(s.axis.y.scrollbar.el.classList.remove(s.classNames.visible),s.axis.y.isVisible=!1),s.isWithinBounds(s.axis.x.track.rect)||(s.axis.x.scrollbar.el.classList.remove(s.classNames.visible),s.axis.x.isVisible=!1)},this.onPointerEvent=function(t){var e,i;s.axis.x.scrollbar.rect=s.axis.x.scrollbar.el.getBoundingClientRect(),s.axis.y.scrollbar.rect=s.axis.y.scrollbar.el.getBoundingClientRect(),(s.axis.x.isOverflowing||s.axis.x.forceVisible)&&(i=s.isWithinBounds(s.axis.x.scrollbar.rect)),(s.axis.y.isOverflowing||s.axis.y.forceVisible)&&(e=s.isWithinBounds(s.axis.y.scrollbar.rect)),(e||i)&&(t.preventDefault(),t.stopPropagation(),"mousedown"===t.type&&(e&&s.onDragStart(t,"y"),i&&s.onDragStart(t,"x")))},this.drag=function(t){var e=s.axis[s.draggedAxis].track,i=e.rect[s.axis[s.draggedAxis].sizeAttr],r=s.axis[s.draggedAxis].scrollbar;t.preventDefault(),t.stopPropagation();var n=(("y"===s.draggedAxis?t.pageY:t.pageX)-e.rect[s.axis[s.draggedAxis].offsetAttr]-s.axis[s.draggedAxis].dragOffset)/e.rect[s.axis[s.draggedAxis].sizeAttr]*s.contentWrapperEl[s.axis[s.draggedAxis].scrollSizeAttr];"x"===s.draggedAxis&&(n=s.isRtl&&l.getRtlHelpers().isRtlScrollbarInverted?n-(i+r.size):n,n=s.isRtl&&l.getRtlHelpers().isRtlScrollingInverted?-n:n),s.contentWrapperEl[s.axis[s.draggedAxis].scrollOffsetAttr]=n},this.onEndDrag=function(t){t.preventDefault(),t.stopPropagation(),s.el.classList.remove(s.classNames.dragging),document.removeEventListener("mousemove",s.drag),document.removeEventListener("mouseup",s.onEndDrag)},this.el=t,this.flashTimeout,this.contentEl,this.contentWrapperEl,this.offsetEl,this.maskEl,this.globalObserver,this.mutationObserver,this.resizeObserver,this.scrollbarWidth,this.minScrollbarWidth=20,this.options=Object.assign({},l.defaultOptions,e),this.classNames=Object.assign({},l.defaultOptions.classNames,this.options.classNames),this.isRtl,this.axis={x:{scrollOffsetAttr:"scrollLeft",sizeAttr:"width",scrollSizeAttr:"scrollWidth",offsetAttr:"left",overflowAttr:"overflowX",dragOffset:0,isOverflowing:!0,isVisible:!1,forceVisible:!1,track:{},scrollbar:{}},y:{scrollOffsetAttr:"scrollTop",sizeAttr:"height",scrollSizeAttr:"scrollHeight",offsetAttr:"top",overflowAttr:"overflowY",dragOffset:0,isOverflowing:!0,isVisible:!1,forceVisible:!1,track:{},scrollbar:{}}},this.el.SimpleBar||(this.recalculate=Ie(this.recalculate.bind(this),64),this.onMouseMove=Ie(this.onMouseMove.bind(this),64),this.hideScrollbars=ri(this.hideScrollbars.bind(this),this.options.timeout),this.onWindowResize=ri(this.onWindowResize.bind(this),64,{leading:!0}),l.getRtlHelpers=Ni(l.getRtlHelpers),this.init())}l.getRtlHelpers=function(){var t=document.createElement("div");t.innerHTML='<div class="hs-dummy-scrollbar-size"><div style="height: 200%; width: 200%; margin: 10px 0;"></div></div>';var e=t.firstElementChild;document.body.appendChild(e);var i=e.firstElementChild;e.scrollLeft=0;var r=l.getOffset(e),n=l.getOffset(i);e.scrollLeft=999;var s=l.getOffset(i);return{isRtlScrollingInverted:r.left!==n.left&&n.left-s.left!=0,isRtlScrollbarInverted:r.left!==n.left}},l.initHtmlApi=function(){this.initDOMLoadedElements=this.initDOMLoadedElements.bind(this),"undefined"!=typeof MutationObserver&&(this.globalObserver=new MutationObserver(function(t){t.forEach(function(t){Array.prototype.forEach.call(t.addedNodes,function(t){1===t.nodeType&&(t.hasAttribute("data-simplebar")?!t.SimpleBar&&new l(t,l.getElOptions(t)):Array.prototype.forEach.call(t.querySelectorAll("[data-simplebar]"),function(t){!t.SimpleBar&&new l(t,l.getElOptions(t))}))}),Array.prototype.forEach.call(t.removedNodes,function(t){1===t.nodeType&&(t.hasAttribute("data-simplebar")?t.SimpleBar&&t.SimpleBar.unMount():Array.prototype.forEach.call(t.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar&&t.SimpleBar.unMount()}))})})}),this.globalObserver.observe(document,{childList:!0,subtree:!0})),"complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?window.setTimeout(this.initDOMLoadedElements):(document.addEventListener("DOMContentLoaded",this.initDOMLoadedElements),window.addEventListener("load",this.initDOMLoadedElements))},l.getElOptions=function(t){return Array.prototype.reduce.call(t.attributes,function(t,e){var i=e.name.match(/data-simplebar-(.+)/);if(i){var r=i[1].replace(/\W+(.)/g,function(t,e){return e.toUpperCase()});switch(e.value){case"true":t[r]=!0;break;case"false":t[r]=!1;break;case void 0:t[r]=!0;break;default:t[r]=e.value}}return t},{})},l.removeObserver=function(){this.globalObserver.disconnect()},l.initDOMLoadedElements=function(){document.removeEventListener("DOMContentLoaded",this.initDOMLoadedElements),window.removeEventListener("load",this.initDOMLoadedElements),Array.prototype.forEach.call(document.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar||new l(t,l.getElOptions(t))})},l.getOffset=function(t){var e=t.getBoundingClientRect();return{top:e.top+(window.pageYOffset||document.documentElement.scrollTop),left:e.left+(window.pageXOffset||document.documentElement.scrollLeft)}};var t=l.prototype;return t.init=function(){this.el.SimpleBar=this,nr&&(this.initDOM(),this.scrollbarWidth=Ee(),this.recalculate(),this.initListeners())},t.initDOM=function(){var e=this;if(Array.prototype.filter.call(this.el.children,function(t){return t.classList.contains(e.classNames.wrapper)}).length)this.wrapperEl=this.el.querySelector("."+this.classNames.wrapper),this.contentWrapperEl=this.el.querySelector("."+this.classNames.contentWrapper),this.offsetEl=this.el.querySelector("."+this.classNames.offset),this.maskEl=this.el.querySelector("."+this.classNames.mask),this.contentEl=this.el.querySelector("."+this.classNames.contentEl),this.placeholderEl=this.el.querySelector("."+this.classNames.placeholder),this.heightAutoObserverWrapperEl=this.el.querySelector("."+this.classNames.heightAutoObserverWrapperEl),this.heightAutoObserverEl=this.el.querySelector("."+this.classNames.heightAutoObserverEl),this.axis.x.track.el=this.el.querySelector("."+this.classNames.track+"."+this.classNames.horizontal),this.axis.y.track.el=this.el.querySelector("."+this.classNames.track+"."+this.classNames.vertical);else{for(this.wrapperEl=document.createElement("div"),this.contentWrapperEl=document.createElement("div"),this.offsetEl=document.createElement("div"),this.maskEl=document.createElement("div"),this.contentEl=document.createElement("div"),this.placeholderEl=document.createElement("div"),this.heightAutoObserverWrapperEl=document.createElement("div"),this.heightAutoObserverEl=document.createElement("div"),this.wrapperEl.classList.add(this.classNames.wrapper),this.contentWrapperEl.classList.add(this.classNames.contentWrapper),this.offsetEl.classList.add(this.classNames.offset),this.maskEl.classList.add(this.classNames.mask),this.contentEl.classList.add(this.classNames.contentEl),this.placeholderEl.classList.add(this.classNames.placeholder),this.heightAutoObserverWrapperEl.classList.add(this.classNames.heightAutoObserverWrapperEl),this.heightAutoObserverEl.classList.add(this.classNames.heightAutoObserverEl);this.el.firstChild;)this.contentEl.appendChild(this.el.firstChild);this.contentWrapperEl.appendChild(this.contentEl),this.offsetEl.appendChild(this.contentWrapperEl),this.maskEl.appendChild(this.offsetEl),this.heightAutoObserverWrapperEl.appendChild(this.heightAutoObserverEl),this.wrapperEl.appendChild(this.heightAutoObserverWrapperEl),this.wrapperEl.appendChild(this.maskEl),this.wrapperEl.appendChild(this.placeholderEl),this.el.appendChild(this.wrapperEl)}if(!this.axis.x.track.el||!this.axis.y.track.el){var t=document.createElement("div"),i=document.createElement("div");t.classList.add(this.classNames.track),i.classList.add(this.classNames.scrollbar),t.appendChild(i),this.axis.x.track.el=t.cloneNode(!0),this.axis.x.track.el.classList.add(this.classNames.horizontal),this.axis.y.track.el=t.cloneNode(!0),this.axis.y.track.el.classList.add(this.classNames.vertical),this.el.appendChild(this.axis.x.track.el),this.el.appendChild(this.axis.y.track.el)}this.axis.x.scrollbar.el=this.axis.x.track.el.querySelector("."+this.classNames.scrollbar),this.axis.y.scrollbar.el=this.axis.y.track.el.querySelector("."+this.classNames.scrollbar),this.options.autoHide||(this.axis.x.scrollbar.el.classList.add(this.classNames.visible),this.axis.y.scrollbar.el.classList.add(this.classNames.visible)),this.el.setAttribute("data-simplebar","init")},t.initListeners=function(){var e=this;this.options.autoHide&&this.el.addEventListener("mouseenter",this.onMouseEnter),["mousedown","click","dblclick","touchstart","touchend","touchmove"].forEach(function(t){e.el.addEventListener(t,e.onPointerEvent,!0)}),this.el.addEventListener("mousemove",this.onMouseMove),this.el.addEventListener("mouseleave",this.onMouseLeave),this.contentWrapperEl.addEventListener("scroll",this.onScroll),window.addEventListener("resize",this.onWindowResize),this.resizeObserver=new rr(this.recalculate),this.resizeObserver.observe(this.el),this.resizeObserver.observe(this.contentEl)},t.recalculate=function(){var t=this.heightAutoObserverEl.offsetHeight<=1,e=this.heightAutoObserverEl.offsetWidth<=1;this.elStyles=window.getComputedStyle(this.el),this.isRtl="rtl"===this.elStyles.direction,this.contentEl.style.padding=this.elStyles.paddingTop+" "+this.elStyles.paddingRight+" "+this.elStyles.paddingBottom+" "+this.elStyles.paddingLeft,this.wrapperEl.style.margin="-"+this.elStyles.paddingTop+" -"+this.elStyles.paddingRight+" -"+this.elStyles.paddingBottom+" -"+this.elStyles.paddingLeft,this.contentWrapperEl.style.height=t?"auto":"100%",this.placeholderEl.style.width=e?this.contentEl.offsetWidth+"px":"auto",this.placeholderEl.style.height=this.contentEl.scrollHeight+"px",this.axis.x.isOverflowing=this.contentWrapperEl.scrollWidth>this.contentWrapperEl.offsetWidth,this.axis.y.isOverflowing=this.contentWrapperEl.scrollHeight>this.contentWrapperEl.offsetHeight,this.axis.x.isOverflowing="hidden"!==this.elStyles.overflowX&&this.axis.x.isOverflowing,this.axis.y.isOverflowing="hidden"!==this.elStyles.overflowY&&this.axis.y.isOverflowing,this.axis.x.forceVisible="x"===this.options.forceVisible||!0===this.options.forceVisible,this.axis.y.forceVisible="y"===this.options.forceVisible||!0===this.options.forceVisible,this.hideNativeScrollbar(),this.axis.x.track.rect=this.axis.x.track.el.getBoundingClientRect(),this.axis.y.track.rect=this.axis.y.track.el.getBoundingClientRect(),this.axis.x.scrollbar.size=this.getScrollbarSize("x"),this.axis.y.scrollbar.size=this.getScrollbarSize("y"),this.axis.x.scrollbar.el.style.width=this.axis.x.scrollbar.size+"px",this.axis.y.scrollbar.el.style.height=this.axis.y.scrollbar.size+"px",this.positionScrollbar("x"),this.positionScrollbar("y"),this.toggleTrackVisibility("x"),this.toggleTrackVisibility("y")},t.getScrollbarSize=function(t){void 0===t&&(t="y");var e,i=this.scrollbarWidth?this.contentWrapperEl[this.axis[t].scrollSizeAttr]:this.contentWrapperEl[this.axis[t].scrollSizeAttr]-this.minScrollbarWidth,r=this.axis[t].track.rect[this.axis[t].sizeAttr];if(this.axis[t].isOverflowing){var n=r/i;return e=Math.max(~~(n*r),this.options.scrollbarMinSize),this.options.scrollbarMaxSize&&(e=Math.min(e,this.options.scrollbarMaxSize)),e}},t.positionScrollbar=function(t){void 0===t&&(t="y");var e=this.contentWrapperEl[this.axis[t].scrollSizeAttr],i=this.axis[t].track.rect[this.axis[t].sizeAttr],r=parseInt(this.elStyles[this.axis[t].sizeAttr],10),n=this.axis[t].scrollbar,s=this.contentWrapperEl[this.axis[t].scrollOffsetAttr],o=(s="x"===t&&this.isRtl&&l.getRtlHelpers().isRtlScrollingInverted?-s:s)/(e-r),a=~~((i-n.size)*o);a="x"===t&&this.isRtl&&l.getRtlHelpers().isRtlScrollbarInverted?a+(i-n.size):a,n.el.style.transform="x"===t?"translate3d("+a+"px, 0, 0)":"translate3d(0, "+a+"px, 0)"},t.toggleTrackVisibility=function(t){void 0===t&&(t="y");var e=this.axis[t].track.el,i=this.axis[t].scrollbar.el;this.axis[t].isOverflowing||this.axis[t].forceVisible?(e.style.visibility="visible",this.contentWrapperEl.style[this.axis[t].overflowAttr]="scroll"):(e.style.visibility="hidden",this.contentWrapperEl.style[this.axis[t].overflowAttr]="hidden"),this.axis[t].isOverflowing?i.style.display="block":i.style.display="none"},t.hideNativeScrollbar=function(){if(this.offsetEl.style[this.isRtl?"left":"right"]=this.axis.y.isOverflowing||this.axis.y.forceVisible?"-"+(this.scrollbarWidth||this.minScrollbarWidth)+"px":0,this.offsetEl.style.bottom=this.axis.x.isOverflowing||this.axis.x.forceVisible?"-"+(this.scrollbarWidth||this.minScrollbarWidth)+"px":0,!this.scrollbarWidth){var t=[this.isRtl?"paddingLeft":"paddingRight"];this.contentWrapperEl.style[t]=this.axis.y.isOverflowing||this.axis.y.forceVisible?this.minScrollbarWidth+"px":0,this.contentWrapperEl.style.paddingBottom=this.axis.x.isOverflowing||this.axis.x.forceVisible?this.minScrollbarWidth+"px":0}},t.onMouseMoveForAxis=function(t){void 0===t&&(t="y"),this.axis[t].track.rect=this.axis[t].track.el.getBoundingClientRect(),this.axis[t].scrollbar.rect=this.axis[t].scrollbar.el.getBoundingClientRect(),this.isWithinBounds(this.axis[t].scrollbar.rect)?this.axis[t].scrollbar.el.classList.add(this.classNames.hover):this.axis[t].scrollbar.el.classList.remove(this.classNames.hover),this.isWithinBounds(this.axis[t].track.rect)?(this.showScrollbar(t),this.axis[t].track.el.classList.add(this.classNames.hover)):this.axis[t].track.el.classList.remove(this.classNames.hover)},t.onMouseLeaveForAxis=function(t){void 0===t&&(t="y"),this.axis[t].track.el.classList.remove(this.classNames.hover),this.axis[t].scrollbar.el.classList.remove(this.classNames.hover)},t.showScrollbar=function(t){void 0===t&&(t="y");var e=this.axis[t].scrollbar.el;this.axis[t].isVisible||(e.classList.add(this.classNames.visible),this.axis[t].isVisible=!0),this.options.autoHide&&this.hideScrollbars()},t.onDragStart=function(t,e){void 0===e&&(e="y");var i=this.axis[e].scrollbar.el,r="y"===e?t.pageY:t.pageX;this.axis[e].dragOffset=r-i.getBoundingClientRect()[this.axis[e].offsetAttr],this.draggedAxis=e,this.el.classList.add(this.classNames.dragging),document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.onEndDrag)},t.getContentElement=function(){return this.contentEl},t.getScrollElement=function(){return this.contentWrapperEl},t.removeListeners=function(){var e=this;this.options.autoHide&&this.el.removeEventListener("mouseenter",this.onMouseEnter),["mousedown","click","dblclick","touchstart","touchend","touchmove"].forEach(function(t){e.el.removeEventListener(t,e.onPointerEvent)}),this.el.removeEventListener("mousemove",this.onMouseMove),this.el.removeEventListener("mouseleave",this.onMouseLeave),this.contentWrapperEl.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onWindowResize),this.mutationObserver&&this.mutationObserver.disconnect(),this.resizeObserver.disconnect(),this.recalculate.cancel(),this.onMouseMove.cancel(),this.hideScrollbars.cancel(),this.onWindowResize.cancel()},t.unMount=function(){this.removeListeners(),this.el.SimpleBar=null},t.isChildNode=function(t){return null!==t&&(t===this.el||this.isChildNode(t.parentNode))},t.isWithinBounds=function(t){return this.mouseX>=t.left&&this.mouseX<=t.left+t.width&&this.mouseY>=t.top&&this.mouseY<=t.top+t.height},l}();return sr.defaultOptions={autoHide:!0,forceVisible:!1,classNames:{contentEl:"simplebar-content",contentWrapper:"simplebar-content-wrapper",offset:"simplebar-offset",mask:"simplebar-mask",wrapper:"simplebar-wrapper",placeholder:"simplebar-placeholder",scrollbar:"simplebar-scrollbar",track:"simplebar-track",heightAutoObserverWrapperEl:"simplebar-height-auto-observer-wrapper",heightAutoObserverEl:"simplebar-height-auto-observer",visible:"simplebar-visible",horizontal:"simplebar-horizontal",vertical:"simplebar-vertical",hover:"simplebar-hover",dragging:"simplebar-dragging"},scrollbarMinSize:25,scrollbarMaxSize:0,timeout:1e3},nr&&sr.initHtmlApi(),sr});
|
1 |
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).SimpleBar=e()}(this,function(){"use strict";function c(t){try{return!!t()}catch(t){return!0}}function C(t){return D.call(t).slice(8,-1)}function w(t){return Object(s(t))}function O(t){return 0<t?H(_(t),9007199254740991):0}var V=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},D={}.toString,B="".split,y=c(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==C(t)?B.call(t,""):Object(t)}:Object,s=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},I=Math.ceil,P=Math.floor,_=function(t){return isNaN(t=+t)?0:(0<t?P:I)(t)},H=Math.min,n=function(t){return"object"==typeof t?null!==t:"function"==typeof t},F=Array.isArray||function(t){return"Array"==C(t)},t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function q(t,e){return t(e={exports:{}},e.exports),e.exports}function $(t,e){if(!n(t))return t;var i,r;if(e&&"function"==typeof(i=t.toString)&&!n(r=i.call(t)))return r;if("function"==typeof(i=t.valueOf)&&!n(r=i.call(t)))return r;if(e||"function"!=typeof(i=t.toString)||n(r=i.call(t)))throw TypeError("Can't convert object to primitive value");return r}function X(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}function Y(e,i){try{b(g,e,i)}catch(t){g[e]=i}return i}function h(t){return ut[t]||(ut[t]=ht&&ft[t]||(ht?ft:ct)("Symbol."+t))}function G(t,e){var i;return new(void 0===(i=F(t)&&("function"==typeof(i=t.constructor)&&(i===Array||F(i.prototype))||n(i)&&null===(i=i[dt]))?void 0:i)?Array:i)(0===e?0:e)}function K(u,t){var f=1==u,d=2==u,p=3==u,v=4==u,g=6==u,b=5==u||g,m=t||G;return function(t,e,i){for(var r,n,s=w(t),o=y(s),a=function(r,n,t){if(V(r),void 0===n)return r;switch(t){case 0:return function(){return r.call(n)};case 1:return function(t){return r.call(n,t)};case 2:return function(t,e){return r.call(n,t,e)};case 3:return function(t,e,i){return r.call(n,t,e,i)}}return function(){return r.apply(n,arguments)}}(e,i,3),l=O(o.length),c=0,h=f?m(t,l):d?m(t,0):void 0;c<l;c++)if((b||c in o)&&(n=a(r=o[c],c,s),u))if(f)h[c]=n;else if(n)switch(u){case 3:return!0;case 5:return r;case 6:return c;case 2:h.push(r)}else if(v)return!1;return g?-1:p||v?v:h}}function U(t){return y(s(t))}function J(t,e){var i,r=U(t),n=0,s=[];for(i in r)!m(xt,i)&&m(r,i)&&s.push(i);for(;e.length>n;)!m(r,i=e[n++])||~St(s,i)||s.push(i);return s}function e(t,e){return(t=jt[Rt(t)])==zt||t!=Nt&&("function"==typeof e?c(e):!!e)}function i(t,e){var i,r,n,s=t.target,o=t.global,a=t.stat,l=o?g:a?g[s]||Y(s,{}):(g[s]||{}).prototype;if(l)for(i in e){if(r=e[i],n=t.noTargetGet?(n=Vt(l,i))&&n.value:l[i],!Ct(o?i:s+(a?".":"#")+i,t.forced)&&void 0!==n){if(typeof r==typeof n)continue;v=p=d=f=u=void 0;for(var c=r,h=n,u=Wt(h),f=ot.f,d=yt.f,p=0;p<u.length;p++){var v=u[p];m(c,v)||f(c,v,d(h,v))}}(t.sham||n&&n.sham)&&b(r,"sham",!0),wt(l,i,r,t)}}var r,Q,Z,tt,o,a,et,l,u,g="object"==typeof window&&window&&window.Math==Math?window:"object"==typeof self&&self&&self.Math==Math?self:Function("return this")(),f=!c(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),it=g.document,rt=n(it)&&n(it.createElement),nt=!f&&!c(function(){return 7!=Object.defineProperty(rt?it.createElement("div"):{},"a",{get:function(){return 7}}).a}),S=function(t){if(n(t))return t;throw TypeError(String(t)+" is not an object")},st=Object.defineProperty,ot={f:f?st:function(t,e,i){if(S(t),e=$(e,!0),S(i),nt)try{return st(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},b=f?function(t,e,i){return ot.f(t,e,X(1,i))}:function(t,e,i){return t[e]=i,t},d=q(function(t){var e="__core-js_shared__",i=g[e]||Y(e,{});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.0.1",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),at=0,lt=Math.random(),ct=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++at+lt).toString(36))},ht=!c(function(){return!String(Symbol())}),ut=d("wks"),ft=g.Symbol,dt=h("species"),pt=h("species"),p={}.propertyIsEnumerable,vt=Object.getOwnPropertyDescriptor,gt={f:vt&&!p.call({1:2},1)?function(t){t=vt(this,t);return!!t&&t.enumerable}:p},bt={}.hasOwnProperty,m=function(t,e){return bt.call(t,e)},mt=Object.getOwnPropertyDescriptor,yt={f:f?mt:function(t,e){if(t=U(t),e=$(e,!0),nt)try{return mt(t,e)}catch(t){}if(m(t,e))return X(!gt.f.call(t,e),t[e])}},v=d("native-function-to-string",Function.toString),p=g.WeakMap,p="function"==typeof p&&/native code/.test(v.call(p)),x=d("keys"),xt={},E=g.WeakMap,Et=(et=p?(r=new E,Q=r.get,Z=r.has,tt=r.set,o=function(t,e){return tt.call(r,t,e),e},a=function(t){return Q.call(r,t)||{}},function(t){return Z.call(r,t)}):(l=x[p="state"]||(x[p]=ct(p)),xt[l]=!0,o=function(t,e){return b(t,l,e),e},a=function(t){return m(t,l)?t[l]:{}},function(t){return m(t,l)}),{set:o,get:a,has:et,enforce:function(t){return et(t)?a(t):o(t,{})},getterFor:function(e){return function(t){if(n(t)&&(t=a(t)).type===e)return t;throw TypeError("Incompatible receiver, "+e+" required")}}}),wt=q(function(t){var e=Et.get,o=Et.enforce,a=String(v).split("toString");d("inspectSource",function(t){return v.call(t)}),(t.exports=function(t,e,i,r){var n=!!r&&!!r.unsafe,s=!!r&&!!r.enumerable,r=!!r&&!!r.noTargetGet;"function"==typeof i&&("string"!=typeof e||m(i,"name")||b(i,"name",e),o(i).source=a.join("string"==typeof e?e:"")),t===g?s?t[e]=i:Y(e,i):(n?!r&&t[e]&&(s=!0):delete t[e],s?t[e]=i:b(t,e,i))})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||v.call(this)})}),Ot=Math.max,_t=Math.min,St=(u=!1,function(t,e,i){var r,n=U(t),s=O(n.length),o=function(t,e){t=_(t);return t<0?Ot(t+e,0):_t(t,e)}(i,s);if(u&&e!=e){for(;o<s;)if((r=n[o++])!=r)return!0}else for(;o<s;o++)if((u||o in n)&&n[o]===e)return u||o||0;return!u&&-1}),At=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Lt=At.concat("length","prototype"),Mt={f:Object.getOwnPropertyNames||function(t){return J(t,Lt)}},kt={f:Object.getOwnPropertySymbols},E=g.Reflect,Wt=E&&E.ownKeys||function(t){var e=Mt.f(S(t)),i=kt.f;return i?e.concat(i(t)):e},Tt=/#|\.prototype\./,Rt=e.normalize=function(t){return String(t).replace(Tt,".").toLowerCase()},jt=e.data={},Nt=e.NATIVE="N",zt=e.POLYFILL="P",Ct=e,Vt=yt.f,Dt=K(2);Ft="filter";function Bt(t,e){var i=[][t];return!i||!c(function(){i.call(null,e||function(){throw 1},1)})}i({target:"Array",proto:!0,forced:!!c(function(){var t=[];return(t.constructor={})[pt]=function(){return{foo:1}},1!==t[Ft](Boolean).foo})},{filter:function(t){return Dt(this,t,arguments[1])}});function It(t,e,i){return e+(i?(i=t,t=e,e=!0,i=String(s(i)),t=_(t),n=i.length,(t<0||n<=t?e?"":void 0:(r=i.charCodeAt(t))<55296||56319<r||t+1===n||(n=i.charCodeAt(t+1))<56320||57343<n?e?i.charAt(t):r:e?i.slice(t,t+2):n-56320+(r-55296<<10)+65536).length):1);var r,n}function Pt(t,e){var i=t.exec;if("function"==typeof i){i=i.call(t,e);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==C(t))throw TypeError("RegExp#exec called on incompatible receiver");return ne.call(t,e)}function Ht(i,t,e,r){var s,n,o=h(i),a=!c(function(){var t={};return t[o]=function(){return 7},7!=""[i](t)}),l=a&&!c(function(){var t=!1,e=/a/;return e.exec=function(){return t=!0,null},"split"===i&&(e.constructor={},e.constructor[se]=function(){return e}),e[o](""),!t});a&&l&&("replace"!==i||oe)&&("split"!==i||ae)||(s=/./[o],e=(l=e(o,""[i],function(t,e,i,r,n){return e.exec===ne?a&&!n?{done:!0,value:s.call(e,i,r)}:{done:!0,value:t.call(i,e,r)}:{done:!1}}))[0],n=l[1],wt(String.prototype,i,e),wt(RegExp.prototype,o,2==t?function(t,e){return n.call(t,this,e)}:function(t){return n.call(t,this)}),r&&b(RegExp.prototype[o],"sham",!0))}var Ft,qt,x=[].forEach,$t=K(0),A=Bt("forEach")?function(t){return $t(this,t,arguments[1])}:x,p=(i({target:"Array",proto:!0,forced:[].forEach!=A},{forEach:A}),i({target:"Array",proto:!0,forced:Bt("reduce")},{reduce:function(t){var e=this,i=t,t=arguments.length,r=arguments[1],n=!1,s=(V(i),w(e)),o=y(s),a=O(s.length),l=n?a-1:0,c=n?-1:1;if(t<2)for(;;){if(l in o){r=o[l],l+=c;break}if(l+=c,n?l<0:a<=l)throw TypeError("Reduce of empty array with no initial value")}for(;n?0<=l:l<a;l+=c)l in o&&(r=i(r,o[l],l,s));return r}}),ot.f),E=Function.prototype,Xt=E.toString,Yt=/^\s*function ([^ (]*)/,Gt=(!f||"name"in E||p(E,"name",{configurable:!0,get:function(){try{return Xt.call(this).match(Yt)[1]}catch(t){return""}}}),Object.keys||function(t){return J(t,At)}),Kt=Object.assign,x=!Kt||c(function(){var t={},e={},i=Symbol(),r="abcdefghijklmnopqrst";return t[i]=7,r.split("").forEach(function(t){e[t]=t}),7!=Kt({},t)[i]||Gt(Kt({},e)).join("")!=r})?function(t,e){for(var i=w(t),r=arguments.length,n=1,s=kt.f,o=gt.f;n<r;)for(var a,l=y(arguments[n++]),c=s?Gt(l).concat(s(l)):Gt(l),h=c.length,u=0;u<h;)o.call(l,a=c[u++])&&(i[a]=l[a]);return i}:Kt,f=(i({target:"Object",stat:!0,forced:Object.assign!==x},{assign:x}),"\t\n\v\f\r \u2028\u2029\ufeff"),p="["+f+"]",Ut=RegExp("^"+p+p+"*"),Jt=RegExp(p+p+"*$"),Qt=g.parseInt,Zt=/^[-+]?0[xX]/,E=8!==Qt(f+"08")||22!==Qt(f+"0x16")?function(t,e){t=String(t),i=3,t=String(s(t)),1&i&&(t=t.replace(Ut,""));var i=t=2&i?t.replace(Jt,""):t;return Qt(i,e>>>0||(Zt.test(i)?16:10))}:Qt,te=(i({global:!0,forced:parseInt!=E},{parseInt:E}),RegExp.prototype.exec),ee=String.prototype.replace,x=te,ie=(p=/a/,f=/b*/g,te.call(p,"a"),te.call(f,"a"),0!==p.lastIndex||0!==f.lastIndex),re=void 0!==/()??/.exec("")[1],ne=x=ie||re?function(t){var e,i,r,n,s=this;return re&&(i=new RegExp("^"+s.source+"$(?!\\s)",function(){var t=S(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}.call(s))),ie&&(e=s.lastIndex),r=te.call(s,t),ie&&r&&(s.lastIndex=s.global?r.index+r[0].length:e),re&&r&&1<r.length&&ee.call(r[0],i,function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(r[n]=void 0)}),r}:x,se=(i({target:"RegExp",proto:!0,forced:/./.exec!==ne},{exec:ne}),h("species")),oe=!c(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),ae=!c(function(){var t=/(?:)/,e=t.exec,t=(t.exec=function(){return e.apply(this,arguments)},"ab".split(t));return 2!==t.length||"a"!==t[0]||"b"!==t[1]}),le=(Ht("match",1,function(r,l,c){return[function(t){var e=s(this),i=null==t?void 0:t[r];return void 0!==i?i.call(t,e):new RegExp(t)[r](String(e))},function(t){var e=c(l,t,this);if(e.done)return e.value;var i=S(t),r=String(this);if(!i.global)return Pt(i,r);for(var n=i.unicode,s=[],o=i.lastIndex=0;null!==(a=Pt(i,r));){var a=String(a[0]);""===(s[o]=a)&&(i.lastIndex=It(r,O(i.lastIndex),n)),o++}return 0===o?null:s}]}),Math.max),ce=Math.min,he=Math.floor,ue=/\$([$&`']|\d\d?|<[^>]*>)/g,fe=/\$([$&`']|\d\d?)/g;Ht("replace",2,function(n,x,E){return[function(t,e){var i=s(this),r=null==t?void 0:t[n];return void 0!==r?r.call(t,i,e):x.call(String(i),t,e)},function(t,e){var i=E(x,t,this,e);if(i.done)return i.value;for(var r,n=S(t),s=String(this),o="function"==typeof e,a=(o||(e=String(e)),n.global),l=(a&&(r=n.unicode,n.lastIndex=0),[]);null!==(d=Pt(n,s))&&(l.push(d),a);)""===String(d[0])&&(n.lastIndex=It(s,O(n.lastIndex),r));for(var c,h="",u=0,f=0;f<l.length;f++){for(var d=l[f],p=String(d[0]),v=le(ce(_(d.index),s.length),0),g=[],b=1;b<d.length;b++)g.push(void 0===(c=d[b])?c:String(c));var m=d.groups,y=o?(y=[p].concat(g,v,s),void 0!==m&&y.push(m),String(e.apply(void 0,y))):function(s,o,a,l,c,t){var h=a+s.length,u=l.length,e=fe;void 0!==c&&(c=w(c),e=ue);return x.call(t,e,function(t,e){var i;switch(e.charAt(0)){case"$":return"$";case"&":return s;case"`":return o.slice(0,a);case"'":return o.slice(h);case"<":i=c[e.slice(1,-1)];break;default:var r,n=+e;if(0==n)return t;if(u<n)return 0!==(r=he(n/10))&&r<=u?void 0===l[r-1]?e.charAt(1):l[r-1]+e.charAt(1):t;i=l[n-1]}return void 0===i?"":i})}(p,s,v,g,m,e);u<=v&&(h+=s.slice(u,v)+y,u=v+p.length)}return h+s.slice(u)}]});for(qt in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var L=g[qt],L=L&&L.prototype;if(L&&L.forEach!==A)try{b(L,"forEach",A)}catch(t){L.forEach=A}}var de=q(function(t,e){t.exports=function(){if("undefined"==typeof document)return 0;var t=document.body,e=document.createElement("div"),i=e.style;return i.position="absolute",i.top=i.left="-9999px",i.width=i.height="100px",i.overflow="scroll",t.appendChild(e),i=e.offsetWidth-e.clientWidth,t.removeChild(e),i}}),pe="Expected a function",ve=NaN,ge=/^\s+|\s+$/g,be=/^[-+]0x[0-9a-f]+$/i,me=/^0b[01]+$/i,ye=/^0o[0-7]+$/i,xe=parseInt,E="object"==typeof t&&t&&t.Object===Object&&t,p="object"==typeof self&&self&&self.Object===Object&&self,Ee=E||p||Function("return this")(),we=Object.prototype.toString,Oe=Math.max,_e=Math.min,Se=function(){return Ee.Date.now()};function Ae(r,i,t){var n,s,o,a,l,c,h=0,u=!1,f=!1,e=!0;if("function"!=typeof r)throw new TypeError(pe);function d(t){var e=n,i=s;return n=s=void 0,h=t,a=r.apply(i,e)}function p(t){var e=t-c;return void 0===c||i<=e||e<0||f&&o<=t-h}function v(){var t,e=Se();if(p(e))return g(e);l=setTimeout(v,(t=i-((e=e)-c),f?_e(t,o-(e-h)):t))}function g(t){return l=void 0,e&&n?d(t):(n=s=void 0,a)}function b(){var t=Se(),e=p(t);if(n=arguments,s=this,c=t,e){if(void 0===l)return h=t=c,l=setTimeout(v,i),u?d(t):a;if(f)return l=setTimeout(v,i),d(c)}return void 0===l&&(l=setTimeout(v,i)),a}return i=Me(i)||0,Le(t)&&(u=!!t.leading,f="maxWait"in t,o=f?Oe(Me(t.maxWait)||0,i):o,e="trailing"in t?!!t.trailing:e),b.cancel=function(){void 0!==l&&clearTimeout(l),n=c=s=l=void(h=0)},b.flush=function(){return void 0===l?a:g(Se())},b}function Le(t){var e=typeof t;return t&&("object"==e||"function"==e)}function Me(t){if("number"==typeof t)return t;if("symbol"==typeof(i=t)||!!(e=i)&&"object"==typeof e&&"[object Symbol]"==we.call(i))return ve;var e;if("string"!=typeof(t=Le(t)?Le(e="function"==typeof t.valueOf?t.valueOf():t)?e+"":e:t))return 0===t?t:+t;t=t.replace(ge,"");var i=me.test(t);return i||ye.test(t)?xe(t.slice(2),i?2:8):be.test(t)?ve:+t}function ke(){return De.Date.now()}var We=function(t,e,i){var r=!0,n=!0;if("function"!=typeof t)throw new TypeError(pe);return Le(i)&&(r="leading"in i?!!i.leading:r,n="trailing"in i?!!i.trailing:n),Ae(t,e,{leading:r,maxWait:e,trailing:n})},Te=NaN,Re="[object Symbol]",je=/^\s+|\s+$/g,Ne=/^[-+]0x[0-9a-f]+$/i,ze=/^0b[01]+$/i,Ce=/^0o[0-7]+$/i,Ve=parseInt,f="object"==typeof t&&t&&t.Object===Object&&t,x="object"==typeof self&&self&&self.Object===Object&&self,De=f||x||Function("return this")(),Be=Object.prototype.toString,Ie=Math.max,Pe=Math.min;function He(t){var e=typeof t;return t&&("object"==e||"function"==e)}function Fe(t){if("number"==typeof t)return t;if("symbol"==typeof(i=t)||!!(e=i)&&"object"==typeof e&&Be.call(i)==Re)return Te;var e;if("string"!=typeof(t=He(t)?He(e="function"==typeof t.valueOf?t.valueOf():t)?e+"":e:t))return 0===t?t:+t;t=t.replace(je,"");var i=ze.test(t);return i||Ce.test(t)?Ve(t.slice(2),i?2:8):Ne.test(t)?Te:+t}var qe=function(r,i,t){var n,s,o,a,l,c,h=0,u=!1,f=!1,e=!0;if("function"!=typeof r)throw new TypeError("Expected a function");function d(t){var e=n,i=s;return n=s=void 0,h=t,a=r.apply(i,e)}function p(t){var e=t-c;return void 0===c||i<=e||e<0||f&&o<=t-h}function v(){var t,e=ke();if(p(e))return g(e);l=setTimeout(v,(t=i-((e=e)-c),f?Pe(t,o-(e-h)):t))}function g(t){return l=void 0,e&&n?d(t):(n=s=void 0,a)}function b(){var t=ke(),e=p(t);if(n=arguments,s=this,c=t,e){if(void 0===l)return h=t=c,l=setTimeout(v,i),u?d(t):a;if(f)return l=setTimeout(v,i),d(c)}return void 0===l&&(l=setTimeout(v,i)),a}return i=Fe(i)||0,He(t)&&(u=!!t.leading,f="maxWait"in t,o=f?Ie(Fe(t.maxWait)||0,i):o,e="trailing"in t?!!t.trailing:e),b.cancel=function(){void 0!==l&&clearTimeout(l),n=c=s=l=void(h=0)},b.flush=function(){return void 0===l?a:g(ke())},b},$e="__lodash_hash_undefined__",Xe="[object Function]",Ye="[object GeneratorFunction]",Ge=/^\[object .+?Constructor\]$/,E="object"==typeof t&&t&&t.Object===Object&&t,p="object"==typeof self&&self&&self.Object===Object&&self,f=E||p||Function("return this")();var x=Array.prototype,t=Function.prototype,E=Object.prototype,p=f["__core-js_shared__"],Ke=(p=/[^.]+$/.exec(p&&p.keys&&p.keys.IE_PROTO||""))?"Symbol(src)_1."+p:"",Ue=t.toString,Je=E.hasOwnProperty,Qe=E.toString,Ze=RegExp("^"+Ue.call(Je).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ti=x.splice,ei=si(f,"Map"),M=si(Object,"create");function k(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}function W(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}function T(t){var e=-1,i=t?t.length:0;for(this.clear();++e<i;){var r=t[e];this.set(r[0],r[1])}}function ii(t,e){for(var i,r,n=t.length;n--;)if((i=t[n][0])===(r=e)||i!=i&&r!=r)return n;return-1}function ri(t){var e;if(ai(t)&&(e=t,!(Ke&&Ke in e)))return(function(t){t=ai(t)?Qe.call(t):"";return t==Xe||t==Ye}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?Ze:Ge).test(function(t){if(null!=t){try{return Ue.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function ni(t,e){var i,r,t=t.__data__;return("string"==(r=typeof(i=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==i:null===i)?t["string"==typeof e?"string":"hash"]:t.map}function si(t,e){e=e;t=null==(t=t)?void 0:t[e];return ri(t)?t:void 0}function oi(r,n){if("function"!=typeof r||n&&"function"!=typeof n)throw new TypeError("Expected a function");function s(){var t=arguments,e=n?n.apply(this,t):t[0],i=s.cache;return i.has(e)?i.get(e):(t=r.apply(this,t),s.cache=i.set(e,t),t)}return s.cache=new(oi.Cache||T),s}function ai(t){var e=typeof t;return t&&("object"==e||"function"==e)}k.prototype.clear=function(){this.__data__=M?M(null):{}},k.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},k.prototype.get=function(t){var e,i=this.__data__;return M?(e=i[t])===$e?void 0:e:Je.call(i,t)?i[t]:void 0},k.prototype.has=function(t){var e=this.__data__;return M?void 0!==e[t]:Je.call(e,t)},k.prototype.set=function(t,e){return this.__data__[t]=M&&void 0===e?$e:e,this},W.prototype.clear=function(){this.__data__=[]},W.prototype.delete=function(t){var e=this.__data__;return!((t=ii(e,t))<0)&&(t==e.length-1?e.pop():ti.call(e,t,1),!0)},W.prototype.get=function(t){var e=this.__data__;return(t=ii(e,t))<0?void 0:e[t][1]},W.prototype.has=function(t){return-1<ii(this.__data__,t)},W.prototype.set=function(t,e){var i=this.__data__,r=ii(i,t);return r<0?i.push([t,e]):i[r][1]=e,this},T.prototype.clear=function(){this.__data__={hash:new k,map:new(ei||W),string:new k}},T.prototype.delete=function(t){return ni(this,t).delete(t)},T.prototype.get=function(t){return ni(this,t).get(t)},T.prototype.has=function(t){return ni(this,t).has(t)},T.prototype.set=function(t,e){return ni(this,t).set(t,e),this},oi.Cache=T;var li=oi,ci="undefined"!=typeof Map?Map:(Object.defineProperty(R.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),R.prototype.get=function(t){t=hi(this.__entries__,t),t=this.__entries__[t];return t&&t[1]},R.prototype.set=function(t,e){var i=hi(this.__entries__,t);~i?this.__entries__[i][1]=e:this.__entries__.push([t,e])},R.prototype.delete=function(t){var e=this.__entries__,t=hi(e,t);~t&&e.splice(t,1)},R.prototype.has=function(t){return!!~hi(this.__entries__,t)},R.prototype.clear=function(){this.__entries__.splice(0)},R.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var i=0,r=this.__entries__;i<r.length;i++){var n=r[i];t.call(e,n[1],n[0])}},R);function hi(t,i){var r=-1;return t.some(function(t,e){return t[0]===i&&(r=e,!0)}),r}function R(){this.__entries__=[]}var ui="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,fi="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),di="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(fi):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)},pi=2;var vi=["top","right","bottom","left","width","height","size","weight"],gi="undefined"!=typeof MutationObserver,bi=(j.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},j.prototype.removeObserver=function(t){var e=this.observers_,t=e.indexOf(t);~t&&e.splice(t,1),!e.length&&this.connected_&&this.disconnect_()},j.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},j.prototype.updateObservers_=function(){var t=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return t.forEach(function(t){return t.broadcastActive()}),0<t.length},j.prototype.connect_=function(){ui&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),gi?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},j.prototype.disconnect_=function(){ui&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},j.prototype.onTransitionEnd_=function(t){var t=t.propertyName,e=void 0===t?"":t;vi.some(function(t){return!!~e.indexOf(t)})&&this.refresh()},j.getInstance=function(){return this.instance_||(this.instance_=new j),this.instance_},j.instance_=null,j);function j(){function t(){s&&(s=!1,r()),o&&i()}function e(){di(t)}function i(){var t=Date.now();if(s){if(t-a<pi)return;o=!0}else o=!(s=!0),setTimeout(e,n);a=t}var r,n,s,o,a;this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=(r=this.refresh.bind(this),o=s=!(n=20),a=0,i)}var mi=function(t,e){for(var i=0,r=Object.keys(e);i<r.length;i++){var n=r[i];Object.defineProperty(t,n,{value:e[n],enumerable:!1,writable:!1,configurable:!0})}return t},N=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||fi},yi=Si(0,0,0,0);function xi(t){return parseFloat(t)||0}function Ei(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return t.reduce(function(t,e){return t+xi(i["border-"+e+"-width"])},0)}function wi(t){var e=t.clientWidth,i=t.clientHeight;if(!e&&!i)return yi;var r=N(t).getComputedStyle(t),n=function(t){for(var e={},i=0,r=["top","right","bottom","left"];i<r.length;i++){var n=r[i],s=t["padding-"+n];e[n]=xi(s)}return e}(r),s=n.left+n.right,o=n.top+n.bottom,a=xi(r.width),l=xi(r.height);return"border-box"===r.boxSizing&&(Math.round(a+s)!==e&&(a-=Ei(r,"left","right")+s),Math.round(l+o)!==i&&(l-=Ei(r,"top","bottom")+o)),t!==N(t).document.documentElement&&(r=Math.round(a+s)-e,t=Math.round(l+o)-i,1!==Math.abs(r)&&(a-=r),1!==Math.abs(t)&&(l-=t)),Si(n.left,n.top,a,l)}var Oi="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof N(t).SVGGraphicsElement}:function(t){return t instanceof N(t).SVGElement&&"function"==typeof t.getBBox};function _i(t){return ui?Oi(t)?Si(0,0,(e=(e=t).getBBox()).width,e.height):wi(t):yi;var e}function Si(t,e,i,r){return{x:t,y:e,width:i,height:r}}Li.prototype.isActive=function(){var t=_i(this.target);return(this.contentRect_=t).width!==this.broadcastWidth||t.height!==this.broadcastHeight},Li.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t};var Ai=Li;function Li(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Si(0,0,0,0),this.target=t}var Mi=function(t,e){i=(e=e).x,r=e.y,s=e.width,e=e.height,n="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,n=Object.create(n.prototype),mi(n,{x:i,y:r,width:s,height:e,top:r,right:i+s,bottom:e+r,left:i});var i,r,n,s=n;mi(this,{target:t,contentRect:s})},ki=(z.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof N(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new Ai(t)),this.controller_.addObserver(this),this.controller_.refresh())}},z.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof N(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},z.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},z.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},z.prototype.broadcastActive=function(){var t,e;this.hasActive()&&(t=this.callbackCtx_,e=this.activeObservations_.map(function(t){return new Mi(t.target,t.broadcastRect())}),this.callback_.call(t,e,t),this.clearActive())},z.prototype.clearActive=function(){this.activeObservations_.splice(0)},z.prototype.hasActive=function(){return 0<this.activeObservations_.length},z);function z(t,e,i){if(this.activeObservations_=[],this.observations_=new ci,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=i}var Wi=new("undefined"!=typeof WeakMap?WeakMap:ci),Ti=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=bi.getInstance(),e=new ki(e,i,this);Wi.set(this,e)},Ri=(["observe","unobserve","disconnect"].forEach(function(e){Ti.prototype[e]=function(){var t;return(t=Wi.get(this))[e].apply(t,arguments)}}),void 0!==fi.ResizeObserver?fi.ResizeObserver:Ti),ji=!("undefined"==typeof window||!window.document||!window.document.createElement),p=function(){function o(t,e){var n=this;this.onScroll=function(){n.scrollXTicking||(window.requestAnimationFrame(n.scrollX),n.scrollXTicking=!0),n.scrollYTicking||(window.requestAnimationFrame(n.scrollY),n.scrollYTicking=!0)},this.scrollX=function(){n.axis.x.isOverflowing&&(n.showScrollbar("x"),n.positionScrollbar("x")),n.scrollXTicking=!1},this.scrollY=function(){n.axis.y.isOverflowing&&(n.showScrollbar("y"),n.positionScrollbar("y")),n.scrollYTicking=!1},this.onMouseEnter=function(){n.showScrollbar("x"),n.showScrollbar("y")},this.onMouseMove=function(t){n.mouseX=t.clientX,n.mouseY=t.clientY,(n.axis.x.isOverflowing||n.axis.x.forceVisible)&&n.onMouseMoveForAxis("x"),(n.axis.y.isOverflowing||n.axis.y.forceVisible)&&n.onMouseMoveForAxis("y")},this.onMouseLeave=function(){n.onMouseMove.cancel(),(n.axis.x.isOverflowing||n.axis.x.forceVisible)&&n.onMouseLeaveForAxis("x"),(n.axis.y.isOverflowing||n.axis.y.forceVisible)&&n.onMouseLeaveForAxis("y"),n.mouseX=-1,n.mouseY=-1},this.onWindowResize=function(){n.scrollbarWidth=de(),n.hideNativeScrollbar()},this.hideScrollbars=function(){n.axis.x.track.rect=n.axis.x.track.el.getBoundingClientRect(),n.axis.y.track.rect=n.axis.y.track.el.getBoundingClientRect(),n.isWithinBounds(n.axis.y.track.rect)||(n.axis.y.scrollbar.el.classList.remove(n.classNames.visible),n.axis.y.isVisible=!1),n.isWithinBounds(n.axis.x.track.rect)||(n.axis.x.scrollbar.el.classList.remove(n.classNames.visible),n.axis.x.isVisible=!1)},this.onPointerEvent=function(t){var e,i;n.axis.x.scrollbar.rect=n.axis.x.scrollbar.el.getBoundingClientRect(),n.axis.y.scrollbar.rect=n.axis.y.scrollbar.el.getBoundingClientRect(),(n.axis.x.isOverflowing||n.axis.x.forceVisible)&&(i=n.isWithinBounds(n.axis.x.scrollbar.rect)),((e=n.axis.y.isOverflowing||n.axis.y.forceVisible?n.isWithinBounds(n.axis.y.scrollbar.rect):e)||i)&&(t.preventDefault(),t.stopPropagation(),"mousedown"===t.type&&(e&&n.onDragStart(t,"y"),i&&n.onDragStart(t,"x")))},this.drag=function(t){var e=n.axis[n.draggedAxis].track,i=e.rect[n.axis[n.draggedAxis].sizeAttr],r=n.axis[n.draggedAxis].scrollbar;t.preventDefault(),t.stopPropagation();t=(("y"===n.draggedAxis?t.pageY:t.pageX)-e.rect[n.axis[n.draggedAxis].offsetAttr]-n.axis[n.draggedAxis].dragOffset)/e.rect[n.axis[n.draggedAxis].sizeAttr]*n.contentWrapperEl[n.axis[n.draggedAxis].scrollSizeAttr];"x"===n.draggedAxis&&(t=n.isRtl&&o.getRtlHelpers().isRtlScrollbarInverted?t-(i+r.size):t,t=n.isRtl&&o.getRtlHelpers().isRtlScrollingInverted?-t:t),n.contentWrapperEl[n.axis[n.draggedAxis].scrollOffsetAttr]=t},this.onEndDrag=function(t){t.preventDefault(),t.stopPropagation(),n.el.classList.remove(n.classNames.dragging),document.removeEventListener("mousemove",n.drag),document.removeEventListener("mouseup",n.onEndDrag)},this.el=t,this.flashTimeout,this.contentEl,this.contentWrapperEl,this.offsetEl,this.maskEl,this.globalObserver,this.mutationObserver,this.resizeObserver,this.scrollbarWidth,this.minScrollbarWidth=20,this.options=Object.assign({},o.defaultOptions,e),this.classNames=Object.assign({},o.defaultOptions.classNames,this.options.classNames),this.isRtl,this.axis={x:{scrollOffsetAttr:"scrollLeft",sizeAttr:"width",scrollSizeAttr:"scrollWidth",offsetAttr:"left",overflowAttr:"overflowX",dragOffset:0,isOverflowing:!0,isVisible:!1,forceVisible:!1,track:{},scrollbar:{}},y:{scrollOffsetAttr:"scrollTop",sizeAttr:"height",scrollSizeAttr:"scrollHeight",offsetAttr:"top",overflowAttr:"overflowY",dragOffset:0,isOverflowing:!0,isVisible:!1,forceVisible:!1,track:{},scrollbar:{}}},this.el.SimpleBar||(this.recalculate=We(this.recalculate.bind(this),64),this.onMouseMove=We(this.onMouseMove.bind(this),64),this.hideScrollbars=qe(this.hideScrollbars.bind(this),this.options.timeout),this.onWindowResize=qe(this.onWindowResize.bind(this),64,{leading:!0}),o.getRtlHelpers=li(o.getRtlHelpers),this.init())}o.getRtlHelpers=function(){var t=document.createElement("div"),t=(t.innerHTML='<div class="hs-dummy-scrollbar-size"><div style="height: 200%; width: 200%; margin: 10px 0;"></div></div>',t.firstElementChild),e=(document.body.appendChild(t),t.firstElementChild),i=(t.scrollLeft=0,o.getOffset(t)),r=o.getOffset(e),t=(t.scrollLeft=999,o.getOffset(e));return{isRtlScrollingInverted:i.left!==r.left&&r.left-t.left!=0,isRtlScrollbarInverted:i.left!==r.left}},o.initHtmlApi=function(){this.initDOMLoadedElements=this.initDOMLoadedElements.bind(this),"undefined"!=typeof MutationObserver&&(this.globalObserver=new MutationObserver(function(t){t.forEach(function(t){Array.prototype.forEach.call(t.addedNodes,function(t){1===t.nodeType&&(t.hasAttribute("data-simplebar")?t.SimpleBar||new o(t,o.getElOptions(t)):Array.prototype.forEach.call(t.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar||new o(t,o.getElOptions(t))}))}),Array.prototype.forEach.call(t.removedNodes,function(t){1===t.nodeType&&(t.hasAttribute("data-simplebar")?t.SimpleBar&&t.SimpleBar.unMount():Array.prototype.forEach.call(t.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar&&t.SimpleBar.unMount()}))})})}),this.globalObserver.observe(document,{childList:!0,subtree:!0})),"complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?window.setTimeout(this.initDOMLoadedElements):(document.addEventListener("DOMContentLoaded",this.initDOMLoadedElements),window.addEventListener("load",this.initDOMLoadedElements))},o.getElOptions=function(t){return Array.prototype.reduce.call(t.attributes,function(t,e){var i=e.name.match(/data-simplebar-(.+)/);if(i){var r=i[1].replace(/\W+(.)/g,function(t,e){return e.toUpperCase()});switch(e.value){case"true":t[r]=!0;break;case"false":t[r]=!1;break;case void 0:t[r]=!0;break;default:t[r]=e.value}}return t},{})},o.removeObserver=function(){this.globalObserver.disconnect()},o.initDOMLoadedElements=function(){document.removeEventListener("DOMContentLoaded",this.initDOMLoadedElements),window.removeEventListener("load",this.initDOMLoadedElements),Array.prototype.forEach.call(document.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar||new o(t,o.getElOptions(t))})},o.getOffset=function(t){t=t.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop),left:t.left+(window.pageXOffset||document.documentElement.scrollLeft)}};var t=o.prototype;return t.init=function(){this.el.SimpleBar=this,ji&&(this.initDOM(),this.scrollbarWidth=de(),this.recalculate(),this.initListeners())},t.initDOM=function(){var t,e,i=this;if(Array.prototype.filter.call(this.el.children,function(t){return t.classList.contains(i.classNames.wrapper)}).length)this.wrapperEl=this.el.querySelector("."+this.classNames.wrapper),this.contentWrapperEl=this.el.querySelector("."+this.classNames.contentWrapper),this.offsetEl=this.el.querySelector("."+this.classNames.offset),this.maskEl=this.el.querySelector("."+this.classNames.mask),this.contentEl=this.el.querySelector("."+this.classNames.contentEl),this.placeholderEl=this.el.querySelector("."+this.classNames.placeholder),this.heightAutoObserverWrapperEl=this.el.querySelector("."+this.classNames.heightAutoObserverWrapperEl),this.heightAutoObserverEl=this.el.querySelector("."+this.classNames.heightAutoObserverEl),this.axis.x.track.el=this.el.querySelector("."+this.classNames.track+"."+this.classNames.horizontal),this.axis.y.track.el=this.el.querySelector("."+this.classNames.track+"."+this.classNames.vertical);else{for(this.wrapperEl=document.createElement("div"),this.contentWrapperEl=document.createElement("div"),this.offsetEl=document.createElement("div"),this.maskEl=document.createElement("div"),this.contentEl=document.createElement("div"),this.placeholderEl=document.createElement("div"),this.heightAutoObserverWrapperEl=document.createElement("div"),this.heightAutoObserverEl=document.createElement("div"),this.wrapperEl.classList.add(this.classNames.wrapper),this.contentWrapperEl.classList.add(this.classNames.contentWrapper),this.offsetEl.classList.add(this.classNames.offset),this.maskEl.classList.add(this.classNames.mask),this.contentEl.classList.add(this.classNames.contentEl),this.placeholderEl.classList.add(this.classNames.placeholder),this.heightAutoObserverWrapperEl.classList.add(this.classNames.heightAutoObserverWrapperEl),this.heightAutoObserverEl.classList.add(this.classNames.heightAutoObserverEl);this.el.firstChild;)this.contentEl.appendChild(this.el.firstChild);this.contentWrapperEl.appendChild(this.contentEl),this.offsetEl.appendChild(this.contentWrapperEl),this.maskEl.appendChild(this.offsetEl),this.heightAutoObserverWrapperEl.appendChild(this.heightAutoObserverEl),this.wrapperEl.appendChild(this.heightAutoObserverWrapperEl),this.wrapperEl.appendChild(this.maskEl),this.wrapperEl.appendChild(this.placeholderEl),this.el.appendChild(this.wrapperEl)}this.axis.x.track.el&&this.axis.y.track.el||(t=document.createElement("div"),e=document.createElement("div"),t.classList.add(this.classNames.track),e.classList.add(this.classNames.scrollbar),t.appendChild(e),this.axis.x.track.el=t.cloneNode(!0),this.axis.x.track.el.classList.add(this.classNames.horizontal),this.axis.y.track.el=t.cloneNode(!0),this.axis.y.track.el.classList.add(this.classNames.vertical),this.el.appendChild(this.axis.x.track.el),this.el.appendChild(this.axis.y.track.el)),this.axis.x.scrollbar.el=this.axis.x.track.el.querySelector("."+this.classNames.scrollbar),this.axis.y.scrollbar.el=this.axis.y.track.el.querySelector("."+this.classNames.scrollbar),this.options.autoHide||(this.axis.x.scrollbar.el.classList.add(this.classNames.visible),this.axis.y.scrollbar.el.classList.add(this.classNames.visible)),this.el.setAttribute("data-simplebar","init")},t.initListeners=function(){var e=this;this.options.autoHide&&this.el.addEventListener("mouseenter",this.onMouseEnter),["mousedown","click","dblclick","touchstart","touchend","touchmove"].forEach(function(t){e.el.addEventListener(t,e.onPointerEvent,!0)}),this.el.addEventListener("mousemove",this.onMouseMove),this.el.addEventListener("mouseleave",this.onMouseLeave),this.contentWrapperEl.addEventListener("scroll",this.onScroll),window.addEventListener("resize",this.onWindowResize),this.resizeObserver=new Ri(this.recalculate),this.resizeObserver.observe(this.el),this.resizeObserver.observe(this.contentEl)},t.recalculate=function(){var t=this.heightAutoObserverEl.offsetHeight<=1,e=this.heightAutoObserverEl.offsetWidth<=1;this.elStyles=window.getComputedStyle(this.el),this.isRtl="rtl"===this.elStyles.direction,this.contentEl.style.padding=this.elStyles.paddingTop+" "+this.elStyles.paddingRight+" "+this.elStyles.paddingBottom+" "+this.elStyles.paddingLeft,this.wrapperEl.style.margin="-"+this.elStyles.paddingTop+" -"+this.elStyles.paddingRight+" -"+this.elStyles.paddingBottom+" -"+this.elStyles.paddingLeft,this.contentWrapperEl.style.height=t?"auto":"100%",this.placeholderEl.style.width=e?this.contentEl.offsetWidth+"px":"auto",this.placeholderEl.style.height=this.contentEl.scrollHeight+"px",this.axis.x.isOverflowing=this.contentWrapperEl.scrollWidth>this.contentWrapperEl.offsetWidth,this.axis.y.isOverflowing=this.contentWrapperEl.scrollHeight>this.contentWrapperEl.offsetHeight,this.axis.x.isOverflowing="hidden"!==this.elStyles.overflowX&&this.axis.x.isOverflowing,this.axis.y.isOverflowing="hidden"!==this.elStyles.overflowY&&this.axis.y.isOverflowing,this.axis.x.forceVisible="x"===this.options.forceVisible||!0===this.options.forceVisible,this.axis.y.forceVisible="y"===this.options.forceVisible||!0===this.options.forceVisible,this.hideNativeScrollbar(),this.axis.x.track.rect=this.axis.x.track.el.getBoundingClientRect(),this.axis.y.track.rect=this.axis.y.track.el.getBoundingClientRect(),this.axis.x.scrollbar.size=this.getScrollbarSize("x"),this.axis.y.scrollbar.size=this.getScrollbarSize("y"),this.axis.x.scrollbar.el.style.width=this.axis.x.scrollbar.size+"px",this.axis.y.scrollbar.el.style.height=this.axis.y.scrollbar.size+"px",this.positionScrollbar("x"),this.positionScrollbar("y"),this.toggleTrackVisibility("x"),this.toggleTrackVisibility("y")},t.getScrollbarSize=function(t){void 0===t&&(t="y");var e=this.scrollbarWidth?this.contentWrapperEl[this.axis[t].scrollSizeAttr]:this.contentWrapperEl[this.axis[t].scrollSizeAttr]-this.minScrollbarWidth,i=this.axis[t].track.rect[this.axis[t].sizeAttr];if(this.axis[t].isOverflowing)return t=Math.max(~~(i/e*i),this.options.scrollbarMinSize),this.options.scrollbarMaxSize?Math.min(t,this.options.scrollbarMaxSize):t},t.positionScrollbar=function(t){var e=this.contentWrapperEl[this.axis[t=void 0===t?"y":t].scrollSizeAttr],i=this.axis[t].track.rect[this.axis[t].sizeAttr],r=parseInt(this.elStyles[this.axis[t].sizeAttr],10),n=this.axis[t].scrollbar,s=this.contentWrapperEl[this.axis[t].scrollOffsetAttr],s="x"===t&&this.isRtl&&o.getRtlHelpers().isRtlScrollingInverted?-s:s,s=~~((i-n.size)*(s/(e-r))),s="x"===t&&this.isRtl&&o.getRtlHelpers().isRtlScrollbarInverted?s+(i-n.size):s;n.el.style.transform="x"===t?"translate3d("+s+"px, 0, 0)":"translate3d(0, "+s+"px, 0)"},t.toggleTrackVisibility=function(t){var e=this.axis[t=void 0===t?"y":t].track.el,i=this.axis[t].scrollbar.el;this.axis[t].isOverflowing||this.axis[t].forceVisible?(e.style.visibility="visible",this.contentWrapperEl.style[this.axis[t].overflowAttr]="scroll"):(e.style.visibility="hidden",this.contentWrapperEl.style[this.axis[t].overflowAttr]="hidden"),this.axis[t].isOverflowing?i.style.display="block":i.style.display="none"},t.hideNativeScrollbar=function(){var t;this.offsetEl.style[this.isRtl?"left":"right"]=this.axis.y.isOverflowing||this.axis.y.forceVisible?"-"+(this.scrollbarWidth||this.minScrollbarWidth)+"px":0,this.offsetEl.style.bottom=this.axis.x.isOverflowing||this.axis.x.forceVisible?"-"+(this.scrollbarWidth||this.minScrollbarWidth)+"px":0,this.scrollbarWidth||(t=[this.isRtl?"paddingLeft":"paddingRight"],this.contentWrapperEl.style[t]=this.axis.y.isOverflowing||this.axis.y.forceVisible?this.minScrollbarWidth+"px":0,this.contentWrapperEl.style.paddingBottom=this.axis.x.isOverflowing||this.axis.x.forceVisible?this.minScrollbarWidth+"px":0)},t.onMouseMoveForAxis=function(t){this.axis[t=void 0===t?"y":t].track.rect=this.axis[t].track.el.getBoundingClientRect(),this.axis[t].scrollbar.rect=this.axis[t].scrollbar.el.getBoundingClientRect(),this.isWithinBounds(this.axis[t].scrollbar.rect)?this.axis[t].scrollbar.el.classList.add(this.classNames.hover):this.axis[t].scrollbar.el.classList.remove(this.classNames.hover),this.isWithinBounds(this.axis[t].track.rect)?(this.showScrollbar(t),this.axis[t].track.el.classList.add(this.classNames.hover)):this.axis[t].track.el.classList.remove(this.classNames.hover)},t.onMouseLeaveForAxis=function(t){this.axis[t=void 0===t?"y":t].track.el.classList.remove(this.classNames.hover),this.axis[t].scrollbar.el.classList.remove(this.classNames.hover)},t.showScrollbar=function(t){var e=this.axis[t=void 0===t?"y":t].scrollbar.el;this.axis[t].isVisible||(e.classList.add(this.classNames.visible),this.axis[t].isVisible=!0),this.options.autoHide&&this.hideScrollbars()},t.onDragStart=function(t,e){var i=this.axis[e=void 0===e?"y":e].scrollbar.el,t="y"===e?t.pageY:t.pageX;this.axis[e].dragOffset=t-i.getBoundingClientRect()[this.axis[e].offsetAttr],this.draggedAxis=e,this.el.classList.add(this.classNames.dragging),document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.onEndDrag)},t.getContentElement=function(){return this.contentEl},t.getScrollElement=function(){return this.contentWrapperEl},t.removeListeners=function(){var e=this;this.options.autoHide&&this.el.removeEventListener("mouseenter",this.onMouseEnter),["mousedown","click","dblclick","touchstart","touchend","touchmove"].forEach(function(t){e.el.removeEventListener(t,e.onPointerEvent)}),this.el.removeEventListener("mousemove",this.onMouseMove),this.el.removeEventListener("mouseleave",this.onMouseLeave),this.contentWrapperEl.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onWindowResize),this.mutationObserver&&this.mutationObserver.disconnect(),this.resizeObserver.disconnect(),this.recalculate.cancel(),this.onMouseMove.cancel(),this.hideScrollbars.cancel(),this.onWindowResize.cancel()},t.unMount=function(){this.removeListeners(),this.el.SimpleBar=null},t.isChildNode=function(t){return null!==t&&(t===this.el||this.isChildNode(t.parentNode))},t.isWithinBounds=function(t){return this.mouseX>=t.left&&this.mouseX<=t.left+t.width&&this.mouseY>=t.top&&this.mouseY<=t.top+t.height},o}();return p.defaultOptions={autoHide:!0,forceVisible:!1,classNames:{contentEl:"simplebar-content",contentWrapper:"simplebar-content-wrapper",offset:"simplebar-offset",mask:"simplebar-mask",wrapper:"simplebar-wrapper",placeholder:"simplebar-placeholder",scrollbar:"simplebar-scrollbar",track:"simplebar-track",heightAutoObserverWrapperEl:"simplebar-height-auto-observer-wrapper",heightAutoObserverEl:"simplebar-height-auto-observer",visible:"simplebar-visible",horizontal:"simplebar-horizontal",vertical:"simplebar-vertical",hover:"simplebar-hover",dragging:"simplebar-dragging"},scrollbarMinSize:25,scrollbarMaxSize:0,timeout:1e3},ji&&p.initHtmlApi(),p});
|
assets/js/um-account.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(){var
|
1 |
+
jQuery(document).ready(function(){var t=jQuery(".um-account-main").attr("data-current_tab");t&&(jQuery('.um-account-tab[data-tab="'+t+'"]').show(),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),wp.hooks.doAction("um_account_active_tab_inited",t)),jQuery(document.body).on("click",".um-account-side li a",function(t){t.preventDefault();var t=jQuery(this),t=(t.parents("ul").find("li a").removeClass("current"),t.addClass("current"),jQuery(this).attr("href")),a=jQuery(this).attr("data-tab");return jQuery('input[id="_um_account_tab"]:hidden').val(a),window.history.pushState("","",t),jQuery(".um-account-tab").hide(),jQuery('.um-account-tab[data-tab="'+a+'"]').fadeIn(),jQuery(".um-account-tab:visible").find("input, select, textarea").filter(".um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-nav a").removeClass("current"),jQuery('.um-account-nav a[data-tab="'+a+'"]').addClass("current"),wp.hooks.doAction("um_after_account_tab_changed",a),!1}),jQuery(document.body).on("click",".um-account-nav a",function(t){t.preventDefault();var t=jQuery(this).attr("data-tab"),a=jQuery(this).parents("div"),e=jQuery(this);return jQuery('input[id="_um_account_tab"]:hidden').val(t),jQuery(".um-account-tab").hide(),e.hasClass("current")?(a.next(".um-account-tab").slideUp(),e.removeClass("current")):(a.next(".um-account-tab").slideDown(),e.parents("div").find("a").removeClass("current"),e.addClass("current")),jQuery(".um-account-tab:visible").find("input, select, textarea").filter(".um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-side li a").removeClass("current"),jQuery('.um-account-side li a[data-tab="'+t+'"]').addClass("current"),wp.hooks.doAction("um_after_account_tab_changed",t),!1}),jQuery(document.body).on("click",".um-request-button",function(t){t.preventDefault();var a,e=jQuery(this).data("action"),t=jQuery("#"+e).val();jQuery(".um-field-area-response."+e).hide(),jQuery("#"+e).length&&""===t?jQuery(".um-field-error."+e).show():(jQuery(".um-field-error."+e).hide(),a={request_action:e,nonce:um_scripts.nonce},jQuery("#"+e).length&&(a.password=t),wp.ajax.send("um_request_user_data",{data:a,success:function(t){jQuery(".um-field-area-response."+e).text(t.answer).show()},error:function(t){console.log(t)}}))})});
|
assets/js/um-conditional.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var arr_all_conditions=[],um_field_conditions={},um_field_default_values={};function um_get_field_default_value(e){var i="",
|
1 |
+
var arr_all_conditions=[],um_field_conditions={},um_field_default_values={};function um_get_field_default_value(e){var i,n="",t=um_get_field_type(e);switch(t){case"text":case"number":case"date":case"textarea":case"select":n=e.find('input:text,input[type="number"],textarea,select').val();break;case"multiselect":n=e.find("select").val();break;case"radio":1<=e.find('input[type="radio"]:checked').length&&(n=e.find('input[type="radio"]:checked').val());break;case"checkbox":1<=e.find('input[type="checkbox"]:checked').length&&(n=1<e.find('input[type="checkbox"]:checked').length?((i=[]).push(n),e.find('input[type="checkbox"]:checked').each(function(){i.push(jQuery(this).val())}),i):e.find('input[type="checkbox"]:checked').val());break;default:n=wp.hooks.applyFilters("um_conditional_logic_default_value",n,t,e)}return{type:t,value:n}}function um_get_field_element(e){var i=e.find("input,textarea,select"),n=um_get_field_type(e);return wp.hooks.applyFilters("um_conditional_logic_field_element",i,n,e)}function um_get_field_type(e){var n="",e=e.attr("class").split(" ");return jQuery.each(e,function(e,i){/um-field-type_/.test(i)&&(n=i.replace("um-field-type_","").trim())}),n}function um_get_field_children(n){var t=[];return jQuery.each(arr_all_conditions,function(e,i){i.field.parent===n&&t.push(i.field.condition)}),t}function um_splitup_array(e,i){for(var n=e.length%i,t=n,a=Math.floor(e.length/i),u=[],o=0;o<e.length;o+=a){var r=a+o,d=!1;0!=n&&t&&(r++,t--,d=!0),u.push(e.slice(o,r)),d&&o++}var c=[];return jQuery.each(u,function(e,i){c.push({action:i[0],if_field:i[1],operator:i[2],value:i[3]})}),c}function um_get_field_data(e){return um_live_field=e.parents(".um-field").data("key"),um_live_value=e.val(),e.is(":checkbox")&&(um_live_value="",1<e.parents(".um-field").find("input:checked").length?e.parents(".um-field").find("input:checked").each(function(){um_live_value=um_live_value+jQuery(this).val()+" "}):1<=e.parents(".um-field").find("input:checked").length&&(um_live_value=e.parents(".um-field").find("input:checked").val())),um_live_value=e.is(":radio")?e.parents(".um-field").find("input[type=radio]:checked").val():um_live_value}function um_in_array(e,i,n){var t,a=!1;for(t in n=!!n,i)if(n&&i[t]===e||!n&&i[t]==e){a=!0;break}return a}function um_apply_conditions(n,e){var i,t,a,u,o,r;n.parents(".um-field[data-key]").length&&(i=n.parents(".um-field[data-key]").data("key"),void 0!==(i=um_field_conditions[i])&&(t=um_get_field_type(n.parents(".um-field[data-key]")),"empty_file"===(a=um_get_field_data(n))&&(a=""),u={},o={},r={},jQuery.each(i,function(e,i){void 0===o[i.owner]&&(o[i.owner]=[],r[i.owner]={}),o[i.owner].push(i.value),r[i.owner]=i}),jQuery.each(i,function(e,i){var n;if(void 0===u[i.owner]&&(u[i.owner]={}),"empty"===i.operator&&(n=Array.isArray(a)?a.join(""):a,u[i.owner][e]=!n||""===n),"not empty"===i.operator&&(n=Array.isArray(a)?a.join(""):a,u[i.owner][e]=!(!n||""===n)),"equals to"===i.operator&&(n=Array.isArray(a)&&1===a.length?a[0]:a,i.value===n&&um_in_array(n,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1),"not equals"===i.operator&&(n=Array.isArray(a)&&1===a.length?a[0]:a,(!jQuery.isNumeric(i.value)||parseInt(n)===parseInt(i.value)||!n||um_in_array(n,o[i.owner]))&&(i.value==n||um_in_array(n,o[i.owner]))?u[i.owner][e]=!1:u[i.owner][e]=!0),"greater than"===i.operator&&(n=Array.isArray(a)&&1===a.length?a[0]:a,jQuery.isNumeric(i.value)&&parseInt(n)>parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"less than"===i.operator&&(n=Array.isArray(a)&&1===a.length?a[0]:a,jQuery.isNumeric(i.value)&&parseInt(n)<parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"contains"===i.operator)switch(t){case"multiselect":a&&0<=a.indexOf(i.value)&&um_in_array(i.value,a)?u[i.owner][e]=!0:u[i.owner][e]=!1;break;case"checkbox":a&&0<=a.indexOf(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1;break;default:void 0===(u=wp.hooks.applyFilters("um_conditional_logic_contains_operator_owners",u,t,a,i,e))[i.owner][e]&&(a&&0<=a.indexOf(i.value)&&um_in_array(a,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1)}}),jQuery.each(u,function(e,i){um_in_array(!0,i)?um_field_apply_action(n,r[e],!0):um_field_apply_action(n,r[e],!1)}),n.trigger("um_fields_change")))}function um_field_apply_action(e,i,n){var t=jQuery('div.um-field[data-key="'+i.owner+'"]');return"show"===i.action&&n&&(t.is(":hidden")&&um_field_restore_default_value(t),t.show(),_show_in_ie(t)),"show"!==i.action||n||(t.hide(),_hide_in_ie(t)),"hide"===i.action&&n&&(t.hide(),_hide_in_ie(t)),"hide"!==i.action||n||(t.is(":hidden")&&um_field_restore_default_value(t),t.show(),_show_in_ie(t)),e.removeClass("um-field-has-changed")}function um_field_restore_default_value(n){var e,i=um_get_field_type(n),t=n.data("key"),a=um_field_default_values[t];switch(i){case"text":case"number":case"date":case"textarea":n.find('input:text,input[type="number"],textareas').val(a.value);break;case"select":n.find("select").find("option").prop("selected",!1),n.find("select").val(a.value),n.find("select").trigger("change");break;case"multiselect":n.find("select").find("option").prop("selected",!1),jQuery.each(a.value,function(e,i){n.find("select").find('option[value="'+i+'"]').attr("selected",!0)}),n.find("select").trigger("change");break;case"checkbox":1<=n.find('input[type="checkbox"]:checked').length&&(n.find('input[type="checkbox"]:checked').prop("checked",!1),n.find("span.um-field-checkbox-state i").removeClass("um-icon-android-checkbox-outline"),n.find("span.um-field-checkbox-state i").addClass("um-icon-android-checkbox-outline-blank"),n.find(".um-field-checkbox.active").removeClass("active"),Array.isArray(a.value)?jQuery.each(a.value,function(e,i){i=n.find('input[type="checkbox"][value="'+i+'"]');i.attr("checked",!0),i.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),i.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),i.closest(".um-field-checkbox").addClass("active")}):((e=n.find('input[type="checkbox"][value="'+a.value+'"]')).attr("checked",!0),e.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),e.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),e.closest(".um-field-checkbox").addClass("active")));break;case"radio":1<=n.find('input[type="radio"]:checked').length&&setTimeout(function(){n.find('input[type="radio"]:checked').prop("checked",!1),n.find("span.um-field-radio-state i").removeClass("um-icon-android-radio-button-on"),n.find("span.um-field-radio-state i").addClass("um-icon-android-radio-button-off"),n.find(".um-field-radio.active").removeClass("active");var e=n.find('input[type="radio"][value="'+a.value+'"]');e.attr("checked",!0),e.closest(".um-field-radio").find("i").removeClass("um-icon-android-radio-button-off"),e.closest(".um-field-radio").find("i").addClass("um-icon-android-radio-button-on"),e.closest(".um-field-radio").addClass("active")},100);break;default:wp.hooks.doAction("um_conditional_logic_restore_default_value",i,n,a)}n.hasClass("um-field-has-changed")||(t=um_get_field_element(n),(t="radio"!==i&&"checkbox"!==i?t:t.find(":checked"))&&(t.trigger("change"),n.addClass("um-field-has-changed")))}function um_field_hide_siblings(){jQuery.each(um_field_conditions,function(e,i){(1<=jQuery('.um-field[data-key="'+e+'"]:hidden').length||"none"===jQuery('.um-field[data-key="'+e+'"]').css("display"))&&jQuery.each(i,function(e,i){jQuery('.um-field[data-key="'+i.owner+'"]').hide()})})}function _hide_in_ie(e){void 0!==jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"hidden"})}function _show_in_ie(e){void 0!==jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"visible"})}function um_init_field_conditions(){var e=[];jQuery(".um-field[data-key]").each(function(){var n=jQuery(this).data("key"),a=(e.push(n),{});jQuery.each(jQuery(this)[0].attributes,function(e,i){var n,t;-1!==i.name.indexOf("data-cond")&&(n=(t=i.name.slice(10)).substring(1,0),t=t.slice(2),void 0===a[n]&&(a[n]={}),a[n][t]=i.value)}),jQuery.each(a,function(e,i){i={field:{owner:n,action:i.action,parent:i.field,operator:i.operator,value:i.value,condition:{owner:n,action:i.action,operator:i.operator,value:i.value}}};arr_all_conditions.push(i)}),um_field_default_values[jQuery(this).data("key")]=um_get_field_default_value(jQuery(this))}),jQuery.each(e,function(e,i){um_field_conditions[i]=um_get_field_children(i)}),jQuery(".um-field[data-key]:visible").each(function(){var e=um_get_field_element(jQuery(this));void 0!==e.trigger&&e.trigger("change")})}jQuery(document).ready(function(){jQuery(document).on("change",'.um-field select, .um-field input[type="radio"], .um-field input[type="checkbox"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="text"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="number"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="password"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("change",'.um-field-image input[type="hidden"],.um-field-file input[type="hidden"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("click",".um-finish-upload",function(){var e=jQuery(this).attr("data-key"),i=jQuery(".um-field-"+e+" input");setTimeout(function(){um_apply_conditions(i,!1)},100)}),jQuery(document).on("click",".um-field .cancel",function(){var e=jQuery(this).parent().attr("data-key"),i=jQuery(".um-field-"+e+" input");setTimeout(function(){um_apply_conditions(i,!1)},1e3)}),jQuery(document).on("um_fields_change",function(){um_field_hide_siblings(),um_field_hide_siblings()}),um_init_field_conditions()});
|
assets/js/um-crop.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)}(function(l){"use strict";var i,e=l(window),h=l(document),a=window.location,D=!0,W=!1,r=null,n="undefined",o="directive",t=".cropper",d=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,g=/^(x|y|width|height)$/,s=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,p="cropper-modal",H="cropper-hidden",c="cropper-invisible",f="cropper-crop",m="cropper-disabled",u="mousedown touchstart",w="mousemove touchmove",v="mouseup mouseleave touchend touchleave touchcancel",x="wheel mousewheel DOMMouseScroll",b="resize"+t,y="dblclick",$="build"+t,C="built"+t,k="dragstart"+t,R="dragmove"+t,z="dragend"+t,L=function(t){return"number"==typeof t},Y=function(t,i){var e=[];return"number"==typeof i&&e.push(i),e.slice.apply(t,e)},X=function(t,i){var e=Y(arguments,2);return function(){return t.apply(i,e.concat(Y(arguments)))}},M=function(t,i){this.element=t,this.$element=l(t),this.defaults=l.extend({},M.DEFAULTS,l.isPlainObject(i)?i:{}),this.$original=r,this.ready=W,this.built=W,this.cropped=W,this.rotated=W,this.disabled=W,this.replaced=W,this.init()},T=Math.sqrt,I=Math.min,E=Math.max,_=Math.abs,P=Math.sin,O=Math.cos,U=parseFloat;M.prototype={constructor:M,support:{canvas:l.isFunction(l("<canvas>")[0].getContext)},init:function(){var e=this.defaults;l.each(e,function(t,i){switch(t){case"aspectRatio":e[t]=_(U(i))||NaN;break;case"autoCropArea":e[t]=_(U(i))||.8;break;case"minWidth":case"minHeight":e[t]=_(U(i))||0;break;case"maxWidth":case"maxHeight":e[t]=_(U(i))||1/0}}),this.image={rotate:0},this.load()},load:function(){var t,i,e=this,h=this.$element,a=this.element,s=this.image,r="";h.is("img")?i=h.prop("src"):h.is("canvas")&&this.support.canvas&&(i=a.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(h.prop("crossOrigin")||this.isCrossOriginURL(i))&&(r=" crossOrigin"),this.$clone=t=l("<img"+r+' src="'+i+'">'),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,e.url=i,e.ready=D,e.build()}),t.addClass(c).prependTo("body"))},isCrossOriginURL:function(t){var i=t.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!i||i[1]===a.protocol&&i[2]===a.hostname&&i[3]===a.port?W:D},build:function(){var t,i,e=this.$element,h=this.defaults;this.ready&&(this.built&&this.unbuild(),e.one($,h.build),t=l.Event($),e.trigger(t),t.isDefaultPrevented()||(this.$cropper=i=l(M.TEMPLATE),e.addClass(H),this.$clone.removeClass(c).prependTo(i),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(H).prependTo(this.$cropper),this.originalImage=l.extend({},this.image)),this.$container=e.parent(),this.$container.append(i),this.$canvas=i.find(".cropper-canvas"),this.$dragger=i.find(".cropper-dragger"),this.$viewer=i.find(".cropper-viewer"),h.autoCrop?this.cropped=D:this.$dragger.addClass(H),h.dragCrop&&this.setDragMode("crop"),h.modal&&this.$canvas.addClass(p),!h.dashed&&this.$dragger.find(".cropper-dashed").addClass(H),!h.movable&&this.$dragger.find(".cropper-face").data(o,"move"),!h.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(H),this.addListeners(),this.initPreview(),this.built=D,this.update(),this.replaced=W,e.one(C,h.built),e.trigger(C)))},unbuild:function(){this.built&&(this.built=W,this.removeListeners(),this.$preview.empty(),this.$preview=r,this.$dragger=r,this.$canvas=r,this.$container=r,this.$cropper.remove(),this.$cropper=r)},update:function(t){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),t?(this.setData(t,D),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(l.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,e=this.dragger,h=t.width,a=t.height,s=e.left-t.left,r=e.top-t.top;this.$viewer.find("img").css({width:h,height:a,marginLeft:-s,marginTop:-r}),this.$preview.each(function(){var t=l(this),i=t.width()/e.width;t.find("img").css({width:h*i,height:a*i,marginLeft:-s*i,marginTop:-r*i})})},addListeners:function(){var t=this.defaults;this.$element.on(k,t.dragstart).on(R,t.dragmove).on(z,t.dragend),this.$cropper.on(u,l.proxy(this.dragstart,this)).on(y,l.proxy(this.dblclick,this)),t.zoomable&&this.$cropper.on(x,l.proxy(this.wheel,this)),t.multiple?this.$cropper.on(w,l.proxy(this.dragmove,this)).on(v,l.proxy(this.dragend,this)):h.on(w,this._dragmove=X(this.dragmove,this)).on(v,this._dragend=X(this.dragend,this)),e.on(b,this._resize=X(this.resize,this))},removeListeners:function(){var t=this.defaults;this.$element.off(k,t.dragstart).off(R,t.dragmove).off(z,t.dragend),this.$cropper.off(u,this.dragstart).off(y,this.dblclick),t.zoomable&&this.$cropper.off(x,this.wheel),t.multiple?this.$cropper.off(w,this.dragmove).off(v,this.dragend):h.off(w,this._dragmove).off(v,this._dragend),e.off(b,this._resize)},initPreview:function(){var t='<img src="'+this.url+'">';this.$preview=l(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var t=this.$container;t!==r&&(this.container={width:E(t.width(),300),height:E(t.height(),150)})},initCropper:function(){var t,i=this.container,e=this.image;0<=e.naturalWidth*i.height/e.naturalHeight-i.width?(t={width:i.width,height:i.width/e.aspectRatio,left:0}).top=(i.height-t.height)/2:(t={width:i.height*e.aspectRatio,height:i.height,top:0}).left=(i.width-t.width)/2,this.$cropper&&this.$cropper.css({width:t.width,height:t.height,left:t.left,top:t.top}),this.cropper=t},initImage:function(){var t=this.image,i=this.cropper,e={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=l.extend({},t,e),t._width!==i.width||t._height!==i.height?l.extend(t,e):(t=l.extend({},e,t),this.replaced&&(t.ratio=e.ratio)),this.image=t,this.renderImage()},renderImage:function(t){var i=this.image;"zoom"===t&&(i.left-=(i.width-i.oldWidth)/2,i.top-=(i.height-i.oldHeight)/2),i.left=I(E(i.left,i._width-i.width),0),i.top=I(E(i.top,i._height-i.height),0),this.$clone.css({width:i.width,height:i.height,marginLeft:i.left,marginTop:i.top}),t&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t,i=this.defaults,e=this.cropper,h=i.aspectRatio||this.image.aspectRatio,a=this.image.ratio;(t=0<=e.height*h-e.width?{height:e.width/h,width:e.width,left:0,top:(e.height-e.width/h)/2,maxWidth:e.width,maxHeight:e.width/h}:{height:e.height,width:e.height*h,left:(e.width-e.height*h)/2,top:0,maxWidth:e.height*h,maxHeight:e.height}).minWidth=0,t.minHeight=0,i.aspectRatio?(isFinite(i.maxWidth)?(t.maxWidth=I(t.maxWidth,i.maxWidth*a),t.maxHeight=t.maxWidth/h):isFinite(i.maxHeight)&&(t.maxHeight=I(t.maxHeight,i.maxHeight*a),t.maxWidth=t.maxHeight*h),0<i.minWidth?(t.minWidth=E(0,i.minWidth*a),t.minHeight=t.minWidth/h):0<i.minHeight&&(t.minHeight=E(0,i.minHeight*a),t.minWidth=t.minHeight*h)):(t.maxWidth=I(t.maxWidth,i.maxWidth*a),t.maxHeight=I(t.maxHeight,i.maxHeight*a),t.minWidth=E(0,i.minWidth*a),t.minHeight=E(0,i.minHeight*a)),t.minWidth=I(t.maxWidth,t.minWidth),t.minHeight=I(t.maxHeight,t.minHeight),t.height*=i.autoCropArea,t.width*=i.autoCropArea,t.left=(e.width-t.width)/2,t.top=(e.height-t.height)/2,t.oldLeft=t.left,t.oldTop=t.top,this.defaultDragger=t,this.dragger=l.extend({},t)},renderDragger:function(){var t=this.dragger,i=this.cropper;t.width>t.maxWidth?(t.width=t.maxWidth,t.left=t.oldLeft):t.width<t.minWidth&&(t.width=t.minWidth,t.left=t.oldLeft),t.height>t.maxHeight?(t.height=t.maxHeight,t.top=t.oldTop):t.height<t.minHeight&&(t.height=t.minHeight,t.top=t.oldTop),t.left=I(E(t.left,0),i.width-t.width),t.top=I(E(t.top,0),i.height-t.height),t.oldLeft=t.left,t.oldTop=t.top,this.dragger=t,this.disabled||this.defaults.done(this.getData()),this.$dragger.css({width:t.width,height:t.height,left:t.left,top:t.top}),this.preview()},reset:function(t){this.cropped&&(t&&(this.defaults.data={}),this.image=l.extend({},this.defaultImage),this.renderImage(),this.dragger=l.extend({},this.defaultDragger),this.setData(this.defaults.data))},clear:function(){this.cropped&&(this.cropped=W,this.setData({x:0,y:0,width:0,height:0}),this.$canvas.removeClass(p),this.$dragger.addClass(H))},destroy:function(){var t=this.$element;this.ready&&(this.unbuild(),t.removeClass(H).removeData("cropper"),this.rotated&&t.attr("src",this.$original.attr("src")))},replace:function(t,i){var e,h=this,a=this.$element,s=this.element;t&&t!==this.url&&t!==a.attr("src")&&(i||(this.rotated=W,this.replaced=D),a.is("img")?(a.attr("src",t),this.load()):a.is("canvas")&&this.support.canvas&&(e=s.getContext("2d"),l('<img src="'+t+'">').one("load",function(){s.width=this.width,s.height=this.height,e.clearRect(0,0,s.width,s.height),e.drawImage(this,0,0),h.load()})))},setData:function(t,i){var e=this.cropper,h=this.dragger,a=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!=n&&((t===r||l.isEmptyObject(t))&&(h=l.extend({},this.defaultDragger)),l.isPlainObject(t)&&!l.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),L(t.x)&&t.x<=e.width-a.left&&(h.left=t.x+a.left),L(t.y)&&t.y<=e.height-a.top&&(h.top=t.y+a.top),s?L(t.width)&&t.width<=h.maxWidth&&t.width>=h.minWidth?(h.width=t.width,h.height=h.width/s):L(t.height)&&t.height<=h.maxHeight&&t.height>=h.minHeight&&(h.height=t.height,h.width=h.height*s):(L(t.width)&&t.width<=h.maxWidth&&t.width>=h.minWidth&&(h.width=t.width),L(t.height)&&t.height<=h.maxHeight&&t.height>=h.minHeight&&(h.height=t.height))),this.dragger=h,this.renderDragger())},getData:function(t){var i=this.dragger,e=this.image,h={};return this.built&&(h={x:i.left-e.left,y:i.top-e.top,width:i.width,height:i.height},h=this.transformData(h,D,t)),h},transformData:function(t,e,h){var a=this.image.ratio,s={};return l.each(t,function(t,i){i=U(i),g.test(t)&&!isNaN(i)&&(s[t]=e?h?Math.round(i/a):i/a:i*a)}),s},setAspectRatio:function(t){var i="auto"===t;t=U(t),(i||!isNaN(t)&&0<t)&&(this.defaults.aspectRatio=i?NaN:t,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var e={};return this.ready&&l.each(this.image,function(t,i){s.test(t)&&(e[t]=i)}),e},getDataURL:function(t,i,e){var h,a=l("<canvas>")[0],s=this.getData(),r="";return l.isPlainObject(t)||(e=i,i=t,t={}),t=l.extend({width:s.width,height:s.height},t),this.cropped&&this.support.canvas&&(a.width=t.width,a.height=t.height,h=a.getContext("2d"),"image/jpeg"===i&&(h.fillStyle="#fff",h.fillRect(0,0,t.width,t.height)),h.drawImage(this.$clone[0],s.x,s.y,s.width,s.height,0,0,t.width,t.height),r=a.toDataURL(i,e)),r},setDragMode:function(t){var i=this.$canvas,e=this.defaults,h=W,a=W;if(this.built&&!this.disabled){switch(t){case"crop":e.dragCrop&&(h=D,i.data(o,t));break;case"move":a=D,i.data(o,t);break;default:i.removeData(o)}i.toggleClass(f,h).toggleClass("cropper-move",a)}},enable:function(){this.built&&(this.disabled=W,this.$cropper.removeClass(m))},disable:function(){this.built&&(this.disabled=D,this.$cropper.addClass(m))},rotate:function(t){var i=this.image;t=U(t)||0,this.built&&0!==t&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=D,t=i.rotate=(i.rotate+t)%360,this.replace(this.getRotatedDataURL(t),!0))},getRotatedDataURL:function(t){var i=l("<canvas>")[0],e=i.getContext("2d"),h=t*Math.PI/180,a=_(t)%180,s=(90<a?180-a:a)*Math.PI/180,r=this.originalImage,n=r.naturalWidth,o=r.naturalHeight,d=_(n*O(s)+o*P(s)),g=_(n*P(s)+o*O(s));return i.width=d,i.height=g,e.save(),e.translate(d/2,g/2),e.rotate(h),e.drawImage(this.$original[0],-n/2,-o/2,n,o),e.restore(),i.toDataURL()},zoom:function(t){var i,e,h,a=this.image;t=U(t),this.built&&t&&!this.disabled&&this.defaults.zoomable&&(i=a.width*(1+t),e=a.height*(1+t),10<(h=i/a._width)||(h<1&&(i=a._width,e=a._height),h<=1?this.setDragMode("crop"):this.setDragMode("move"),a.oldWidth=a.width,a.oldHeight=a.height,a.width=i,a.height=e,a.ratio=a.width/a.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||(this.$canvas.hasClass(f)?this.setDragMode("move"):this.setDragMode("crop"))},wheel:function(t){var i,e=t.originalEvent;this.disabled||(t.preventDefault(),i=e.deltaY?(i=e.deltaY)%5==0?i/5:i%117.25==0?i/117.25:i/166.66665649414062:e.wheelDelta?-e.wheelDelta/120:e.detail?e.detail/3:0,this.zoom(.1*i))},dragstart:function(t){var i,e,h,a=t.originalEvent.touches,s=t;if(!this.disabled){if(a){if(1<(h=a.length)){if(!this.defaults.zoomable||2!==h)return;s=a[1],this.startX2=s.pageX,this.startY2=s.pageY,i="zoom"}s=a[0]}if(i=i||l(s.target).data(o),d.test(i)){if(t.preventDefault(),e=l.Event(k),this.$element.trigger(e),e.isDefaultPrevented())return;this.directive=i,this.cropping=W,this.startX=s.pageX,this.startY=s.pageY,"crop"===i&&(this.cropping=D,this.$canvas.addClass(p))}}},dragmove:function(t){var i,e,h=t.originalEvent.touches,a=t;if(!this.disabled){if(h){if(1<(e=h.length)){if(!this.defaults.zoomable||2!==e)return;a=h[1],this.endX2=a.pageX,this.endY2=a.pageY}a=h[0]}if(this.directive){if(t.preventDefault(),i=l.Event(R),this.$element.trigger(i),i.isDefaultPrevented())return;this.endX=a.pageX,this.endY=a.pageY,this.dragging()}}},dragend:function(t){var i;if(!this.disabled&&this.directive){if(t.preventDefault(),i=l.Event(z),this.$element.trigger(i),i.isDefaultPrevented())return;this.cropping&&(this.cropping=W,this.$canvas.toggleClass(p,this.cropped&&this.defaults.modal)),this.directive=""}},dragging:function(){var t,i,e,h,a,s,r,n=this.directive,o=this.image,d=this.cropper,g=d.width,l=d.height,p=this.dragger,c=p.width,f=p.height,m=p.left,u=p.top,w=m+c,v=u+f,x=D,b=this.defaults,y=b.aspectRatio,$={x:this.endX-this.startX,y:this.endY-this.startY};switch(y&&($.X=$.y*y,$.Y=$.x/y),n){case"all":m+=$.x,u+=$.y;break;case"e":if(0<=$.x&&(g<=w||y&&(u<=0||l<=v))){x=W;break}c+=$.x,y&&(f=c/y,u-=$.Y/2),c<0&&(n="w",c=0);break;case"n":if($.y<=0&&(u<=0||y&&(m<=0||g<=w))){x=W;break}f-=$.y,u+=$.y,y&&(c=f*y,m+=$.X/2),f<0&&(n="s",f=0);break;case"w":if($.x<=0&&(m<=0||y&&(u<=0||l<=v))){x=W;break}c-=$.x,m+=$.x,y&&(f=c/y,u+=$.Y/2),c<0&&(n="e",c=0);break;case"s":if(0<=$.y&&(l<=v||y&&(m<=0||g<=w))){x=W;break}f+=$.y,y&&(c=f*y,m-=$.X/2),f<0&&(n="n",f=0);break;case"ne":if(y){if($.y<=0&&(u<=0||g<=w)){x=W;break}f-=$.y,u+=$.y,c=f*y}else 0<=$.x?w<g?c+=$.x:$.y<=0&&u<=0&&(x=W):c+=$.x,$.y<=0?0<u&&(f-=$.y,u+=$.y):(f-=$.y,u+=$.y);f<0&&(n="sw",c=f=0);break;case"nw":if(y){if($.y<=0&&(u<=0||m<=0)){x=W;break}f-=$.y,u+=$.y,c=f*y,m+=$.X}else $.x<=0?0<m?(c-=$.x,m+=$.x):$.y<=0&&u<=0&&(x=W):(c-=$.x,m+=$.x),$.y<=0?0<u&&(f-=$.y,u+=$.y):(f-=$.y,u+=$.y);f<0&&(n="se",c=f=0);break;case"sw":if(y){if($.x<=0&&(m<=0||l<=v)){x=W;break}c-=$.x,m+=$.x,f=c/y}else $.x<=0?0<m?(c-=$.x,m+=$.x):0<=$.y&&l<=v&&(x=W):(c-=$.x,m+=$.x),0<=$.y?v<l&&(f+=$.y):f+=$.y;c<0&&(n="ne",c=f=0);break;case"se":if(y){if(0<=$.x&&(g<=w||l<=v)){x=W;break}f=(c+=$.x)/y}else 0<=$.x?w<g?c+=$.x:0<=$.y&&l<=v&&(x=W):c+=$.x,0<=$.y?v<l&&(f+=$.y):f+=$.y;c<0&&(n="nw",c=f=0);break;case"move":o.left+=$.x,o.top+=$.y,this.renderImage("move"),x=W;break;case"zoom":b.zoomable&&(this.zoom((i=o.width,e=o.height,h=_(this.startX-this.startX2),a=_(this.startY-this.startY2),s=_(this.endX-this.endX2),r=_(this.endY-this.endY2),(T(s*s+r*r)-T(h*h+a*a))/T(i*i+e*e))),this.endX2=this.startX2,this.endY2=this.startY2);break;case"crop":$.x&&$.y&&(t=this.$cropper.offset(),m=this.startX-t.left,u=this.startY-t.top,c=p.minWidth,f=p.minHeight,0<$.x?0<$.y?n="se":(n="ne",u-=f):0<$.y?(n="sw",m-=c):(n="nw",m-=c,u-=f),this.cropped||(this.cropped=D,this.$dragger.removeClass(H)))}x&&(p.width=c,p.height=f,p.left=m,p.top=u,this.directive=n,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},M.TEMPLATE=(i=(i="div,span,directive,data,point,cropper,class,line,dashed").split(","),'<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>'.replace(/\d+/g,function(t){return i[t]})),M.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:l.noop,preview:"",multiple:W,autoCrop:D,dragCrop:D,dashed:D,modal:D,movable:D,resizable:D,zoomable:D,rotatable:D,checkImageOrigin:D,minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,build:r,built:r,dragstart:r,dragmove:r,dragend:r},M.setDefaults=function(t){l.extend(M.DEFAULTS,t)},M.other=l.fn.cropper,l.fn.cropper=function(h){var a,s=Y(arguments,1);return this.each(function(){var t,i=l(this),e=i.data("cropper");e||i.data("cropper",e=new M(this,h)),"string"==typeof h&&l.isFunction(t=e[h])&&(a=t.apply(e,s))}),typeof a!=n?a:this},l.fn.cropper.Constructor=M,l.fn.cropper.setDefaults=M.setDefaults,l.fn.cropper.noConflict=function(){return l.fn.cropper=M.other,this}});
|
1 |
+
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)}(function(n){"use strict";function r(t){return"number"==typeof t}function s(t,i){var e=[];return"number"==typeof i&&e.push(i),e.slice.apply(t,e)}function i(t,i){var e=s(arguments,2);return function(){return t.apply(i,e.concat(s(arguments)))}}function o(t,i){this.element=t,this.$element=n(t),this.defaults=n.extend({},o.DEFAULTS,n.isPlainObject(i)?i:{}),this.$original=g,this.ready=D,this.built=D,this.cropped=D,this.rotated=D,this.disabled=D,this.replaced=D,this.init()}var e,h=n(window),a=n(document),d=window.location,$=!0,D=!1,g=null,l="undefined",p="directive",t=".cropper",E=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,_=/^(x|y|width|height)$/,P=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,c="cropper-modal",W="cropper-hidden",f="cropper-invisible",m="cropper-crop",u="cropper-disabled",w="mousedown touchstart",v="mousemove touchmove",x="mouseup mouseleave touchend touchleave touchcancel",b="wheel mousewheel DOMMouseScroll",y="resize"+t,H="dblclick",C="build"+t,k="built"+t,R="dragstart"+t,z="dragmove"+t,L="dragend"+t,Y=Math.sqrt,X=Math.min,M=Math.max,T=Math.abs,O=Math.sin,U=Math.cos,I=parseFloat;o.prototype={constructor:o,support:{canvas:n.isFunction(n("<canvas>")[0].getContext)},init:function(){var e=this.defaults;n.each(e,function(t,i){switch(t){case"aspectRatio":e[t]=T(I(i))||NaN;break;case"autoCropArea":e[t]=T(I(i))||.8;break;case"minWidth":case"minHeight":e[t]=T(I(i))||0;break;case"maxWidth":case"maxHeight":e[t]=T(I(i))||1/0}}),this.image={rotate:0},this.load()},load:function(){var t,i,e=this,h=this.$element,a=this.element,s=this.image,r="";h.is("img")?i=h.prop("src"):h.is("canvas")&&this.support.canvas&&(i=a.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(h.prop("crossOrigin")||this.isCrossOriginURL(i))&&(r=" crossOrigin"),this.$clone=t=n("<img"+r+' src="'+i+'">'),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,e.url=i,e.ready=$,e.build()}),t.addClass(f).prependTo("body"))},isCrossOriginURL:function(t){t=t.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!t||t[1]===d.protocol&&t[2]===d.hostname&&t[3]===d.port?D:$},build:function(){var t,i=this.$element,e=this.defaults;this.ready&&(this.built&&this.unbuild(),i.one(C,e.build),t=n.Event(C),i.trigger(t),t.isDefaultPrevented()||(this.$cropper=t=n(o.TEMPLATE),i.addClass(W),this.$clone.removeClass(f).prependTo(t),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(W).prependTo(this.$cropper),this.originalImage=n.extend({},this.image)),this.$container=i.parent(),this.$container.append(t),this.$canvas=t.find(".cropper-canvas"),this.$dragger=t.find(".cropper-dragger"),this.$viewer=t.find(".cropper-viewer"),e.autoCrop?this.cropped=$:this.$dragger.addClass(W),e.dragCrop&&this.setDragMode("crop"),e.modal&&this.$canvas.addClass(c),e.dashed||this.$dragger.find(".cropper-dashed").addClass(W),e.movable||this.$dragger.find(".cropper-face").data(p,"move"),e.resizable||this.$dragger.find(".cropper-line, .cropper-point").addClass(W),this.addListeners(),this.initPreview(),this.built=$,this.update(),this.replaced=D,i.one(k,e.built),i.trigger(k)))},unbuild:function(){this.built&&(this.built=D,this.removeListeners(),this.$preview.empty(),this.$preview=g,this.$dragger=g,this.$canvas=g,this.$container=g,this.$cropper.remove(),this.$cropper=g)},update:function(t){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),t?(this.setData(t,$),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(n.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,e=this.dragger,h=t.width,a=t.height,s=e.left-t.left,r=e.top-t.top;this.$viewer.find("img").css({width:h,height:a,marginLeft:-s,marginTop:-r}),this.$preview.each(function(){var t=n(this),i=t.width()/e.width;t.find("img").css({width:h*i,height:a*i,marginLeft:-s*i,marginTop:-r*i})})},addListeners:function(){var t=this.defaults;this.$element.on(R,t.dragstart).on(z,t.dragmove).on(L,t.dragend),this.$cropper.on(w,n.proxy(this.dragstart,this)).on(H,n.proxy(this.dblclick,this)),t.zoomable&&this.$cropper.on(b,n.proxy(this.wheel,this)),t.multiple?this.$cropper.on(v,n.proxy(this.dragmove,this)).on(x,n.proxy(this.dragend,this)):a.on(v,this._dragmove=i(this.dragmove,this)).on(x,this._dragend=i(this.dragend,this)),h.on(y,this._resize=i(this.resize,this))},removeListeners:function(){var t=this.defaults;this.$element.off(R,t.dragstart).off(z,t.dragmove).off(L,t.dragend),this.$cropper.off(w,this.dragstart).off(H,this.dblclick),t.zoomable&&this.$cropper.off(b,this.wheel),t.multiple?this.$cropper.off(v,this.dragmove).off(x,this.dragend):a.off(v,this._dragmove).off(x,this._dragend),h.off(y,this._resize)},initPreview:function(){var t='<img src="'+this.url+'">';this.$preview=n(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var t=this.$container;t!==g&&(this.container={width:M(t.width(),300),height:M(t.height(),150)})},initCropper:function(){var t,i=this.container,e=this.image;0<=e.naturalWidth*i.height/e.naturalHeight-i.width?(t={width:i.width,height:i.width/e.aspectRatio,left:0}).top=(i.height-t.height)/2:(t={width:i.height*e.aspectRatio,height:i.height,top:0}).left=(i.width-t.width)/2,this.$cropper&&this.$cropper.css({width:t.width,height:t.height,left:t.left,top:t.top}),this.cropper=t},initImage:function(){var t=this.image,i=this.cropper,e={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=n.extend({},t,e),t._width!==i.width||t._height!==i.height?n.extend(t,e):(t=n.extend({},e,t),this.replaced&&(t.ratio=e.ratio)),this.image=t,this.renderImage()},renderImage:function(t){var i=this.image;"zoom"===t&&(i.left-=(i.width-i.oldWidth)/2,i.top-=(i.height-i.oldHeight)/2),i.left=X(M(i.left,i._width-i.width),0),i.top=X(M(i.top,i._height-i.height),0),this.$clone.css({width:i.width,height:i.height,marginLeft:i.left,marginTop:i.top}),t&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t=this.defaults,i=this.cropper,e=t.aspectRatio||this.image.aspectRatio,h=this.image.ratio,a=0<=i.height*e-i.width?{height:i.width/e,width:i.width,left:0,top:(i.height-i.width/e)/2,maxWidth:i.width,maxHeight:i.width/e}:{height:i.height,width:i.height*e,left:(i.width-i.height*e)/2,top:0,maxWidth:i.height*e,maxHeight:i.height};a.minWidth=0,a.minHeight=0,t.aspectRatio?(isFinite(t.maxWidth)?(a.maxWidth=X(a.maxWidth,t.maxWidth*h),a.maxHeight=a.maxWidth/e):isFinite(t.maxHeight)&&(a.maxHeight=X(a.maxHeight,t.maxHeight*h),a.maxWidth=a.maxHeight*e),0<t.minWidth?(a.minWidth=M(0,t.minWidth*h),a.minHeight=a.minWidth/e):0<t.minHeight&&(a.minHeight=M(0,t.minHeight*h),a.minWidth=a.minHeight*e)):(a.maxWidth=X(a.maxWidth,t.maxWidth*h),a.maxHeight=X(a.maxHeight,t.maxHeight*h),a.minWidth=M(0,t.minWidth*h),a.minHeight=M(0,t.minHeight*h)),a.minWidth=X(a.maxWidth,a.minWidth),a.minHeight=X(a.maxHeight,a.minHeight),a.height*=t.autoCropArea,a.width*=t.autoCropArea,a.left=(i.width-a.width)/2,a.top=(i.height-a.height)/2,a.oldLeft=a.left,a.oldTop=a.top,this.defaultDragger=a,this.dragger=n.extend({},a)},renderDragger:function(){var t=this.dragger,i=this.cropper;t.width>t.maxWidth?(t.width=t.maxWidth,t.left=t.oldLeft):t.width<t.minWidth&&(t.width=t.minWidth,t.left=t.oldLeft),t.height>t.maxHeight?(t.height=t.maxHeight,t.top=t.oldTop):t.height<t.minHeight&&(t.height=t.minHeight,t.top=t.oldTop),t.left=X(M(t.left,0),i.width-t.width),t.top=X(M(t.top,0),i.height-t.height),t.oldLeft=t.left,t.oldTop=t.top,this.dragger=t,this.disabled||this.defaults.done(this.getData()),this.$dragger.css({width:t.width,height:t.height,left:t.left,top:t.top}),this.preview()},reset:function(t){this.cropped&&(t&&(this.defaults.data={}),this.image=n.extend({},this.defaultImage),this.renderImage(),this.dragger=n.extend({},this.defaultDragger),this.setData(this.defaults.data))},clear:function(){this.cropped&&(this.cropped=D,this.setData({x:0,y:0,width:0,height:0}),this.$canvas.removeClass(c),this.$dragger.addClass(W))},destroy:function(){var t=this.$element;this.ready&&(this.unbuild(),t.removeClass(W).removeData("cropper"),this.rotated&&t.attr("src",this.$original.attr("src")))},replace:function(t,i){var e,h=this,a=this.$element,s=this.element;t&&t!==this.url&&t!==a.attr("src")&&(i||(this.rotated=D,this.replaced=$),a.is("img")?(a.attr("src",t),this.load()):a.is("canvas")&&this.support.canvas&&(e=s.getContext("2d"),n('<img src="'+t+'">').one("load",function(){s.width=this.width,s.height=this.height,e.clearRect(0,0,s.width,s.height),e.drawImage(this,0,0),h.load()})))},setData:function(t,i){var e=this.cropper,h=this.dragger,a=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!=l&&(t!==g&&!n.isEmptyObject(t)||(h=n.extend({},this.defaultDragger)),n.isPlainObject(t)&&!n.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),r(t.x)&&t.x<=e.width-a.left&&(h.left=t.x+a.left),r(t.y)&&t.y<=e.height-a.top&&(h.top=t.y+a.top),s?r(t.width)&&t.width<=h.maxWidth&&t.width>=h.minWidth?(h.width=t.width,h.height=h.width/s):r(t.height)&&t.height<=h.maxHeight&&t.height>=h.minHeight&&(h.height=t.height,h.width=h.height*s):(r(t.width)&&t.width<=h.maxWidth&&t.width>=h.minWidth&&(h.width=t.width),r(t.height)&&t.height<=h.maxHeight&&t.height>=h.minHeight&&(h.height=t.height))),this.dragger=h,this.renderDragger())},getData:function(t){var i=this.dragger,e=this.image,h={};return this.built&&(h={x:i.left-e.left,y:i.top-e.top,width:i.width,height:i.height},h=this.transformData(h,$,t)),h},transformData:function(t,e,h){var a=this.image.ratio,s={};return n.each(t,function(t,i){i=I(i),_.test(t)&&!isNaN(i)&&(s[t]=e?h?Math.round(i/a):i/a:i*a)}),s},setAspectRatio:function(t){var i="auto"===t;t=I(t),(i||!isNaN(t)&&0<t)&&(this.defaults.aspectRatio=i?NaN:t,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var e={};return this.ready&&n.each(this.image,function(t,i){P.test(t)&&(e[t]=i)}),e},getDataURL:function(t,i,e){var h,a=n("<canvas>")[0],s=this.getData(),r="";return n.isPlainObject(t)||(e=i,i=t,t={}),t=n.extend({width:s.width,height:s.height},t),this.cropped&&this.support.canvas&&(a.width=t.width,a.height=t.height,h=a.getContext("2d"),"image/jpeg"===i&&(h.fillStyle="#fff",h.fillRect(0,0,t.width,t.height)),h.drawImage(this.$clone[0],s.x,s.y,s.width,s.height,0,0,t.width,t.height),r=a.toDataURL(i,e)),r},setDragMode:function(t){var i=this.$canvas,e=this.defaults,h=D,a=D;if(this.built&&!this.disabled){switch(t){case"crop":e.dragCrop&&(h=$,i.data(p,t));break;case"move":a=$,i.data(p,t);break;default:i.removeData(p)}i.toggleClass(m,h).toggleClass("cropper-move",a)}},enable:function(){this.built&&(this.disabled=D,this.$cropper.removeClass(u))},disable:function(){this.built&&(this.disabled=$,this.$cropper.addClass(u))},rotate:function(t){var i=this.image;t=I(t)||0,this.built&&0!==t&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=$,t=i.rotate=(i.rotate+t)%360,this.replace(this.getRotatedDataURL(t),!0))},getRotatedDataURL:function(t){var i=n("<canvas>")[0],e=i.getContext("2d"),h=t*Math.PI/180,t=T(t)%180,t=(90<t?180-t:t)*Math.PI/180,a=this.originalImage,s=a.naturalWidth,a=a.naturalHeight,r=T(s*U(t)+a*O(t)),t=T(s*O(t)+a*U(t));return i.width=r,i.height=t,e.save(),e.translate(r/2,t/2),e.rotate(h),e.drawImage(this.$original[0],-s/2,-a/2,s,a),e.restore(),i.toDataURL()},zoom:function(t){var i,e,h=this.image;t=I(t),this.built&&t&&!this.disabled&&this.defaults.zoomable&&(i=h.width*(1+t),t=h.height*(1+t),10<(e=i/h._width)||(e<1&&(i=h._width,t=h._height),e<=1?this.setDragMode("crop"):this.setDragMode("move"),h.oldWidth=h.width,h.oldHeight=h.height,h.width=i,h.height=t,h.ratio=h.width/h.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||(this.$canvas.hasClass(m)?this.setDragMode("move"):this.setDragMode("crop"))},wheel:function(t){var i,e=t.originalEvent;this.disabled||(t.preventDefault(),i=e.deltaY?(i=e.deltaY)%5==0?i/5:i%117.25==0?i/117.25:i/166.66665649414062:e.wheelDelta?-e.wheelDelta/120:e.detail?e.detail/3:0,this.zoom(.1*i))},dragstart:function(t){var i,e,h=t.originalEvent.touches,a=t;if(!this.disabled){if(h){if(1<(e=h.length)){if(!this.defaults.zoomable||2!==e)return;a=h[1],this.startX2=a.pageX,this.startY2=a.pageY,i="zoom"}a=h[0]}i=i||n(a.target).data(p),E.test(i)&&(t.preventDefault(),e=n.Event(R),this.$element.trigger(e),e.isDefaultPrevented()||(this.directive=i,this.cropping=D,this.startX=a.pageX,this.startY=a.pageY,"crop"===i&&(this.cropping=$,this.$canvas.addClass(c))))}},dragmove:function(t){var i,e=t.originalEvent.touches,h=t;if(!this.disabled){if(e){if(1<(i=e.length)){if(!this.defaults.zoomable||2!==i)return;h=e[1],this.endX2=h.pageX,this.endY2=h.pageY}h=e[0]}this.directive&&(t.preventDefault(),i=n.Event(z),this.$element.trigger(i),i.isDefaultPrevented()||(this.endX=h.pageX,this.endY=h.pageY,this.dragging()))}},dragend:function(t){this.disabled||this.directive&&(t.preventDefault(),t=n.Event(L),this.$element.trigger(t),t.isDefaultPrevented()||(this.cropping&&(this.cropping=D,this.$canvas.toggleClass(c,this.cropped&&this.defaults.modal)),this.directive=""))},dragging:function(){var t,i,e,h,a,s,r=this.directive,n=this.image,o=this.cropper,d=o.width,g=o.height,l=this.dragger,p=l.width,c=l.height,f=l.left,m=l.top,u=f+p,w=m+c,v=$,x=this.defaults,b=x.aspectRatio,y={x:this.endX-this.startX,y:this.endY-this.startY};switch(b&&(y.X=y.y*b,y.Y=y.x/b),r){case"all":f+=y.x,m+=y.y;break;case"e":if(0<=y.x&&(d<=u||b&&(m<=0||g<=w))){v=D;break}p+=y.x,b&&(c=p/b,m-=y.Y/2),p<0&&(r="w",p=0);break;case"n":if(y.y<=0&&(m<=0||b&&(f<=0||d<=u))){v=D;break}c-=y.y,m+=y.y,b&&(p=c*b,f+=y.X/2),c<0&&(r="s",c=0);break;case"w":if(y.x<=0&&(f<=0||b&&(m<=0||g<=w))){v=D;break}p-=y.x,f+=y.x,b&&(c=p/b,m+=y.Y/2),p<0&&(r="e",p=0);break;case"s":if(0<=y.y&&(g<=w||b&&(f<=0||d<=u))){v=D;break}c+=y.y,b&&(p=c*b,f-=y.X/2),c<0&&(r="n",c=0);break;case"ne":if(b){if(y.y<=0&&(m<=0||d<=u)){v=D;break}c-=y.y,m+=y.y,p=c*b}else!(0<=y.x)||u<d?p+=y.x:y.y<=0&&m<=0&&(v=D),(!(y.y<=0)||0<m)&&(c-=y.y,m+=y.y);c<0&&(r="sw",p=c=0);break;case"nw":if(b){if(y.y<=0&&(m<=0||f<=0)){v=D;break}c-=y.y,m+=y.y,p=c*b,f+=y.X}else!(y.x<=0)||0<f?(p-=y.x,f+=y.x):y.y<=0&&m<=0&&(v=D),(!(y.y<=0)||0<m)&&(c-=y.y,m+=y.y);c<0&&(r="se",p=c=0);break;case"sw":if(b){if(y.x<=0&&(f<=0||g<=w)){v=D;break}p-=y.x,f+=y.x,c=p/b}else!(y.x<=0)||0<f?(p-=y.x,f+=y.x):0<=y.y&&g<=w&&(v=D),(!(0<=y.y)||w<g)&&(c+=y.y);p<0&&(r="ne",p=c=0);break;case"se":if(b){if(0<=y.x&&(d<=u||g<=w)){v=D;break}c=(p+=y.x)/b}else!(0<=y.x)||u<d?p+=y.x:0<=y.y&&g<=w&&(v=D),(!(0<=y.y)||w<g)&&(c+=y.y);p<0&&(r="nw",p=c=0);break;case"move":n.left+=y.x,n.top+=y.y,this.renderImage("move"),v=D;break;case"zoom":x.zoomable&&(this.zoom((t=n.width,i=n.height,e=T(this.startX-this.startX2),h=T(this.startY-this.startY2),a=T(this.endX-this.endX2),s=T(this.endY-this.endY2),(Y(a*a+s*s)-Y(e*e+h*h))/Y(t*t+i*i))),this.endX2=this.startX2,this.endY2=this.startY2);break;case"crop":y.x&&y.y&&(a=this.$cropper.offset(),f=this.startX-a.left,m=this.startY-a.top,p=l.minWidth,c=l.minHeight,0<y.x?0<y.y?r="se":(r="ne",m-=c):0<y.y?(r="sw",f-=p):(r="nw",f-=p,m-=c),this.cropped||(this.cropped=$,this.$dragger.removeClass(W)))}v&&(l.width=p,l.height=c,l.left=f,l.top=m,this.directive=r,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},o.TEMPLATE=(e="div,span,directive,data,point,cropper,class,line,dashed".split(","),'<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>'.replace(/\d+/g,function(t){return e[t]})),o.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:n.noop,preview:"",multiple:D,autoCrop:$,dragCrop:$,dashed:$,modal:$,movable:$,resizable:$,zoomable:$,rotatable:$,checkImageOrigin:$,minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,build:g,built:g,dragstart:g,dragmove:g,dragend:g},o.setDefaults=function(t){n.extend(o.DEFAULTS,t)},o.other=n.fn.cropper,n.fn.cropper=function(e){var h,a=s(arguments,1);return this.each(function(){var t=n(this),i=t.data("cropper");i||t.data("cropper",i=new o(this,e)),"string"==typeof e&&n.isFunction(t=i[e])&&(h=t.apply(i,a))}),typeof h!=l?h:this},n.fn.cropper.Constructor=o,n.fn.cropper.setDefaults=o.setDefaults,n.fn.cropper.noConflict=function(){return n.fn.cropper=o.other,this}});
|
assets/js/um-functions.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function UM_hide_menus(){UM.dropdown.hideAll()}function UM_domenus(){jQuery(".um-dropdown").each(function(e,t){UM.dropdown.setPosition(t)})}function UM_check_password_matched(){jQuery(document).on("keyup","input[data-key=user_password],input[data-key=confirm_user_password]",function(e){var t=jQuery("input[data-key=user_password]").val(),a=jQuery("input[data-key=confirm_user_password]").val(),o=jQuery("input[data-key=user_password],input[data-key=confirm_user_password]");t||a?t!==a?o.removeClass("um-validate-matched").addClass("um-validate-not-matched"):o.removeClass("um-validate-not-matched").addClass("um-validate-matched"):o.removeClass("um-validate-matched").removeClass("um-validate-not-matched")})}function um_responsive(){jQuery(".um").each(function(){element_width=jQuery(this).width(),element_width<=340?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob340")):element_width<=500?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob500")):element_width<=800?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob800")):element_width<=960?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob960")):960<element_width&&(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960")),0<jQuery(".um-account-nav").length&&jQuery(".um-account-side").is(":visible")&&0==jQuery(".um-account-tab:visible").length&&jQuery(".um-account-side li a.current").trigger("click"),jQuery(this).css("opacity",1)}),jQuery(".um-cover, .um-member-cover, .um-cover-e").each(function(){var e=jQuery(this),t=e.data("ratio"),a=e.width(),o=t.split(":");calcHeight=Math.round(a/o[0])+"px",e.height(calcHeight),e.find(".um-cover-add").height(calcHeight)}),UM_domenus()}function initImageUpload_UM(r){r.data("upload_help_text")?upload_help_text='<span class="help">'+r.data("upload_help_text")+"</span>":upload_help_text="",r.data("icon")?icon='<span class="icon"><i class="'+r.data("icon")+'"></i></span>':icon="",r.data("upload_text")?upload_text='<span class="str">'+r.data("upload_text")+"</span>":upload_text="";var e=0;jQuery("#um_upload_single:visible").data("user_id")&&(e=jQuery("#um_upload_single:visible").data("user_id")),r.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_imageupload",key:r.data("key"),set_id:r.data("set_id"),set_mode:r.data("set_mode"),_wpnonce:r.data("nonce"),timestamp:r.data("timestamp"),user_id:e},fileName:r.data("key"),allowedTypes:r.data("allowed_types"),maxFileSize:r.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:r.data("max_size_error"),extErrorStr:r.data("extension_error"),maxFileCountErrorStr:r.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,returnType:"json",onSubmit:function(e){r.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,t,a){r.selectedFiles=0,t.success&&0==t.success||void 0!==t.data.error?(r.parents(".um-modal-body").append('<div class="um-error-block">'+t.data.error+"</div>"),r.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(t.data,function(e,t){var a=r.parents(".um-modal-body").find(".um-single-image-preview img"),o=r.parents(".um-modal-body").find(".um-single-image-preview"),i=new Date;a.attr("src",t.url+"?"+i.getTime()),a.data("file",t.file),a.on("load",function(){r.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),r.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),o.show(0),um_modal_responsive()})})},onError:function(e){console.log(e)}})}function initFileUpload_UM(o){o.data("upload_help_text")?upload_help_text='<span class="help">'+o.data("upload_help_text")+"</span>":upload_help_text="",o.data("icon")?icon='<span class="icon"><i class="'+o.data("icon")+'"></i></span>':icon="",o.data("upload_text")?upload_text='<span class="str">'+o.data("upload_text")+"</span>":upload_text="",jQuery("#um_upload_single:visible").data("user_id")&&(user_id=jQuery("#um_upload_single:visible").data("user_id")),o.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_fileupload",key:o.data("key"),set_id:o.data("set_id"),user_id:o.data("user_id"),set_mode:o.data("set_mode"),_wpnonce:o.data("nonce"),timestamp:o.data("timestamp")},fileName:o.data("key"),allowedTypes:o.data("allowed_types"),maxFileSize:o.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:o.data("max_size_error"),extErrorStr:o.data("extension_error"),maxFileCountErrorStr:o.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(e){o.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,t,a){o.selectedFiles=0,t.success&&0==t.success||void 0!==t.data.error?(o.parents(".um-modal-body").append('<div class="um-error-block">'+t.data.error+"</div>"),o.parents(".um-modal-body").find(".upload-statusbar").hide(0)):jQuery.each(t.data,function(e,t){o.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),o.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),o.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==e?o.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(t):"icon_bg"==e?o.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":t}):"filename"==e?o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-file",t):"original_name"==e?(o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-orignal-name",t),o.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(t)):"url"==e&&o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",t)}),setTimeout(function(){um_modal_responsive()},1e3)},onError:function(e){console.log(e)}})}function initCrop_UM(){var t=jQuery(".um-modal .um-single-image-preview img").first(),e=jQuery(".um-modal .um-single-image-preview"),a=t.parent().attr("data-crop"),o=t.parent().attr("data-min_width"),i=t.parent().attr("data-min_height"),r=t.parent().attr("data-ratio");if(jQuery(".um-modal").find("#um_upload_single").attr("data-ratio"))r=(r=jQuery(".um-modal").find("#um_upload_single").attr("data-ratio")).split(":")[0];if(t.length&&""!=t.attr("src")){var d=jQuery(window).height()-(jQuery(".um-modal-footer a").height()+20)-50-jQuery(".um-modal-header:visible").height();if(t.css({height:"auto"}),e.css({height:"auto"}),jQuery(window).height()<=400?(e.css({height:d+"px","max-height":d+"px"}),t.css({height:"auto"})):(t.css({height:"auto","max-height":d+"px"}),e.css({height:t.height(),"max-height":d+"px"})),"square"==a)var u={minWidth:o,minHeight:i,dragCrop:!1,aspectRatio:1,zoomable:!1,rotatable:!1,dashed:!1,done:function(e){t.parent().attr("data-coord",Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height))}};else if("cover"==a){0<Math.round(o/r)&&(i=Math.round(o/r));u={minWidth:o,minHeight:i,dragCrop:!1,aspectRatio:r,zoomable:!1,rotatable:!1,dashed:!1,done:function(e){t.parent().attr("data-coord",Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height))}}}else if("user"==a)u={minWidth:o,minHeight:i,dragCrop:!0,aspectRatio:"auto",zoomable:!1,rotatable:!1,dashed:!1,done:function(e){t.parent().attr("data-coord",Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height))}};0!=a&&(t.cropper(u),jQuery(".um-single-image-preview img.cropper-hidden").cropper("destroy"),jQuery(".um-single-image-preview img.lazyloaded").addClass("cropper-hidden"),jQuery(".um-single-image-preview img.lazyloaded").removeClass("lazyloaded"),jQuery(".um-single-image-preview .cropper-container").append('<div class="um-clear"></div>'))}}function um_new_modal(e,t,a,o){var i=jQuery(".um-modal-overlay");0!==i.length&&(i.hide(),i.next(".um-modal").hide()),jQuery(".tipsy").hide(),UM.dropdown.hideAll(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()});var r=jQuery('<div class="um-modal-overlay"></div><div class="um-modal"></div>'),d=r.filter(".um-modal");if(d.append(jQuery("#"+e)),jQuery("body").append(r),a){var u=jQuery('<img src="'+o+'" />'),s=jQuery(window).width()-60,n=jQuery(window).height()-.25*jQuery(window).height();u.on("load",function(){d.find(".um-modal-photo").html(u),d.addClass("is-photo").css({width:u.width(),"margin-left":"-"+u.width()/2+"px"}).show().children().show(),u.css({opacity:0,"max-width":s,"max-height":n}).animate({opacity:1},1e3),um_modal_responsive()})}else d.addClass("no-photo").show().children().show(),um_modal_size(t),initImageUpload_UM(jQuery(".um-modal:visible .um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible .um-single-file-upload")),um_modal_responsive()}function um_modal_responsive(){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,a=jQuery(".um-modal:visible").not(".um-modal-hidden");if(a.find(".um-modal-body.photo:visible").length){a.removeClass("uimob340"),a.removeClass("uimob500");var o=jQuery(".um-modal-photo img"),i=e-60,r=t-.25*t;o.css({opacity:0}),o.css({"max-width":i}),o.css({"max-height":r}),a.css({width:o.width(),"margin-left":"-"+o.width()/2+"px"}),o.animate({opacity:1},1e3);var d=(t-a.innerHeight())/2+"px";a.animate({bottom:d},300)}else if(a.length)if(a.removeClass("uimob340"),a.removeClass("uimob500"),e<=340)a.addClass("uimob340"),initCrop_UM(),a.animate({bottom:0},300);else if(e<=500)a.addClass("uimob500"),initCrop_UM(),a.animate({bottom:0},300);else if(e<=800){initCrop_UM();d=(t-a.innerHeight())/2+"px";a.animate({bottom:d},300)}else if(e<=960){initCrop_UM();d=(t-a.innerHeight())/2+"px";a.animate({bottom:d},300)}else if(960<e){initCrop_UM();d=(t-a.innerHeight())/2+"px";a.animate({bottom:d},300)}}function um_remove_modal(){jQuery("img.cropper-hidden").cropper("destroy"),jQuery("body,html,textarea").css("overflow","auto"),jQuery(document).unbind("touchmove"),jQuery('body > .um-modal div[id^="um_"]').hide().appendTo("body"),jQuery("body > .um-modal, body > .um-modal-overlay").remove()}function um_modal_size(e){jQuery(".um-modal:visible").not(".um-modal-hidden").addClass(e)}function um_modal_add_attr(e,t){jQuery(".um-modal:visible").not(".um-modal-hidden").data(e,t)}function prepare_Modal(){0==jQuery(".um-popup-overlay").length&&(jQuery("body").append('<div class="um-popup-overlay"></div>'),jQuery("body").append('<div class="um-popup"></div>'),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(wp.hooks.doAction("um_before_modal_removed",jQuery(".um-popup")),jQuery(".tipsy").remove(),jQuery(".um-popup").empty().remove(),jQuery(".um-popup-overlay").empty().remove(),jQuery("body,html").css({overflow:"auto"}))}function show_Modal(e){jQuery(".um-popup-overlay").length&&(jQuery(".um-popup").removeClass("loading").html(e),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,offset:3}))}function responsive_Modal(){jQuery(".um-popup-overlay").length&&(ag_height=jQuery(window).height()-jQuery(".um-popup .um-popup-header").outerHeight()-jQuery(".um-popup .um-popup-footer").outerHeight()-80,350<ag_height&&(ag_height=350),jQuery(".um-popup-autogrow:visible").length?jQuery(".um-popup-autogrow:visible").css({height:ag_height+"px"}):jQuery(".um-popup-autogrow2:visible").length&&jQuery(".um-popup-autogrow2:visible").css({"max-height":ag_height+"px"}))}function um_reset_field(e){jQuery(e).find("div.um-field-area").find("input,textarea,select").not(":button, :submit, :reset, :hidden").val("").prop("checked",!1).prop("selected",!1)}function um_selected(e,t){if(e==t)return"selected='selected'"}"object"!=typeof window.UM&&(window.UM={}),UM.dropdown={hide:function(e){var t=jQuery(e);t.parents("div").find("a").removeClass("active"),t.hide()},hideAll:function(){var e=jQuery(".um-dropdown");e.parents("div").find("a").removeClass("active"),e.hide()},setPosition:function(e){var t=jQuery(e),a=200,o=jQuery("html").attr("dir"),i=t.attr("data-element"),r=t.attr("data-position"),d=t.attr("data-trigger"),u=i&&jQuery(i).length?jQuery(i):t.siblings("a").length?t.siblings("a").first():t.parent();u.addClass("um-trigger-menu-on-"+d);var s=0,n=(u.outerWidth()-a)/2,l=u.outerHeight(),m=u.offset();if(u.is(".um-profile-photo")){var p=u.find(".um-profile-photo-img");l=u.closest("div.uimob500").length?u.outerHeight()-p.outerHeight()/4:(n=(p.outerWidth()-a)/2,p.outerHeight()/4)}if(u.is(".um-cover")){p=u.find(".um-cover-e");l=u.closest("div.uimob500").length?(n=(p.outerWidth()-a)/2,p.outerHeight()/2+24):(n=(p.outerWidth()-a)/2,p.outerHeight()/2+46)}switch("lc"===r&&"rtl"===o&&(r="rc"),u.outerWidth()<a&&("rtl"===o&&m.left<100?r="rc":"rtl"!==o&&window.innerWidth-m.left-u.outerWidth()<100&&(r="lc")),r){case"lc":s=u.width()+17,t.css({top:0,width:a,left:"auto",right:s+"px","text-align":"center"}),t.find(".um-dropdown-arr").css({top:"4px",left:"auto",right:"-17px"}).find("i").removeClass().addClass("um-icon-arrow-right-b");break;case"rc":s=u.width()+25,t.css({top:0,width:a,left:s+"px",right:"auto","text-align":"center"}),t.find(".um-dropdown-arr").css({top:"4px",left:"-17px",right:"auto"}).find("i").removeClass().addClass("um-icon-arrow-left-b");break;case"bc":default:var h=t.data("top-offset");void 0!==h&&(l+=h),t.css({top:l+6,width:a,left:n,right:"auto","text-align":"center"}),t.find(".um-dropdown-arr").css({top:"-17px",left:t.width()/2-12,right:"auto"}).find("i").removeClass().addClass("um-icon-arrow-up-b")}},show:function(e){var t=jQuery(e);UM.dropdown.hideAll(),UM.dropdown.setPosition(t),t.show()}},jQuery(function(){jQuery(".um-search form *").on("keypress",function(e){if(13==e.which)return jQuery(".um-search form").trigger("submit"),!1}),2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()});
|
1 |
+
function UM_hide_menus(){UM.dropdown.hideAll()}function UM_domenus(){jQuery(".um-dropdown").each(function(e,t){UM.dropdown.setPosition(t)})}function UM_check_password_matched(){jQuery(document).on("keyup","input[data-key=user_password],input[data-key=confirm_user_password]",function(e){var t=jQuery("input[data-key=user_password]").val(),a=jQuery("input[data-key=confirm_user_password]").val(),o=jQuery("input[data-key=user_password],input[data-key=confirm_user_password]");t||a?t!==a?o.removeClass("um-validate-matched").addClass("um-validate-not-matched"):o.removeClass("um-validate-not-matched").addClass("um-validate-matched"):o.removeClass("um-validate-matched").removeClass("um-validate-not-matched")})}function um_responsive(){jQuery(".um").each(function(){(element_width=jQuery(this).width())<=340?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob340")):element_width<=500?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob500")):element_width<=800?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob800")):element_width<=960?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob960")):960<element_width&&(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960")),0<jQuery(".um-account-nav").length&&jQuery(".um-account-side").is(":visible")&&0==jQuery(".um-account-tab:visible").length&&jQuery(".um-account-side li a.current").trigger("click"),jQuery(this).css("opacity",1)}),jQuery(".um-cover, .um-member-cover, .um-cover-e").each(function(){var e=jQuery(this),t=e.data("ratio"),a=e.width(),t=t.split(":");calcHeight=Math.round(a/t[0])+"px",e.height(calcHeight),e.find(".um-cover-add").height(calcHeight)}),UM_domenus()}function initImageUpload_UM(r){upload_help_text=r.data("upload_help_text")?'<span class="help">'+r.data("upload_help_text")+"</span>":"",icon=r.data("icon")?'<span class="icon"><i class="'+r.data("icon")+'"></i></span>':"",upload_text=r.data("upload_text")?'<span class="str">'+r.data("upload_text")+"</span>":"";var e=0;jQuery("#um_upload_single:visible").data("user_id")&&(e=jQuery("#um_upload_single:visible").data("user_id")),r.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_imageupload",key:r.data("key"),set_id:r.data("set_id"),set_mode:r.data("set_mode"),_wpnonce:r.data("nonce"),timestamp:r.data("timestamp"),user_id:e},fileName:r.data("key"),allowedTypes:r.data("allowed_types"),maxFileSize:r.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:r.data("max_size_error"),extErrorStr:r.data("extension_error"),maxFileCountErrorStr:r.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,returnType:"json",onSubmit:function(e){r.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,t,a){r.selectedFiles=0,t.success&&0==t.success||void 0!==t.data.error?(r.parents(".um-modal-body").append('<div class="um-error-block">'+t.data.error+"</div>"),r.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(t.data,function(e,t){var a=r.parents(".um-modal-body").find(".um-single-image-preview img"),o=r.parents(".um-modal-body").find(".um-single-image-preview"),i=new Date;a.attr("src",t.url+"?"+i.getTime()),a.data("file",t.file),a.on("load",function(){r.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),r.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),o.show(0),um_modal_responsive()})})},onError:function(e){console.log(e)}})}function initFileUpload_UM(o){upload_help_text=o.data("upload_help_text")?'<span class="help">'+o.data("upload_help_text")+"</span>":"",icon=o.data("icon")?'<span class="icon"><i class="'+o.data("icon")+'"></i></span>':"",upload_text=o.data("upload_text")?'<span class="str">'+o.data("upload_text")+"</span>":"",jQuery("#um_upload_single:visible").data("user_id")&&(user_id=jQuery("#um_upload_single:visible").data("user_id")),o.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_fileupload",key:o.data("key"),set_id:o.data("set_id"),user_id:o.data("user_id"),set_mode:o.data("set_mode"),_wpnonce:o.data("nonce"),timestamp:o.data("timestamp")},fileName:o.data("key"),allowedTypes:o.data("allowed_types"),maxFileSize:o.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:o.data("max_size_error"),extErrorStr:o.data("extension_error"),maxFileCountErrorStr:o.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(e){o.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,t,a){o.selectedFiles=0,t.success&&0==t.success||void 0!==t.data.error?(o.parents(".um-modal-body").append('<div class="um-error-block">'+t.data.error+"</div>"),o.parents(".um-modal-body").find(".upload-statusbar").hide(0)):jQuery.each(t.data,function(e,t){o.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),o.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),o.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==e?o.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(t):"icon_bg"==e?o.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":t}):"filename"==e?o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-file",t):"original_name"==e?(o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-orignal-name",t),o.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(t)):"url"==e&&o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",t)}),setTimeout(function(){um_modal_responsive()},1e3)},onError:function(e){console.log(e)}})}function initCrop_UM(){var e,t,a=jQuery(".um-modal .um-single-image-preview img").first(),o=jQuery(".um-modal .um-single-image-preview"),i=a.parent().attr("data-crop"),r=a.parent().attr("data-min_width"),d=a.parent().attr("data-min_height"),u=a.parent().attr("data-ratio");jQuery(".um-modal").find("#um_upload_single").attr("data-ratio")&&(u=(u=jQuery(".um-modal").find("#um_upload_single").attr("data-ratio")).split(":")[0]),a.length&&""!=a.attr("src")&&(e=jQuery(window).height()-(jQuery(".um-modal-footer a").height()+20)-50-jQuery(".um-modal-header:visible").height(),a.css({height:"auto"}),o.css({height:"auto"}),jQuery(window).height()<=400?(o.css({height:e+"px","max-height":e+"px"}),a.css({height:"auto"})):(a.css({height:"auto","max-height":e+"px"}),o.css({height:a.height(),"max-height":e+"px"})),"square"==i?t={minWidth:r,minHeight:d,dragCrop:!1,aspectRatio:1,zoomable:!1,rotatable:!1,dashed:!1,done:function(e){a.parent().attr("data-coord",Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height))}}:"cover"==i?t={minWidth:r,minHeight:d=0<Math.round(r/u)?Math.round(r/u):d,dragCrop:!1,aspectRatio:u,zoomable:!1,rotatable:!1,dashed:!1,done:function(e){a.parent().attr("data-coord",Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height))}}:"user"==i&&(t={minWidth:r,minHeight:d,dragCrop:!0,aspectRatio:"auto",zoomable:!1,rotatable:!1,dashed:!1,done:function(e){a.parent().attr("data-coord",Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height))}}),0!=i&&(a.cropper(t),jQuery(".um-single-image-preview img.cropper-hidden").cropper("destroy"),jQuery(".um-single-image-preview img.lazyloaded").addClass("cropper-hidden"),jQuery(".um-single-image-preview img.lazyloaded").removeClass("lazyloaded"),jQuery(".um-single-image-preview .cropper-container").append('<div class="um-clear"></div>')))}function um_new_modal(e,t,a,o){var i,r,d,u=jQuery(".um-modal-overlay"),u=(0!==u.length&&(u.hide(),u.next(".um-modal").hide()),jQuery(".tipsy").hide(),UM.dropdown.hideAll(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()}),jQuery('<div class="um-modal-overlay"></div><div class="um-modal"></div>')),s=u.filter(".um-modal");s.append(jQuery("#"+e)),jQuery("body").append(u),a?(i=jQuery('<img src="'+o+'" />'),r=jQuery(window).width()-60,d=jQuery(window).height()-.25*jQuery(window).height(),i.on("load",function(){s.find(".um-modal-photo").html(i),s.addClass("is-photo").css({width:i.width(),"margin-left":"-"+i.width()/2+"px"}).show().children().show(),i.css({opacity:0,"max-width":r,"max-height":d}).animate({opacity:1},1e3),um_modal_responsive()})):(s.addClass("no-photo").show().children().show(),um_modal_size(t),initImageUpload_UM(jQuery(".um-modal:visible .um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible .um-single-file-upload")),um_modal_responsive())}function um_modal_responsive(){var e,t,a,o=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,r=jQuery(".um-modal:visible").not(".um-modal-hidden");r.find(".um-modal-body.photo:visible").length?(r.removeClass("uimob340"),r.removeClass("uimob500"),a=o-60,t=i-.25*i,(e=jQuery(".um-modal-photo img")).css({opacity:0}),e.css({"max-width":a}),e.css({"max-height":t}),r.css({width:e.width(),"margin-left":"-"+e.width()/2+"px"}),e.animate({opacity:1},1e3),a=(i-r.innerHeight())/2+"px",r.animate({bottom:a},300)):r.length&&(r.removeClass("uimob340"),r.removeClass("uimob500"),o<=340?(r.addClass("uimob340"),initCrop_UM(),r.animate({bottom:0},300)):o<=500?(r.addClass("uimob500"),initCrop_UM(),r.animate({bottom:0},300)):(o<=800||o<=960||960<o)&&(initCrop_UM(),a=(i-r.innerHeight())/2+"px",r.animate({bottom:a},300)))}function um_remove_modal(){jQuery("img.cropper-hidden").cropper("destroy"),jQuery("body,html,textarea").css("overflow","auto"),jQuery(document).unbind("touchmove"),jQuery('body > .um-modal div[id^="um_"]').hide().appendTo("body"),jQuery("body > .um-modal, body > .um-modal-overlay").remove()}function um_modal_size(e){jQuery(".um-modal:visible").not(".um-modal-hidden").addClass(e)}function um_modal_add_attr(e,t){jQuery(".um-modal:visible").not(".um-modal-hidden").data(e,t)}function prepare_Modal(){0==jQuery(".um-popup-overlay").length&&(jQuery("body").append('<div class="um-popup-overlay"></div>'),jQuery("body").append('<div class="um-popup"></div>'),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(wp.hooks.doAction("um_before_modal_removed",jQuery(".um-popup")),jQuery(".tipsy").remove(),jQuery(".um-popup").empty().remove(),jQuery(".um-popup-overlay").empty().remove(),jQuery("body,html").css({overflow:"auto"}))}function show_Modal(e){jQuery(".um-popup-overlay").length&&(jQuery(".um-popup").removeClass("loading").html(e),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,offset:3}))}function responsive_Modal(){jQuery(".um-popup-overlay").length&&(350<(ag_height=jQuery(window).height()-jQuery(".um-popup .um-popup-header").outerHeight()-jQuery(".um-popup .um-popup-footer").outerHeight()-80)&&(ag_height=350),jQuery(".um-popup-autogrow:visible").length?jQuery(".um-popup-autogrow:visible").css({height:ag_height+"px"}):jQuery(".um-popup-autogrow2:visible").length&&jQuery(".um-popup-autogrow2:visible").css({"max-height":ag_height+"px"}))}function um_reset_field(e){jQuery(e).find("div.um-field-area").find("input,textarea,select").not(":button, :submit, :reset, :hidden").val("").prop("checked",!1).prop("selected",!1)}function um_selected(e,t){if(e==t)return"selected='selected'"}"object"!=typeof window.UM&&(window.UM={}),UM.dropdown={hide:function(e){e=jQuery(e);e.parents("div").find("a").removeClass("active"),e.hide()},hideAll:function(){var e=jQuery(".um-dropdown");e.parents("div").find("a").removeClass("active"),e.hide()},setPosition:function(e){var t,a=jQuery(e),o=200,e=jQuery("html").attr("dir"),i=a.attr("data-element"),r=a.attr("data-position"),d=a.attr("data-trigger"),u=i&&jQuery(i).length?jQuery(i):a.siblings("a").length?a.siblings("a").first():a.parent(),s=(u.addClass("um-trigger-menu-on-"+d),0),n=(u.outerWidth()-o)/2,m=u.outerHeight(),i=u.offset();switch(u.is(".um-profile-photo")&&(t=u.find(".um-profile-photo-img"),m=u.closest("div.uimob500").length?u.outerHeight()-t.outerHeight()/4:(n=(t.outerWidth()-o)/2,t.outerHeight()/4)),u.is(".um-cover")&&(t=u.find(".um-cover-e"),m=u.closest("div.uimob500").length?(n=(t.outerWidth()-o)/2,t.outerHeight()/2+24):(n=(t.outerWidth()-o)/2,t.outerHeight()/2+46)),"lc"===r&&"rtl"===e&&(r="rc"),u.outerWidth()<o&&("rtl"===e&&i.left<100?r="rc":"rtl"!==e&&window.innerWidth-i.left-u.outerWidth()<100&&(r="lc")),r){case"lc":s=u.width()+17,a.css({top:0,width:o,left:"auto",right:s+"px","text-align":"center"}),a.find(".um-dropdown-arr").css({top:"4px",left:"auto",right:"-17px"}).find("i").removeClass().addClass("um-icon-arrow-right-b");break;case"rc":s=u.width()+25,a.css({top:0,width:o,left:s+"px",right:"auto","text-align":"center"}),a.find(".um-dropdown-arr").css({top:"4px",left:"-17px",right:"auto"}).find("i").removeClass().addClass("um-icon-arrow-left-b");break;default:var l=a.data("top-offset");void 0!==l&&(m+=l),a.css({top:m+6,width:o,left:n,right:"auto","text-align":"center"}),a.find(".um-dropdown-arr").css({top:"-17px",left:a.width()/2-12,right:"auto"}).find("i").removeClass().addClass("um-icon-arrow-up-b")}},show:function(e){e=jQuery(e);UM.dropdown.hideAll(),UM.dropdown.setPosition(e),e.show()}},jQuery(function(){jQuery(".um-search form *").on("keypress",function(e){if(13==e.which)return jQuery(".um-search form").trigger("submit"),!1}),2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()});
|
assets/js/um-jquery-form.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(O){"use strict";var b={};b.fileapi=void 0!==O("<input type='file'/>").get(0).files,b.formdata=void 0!==window.FormData;var t=!!O.fn.prop;function r(e){var t=e.data;e.isDefaultPrevented()||(e.preventDefault(),O(e.target).ajaxSubmit(t))}function a(e){var t=e.target,r=O(t);if(!r.is("[type=submit],[type=image]")){var a=r.closest("[type=submit]");if(0===a.length)return;t=a[0]}var n=this;if("image"==(n.clk=t).type)if(void 0!==e.offsetX)n.clk_x=e.offsetX,n.clk_y=e.offsetY;else if("function"==typeof O.fn.offset){var i=r.offset();n.clk_x=e.pageX-i.left,n.clk_y=e.pageY-i.top}else n.clk_x=e.pageX-t.offsetLeft,n.clk_y=e.pageY-t.offsetTop;setTimeout(function(){n.clk=n.clk_x=n.clk_y=null},100)}function X(){if(O.fn.ajaxSubmit.debug){var e="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(e):window.opera&&window.opera.postError&&window.opera.postError(e)}}O.fn.attr2=function(){if(!t)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},O.fn.ajaxSubmit=function(L){if(!this.length)return X("ajaxSubmit: skipping submit process - no element selected"),this;var E,e,t,M=this;"function"==typeof L?L={success:L}:void 0===L&&(L={}),E=L.type||this.attr2("method"),(t=(t="string"==typeof(e=L.url||this.attr2("action"))?O.trim(e):"")||window.location.href||"")&&(t=(t.match(/^([^#]+)/)||[])[1]),L=O.extend(!0,{url:t,success:O.ajaxSettings.success,type:E||O.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},L);var r={};if(this.trigger("form-pre-serialize",[this,L,r]),r.veto)return X("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(L.beforeSerialize&&!1===L.beforeSerialize(this,L))return X("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var a=L.traditional;void 0===a&&(a=O.ajaxSettings.traditional);var n,F=[],i=this.formToArray(L.semantic,F);if(L.data&&(L.extraData=L.data,n=O.param(L.data,a)),L.beforeSubmit&&!1===L.beforeSubmit(i,this,L))return X("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[i,this,L,r]),r.veto)return X("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var o=O.param(i,a);n&&(o=o?o+"&"+n:n),"GET"==L.type.toUpperCase()?(L.url+=(0<=L.url.indexOf("?")?"&":"?")+o,L.data=null):L.data=o;var s=[];if(L.resetForm&&s.push(function(){M.resetForm()}),L.clearForm&&s.push(function(){M.clearForm(L.includeHidden)}),!L.dataType&&L.target){var u=L.success||function(){};s.push(function(e){var t=L.replaceTarget?"replaceWith":"html";O(L.target)[t](e).each(u,arguments)})}else L.success&&s.push(L.success);if(L.success=function(e,t,r){for(var a=L.context||this,n=0,i=s.length;n<i;n++)s[n].apply(a,[e,t,r||M,M])},L.error){var c=L.error;L.error=function(e,t,r){var a=L.context||this;c.apply(a,[e,t,r,M])}}if(L.complete){var l=L.complete;L.complete=function(e,t){var r=L.context||this;l.apply(r,[e,t,M])}}var f=0<O("input[type=file]:enabled",this).filter(function(){return""!==O(this).val()}).length,m="multipart/form-data",p=M.attr("enctype")==m||M.attr("encoding")==m,d=b.fileapi&&b.formdata;X("fileAPI :"+d);var h,v=(f||p)&&!d;!1!==L.iframe&&(L.iframe||v)?L.closeKeepAlive?O.get(L.closeKeepAlive,function(){h=x(i)}):h=x(i):h=(f||p)&&d?function(e){for(var r=new FormData,t=0;t<e.length;t++)r.append(e[t].name,e[t].value);if(L.extraData){var a=function(e){var t,r,a=O.param(e,L.traditional).split("&"),n=a.length,i=[];for(t=0;t<n;t++)a[t]=a[t].replace(/\+/g," "),r=a[t].split("="),i.push([decodeURIComponent(r[0]),decodeURIComponent(r[1])]);return i}(L.extraData);for(t=0;t<a.length;t++)a[t]&&r.append(a[t][0],a[t][1])}L.data=null;var n=O.extend(!0,{},O.ajaxSettings,L,{contentType:!1,processData:!1,cache:!1,type:E||"POST"});L.uploadProgress&&(n.xhr=function(){var e=O.ajaxSettings.xhr();return e.upload&&e.upload.addEventListener("progress",function(e){var t=0,r=e.loaded||e.position,a=e.total;e.lengthComputable&&(t=Math.ceil(r/a*100)),L.uploadProgress(e,r,a,t)},!1),e});n.data=null;var i=n.beforeSend;return n.beforeSend=function(e,t){L.formData?t.data=L.formData:t.data=r,i&&i.call(this,e,t)},O.ajax(n)}(i):O.ajax(L),M.removeData("jqxhr").data("jqxhr",h);for(var g=0;g<F.length;g++)F[g]=null;return this.trigger("form-submit-notify",[this,L]),this;function x(e){var t,l,f,i,m,p,d,r,a,h,v,o=M[0],g=O.Deferred();if(g.abort=function(e){d.abort(e)},e)for(t=0;t<F.length;t++)O(F[t]).prop("disabled",!1);if((l=O.extend(!0,{},O.ajaxSettings,L)).context=l.context||l,i="jqFormIO"+(new Date).getTime(),l.iframeTarget?(a=(m=O(l.iframeTarget)).attr2("name"))?i=a:m.attr2("name",i):(m=O('<iframe name="'+i+'" src="'+l.iframeSrc+'" />')).css({position:"absolute",top:"-1000px",left:"-1000px"}),p=m[0],d={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){var t="timeout"===e?"timeout":"aborted";X("aborting upload... "+t),this.aborted=1;try{p.contentWindow.document.execCommand&&p.contentWindow.document.execCommand("Stop")}catch(e){}m.attr("src",l.iframeSrc),d.error=t,l.error&&l.error.call(l.context,d,t,e),f&&O.event.trigger("ajaxError",[d,l,t]),l.complete&&l.complete.call(l.context,d,t)}},(f=l.global)&&0==O.active++&&O.event.trigger("ajaxStart"),f&&O.event.trigger("ajaxSend",[d,l]),l.beforeSend&&!1===l.beforeSend.call(l.context,d,l))return l.global&&O.active--,g.reject(),g;if(d.aborted)return g.reject(),g;(r=o.clk)&&(a=r.name)&&!r.disabled&&(l.extraData=l.extraData||{},l.extraData[a]=r.value,"image"==r.type&&(l.extraData[a+".x"]=o.clk_x,l.extraData[a+".y"]=o.clk_y));var x=1,b=2;function y(t){var r=null;try{t.contentWindow&&(r=t.contentWindow.document)}catch(e){X("cannot get iframe.contentWindow document: "+e)}if(r)return r;try{r=t.contentDocument?t.contentDocument:t.document}catch(e){X("cannot get iframe.contentDocument: "+e),r=t.document}return r}var n=O("meta[name=csrf-token]").attr("content"),s=O("meta[name=csrf-param]").attr("content");function u(){var e=M.attr2("target"),t=M.attr2("action"),r=M.attr("enctype")||M.attr("encoding")||"multipart/form-data";o.setAttribute("target",i),E&&!/post/i.test(E)||o.setAttribute("method","POST"),t!=l.url&&o.setAttribute("action",l.url),l.skipEncodingOverride||E&&!/post/i.test(E)||M.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),l.timeout&&(v=setTimeout(function(){h=!0,D(x)},l.timeout));var a=[];try{if(l.extraData)for(var n in l.extraData)l.extraData.hasOwnProperty(n)&&(O.isPlainObject(l.extraData[n])&&l.extraData[n].hasOwnProperty("name")&&l.extraData[n].hasOwnProperty("value")?a.push(O('<input type="hidden" name="'+l.extraData[n].name+'">').val(l.extraData[n].value).appendTo(o)[0]):a.push(O('<input type="hidden" name="'+n+'">').val(l.extraData[n]).appendTo(o)[0]));l.iframeTarget||m.appendTo("body"),p.attachEvent?p.attachEvent("onload",D):p.addEventListener("load",D,!1),setTimeout(function e(){try{var t=y(p).readyState;X("state = "+t),t&&"uninitialized"==t.toLowerCase()&&setTimeout(e,50)}catch(e){X("Server abort: ",e," (",e.name,")"),D(b),v&&clearTimeout(v),v=void 0}},15);try{o.submit()}catch(e){document.createElement("form").submit.apply(o)}}finally{o.setAttribute("action",t),o.setAttribute("enctype",r),e?o.setAttribute("target",e):M.removeAttr("target"),O(a).remove()}}s&&n&&(l.extraData=l.extraData||{},l.extraData[s]=n),l.forceSync?u():setTimeout(u,10);var T,j,w,S=50;function D(e){if(!d.aborted&&!w){if((j=y(p))||(X("cannot access response document"),e=b),e===x&&d)return d.abort("timeout"),void g.reject(d,"timeout");if(e==b&&d)return d.abort("server abort"),void g.reject(d,"error","server abort");if(j&&j.location.href!=l.iframeSrc||h){p.detachEvent?p.detachEvent("onload",D):p.removeEventListener("load",D,!1);var t,r="success";try{if(h)throw"timeout";var a="xml"==l.dataType||j.XMLDocument||O.isXMLDoc(j);if(X("isXml="+a),!a&&window.opera&&(null===j.body||!j.body.innerHTML)&&--S)return X("requeing onLoad callback, DOM not available"),void setTimeout(D,250);var n=j.body?j.body:j.documentElement;d.responseText=n?n.innerHTML:null,d.responseXML=j.XMLDocument?j.XMLDocument:j,a&&(l.dataType="xml"),d.getResponseHeader=function(e){return{"content-type":l.dataType}[e.toLowerCase()]},n&&(d.status=Number(n.getAttribute("status"))||d.status,d.statusText=n.getAttribute("statusText")||d.statusText);var i=(l.dataType||"").toLowerCase(),o=/(json|script|text)/.test(i);if(o||l.textarea){var s=j.getElementsByTagName("textarea")[0];if(s)d.responseText=s.value,d.status=Number(s.getAttribute("status"))||d.status,d.statusText=s.getAttribute("statusText")||d.statusText;else if(o){var u=j.getElementsByTagName("pre")[0],c=j.getElementsByTagName("body")[0];u?d.responseText=u.textContent?u.textContent:u.innerText:c&&(d.responseText=c.textContent?c.textContent:c.innerText)}}else"xml"==i&&!d.responseXML&&d.responseText&&(d.responseXML=k(d.responseText));try{T=A(d,i,l)}catch(e){r="parsererror",d.error=t=e||r}}catch(e){X("error caught: ",e),r="error",d.error=t=e||r}d.aborted&&(X("upload aborted"),r=null),d.status&&(r=200<=d.status&&d.status<300||304===d.status?"success":"error"),"success"===r?(l.success&&l.success.call(l.context,T,"success",d),g.resolve(d.responseText,"success",d),f&&O.event.trigger("ajaxSuccess",[d,l])):r&&(void 0===t&&(t=d.statusText),l.error&&l.error.call(l.context,d,r,t),g.reject(d,"error",t),f&&O.event.trigger("ajaxError",[d,l,t])),f&&O.event.trigger("ajaxComplete",[d,l]),f&&!--O.active&&O.event.trigger("ajaxStop"),l.complete&&l.complete.call(l.context,d,r),w=!0,l.timeout&&clearTimeout(v),setTimeout(function(){l.iframeTarget?m.attr("src",l.iframeSrc):m.remove(),d.responseXML=null},100)}}}var k=O.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},c=O.parseJSON||function(e){return window.eval("("+e+")")},A=function(e,t,r){var a=e.getResponseHeader("content-type")||"",n="xml"===t||!t&&0<=a.indexOf("xml"),i=n?e.responseXML:e.responseText;return n&&"parsererror"===i.documentElement.nodeName&&O.error&&O.error("parsererror"),r&&r.dataFilter&&(i=r.dataFilter(i,t)),"string"==typeof i&&("json"===t||!t&&0<=a.indexOf("json")?i=c(i):("script"===t||!t&&0<=a.indexOf("javascript"))&&O.globalEval(i)),i};return g}},O.fn.ajaxForm=function(e){if((e=e||{}).delegation=e.delegation&&O.isFunction(O.fn.on),e.delegation||0!==this.length)return e.delegation?(O(document).off("submit.form-plugin",this.selector,r).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,e,r).on("click.form-plugin",this.selector,e,a),this):this.ajaxFormUnbind().bind("submit.form-plugin",e,r).bind("click.form-plugin",e,a);var t={s:this.selector,c:this.context};return!O.isReady&&t.s?(X("DOM not ready, queuing ajaxForm"),O(function(){O(t.s,t.c).ajaxForm(e)})):X("terminating; zero elements found by selector"+(O.isReady?"":" (DOM not ready)")),this},O.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},O.fn.formToArray=function(e,t){var r=[];if(0===this.length)return r;var a,n,i,o,s,u,c,l,f=this[0],m=this.attr("id"),p=e?f.getElementsByTagName("*"):f.elements;if(p&&!/MSIE [678]/.test(navigator.userAgent)&&(p=O(p).get()),m&&(a=O(':input[form="'+m+'"]').get()).length&&(p=(p||[]).concat(a)),!p||!p.length)return r;for(n=0,c=p.length;n<c;n++)if((o=(u=p[n]).name)&&!u.disabled)if(e&&f.clk&&"image"==u.type)f.clk==u&&(r.push({name:o,value:O(u).val(),type:u.type}),r.push({name:o+".x",value:f.clk_x},{name:o+".y",value:f.clk_y}));else if((s=O.fieldValue(u,!0))&&s.constructor==Array)for(t&&t.push(u),i=0,l=s.length;i<l;i++)r.push({name:o,value:s[i]});else if(b.fileapi&&"file"==u.type){t&&t.push(u);var d=u.files;if(d.length)for(i=0;i<d.length;i++)r.push({name:o,value:d[i],type:u.type});else r.push({name:o,value:"",type:u.type})}else null!=s&&(t&&t.push(u),r.push({name:o,value:s,type:u.type,required:u.required}));if(!e&&f.clk){var h=O(f.clk),v=h[0];(o=v.name)&&!v.disabled&&"image"==v.type&&(r.push({name:o,value:h.val()}),r.push({name:o+".x",value:f.clk_x},{name:o+".y",value:f.clk_y}))}return r},O.fn.formSerialize=function(e){return O.param(this.formToArray(e))},O.fn.fieldSerialize=function(n){var i=[];return this.each(function(){var e=this.name;if(e){var t=O.fieldValue(this,n);if(t&&t.constructor==Array)for(var r=0,a=t.length;r<a;r++)i.push({name:e,value:t[r]});else null!=t&&i.push({name:this.name,value:t})}}),O.param(i)},O.fn.fieldValue=function(e){for(var t=[],r=0,a=this.length;r<a;r++){var n=this[r],i=O.fieldValue(n,e);null==i||i.constructor==Array&&!i.length||(i.constructor==Array?O.merge(t,i):t.push(i))}return t},O.fieldValue=function(e,t){var r=e.name,a=e.type,n=e.tagName.toLowerCase();if(void 0===t&&(t=!0),t&&(!r||e.disabled||"reset"==a||"button"==a||("checkbox"==a||"radio"==a)&&!e.checked||("submit"==a||"image"==a)&&e.form&&e.form.clk!=e||"select"==n&&-1==e.selectedIndex))return null;if("select"!=n)return O(e).val();var i=e.selectedIndex;if(i<0)return null;for(var o=[],s=e.options,u="select-one"==a,c=u?i+1:s.length,l=u?i:0;l<c;l++){var f=s[l];if(f.selected){var m=f.value;if(m||(m=f.attributes&&f.attributes.value&&!f.attributes.value.specified?f.text:f.value),u)return m;o.push(m)}}return o},O.fn.clearForm=function(e){return this.each(function(){O("input,select,textarea",this).clearFields(e)})},O.fn.clearFields=O.fn.clearInputs=function(r){var a=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var e=this.type,t=this.tagName.toLowerCase();a.test(e)||"textarea"==t?this.value="":"checkbox"==e||"radio"==e?this.checked=!1:"select"==t?this.selectedIndex=-1:"file"==e?/MSIE/.test(navigator.userAgent)?O(this).replaceWith(O(this).clone(!0)):O(this).val(""):r&&(!0===r&&/hidden/.test(e)||"string"==typeof r&&O(this).is(r))&&(this.value="")})},O.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},O.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},O.fn.selected=function(r){return void 0===r&&(r=!0),this.each(function(){var e=this.type;if("checkbox"==e||"radio"==e)this.checked=r;else if("option"==this.tagName.toLowerCase()){var t=O(this).parent("select");r&&t[0]&&"select-one"==t[0].type&&t.find("option").selected(!1),this.selected=r}})},O.fn.ajaxSubmit.debug=!1});
|
1 |
+
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(L){"use strict";var h={},t=(h.fileapi=void 0!==L("<input type='file'/>").get(0).files,h.formdata=void 0!==window.FormData,!!L.fn.prop);function r(e){var t=e.data;e.isDefaultPrevented()||(e.preventDefault(),L(e.target).ajaxSubmit(t))}function a(e){var t=e.target,r=L(t);if(!r.is("[type=submit],[type=image]")){var a=r.closest("[type=submit]");if(0===a.length)return;t=a[0]}var n=this;"image"==(n.clk=t).type&&(void 0!==e.offsetX?(n.clk_x=e.offsetX,n.clk_y=e.offsetY):"function"==typeof L.fn.offset?(a=r.offset(),n.clk_x=e.pageX-a.left,n.clk_y=e.pageY-a.top):(n.clk_x=e.pageX-t.offsetLeft,n.clk_y=e.pageY-t.offsetTop)),setTimeout(function(){n.clk=n.clk_x=n.clk_y=null},100)}function M(){var e;L.fn.ajaxSubmit.debug&&(e="[jquery.form] "+Array.prototype.join.call(arguments,""),window.console&&window.console.log?window.console.log(e):window.opera&&window.opera.postError&&window.opera.postError(e))}L.fn.attr2=function(){if(!t)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},L.fn.ajaxSubmit=function(u){if(!this.length)return M("ajaxSubmit: skipping submit process - no element selected"),this;var A,E=this,e=("function"==typeof u?u={success:u}:void 0===u&&(u={}),A=u.type||this.attr2("method"),e=(e=(e="string"==typeof(e=u.url||this.attr2("action"))?L.trim(e):"")||window.location.href||"")&&(e.match(/^([^#]+)/)||[])[1],u=L.extend(!0,{url:e,success:L.ajaxSettings.success,type:A||L.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},u),{});if(this.trigger("form-pre-serialize",[this,u,e]),e.veto)return M("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(u.beforeSerialize&&!1===u.beforeSerialize(this,u))return M("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var t=u.traditional,n=(void 0===t&&(t=L.ajaxSettings.traditional),[]),r=this.formToArray(u.semantic,n);if(u.data&&(u.extraData=u.data,l=L.param(u.data,t)),u.beforeSubmit&&!1===u.beforeSubmit(r,this,u))return M("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[r,this,u,e]),e.veto)return M("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var a,o,i,e=L.param(r,t),s=(l&&(e=e?e+"&"+l:l),"GET"==u.type.toUpperCase()?(u.url+=(0<=u.url.indexOf("?")?"&":"?")+e,u.data=null):u.data=e,[]);u.resetForm&&s.push(function(){E.resetForm()}),u.clearForm&&s.push(function(){E.clearForm(u.includeHidden)}),!u.dataType&&u.target?(a=u.success||function(){},s.push(function(e){var t=u.replaceTarget?"replaceWith":"html";L(u.target)[t](e).each(a,arguments)})):u.success&&s.push(u.success),u.success=function(e,t,r){for(var a=u.context||this,n=0,o=s.length;n<o;n++)s[n].apply(a,[e,t,r||E,E])},u.error&&(o=u.error,u.error=function(e,t,r){var a=u.context||this;o.apply(a,[e,t,r,E])}),u.complete&&(i=u.complete,u.complete=function(e,t){var r=u.context||this;i.apply(r,[e,t,E])});var c,t=0<L("input[type=file]:enabled",this).filter(function(){return""!==L(this).val()}).length,l="multipart/form-data",e=E.attr("enctype")==l||E.attr("encoding")==l,l=h.fileapi&&h.formdata;M("fileAPI :"+l),!1!==u.iframe&&(u.iframe||(t||e)&&!l)?u.closeKeepAlive?L.get(u.closeKeepAlive,function(){c=m(r)}):c=m(r):c=(t||e)&&l?function(e){for(var r=new FormData,t=0;t<e.length;t++)r.append(e[t].name,e[t].value);if(u.extraData){var a=function(e){var t,r,a=L.param(e,u.traditional).split("&"),n=a.length,o=[];for(t=0;t<n;t++)a[t]=a[t].replace(/\+/g," "),r=a[t].split("="),o.push([decodeURIComponent(r[0]),decodeURIComponent(r[1])]);return o}(u.extraData);for(t=0;t<a.length;t++)a[t]&&r.append(a[t][0],a[t][1])}u.data=null;var n=L.extend(!0,{},L.ajaxSettings,u,{contentType:!1,processData:!1,cache:!1,type:A||"POST"});u.uploadProgress&&(n.xhr=function(){var e=L.ajaxSettings.xhr();return e.upload&&e.upload.addEventListener("progress",function(e){var t=0,r=e.loaded||e.position,a=e.total;e.lengthComputable&&(t=Math.ceil(r/a*100)),u.uploadProgress(e,r,a,t)},!1),e});n.data=null;var o=n.beforeSend;return n.beforeSend=function(e,t){u.formData?t.data=u.formData:t.data=r,o&&o.call(this,e,t)},L.ajax(n)}(r):L.ajax(u),E.removeData("jqxhr").data("jqxhr",c);for(var f=0;f<n.length;f++)n[f]=null;return this.trigger("form-submit-notify",[this,u]),this;function m(e){var t,c,l,o,f,m,p,d,h,i=E[0],v=L.Deferred();if(v.abort=function(e){p.abort(e)},e)for(t=0;t<n.length;t++)L(n[t]).prop("disabled",!1);if((c=L.extend(!0,{},L.ajaxSettings,u)).context=c.context||c,o="jqFormIO"+(new Date).getTime(),c.iframeTarget?(r=(f=L(c.iframeTarget)).attr2("name"))?o=r:f.attr2("name",o):(f=L('<iframe name="'+o+'" src="'+c.iframeSrc+'" />')).css({position:"absolute",top:"-1000px",left:"-1000px"}),m=f[0],p={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){var t="timeout"===e?"timeout":"aborted";M("aborting upload... "+t),this.aborted=1;try{m.contentWindow.document.execCommand&&m.contentWindow.document.execCommand("Stop")}catch(e){}f.attr("src",c.iframeSrc),p.error=t,c.error&&c.error.call(c.context,p,t,e),l&&L.event.trigger("ajaxError",[p,c,t]),c.complete&&c.complete.call(c.context,p,t)}},(l=c.global)&&0==L.active++&&L.event.trigger("ajaxStart"),l&&L.event.trigger("ajaxSend",[p,c]),c.beforeSend&&!1===c.beforeSend.call(c.context,p,c))return c.global&&L.active--,v.reject(),v;if(p.aborted)return v.reject(),v;(e=i.clk)&&(r=e.name)&&!e.disabled&&(c.extraData=c.extraData||{},c.extraData[r]=e.value,"image"==e.type&&(c.extraData[r+".x"]=i.clk_x,c.extraData[r+".y"]=i.clk_y));var g=1,x=2;function b(t){var r=null;try{t.contentWindow&&(r=t.contentWindow.document)}catch(e){M("cannot get iframe.contentWindow document: "+e)}if(r)return r;try{r=t.contentDocument||t.document}catch(e){M("cannot get iframe.contentDocument: "+e),r=t.document}return r}var e=L("meta[name=csrf-token]").attr("content"),r=L("meta[name=csrf-param]").attr("content");function a(){var e=E.attr2("target"),t=E.attr2("action"),r=E.attr("enctype")||E.attr("encoding")||"multipart/form-data";i.setAttribute("target",o),A&&!/post/i.test(A)||i.setAttribute("method","POST"),t!=c.url&&i.setAttribute("action",c.url),c.skipEncodingOverride||A&&!/post/i.test(A)||E.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),c.timeout&&(h=setTimeout(function(){d=!0,S(g)},c.timeout));var a=[];try{if(c.extraData)for(var n in c.extraData)c.extraData.hasOwnProperty(n)&&(L.isPlainObject(c.extraData[n])&&c.extraData[n].hasOwnProperty("name")&&c.extraData[n].hasOwnProperty("value")?a.push(L('<input type="hidden" name="'+c.extraData[n].name+'">').val(c.extraData[n].value).appendTo(i)[0]):a.push(L('<input type="hidden" name="'+n+'">').val(c.extraData[n]).appendTo(i)[0]));c.iframeTarget||f.appendTo("body"),m.attachEvent?m.attachEvent("onload",S):m.addEventListener("load",S,!1),setTimeout(function e(){try{var t=b(m).readyState;M("state = "+t),t&&"uninitialized"==t.toLowerCase()&&setTimeout(e,50)}catch(e){M("Server abort: ",e," (",e.name,")"),S(x),h&&clearTimeout(h),h=void 0}},15);try{i.submit()}catch(e){document.createElement("form").submit.apply(i)}}finally{i.setAttribute("action",t),i.setAttribute("enctype",r),e?i.setAttribute("target",e):E.removeAttr("target"),L(a).remove()}}r&&e&&(c.extraData=c.extraData||{},c.extraData[r]=e),c.forceSync?a():setTimeout(a,10);var y,T,j,w=50;function S(t){if(!p.aborted&&!j){if((T=b(m))||(M("cannot access response document"),t=x),t===g&&p)return p.abort("timeout"),void v.reject(p,"timeout");if(t==x&&p)return p.abort("server abort"),void v.reject(p,"error","server abort");if(T&&T.location.href!=c.iframeSrc||d){m.detachEvent?m.detachEvent("onload",S):m.removeEventListener("load",S,!1);var r,t="success";try{if(d)throw"timeout";var e="xml"==c.dataType||T.XMLDocument||L.isXMLDoc(T);if(M("isXml="+e),!e&&window.opera&&(null===T.body||!T.body.innerHTML)&&--w)return M("requeing onLoad callback, DOM not available"),void setTimeout(S,250);var a,n,o,i=T.body||T.documentElement,s=(p.responseText=i?i.innerHTML:null,p.responseXML=T.XMLDocument||T,e&&(c.dataType="xml"),p.getResponseHeader=function(e){return{"content-type":c.dataType}[e.toLowerCase()]},i&&(p.status=Number(i.getAttribute("status"))||p.status,p.statusText=i.getAttribute("statusText")||p.statusText),(c.dataType||"").toLowerCase()),u=/(json|script|text)/.test(s);u||c.textarea?(a=T.getElementsByTagName("textarea")[0])?(p.responseText=a.value,p.status=Number(a.getAttribute("status"))||p.status,p.statusText=a.getAttribute("statusText")||p.statusText):u&&(n=T.getElementsByTagName("pre")[0],o=T.getElementsByTagName("body")[0],n?p.responseText=n.textContent||n.innerText:o&&(p.responseText=o.textContent||o.innerText)):"xml"==s&&!p.responseXML&&p.responseText&&(p.responseXML=k(p.responseText));try{y=D(p,s,c)}catch(e){t="parsererror",p.error=r=e||t}}catch(e){M("error caught: ",e),t="error",p.error=r=e||t}p.aborted&&(M("upload aborted"),t=null),"success"===(t=p.status?200<=p.status&&p.status<300||304===p.status?"success":"error":t)?(c.success&&c.success.call(c.context,y,"success",p),v.resolve(p.responseText,"success",p),l&&L.event.trigger("ajaxSuccess",[p,c])):t&&(void 0===r&&(r=p.statusText),c.error&&c.error.call(c.context,p,t,r),v.reject(p,"error",r),l&&L.event.trigger("ajaxError",[p,c,r])),l&&L.event.trigger("ajaxComplete",[p,c]),l&&!--L.active&&L.event.trigger("ajaxStop"),c.complete&&c.complete.call(c.context,p,t),j=!0,c.timeout&&clearTimeout(h),setTimeout(function(){c.iframeTarget?f.attr("src",c.iframeSrc):f.remove(),p.responseXML=null},100)}}}var k=L.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},s=L.parseJSON||function(e){return window.eval("("+e+")")},D=function(e,t,r){var a=e.getResponseHeader("content-type")||"",n="xml"===t||!t&&0<=a.indexOf("xml"),e=n?e.responseXML:e.responseText;return n&&"parsererror"===e.documentElement.nodeName&&L.error&&L.error("parsererror"),"string"==typeof(e=r&&r.dataFilter?r.dataFilter(e,t):e)&&("json"===t||!t&&0<=a.indexOf("json")?e=s(e):("script"===t||!t&&0<=a.indexOf("javascript"))&&L.globalEval(e)),e};return v}},L.fn.ajaxForm=function(e){var t;return(e=e||{}).delegation=e.delegation&&L.isFunction(L.fn.on),e.delegation||0!==this.length?e.delegation?(L(document).off("submit.form-plugin",this.selector,r).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,e,r).on("click.form-plugin",this.selector,e,a),this):this.ajaxFormUnbind().bind("submit.form-plugin",e,r).bind("click.form-plugin",e,a):(t={s:this.selector,c:this.context},!L.isReady&&t.s?(M("DOM not ready, queuing ajaxForm"),L(function(){L(t.s,t.c).ajaxForm(e)})):M("terminating; zero elements found by selector"+(L.isReady?"":" (DOM not ready)")),this)},L.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},L.fn.formToArray=function(e,t){var r=[];if(0===this.length)return r;var a,n,o,i,s,u,c,l,f=this[0],m=this.attr("id"),p=e?f.getElementsByTagName("*"):f.elements;if(p&&!/MSIE [678]/.test(navigator.userAgent)&&(p=L(p).get()),!(p=m&&(m=L(':input[form="'+m+'"]').get()).length?(p||[]).concat(m):p)||!p.length)return r;for(a=0,s=p.length;a<s;a++)if((l=(i=p[a]).name)&&!i.disabled)if(e&&f.clk&&"image"==i.type)f.clk==i&&(r.push({name:l,value:L(i).val(),type:i.type}),r.push({name:l+".x",value:f.clk_x},{name:l+".y",value:f.clk_y}));else if((o=L.fieldValue(i,!0))&&o.constructor==Array)for(t&&t.push(i),n=0,u=o.length;n<u;n++)r.push({name:l,value:o[n]});else if(h.fileapi&&"file"==i.type){t&&t.push(i);var d=i.files;if(d.length)for(n=0;n<d.length;n++)r.push({name:l,value:d[n],type:i.type});else r.push({name:l,value:"",type:i.type})}else null!=o&&(t&&t.push(i),r.push({name:l,value:o,type:i.type,required:i.required}));return!e&&f.clk&&(l=(c=(m=L(f.clk))[0]).name)&&!c.disabled&&"image"==c.type&&(r.push({name:l,value:m.val()}),r.push({name:l+".x",value:f.clk_x},{name:l+".y",value:f.clk_y})),r},L.fn.formSerialize=function(e){return L.param(this.formToArray(e))},L.fn.fieldSerialize=function(n){var o=[];return this.each(function(){var e=this.name;if(e){var t=L.fieldValue(this,n);if(t&&t.constructor==Array)for(var r=0,a=t.length;r<a;r++)o.push({name:e,value:t[r]});else null!=t&&o.push({name:this.name,value:t})}}),L.param(o)},L.fn.fieldValue=function(e){for(var t=[],r=0,a=this.length;r<a;r++){var n=this[r],n=L.fieldValue(n,e);null==n||n.constructor==Array&&!n.length||(n.constructor==Array?L.merge(t,n):t.push(n))}return t},L.fieldValue=function(e,t){var r=e.name,a=e.type,n=e.tagName.toLowerCase();if((t=void 0===t?!0:t)&&(!r||e.disabled||"reset"==a||"button"==a||("checkbox"==a||"radio"==a)&&!e.checked||("submit"==a||"image"==a)&&e.form&&e.form.clk!=e||"select"==n&&-1==e.selectedIndex))return null;if("select"!=n)return L(e).val();t=e.selectedIndex;if(t<0)return null;for(var o=[],i=e.options,s="select-one"==a,u=s?t+1:i.length,c=s?t:0;c<u;c++){var l=i[c];if(l.selected){var f=(f=l.value)||(l.attributes&&l.attributes.value&&!l.attributes.value.specified?l.text:l.value);if(s)return f;o.push(f)}}return o},L.fn.clearForm=function(e){return this.each(function(){L("input,select,textarea",this).clearFields(e)})},L.fn.clearFields=L.fn.clearInputs=function(r){var a=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var e=this.type,t=this.tagName.toLowerCase();a.test(e)||"textarea"==t?this.value="":"checkbox"==e||"radio"==e?this.checked=!1:"select"==t?this.selectedIndex=-1:"file"==e?/MSIE/.test(navigator.userAgent)?L(this).replaceWith(L(this).clone(!0)):L(this).val(""):r&&(!0===r&&/hidden/.test(e)||"string"==typeof r&&L(this).is(r))&&(this.value="")})},L.fn.resetForm=function(){return this.each(function(){"function"!=typeof this.reset&&("object"!=typeof this.reset||this.reset.nodeType)||this.reset()})},L.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},L.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var e=this.type;"checkbox"==e||"radio"==e?this.checked=t:"option"==this.tagName.toLowerCase()&&(e=L(this).parent("select"),t&&e[0]&&"select-one"==e[0].type&&e.find("option").selected(!1),this.selected=t)})},L.fn.ajaxSubmit.debug=!1});
|
assets/js/um-members.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var um_members_directory_busy=[],um_member_directories=[],um_member_directory_last_data=[];function um_parse_current_url(){var t={},a=window.location.search.substring(1).split("&");return jQuery.each(a,function(e){var r=a[e].split("=");t[r[0]]=r[1]}),t}function um_get_data_for_directory(e,r){var t=um_members_get_hash(e),a={},i=um_parse_current_url();if(jQuery.each(i,function(e){-1!==e.indexOf("_"+t)&&""!==i[e]&&(a[e.replace("_"+t,"")]=i[e])}),r){if(void 0!==a[r])try{a[r]=decodeURIComponent(a[r])}catch(e){console.error(e)}return a[r]}return a}function um_set_url_from_data(e,r,t){var a=um_members_get_hash(e),i=um_get_data_for_directory(e),m={};Array.isArray(t)?(jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")):jQuery.isNumeric(t)||(t=t.split("||"),jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")),""!==t&&(m[r+"_"+a]=t),jQuery.each(i,function(e){r===e?""!==t&&(m[e+"_"+a]=t):m[e+"_"+a]=i[e]}),jQuery.each(um_member_directories,function(e){var r=um_member_directories[e];if(r!==a){var t=um_get_data_for_directory(jQuery('.um-directory[data-hash="'+r+'"]'));jQuery.each(t,function(e){m[e+"_"+r]=t[e]})}});var d=[];jQuery.each(m,function(e){d.push(e+"="+m[e])});var s="?"+(d=wp.hooks.applyFilters("um_member_directory_url_attrs",d)).join("&");"?"===s&&(s=""),window.history.pushState("string","UM Member Directory",window.location.origin+window.location.pathname+s)}function um_members_get_hash(e){return e.data("hash")}function um_is_directory_busy(e){var r=um_members_get_hash(e);return void 0!==um_members_directory_busy[r]&&um_members_directory_busy[r]}function um_members_show_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!0,e.find(".um-members-overlay").show()}function um_members_hide_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!1,e.find(".um-members-overlay").hide()}function um_set_range_label(e,r){var t,a,i="",m=e.siblings(".um-slider-range").data("placeholder-s"),d=e.siblings(".um-slider-range").data("placeholder-p");a=r?(i=r.values[0]===r.values[1]?m.replace("{value}",r.values[0]).replace("{field_label}",e.siblings(".um-slider-range").data("label")):d.replace("{min_range}",r.values[0]).replace("{max_range}",r.values[1]).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=r.values[0],r.values[1]):(i=e.slider("values",0)===e.slider("values",1)?m.replace("{value}",e.slider("values",0)).replace("{field_label}",e.siblings(".um-slider-range").data("label")):d.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1)).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=e.slider("values",0),e.slider("values",1)),e.siblings(".um-slider-range").html(i),e.siblings(".um_range_min").val(t),e.siblings(".um_range_max").val(a)}function um_get_search(e){return e.find(".um-search-line").length?e.find(".um-search-line").val():""}function um_get_sort(e){return e.data("sorting")}function um_get_current_page(e){var r=e.data("page");return r&&void 0!==r||(r=1),r}function um_time_convert(e,r){var t=Math.floor(e/60),a=e%60;return 60<=a&&(a=0,24<=(t+=1)&&(t=0)),a<10&&(a="0"+a),t+":"+a}function um_ajax_get_members(u,e){var t=um_members_get_hash(u);if(wp.hooks.applyFilters("um_member_directory_get_members_allow",!0,t,u)){var r=um_get_current_page(u),a=um_get_search(u),i=um_get_sort(u),m=-(new Date).getTimezoneOffset()/60,_={directory_id:t,page:r,search:a,sorting:i,gmt_offset:m,post_refferer:u.data("base-post"),nonce:um_scripts.nonce};u.find(".um-search-filter").length&&u.find(".um-search-filter").each(function(){var e=jQuery(this);if(e.find(".um-slider").length){var r=e.find(".um-slider").data("field_name"),t=um_get_data_for_directory(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"filter_"+r+"_to");void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find(".um-datepicker-filter").length){r=e.find(".um-datepicker-filter").data("filter_name"),t=um_get_data_for_directory(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"filter_"+r+"_to");void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find(".um-timepicker-filter").length){r=e.find(".um-timepicker-filter").data("filter_name"),t=um_get_data_for_directory(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"filter_"+r+"_to");if(void 0!==t)(i=1*(t=t.split(":"))[0])<10&&(i="0"+i),(d=1*t[1])<10&&(d="0"+d),t=i+":"+d+":00";if(void 0!==a){var i,m=a.split(":"),d=1*m[1];(i=1*m[0])<10&&(i="0"+i),d<10&&(d="0"+d),a=i+":"+d+":59"}void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find("select").length){r=e.find("select").attr("name");void 0!==(s=um_get_data_for_directory(u,"filter_"+r))&&(s=um_unsanitize_value(s),_[r]=s.split("||"))}else if(e.hasClass("um-text-filter-type")&&e.find('input[type="text"]').length){var s;r=e.find('input[type="text"]').attr("name");void 0!==(s=um_get_data_for_directory(u,"filter_"+r))&&(s=um_unsanitize_value(s),_[r]=s)}else _=wp.hooks.applyFilters("um_member_directory_custom_filter_handler",_,e,u)}),_=wp.hooks.applyFilters("um_member_directory_filter_request",_),wp.ajax.send("um_get_members",{data:_,success:function(e){um_member_directory_last_data[t]=e,um_build_template(u,e);var r=wp.template("um-members-pagination");u.find(".um-members-pagination-box").html(r(e)),u.data("total_pages",e.pagination.total_pages),e.pagination.total_pages?(u.find(".um-member-directory-sorting-options").prop("disabled",!1),u.find(".um-member-directory-view-type").removeClass("um-disabled")):(u.find(".um-member-directory-sorting-options").prop("disabled",!0),u.find(".um-member-directory-view-type").addClass("um-disabled")),wp.hooks.doAction("um_member_directory_loaded",u,e),um_init_new_dropdown(),um_members_hide_preloader(u)},error:function(e){console.log(e),um_members_hide_preloader(u)}})}else setTimeout(um_ajax_get_members,600,u,e)}function um_build_template(e,r){var t=e.data("view_type"),a=wp.template("um-member-"+t+"-"+um_members_get_hash(e));e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-members-wrapper").prepend(a(r.users));var i=wp.template("um-members-header");e.find(".um-members-intro").remove();var m=wp.hooks.applyFilters("um_member_directory_generate_header",!1,e);(void 0!==r.is_search&&r.is_search||m)&&e.find(".um-members-wrapper").prepend(i(r)),e.addClass("um-loaded"),e.find(".um-members.um-members-grid").length&&UM_Member_Grid(e.find(".um-members.um-members-grid")),jQuery(document).trigger("um_build_template",[e,r]),jQuery(window).trigger("resize"),init_tipsy()}function UM_Member_Grid(r){r.find(".um-member").length&&r.imagesLoaded(function(){var e=wp.hooks.applyFilters("um_member_directory_grid_masonry_attrs",{itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"},r);r.masonry(e).on("layoutComplete",function(e,r){jQuery(document).trigger("um_grid_initialized",[e,r])})})}function um_get_filters_data(u){var _=[];return u.find(".um-search-filter").each(function(){var t,a,d,i=jQuery(this);if(i.find("input.um-datepicker-filter").length)d="datepicker",i.find("input.um-datepicker-filter").each(function(){if("to"!==jQuery(this).data("range")){var e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(u,"filter_"+e+"_from"),t=um_get_data_for_directory(u,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=u.find('input.um-datepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val();i===m?a=m:""!==i&&""!==m?a=i+" - "+m:""===i?a="before "+m:""===m&&(a="since "+i),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:a,value:[r,t],type:d})}}});else if(i.find("input.um-timepicker-filter").length)d="timepicker",i.find("input.um-timepicker-filter").each(function(){if("to"!==jQuery(this).data("range")){var e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(u,"filter_"+e+"_from"),t=um_get_data_for_directory(u,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=u.find('input.um-timepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val();i===m?a=m:""!==i&&""!==m?a=i+" - "+m:""===i?a="before "+m:""===m&&(a="since "+i),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:a,value:[r,t],type:d})}}});else if(i.find("select").length){d="select",t=i.find("select").attr("name"),a=i.find("select").data("placeholder"),m=void 0===(m=um_get_data_for_directory(u,"filter_"+t))?[]:(m=um_unsanitize_value(m)).split("||"),jQuery.each(m,function(e){var r=i.find('select option[value="'+m[e]+'"]').data("value_label");_.push({name:t,label:a,value_label:r,value:m[e],type:d})})}else if(i.hasClass("um-text-filter-type")&&i.find('input[type="text"]').length){var m;d="text",t=i.find('input[type="text"]').attr("name"),a=i.find('input[type="text"]').attr("placeholder"),void 0===(m=um_get_data_for_directory(u,"filter_"+t))&&(m=""),""!=m&&_.push({name:t,label:a,value_label:m,value:m,type:d})}else if(i.find("div.ui-slider").length){d="slider",t=i.find("div.ui-slider").data("field_name");var e,r=um_get_data_for_directory(u,"filter_"+t+"_from"),s=um_get_data_for_directory(u,"filter_"+t+"_to");if(void 0===r&&void 0===s)return;e=r===s?i.find("div.um-slider-range").data("placeholder-s").replace("{value}",r).replace("{field_label}",i.find("div.um-slider-range").data("label")):i.find("div.um-slider-range").data("placeholder-p").replace("{min_range}",r).replace("{max_range}",s).replace("{field_label}",i.find("div.um-slider-range").data("label")),a=i.find("div.um-slider-range").data("label"),_.push({name:t,label:a,value_label:e,value:[r,s],type:d})}else _=wp.hooks.applyFilters("um_member_directory_get_filter_data",_,u,i)}),_}function um_change_tag(e){var r=um_get_filters_data(e);e.find(".um-members-filter-tag").remove();var t=e.find(".um-filtered-line");if(t.length){var a=wp.template("um-members-filtered-line");t.prepend(a({filters:r})),0===e.find(".um-members-filter-remove").length?(e.find(".um-clear-filters").hide(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(e.find(".um-clear-filters").show(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible"))}}function um_run_search(e){if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=um_get_data_for_directory(e,"search"),t=um_sanitize_value(e.find(".um-search-line").val());if(t===r||""===t&&void 0===r)um_members_hide_preloader(e);else{e.data("general_search",t),um_set_url_from_data(e,"search",t),e.data("page",1),um_set_url_from_data(e,"page","");var a=!1;if(!(a=wp.hooks.applyFilters("um_member_directory_ignore_after_search",a,e)))if(1===e.data("must-search")&&(t=um_get_search(e),0===e.find(".um-members-filter-remove").length&&!t))return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),void um_members_hide_preloader(e);e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}}jQuery(document.body).ready(function(){jQuery(".um-directory .um-search-filter select").each(function(){1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var e=jQuery(this);e.select2("destroy").select2({dropdownParent:e.parent()})}),jQuery(document.body).on("mouseover",".um-directory .um-member-directory-view-type",function(){if(!jQuery(this).hasClass("um-disabled")){var e=jQuery(this).find(".um-member-directory-view-type-a:visible");e.hide(),e.next().length?e.next().show().tipsy("show"):jQuery(this).find(".um-member-directory-view-type-a:first").show().tipsy("show")}}).on("mouseout",".um-directory .um-member-directory-view-type",function(){jQuery(this).hasClass("um-disabled")||(jQuery(this).find(".um-member-directory-view-type-a").hide().tipsy("hide"),jQuery(this).find('.um-member-directory-view-type-a[data-type="'+jQuery(this).parents(".um-directory").data("view_type")+'"]').show())}),jQuery(document.body).on("click",".um-directory .um-member-directory-view-type-a",function(){var e=jQuery(this).parents(".um-directory");if(um_is_directory_busy(e))return!1;var r=jQuery(this),t=r.parents(".um-member-directory-view-type");if(!t.hasClass("um-disabled")){um_members_show_preloader(e);var a=t.find(".um-member-directory-view-type-a:visible");a.hide(),a.next().length?a.next().show().tipsy("show"):t.find(".um-member-directory-view-type-a:first").show().tipsy("show");var i=um_member_directory_last_data[um_members_get_hash(e)];if(null!==i){var m=r.data("type");um_set_url_from_data(e,"view_type",m),e.data("view_type",m),um_build_template(e,i),um_init_new_dropdown()}um_members_hide_preloader(e)}}),jQuery(document.body).on("click",".um-directory .um-do-search",function(){um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("keypress",".um-directory .um-search-line",function(e){13===e.which&&um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("click",'.um-new-dropdown[data-element=".um-member-directory-sorting-a"] li a',function(){if(1!==jQuery(this).data("selected")){var e=jQuery(this).data("directory-hash"),r=jQuery('.um-directory[data-hash="'+e+'"]');if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=jQuery(this).html(),a=jQuery(this).data("value");r.data("sorting",a),um_set_url_from_data(r,"sort",a),um_ajax_get_members(r),r.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),r.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"] a[data-value="'+a+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),r.find(".um-member-directory-sorting-a").find("> a").html(t)}}}),jQuery(document.body).on("click",".um-directory .pagi:not(.current)",function(){if(!jQuery(this).hasClass("disabled")){var e,r=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(r))um_members_show_preloader(r),1===(e="first"===jQuery(this).data("page")?1:"prev"===jQuery(this).data("page")?1*r.data("page")-1:"next"===jQuery(this).data("page")?1*r.data("page")+1:"last"===jQuery(this).data("page")?parseInt(r.data("total_pages")):parseInt(jQuery(this).data("page")))?(r.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass("disabled"),r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled")):(e===parseInt(r.data("total_pages"))?r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass("disabled"):r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled"),r.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass("disabled")),r.find(".pagi").removeClass("current"),r.find('.pagi[data-page="'+e+'"]').addClass("current"),r.data("page",e),um_set_url_from_data(r,"page",1===e?"":e),um_ajax_get_members(r)}}),jQuery(document.body).on("change",".um-directory .um-members-pagi-dropdown",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=jQuery(this).val();e.find(".pagi").removeClass("current"),e.find('.pagi[data-page="'+r+'"]').addClass("current"),e.data("page",r),um_set_url_from_data(e,"page",1===r?"":r),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member");return r.find(".um-member-more").hide(),r.find(".um-member-meta-main").slideDown(),r.find(".um-member-less").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member");return r.find(".um-member-less").hide(),r.find(".um-member-meta-main").slideUp(),r.find(".um-member-more").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-more").hide(),r.find(".um-member-meta").slideDown(function(){UM_Member_Grid(t)}),r.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(t)},100),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-less").hide(),r.find(".um-member-meta").slideUp(function(){r.find(".um-member-more").fadeIn(),UM_Member_Grid(t)}),!1}),jQuery(".um-member-directory-filters-a").on("click",function(){var e=jQuery(this),r=e.parents(".um-directory").find(".um-search");r.is(":visible")?r.slideUp(250,function(){e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}):r.slideDown({duration:250,start:function(){jQuery(this).css({display:"grid"}),e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}})}),jQuery(document.body).on("change",".um-directory .um-search-filter select",function(){var e=jQuery(this).val(),r=um_sanitize_value(e);if(""!==r){var t=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(t)){um_members_show_preloader(t);var a=jQuery(this).prop("name"),i=um_get_data_for_directory(t,"filter_"+a);i=void 0===i?[]:i.split("||"),-1===jQuery.inArray(r,i)&&(i.push(r),um_set_url_from_data(t,"filter_"+a,i=i.join("||")),t.data("page",1),um_set_url_from_data(t,"page","")),jQuery(this).find('option[value="'+e+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var m=jQuery(this);m.select2("destroy").select2({dropdownParent:m.parent()}),m.val("").trigger("change"),um_ajax_get_members(t),um_change_tag(t),t.data("searched",1),t.find(".um-member-directory-sorting-options").prop("disabled",!1),t.find(".um-member-directory-view-type").removeClass("um-disabled")}}}),jQuery(document.body).on("blur",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){var r=um_sanitize_value(jQuery(this).val()),t=jQuery(this).prop("name"),a=um_get_data_for_directory(e,"filter_"+t);void 0===a&&(a=""),r!==a&&(um_members_show_preloader(e),um_set_url_from_data(e,"filter_"+t,r),e.data("page",1),um_set_url_from_data(e,"page",""),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),jQuery(document.body).on("keypress",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(e){if(13===e.which){var r=jQuery(this).parents(".um-directory");if(um_is_directory_busy(r))return;var t=um_sanitize_value(jQuery(this).val()),a=jQuery(this).prop("name"),i=um_get_data_for_directory(r,"filter_"+a);if(void 0===i&&(i=""),t===i)return;um_members_show_preloader(r),um_set_url_from_data(r,"filter_"+a,t),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}),jQuery(document.body).on("click",".um-directory .um-members-filter-remove",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)&&e){um_members_show_preloader(e);var r=jQuery(this).data("value"),t=jQuery(this).data("name"),a=jQuery(this).data("type");if("text"===a)um_set_url_from_data(e,"filter_"+t,""),jQuery('.um-search-filter input[name="'+t+'"]').val("");else if("select"===a){var i=um_get_data_for_directory(e,"filter_"+t);i=void 0===i?[]:(i=um_unsanitize_value(i)).split("||"),-1!==jQuery.inArray(r.toString(),i)&&(i=jQuery.grep(i,function(e){return e!==r.toString()})),i.length||(i=""),um_set_url_from_data(e,"filter_"+t,i);var m=jQuery('.um-search-filter select[name="'+t+'"]');m.find('option[value="'+r+'"]').prop("disabled",!1).show(),1<m.find("option:not(:disabled)").length&&m.prop("disabled",!1),m.select2("destroy").select2({dropdownParent:m.parent()}),0<e.find('.um-search-filter select[data-um-parent="'+t+'"]').length&&m.trigger("change")}else if("slider"===a){um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to","");var d=jQuery(".um-search-filter #"+t+"_min").siblings(".um-slider"),s=d.slider("option");d.slider("values",[s.min,s.max]),jQuery(".um-search-filter #"+t+"_min").val(""),jQuery(".um-search-filter #"+t+"_max").val(""),um_set_range_label(d)}else"datepicker"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""),jQuery(".um-search-filter #"+t+"_from").val(""),jQuery(".um-search-filter #"+t+"_to").val("")):"timepicker"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""),jQuery(".um-search-filter #"+t+"_from").val(""),jQuery(".um-search-filter #"+t+"_to").val("")):wp.hooks.doAction("um_member_directory_filter_remove",a,e,t,r);e.data("page",1),um_set_url_from_data(e,"page",""),jQuery(this).tipsy("hide"),jQuery(this).parents(".um-members-filter-tag").remove(),0===e.find(".um-members-filter-remove").length?e.find(".um-clear-filters").hide():e.find(".um-clear-filters").show();var u=!1;if(!(u=wp.hooks.applyFilters("um_member_directory_ignore_after_search",u,e)))if(1===e.data("must-search")){var _=um_get_search(e);if(0===e.find(".um-members-filter-remove").length&&!_)return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),void um_members_hide_preloader(e)}e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-clear-filters-a",function(){var s=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(s)){um_members_show_preloader(s),s.find(".um-members-filter-remove").each(function(){var r=jQuery(this).data("value"),e=jQuery(this).data("name"),t=jQuery(this).data("type");if("text"===t)um_set_url_from_data(s,"filter_"+e,""),jQuery('.um-search-filter input[name="'+e+'"]').val("");else if("select"===t){var a=um_get_data_for_directory(s,"filter_"+e);a=void 0===a?[]:(a=um_unsanitize_value(a)).split("||"),-1!==jQuery.inArray(r.toString(),a)&&(a=jQuery.grep(a,function(e){return e!==r.toString()})),a.length||(a=""),um_set_url_from_data(s,"filter_"+e,a);var i=jQuery('.um-search-filter select[name="'+e+'"]');i.find('option[value="'+r+'"]').prop("disabled",!1).show(),1<i.find("option:not(:disabled)").length&&i.prop("disabled",!1),i.select2("destroy").select2({dropdownParent:i.parent()}),0<s.find('.um-search-filter select[data-um-parent="'+e+'"]').length&&i.trigger("change")}else if("slider"===t){um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to","");var m=jQuery(".um-search-filter #"+e+"_min").siblings(".um-slider"),d=m.slider("option");m.slider("values",[d.min,d.max]),jQuery(".um-search-filter #"+e+"_min").val(""),jQuery(".um-search-filter #"+e+"_max").val(""),um_set_range_label(m)}else"datepicker"===t?(um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):"timepicker"===t?(um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):wp.hooks.doAction("um_member_directory_clear_filters",t,s,e,r)}),s.data("page",1),um_set_url_from_data(s,"page",""),s.find(".um-members-filter-tag").remove(),0===s.find(".um-members-filter-remove").length?(s.find(".um-clear-filters").hide(),s.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(s.find(".um-clear-filters").show(),s.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible"));var e=!1;if(!(e=wp.hooks.applyFilters("um_member_directory_ignore_after_search",e,s)))if(1===s.data("must-search"))if(!um_get_search(s))return s.data("searched",0),s.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),s.find(".um-member-directory-sorting-options").prop("disabled",!0),s.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",s),void um_members_hide_preloader(s);s.find(".um-member-directory-sorting-options").prop("disabled",!1),s.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(s)}}),wp.hooks.doAction("um_member_directory_on_first_pages_loading"),jQuery(".um-directory").each(function(){var e=jQuery(this),r=um_members_get_hash(e);um_member_directories.push(r),e.find(".um-search").length&&(e.find(".um-search").is(":visible")||e.find(".um-search").css({display:"grid"}).slideUp(1)),e.find(".um-slider").each(function(){var e=jQuery(this),t=e.parents(".um-directory"),a=e.data("field_name"),r=um_get_data_for_directory(t,"filter_"+a+"_from"),i=um_get_data_for_directory(t,"filter_"+a+"_to");void 0===r&&(r=parseInt(e.data("min"))),void 0===i&&(i=parseInt(e.data("max")));var m=[r,i];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:m,create:function(e,r){},step:1,slide:function(e,r){um_set_range_label(jQuery(this),r)},stop:function(e,r){um_is_directory_busy(t)||(um_members_show_preloader(t),um_set_url_from_data(t,"filter_"+a+"_from",r.values[0]),um_set_url_from_data(t,"filter_"+a+"_to",r.values[1]),t.data("page",1),um_set_url_from_data(t,"page",""),um_ajax_get_members(t),um_change_tag(t),t.data("searched",1),t.find(".um-member-directory-sorting-options").prop("disabled",!1),t.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),um_set_range_label(e)}),e.find(".um-datepicker-filter").each(function(){var s=jQuery(this),u=new Date(1e3*s.data("date_min")),_=new Date(1e3*s.data("date_max")),e=s.pickadate({selectYears:!0,min:u,max:_,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){s.blur()},onClose:function(){s.blur()},onSet:function(e){if(e.select){var r=s.parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=s.data("filter_name"),a=s.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to");void 0===i&&(i=u/1e3),void 0===m&&(m=_/1e3);var d=e.select/1e3;s.val();"from"===a?i=d:"to"===a&&(m=d),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}}}).pickadate("picker"),r=s.data("filter_name"),t=s.data("range"),a=um_get_data_for_directory(s.parents(".um-directory"),"filter_"+r+"_"+t);void 0!==a&&e.set("select",1e3*a)}),e.find(".um-timepicker-filter").each(function(){var u=jQuery(this),_=u.attr("id"),o=u.data("filter_name"),n=u.attr("data-min"),l=u.attr("data-max"),e=n.split(":"),r=l.split(":"),t=u.pickatime({format:u.data("format"),interval:parseInt(u.data("intervals")),min:[e[0],e[1]],max:[r[0],r[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){u.blur()},onClose:function(){u.blur()},onSet:function(e){if(e.select){var r=u.parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=u.data("filter_name"),a=u.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to");if(void 0===i&&(i=n),void 0===m&&(m=l),void 0!==e.select){var d=um_time_convert(e.select,a);"from"===a?i=d:"to"===a&&(m=d)}else"from"===a?i=n:"to"===a&&(m=l);var s=jQuery("#"+_).val();"from"===u.data("range")?jQuery("#"+o+"_to").pickatime("picker").set("min",s):jQuery("#"+o+"_from").pickatime("picker").set("max",s),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}}}).pickatime("picker"),a=u.data("filter_name"),i=u.data("range"),m=um_get_data_for_directory(u.parents(".um-directory"),"filter_"+a+"_"+i);if(void 0!==m){var d=m.split(":");t.set("select",60*d[0]+1*d[1])}}),wp.hooks.doAction("um_member_directory_on_init",e,r);var t=!1;if(!(t=wp.hooks.applyFilters("um_member_directory_ignore_after_search",t,e))&&1===e.data("must-search")){var a=um_get_search(e);if(!um_get_filters_data(e).length&&!a)return}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,e,r)||(um_members_show_preloader(e),um_ajax_get_members(e,{first_load:!0}),um_change_tag(e))}),window.addEventListener("popstate",function(e){jQuery(".um-directory").each(function(){var d=jQuery(this),e=um_members_get_hash(d);(um_member_directories.push(e),um_members_show_preloader(d),d.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),d.find(".um-member-directory-search-line").length)&&(void 0===(s=um_get_data_for_directory(d,"search"))&&(s=""),d.data("general_search",s),d.find(".um-search-line").val(s));var r=um_get_data_for_directory(d,"page");if(void 0===r?r=1:r>d.data("total_pages")&&(r=d.data("total_pages")),d.data("page",r).attr("data-page",r),d.find(".um-member-directory-sorting").length){var t=um_get_data_for_directory(d,"sort");void 0===t&&(t=d.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find('a[data-default="1"]').data("value")),d.data("sorting",t);var a=d.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]');a.find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),a.find('a[data-value="'+t+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),d.find(".um-member-directory-sorting-a").find("> a").html(a.find('a[data-value="'+t+'"]').html())}if(d.find(".um-member-directory-view-type").length){var i=um_get_data_for_directory(d,"view_type");void 0===i&&(i=d.find('.um-member-directory-view-type-a[data-default="1"]').data("type")),d.data("view_type",i),d.find(".um-member-directory-view-type .um-member-directory-view-type-a").hide(),d.find('.um-member-directory-view-type .um-member-directory-view-type-a[data-type="'+i+'"]').show()}d.find(".um-datepicker-filter").each(function(){var e=jQuery(this),r=e.pickadate("picker"),t=e.data("filter_name"),a=e.data("range"),i=um_get_data_for_directory(d,"filter_"+t+"_"+a);void 0!==i?r.set("select",1e3*i):r.clear()}),d.find(".um-slider").each(function(){var e=jQuery(this),r=e.data("field_name"),t=um_get_data_for_directory(d,"filter_"+r+"_from"),a=um_get_data_for_directory(d,"filter_"+r+"_to");void 0===t&&(t=e.data("min")),t=parseInt(t),void 0===a&&(a=e.data("max")),a=parseInt(a),e.slider("values",[t,a]),um_set_range_label(e)}),d.find(".um-timepicker-filter").each(function(){var e=jQuery(this),r=e.pickatime("picker"),t=e.data("filter_name"),a=e.data("range"),i=um_get_data_for_directory(d,"filter_"+t+"_"+a);if(void 0!==i){var m=i.split(":");r.set("select",60*m[0])}else r.clear()});var m=!1;if(!(m=wp.hooks.applyFilters("um_member_directory_ignore_after_search",m,d))&&1===d.data("must-search")){var s=um_get_search(d);if(!um_get_filters_data(d).length&&!s)return d.data("searched",0),void um_members_hide_preloader(d);d.data("searched",1)}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,d,e)||(um_ajax_get_members(d),um_change_tag(d))})})});
|
1 |
+
var um_members_directory_busy=[],um_member_directories=[],um_member_directory_last_data=[];function um_parse_current_url(){var r={},t=window.location.search.substring(1).split("&");return jQuery.each(t,function(e){e=t[e].split("=");r[e[0]]=e[1]}),r}function um_get_data_for_directory(e,r){var t=um_members_get_hash(e),a={},i=um_parse_current_url();if(jQuery.each(i,function(e){-1!==e.indexOf("_"+t)&&""!==i[e]&&(a[e.replace("_"+t,"")]=i[e])}),r){if(void 0!==a[r])try{a[r]=decodeURIComponent(a[r])}catch(e){console.error(e)}return a[r]}return a}function um_set_url_from_data(e,r,t){var a=um_members_get_hash(e),i=um_get_data_for_directory(e),m={},d=(Array.isArray(t)?(jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")):jQuery.isNumeric(t)||(t=t.split("||"),jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")),""!==t&&(m[r+"_"+a]=t),jQuery.each(i,function(e){r===e?""!==t&&(m[e+"_"+a]=t):m[e+"_"+a]=i[e]}),jQuery.each(um_member_directories,function(e){var r,t=um_member_directories[e];t!==a&&(r=um_get_data_for_directory(jQuery('.um-directory[data-hash="'+t+'"]')),jQuery.each(r,function(e){m[e+"_"+t]=r[e]}))}),[]),e=(jQuery.each(m,function(e){d.push(e+"="+m[e])}),"?"+(d=wp.hooks.applyFilters("um_member_directory_url_attrs",d)).join("&"));"?"===e&&(e=""),window.history.pushState("string","UM Member Directory",window.location.origin+window.location.pathname+e)}function um_members_get_hash(e){return e.data("hash")}function um_is_directory_busy(e){e=um_members_get_hash(e);return void 0!==um_members_directory_busy[e]&&um_members_directory_busy[e]}function um_members_show_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!0,e.find(".um-members-overlay").show()}function um_members_hide_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!1,e.find(".um-members-overlay").hide()}function um_set_range_label(e,r){var t,a="",i=e.siblings(".um-slider-range").data("placeholder-s"),m=e.siblings(".um-slider-range").data("placeholder-p"),r=r?(a=(r.values[0]===r.values[1]?i.replace("{value}",r.values[0]):m.replace("{min_range}",r.values[0]).replace("{max_range}",r.values[1])).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=r.values[0],r.values[1]):(a=(e.slider("values",0)===e.slider("values",1)?i.replace("{value}",e.slider("values",0)):m.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1))).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=e.slider("values",0),e.slider("values",1));e.siblings(".um-slider-range").html(a),e.siblings(".um_range_min").val(t),e.siblings(".um_range_max").val(r)}function um_get_search(e){return e.find(".um-search-line").length?e.find(".um-search-line").val():""}function um_get_sort(e){return e.data("sorting")}function um_get_current_page(e){e=e.data("page");return e=e&&void 0!==e?e:1}function um_time_convert(e,r){var t=Math.floor(e/60),e=e%60;return 60<=e&&(e=0,24<=(t+=1)&&(t=0)),t+":"+(e=e<10?"0"+e:e)}function um_ajax_get_members(s,e){var r,t,a,i,_,m=um_members_get_hash(s);wp.hooks.applyFilters("um_member_directory_get_members_allow",!0,m,s)?(r=um_get_current_page(s),t=um_get_search(s),a=um_get_sort(s),i=-(new Date).getTimezoneOffset()/60,_={directory_id:m,page:r,search:t,sorting:a,gmt_offset:i,post_refferer:s.data("base-post"),nonce:um_scripts.nonce},s.find(".um-search-filter").length&&s.find(".um-search-filter").each(function(){var e,r,t,a,i,m,d,u=jQuery(this);u.find(".um-slider").length?(m=u.find(".um-slider").data("field_name"),r=um_get_data_for_directory(s,"filter_"+m+"_from"),e=um_get_data_for_directory(s,"filter_"+m+"_to"),void 0===r&&void 0===e||(_[m]=[r,e])):u.find(".um-datepicker-filter").length?(m=u.find(".um-datepicker-filter").data("filter_name"),r=um_get_data_for_directory(s,"filter_"+m+"_from"),e=um_get_data_for_directory(s,"filter_"+m+"_to"),void 0===r&&void 0===e||(_[m]=[r,e])):u.find(".um-timepicker-filter").length?(m=u.find(".um-timepicker-filter").data("filter_name"),r=um_get_data_for_directory(s,"filter_"+m+"_from"),e=um_get_data_for_directory(s,"filter_"+m+"_to"),void 0!==r&&(r=(i=(i=+(r=r.split(":"))[0])<10?"0"+i:i)+":"+(a=(a=+r[1])<10?"0"+a:a)+":00"),void 0!==e&&(a=+(t=e.split(":"))[1],e=(i=(i=+t[0])<10?"0"+i:i)+":"+(a=a<10?"0"+a:a)+":59"),void 0===r&&void 0===e||(_[m]=[r,e])):u.find("select").length?(m=u.find("select").attr("name"),void 0!==(d=um_get_data_for_directory(s,"filter_"+m))&&(d=um_unsanitize_value(d),_[m]=d.split("||"))):u.hasClass("um-text-filter-type")&&u.find('input[type="text"]').length?(m=u.find('input[type="text"]').attr("name"),void 0!==(d=um_get_data_for_directory(s,"filter_"+m))&&(d=um_unsanitize_value(d),_[m]=d)):_=wp.hooks.applyFilters("um_member_directory_custom_filter_handler",_,u,s)}),_=wp.hooks.applyFilters("um_member_directory_filter_request",_),wp.ajax.send("um_get_members",{data:_,success:function(e){um_member_directory_last_data[m]=e,um_build_template(s,e);var r=wp.template("um-members-pagination");s.find(".um-members-pagination-box").html(r(e)),s.data("total_pages",e.pagination.total_pages),e.pagination.total_pages?(s.find(".um-member-directory-sorting-options").prop("disabled",!1),s.find(".um-member-directory-view-type").removeClass("um-disabled")):(s.find(".um-member-directory-sorting-options").prop("disabled",!0),s.find(".um-member-directory-view-type").addClass("um-disabled")),wp.hooks.doAction("um_member_directory_loaded",s,e),um_init_new_dropdown(),um_members_hide_preloader(s)},error:function(e){console.log(e),um_members_hide_preloader(s)}})):setTimeout(um_ajax_get_members,600,s,e)}function um_build_template(e,r){var t=e.data("view_type"),t=wp.template("um-member-"+t+"-"+um_members_get_hash(e)),t=(e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-members-wrapper").prepend(t(r.users)),wp.template("um-members-header")),a=(e.find(".um-members-intro").remove(),wp.hooks.applyFilters("um_member_directory_generate_header",!1,e));(void 0!==r.is_search&&r.is_search||a)&&e.find(".um-members-wrapper").prepend(t(r)),e.addClass("um-loaded"),e.find(".um-members.um-members-grid").length&&UM_Member_Grid(e.find(".um-members.um-members-grid")),jQuery(document).trigger("um_build_template",[e,r]),jQuery(window).trigger("resize"),init_tipsy()}function UM_Member_Grid(r){r.find(".um-member").length&&r.imagesLoaded(function(){var e=wp.hooks.applyFilters("um_member_directory_grid_masonry_attrs",{itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"},r);r.masonry(e).on("layoutComplete",function(e,r){jQuery(document).trigger("um_grid_initialized",[e,r])})})}function um_get_filters_data(s){var _=[];return s.find(".um-search-filter").each(function(){var d,t,a,i,e,r,m,u=jQuery(this);u.find("input.um-datepicker-filter").length?(d="datepicker",u.find("input.um-datepicker-filter").each(function(){var e,r,t,a,i,m;"to"!==jQuery(this).data("range")&&(e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(s,"filter_"+e+"_from"),t=um_get_data_for_directory(s,"filter_"+e+"_to"),void 0===r&&void 0===t||((a=jQuery(this).val())===(i=s.find('input.um-datepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val())?m=i:""!==a&&""!==i?m=a+" - "+i:""===a?m="before "+i:""===i&&(m="since "+a),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:m,value:[r,t],type:d})))})):u.find("input.um-timepicker-filter").length?(d="timepicker",u.find("input.um-timepicker-filter").each(function(){var e,r,t,a,i,m;"to"!==jQuery(this).data("range")&&(e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(s,"filter_"+e+"_from"),t=um_get_data_for_directory(s,"filter_"+e+"_to"),void 0===r&&void 0===t||((a=jQuery(this).val())===(i=s.find('input.um-timepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val())?m=i:""!==a&&""!==i?m=a+" - "+i:""===a?m="before "+i:""===i&&(m="since "+a),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:m,value:[r,t],type:d})))})):u.find("select").length?(d="select",t=u.find("select").attr("name"),a=u.find("select").data("placeholder"),i=void 0===(i=um_get_data_for_directory(s,"filter_"+t))?[]:(i=um_unsanitize_value(i)).split("||"),jQuery.each(i,function(e){var r=u.find('select option[value="'+i[e]+'"]').data("value_label");_.push({name:t,label:a,value_label:r,value:i[e],type:d})})):u.hasClass("um-text-filter-type")&&u.find('input[type="text"]').length?(d="text",t=u.find('input[type="text"]').attr("name"),a=u.find('input[type="text"]').attr("placeholder"),""!=(i=void 0===(i=um_get_data_for_directory(s,"filter_"+t))?"":i)&&_.push({name:t,label:a,value_label:i,value:i,type:d})):u.find("div.ui-slider").length?(d="slider",t=u.find("div.ui-slider").data("field_name"),e=um_get_data_for_directory(s,"filter_"+t+"_from"),r=um_get_data_for_directory(s,"filter_"+t+"_to"),void 0===e&&void 0===r||(m=(e===r?u.find("div.um-slider-range").data("placeholder-s").replace("{value}",e):u.find("div.um-slider-range").data("placeholder-p").replace("{min_range}",e).replace("{max_range}",r)).replace("{field_label}",u.find("div.um-slider-range").data("label")),a=u.find("div.um-slider-range").data("label"),_.push({name:t,label:a,value_label:m,value:[e,r],type:d}))):_=wp.hooks.applyFilters("um_member_directory_get_filter_data",_,s,u)}),_}function um_change_tag(e){var r,t=um_get_filters_data(e),a=(e.find(".um-members-filter-tag").remove(),e.find(".um-filtered-line"));a.length&&(r=wp.template("um-members-filtered-line"),a.prepend(r({filters:t})),0===e.find(".um-members-filter-remove").length?(e.find(".um-clear-filters").hide(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(e.find(".um-clear-filters").show(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible")))}function um_run_search(e){if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=um_get_data_for_directory(e,"search"),t=um_sanitize_value(e.find(".um-search-line").val());if(t===r||""===t&&void 0===r)um_members_hide_preloader(e);else{e.data("general_search",t),um_set_url_from_data(e,"search",t),e.data("page",1),um_set_url_from_data(e,"page","");if(!wp.hooks.applyFilters("um_member_directory_ignore_after_search",!1,e)){r=e.data("must-search");if(1===r&&(t=um_get_search(e),0===e.find(".um-members-filter-remove").length&&!t))return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),void um_members_hide_preloader(e)}e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}}jQuery(document.body).ready(function(){jQuery(".um-directory .um-search-filter select").each(function(){1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var e=jQuery(this);e.select2("destroy").select2({dropdownParent:e.parent()})}),jQuery(document.body).on("mouseover",".um-directory .um-member-directory-view-type",function(){var e;jQuery(this).hasClass("um-disabled")||((e=jQuery(this).find(".um-member-directory-view-type-a:visible")).hide(),(e.next().length?e.next():jQuery(this).find(".um-member-directory-view-type-a:first")).show().tipsy("show"))}).on("mouseout",".um-directory .um-member-directory-view-type",function(){jQuery(this).hasClass("um-disabled")||(jQuery(this).find(".um-member-directory-view-type-a").hide().tipsy("hide"),jQuery(this).find('.um-member-directory-view-type-a[data-type="'+jQuery(this).parents(".um-directory").data("view_type")+'"]').show())}),jQuery(document.body).on("click",".um-directory .um-member-directory-view-type-a",function(){var e=jQuery(this).parents(".um-directory");if(um_is_directory_busy(e))return!1;var r,t=jQuery(this),a=t.parents(".um-member-directory-view-type");a.hasClass("um-disabled")||(um_members_show_preloader(e),(r=a.find(".um-member-directory-view-type-a:visible")).hide(),(r.next().length?r.next():a.find(".um-member-directory-view-type-a:first")).show().tipsy("show"),null!==(r=um_member_directory_last_data[um_members_get_hash(e)])&&(um_set_url_from_data(e,"view_type",a=t.data("type")),e.data("view_type",a),um_build_template(e,r),um_init_new_dropdown()),um_members_hide_preloader(e))}),jQuery(document.body).on("click",".um-directory .um-do-search",function(){um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("keypress",".um-directory .um-search-line",function(e){13===e.which&&um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("click",'.um-new-dropdown[data-element=".um-member-directory-sorting-a"] li a',function(){var e,r,t;1!==jQuery(this).data("selected")&&(e=jQuery(this).data("directory-hash"),um_is_directory_busy(e=jQuery('.um-directory[data-hash="'+e+'"]'))||(um_members_show_preloader(e),r=jQuery(this).html(),t=jQuery(this).data("value"),e.data("sorting",t),um_set_url_from_data(e,"sort",t),um_ajax_get_members(e),e.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),e.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"] a[data-value="'+t+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),e.find(".um-member-directory-sorting-a").find("> a").html(r)))}),jQuery(document.body).on("click",".um-directory .pagi:not(.current)",function(){var e,r;jQuery(this).hasClass("disabled")||(um_is_directory_busy(e=jQuery(this).parents(".um-directory"))||(um_members_show_preloader(e),1===(r="first"===jQuery(this).data("page")?1:"prev"===jQuery(this).data("page")?+e.data("page")-1:"next"===jQuery(this).data("page")?+e.data("page")+1:"last"===jQuery(this).data("page")?parseInt(e.data("total_pages")):parseInt(jQuery(this).data("page")))?(e.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass("disabled"),e.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled")):(r===parseInt(e.data("total_pages"))?e.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass("disabled"):e.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled"),e.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass("disabled")),e.find(".pagi").removeClass("current"),e.find('.pagi[data-page="'+r+'"]').addClass("current"),e.data("page",r),um_set_url_from_data(e,"page",1===r?"":r),um_ajax_get_members(e)))}),jQuery(document.body).on("change",".um-directory .um-members-pagi-dropdown",function(){var e,r=jQuery(this).parents(".um-directory");um_is_directory_busy(r)||(um_members_show_preloader(r),e=jQuery(this).val(),r.find(".pagi").removeClass("current"),r.find('.pagi[data-page="'+e+'"]').addClass("current"),r.data("page",e),um_set_url_from_data(r,"page",1===e?"":e),um_ajax_get_members(r))}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-more a",function(e){e.preventDefault();e=jQuery(this).parents(".um-member");return e.find(".um-member-more").hide(),e.find(".um-member-meta-main").slideDown(),e.find(".um-member-less").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-less a",function(e){e.preventDefault();e=jQuery(this).parents(".um-member");return e.find(".um-member-less").hide(),e.find(".um-member-meta-main").slideUp(),e.find(".um-member-more").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-more a",function(e){e.preventDefault();var e=jQuery(this).parents(".um-member"),r=jQuery(this).parents(".um-members");return e.find(".um-member-more").hide(),e.find(".um-member-meta").slideDown(function(){UM_Member_Grid(r)}),e.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(r)},100),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-less").hide(),r.find(".um-member-meta").slideUp(function(){r.find(".um-member-more").fadeIn(),UM_Member_Grid(t)}),!1}),jQuery(".um-member-directory-filters-a").on("click",function(){var e=jQuery(this),r=e.parents(".um-directory").find(".um-search");r.is(":visible")?r.slideUp(250,function(){e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}):r.slideDown({duration:250,start:function(){jQuery(this).css({display:"grid"}),e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}})}),jQuery(document.body).on("change",".um-directory .um-search-filter select",function(){var e,r,t,a=jQuery(this).val(),i=um_sanitize_value(a);""===i||um_is_directory_busy(e=jQuery(this).parents(".um-directory"))||(um_members_show_preloader(e),t=void 0===(t=um_get_data_for_directory(e,"filter_"+(r=jQuery(this).prop("name"))))?[]:t.split("||"),-1===jQuery.inArray(i,t)&&(t.push(i),um_set_url_from_data(e,"filter_"+r,t=t.join("||")),e.data("page",1),um_set_url_from_data(e,"page","")),jQuery(this).find('option[value="'+a+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0),(i=jQuery(this)).select2("destroy").select2({dropdownParent:i.parent()}),i.val("").trigger("change"),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}),jQuery(document.body).on("blur",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(){var e,r,t,a=jQuery(this).parents(".um-directory");um_is_directory_busy(a)||(e=um_sanitize_value(jQuery(this).val()))!==(t=void 0===(t=um_get_data_for_directory(a,"filter_"+(r=jQuery(this).prop("name"))))?"":t)&&(um_members_show_preloader(a),um_set_url_from_data(a,"filter_"+r,e),a.data("page",1),um_set_url_from_data(a,"page",""),um_ajax_get_members(a),um_change_tag(a),a.data("searched",1),a.find(".um-member-directory-sorting-options").prop("disabled",!1),a.find(".um-member-directory-view-type").removeClass("um-disabled"))}),jQuery(document.body).on("keypress",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(e){var r,t,a;13!==e.which||um_is_directory_busy(e=jQuery(this).parents(".um-directory"))||(r=um_sanitize_value(jQuery(this).val()))!==(a=void 0===(a=um_get_data_for_directory(e,"filter_"+(t=jQuery(this).prop("name"))))?"":a)&&(um_members_show_preloader(e),um_set_url_from_data(e,"filter_"+t,r),e.data("page",1),um_set_url_from_data(e,"page",""),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}),jQuery(document.body).on("click",".um-directory .um-members-filter-remove",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)&&e){um_members_show_preloader(e);var r=jQuery(this).data("value"),t=jQuery(this).data("name"),a=jQuery(this).data("type"),i=("text"===a?(um_set_url_from_data(e,"filter_"+t,""),jQuery('.um-search-filter input[name="'+t+'"]').val("")):"select"===a?(m=void 0===(m=um_get_data_for_directory(e,"filter_"+t))?[]:(m=um_unsanitize_value(m)).split("||"),um_set_url_from_data(e,"filter_"+t,m=(m=-1!==jQuery.inArray(r.toString(),m)?jQuery.grep(m,function(e){return e!==r.toString()}):m).length?m:""),(m=jQuery('.um-search-filter select[name="'+t+'"]')).find('option[value="'+r+'"]').prop("disabled",!1).show(),1<m.find("option:not(:disabled)").length&&m.prop("disabled",!1),m.select2("destroy").select2({dropdownParent:m.parent()}),0<e.find('.um-search-filter select[data-um-parent="'+t+'"]').length&&m.trigger("change")):"slider"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""),i=(m=jQuery(".um-search-filter #"+t+"_min").siblings(".um-slider")).slider("option"),m.slider("values",[i.min,i.max]),jQuery(".um-search-filter #"+t+"_min").val(""),jQuery(".um-search-filter #"+t+"_max").val(""),um_set_range_label(m)):"datepicker"===a||"timepicker"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""),jQuery(".um-search-filter #"+t+"_from").val(""),jQuery(".um-search-filter #"+t+"_to").val("")):wp.hooks.doAction("um_member_directory_filter_remove",a,e,t,r),e.data("page",1),um_set_url_from_data(e,"page",""),jQuery(this).tipsy("hide"),jQuery(this).parents(".um-members-filter-tag").remove(),0===e.find(".um-members-filter-remove").length?e.find(".um-clear-filters").hide():e.find(".um-clear-filters").show(),wp.hooks.applyFilters("um_member_directory_ignore_after_search",!1,e));if(!i)if(1===e.data("must-search")){var m=um_get_search(e);if(0===e.find(".um-members-filter-remove").length&&!m)return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),void um_members_hide_preloader(e)}e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-clear-filters-a",function(){var m=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(m)){um_members_show_preloader(m),m.find(".um-members-filter-remove").each(function(){var e,r,t=jQuery(this).data("value"),a=jQuery(this).data("name"),i=jQuery(this).data("type");"text"===i?(um_set_url_from_data(m,"filter_"+a,""),jQuery('.um-search-filter input[name="'+a+'"]').val("")):"select"===i?(e=void 0===(e=um_get_data_for_directory(m,"filter_"+a))?[]:(e=um_unsanitize_value(e)).split("||"),(e=-1!==jQuery.inArray(t.toString(),e)?jQuery.grep(e,function(e){return e!==t.toString()}):e).length||(e=""),um_set_url_from_data(m,"filter_"+a,e),(e=jQuery('.um-search-filter select[name="'+a+'"]')).find('option[value="'+t+'"]').prop("disabled",!1).show(),1<e.find("option:not(:disabled)").length&&e.prop("disabled",!1),e.select2("destroy").select2({dropdownParent:e.parent()}),0<m.find('.um-search-filter select[data-um-parent="'+a+'"]').length&&e.trigger("change")):"slider"===i?(um_set_url_from_data(m,"filter_"+a+"_from",""),um_set_url_from_data(m,"filter_"+a+"_to",""),r=(e=jQuery(".um-search-filter #"+a+"_min").siblings(".um-slider")).slider("option"),e.slider("values",[r.min,r.max]),jQuery(".um-search-filter #"+a+"_min").val(""),jQuery(".um-search-filter #"+a+"_max").val(""),um_set_range_label(e)):"datepicker"===i||"timepicker"===i?(um_set_url_from_data(m,"filter_"+a+"_from",""),um_set_url_from_data(m,"filter_"+a+"_to",""),jQuery(".um-search-filter #"+a+"_from").val(""),jQuery(".um-search-filter #"+a+"_to").val("")):wp.hooks.doAction("um_member_directory_clear_filters",i,m,a,t)}),m.data("page",1),um_set_url_from_data(m,"page",""),m.find(".um-members-filter-tag").remove(),0===m.find(".um-members-filter-remove").length?(m.find(".um-clear-filters").hide(),m.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(m.find(".um-clear-filters").show(),m.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible"));if(!wp.hooks.applyFilters("um_member_directory_ignore_after_search",!1,m)){var e=m.data("must-search");if(1===e)if(!um_get_search(m))return m.data("searched",0),m.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),m.find(".um-member-directory-sorting-options").prop("disabled",!0),m.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",m),void um_members_hide_preloader(m)}m.find(".um-member-directory-sorting-options").prop("disabled",!1),m.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(m)}}),wp.hooks.doAction("um_member_directory_on_first_pages_loading"),jQuery(".um-directory").each(function(){var e=jQuery(this),r=um_members_get_hash(e),t=(um_member_directories.push(r),e.find(".um-search").length&&!e.find(".um-search").is(":visible")&&e.find(".um-search").css({display:"grid"}).slideUp(1),e.find(".um-slider").each(function(){var e=jQuery(this),t=e.parents(".um-directory"),a=e.data("field_name"),r=um_get_data_for_directory(t,"filter_"+a+"_from"),i=um_get_data_for_directory(t,"filter_"+a+"_to"),r=[r=void 0===r?parseInt(e.data("min")):r,i=void 0===i?parseInt(e.data("max")):i];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:r,create:function(e,r){},step:1,slide:function(e,r){um_set_range_label(jQuery(this),r)},stop:function(e,r){um_is_directory_busy(t)||(um_members_show_preloader(t),um_set_url_from_data(t,"filter_"+a+"_from",r.values[0]),um_set_url_from_data(t,"filter_"+a+"_to",r.values[1]),t.data("page",1),um_set_url_from_data(t,"page",""),um_ajax_get_members(t),um_change_tag(t),t.data("searched",1),t.find(".um-member-directory-sorting-options").prop("disabled",!1),t.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),um_set_range_label(e)}),e.find(".um-datepicker-filter").each(function(){var d=jQuery(this),u=new Date(1e3*d.data("date_min")),s=new Date(1e3*d.data("date_max")),e=d.pickadate({selectYears:!0,min:u,max:s,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){d.blur()},onClose:function(){d.blur()},onSet:function(e){var r,t,a,i,m;!e.select||um_is_directory_busy(r=d.parents(".um-directory"))||(um_members_show_preloader(r),t=d.data("filter_name"),a=d.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to"),void 0===i&&(i=u/1e3),void 0===m&&(m=s/1e3),e=e.select/1e3,d.val(),"from"===a?i=e:"to"===a&&(m=e),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled"))}}).pickadate("picker"),r=d.data("filter_name"),t=d.data("range"),r=um_get_data_for_directory(d.parents(".um-directory"),"filter_"+r+"_"+t);void 0!==r&&e.set("select",1e3*r)}),e.find(".um-timepicker-filter").each(function(){var d=jQuery(this),u=d.attr("id"),s=d.data("filter_name"),_=d.attr("data-min"),o=d.attr("data-max"),e=_.split(":"),r=o.split(":"),e=d.pickatime({format:d.data("format"),interval:parseInt(d.data("intervals")),min:[e[0],e[1]],max:[r[0],r[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){d.blur()},onClose:function(){d.blur()},onSet:function(e){var r,t,a,i,m;!e.select||um_is_directory_busy(r=d.parents(".um-directory"))||(um_members_show_preloader(r),t=d.data("filter_name"),a=d.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to"),void 0===i&&(i=_),void 0===m&&(m=o),void 0!==e.select?(e=um_time_convert(e.select,a),"from"===a?i=e:"to"===a&&(m=e)):"from"===a?i=_:"to"===a&&(m=o),e=jQuery("#"+u).val(),"from"===d.data("range")?jQuery("#"+s+"_to").pickatime("picker").set("min",e):jQuery("#"+s+"_from").pickatime("picker").set("max",e),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled"))}}).pickatime("picker"),r=d.data("filter_name"),t=d.data("range"),r=um_get_data_for_directory(d.parents(".um-directory"),"filter_"+r+"_"+t);void 0!==r&&(t=r.split(":"),e.set("select",60*t[0]+ +t[1]))}),wp.hooks.doAction("um_member_directory_on_init",e,r),wp.hooks.applyFilters("um_member_directory_ignore_after_search",!1,e));if(!t&&1===e.data("must-search")){t=um_get_search(e);if(!um_get_filters_data(e).length&&!t)return}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,e,r)||(um_members_show_preloader(e),um_ajax_get_members(e,{first_load:!0}),um_change_tag(e))}),window.addEventListener("popstate",function(e){jQuery(".um-directory").each(function(){var e,a=jQuery(this),r=um_members_get_hash(a),t=(um_member_directories.push(r),um_members_show_preloader(a),a.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),a.find(".um-member-directory-search-line").length&&(i=um_get_data_for_directory(a,"search"),a.data("general_search",i=void 0===i?"":i),a.find(".um-search-line").val(i)),um_get_data_for_directory(a,"page")),t=(void 0===t?t=1:t>a.data("total_pages")&&(t=a.data("total_pages")),a.data("page",t).attr("data-page",t),a.find(".um-member-directory-sorting").length&&(void 0===(t=um_get_data_for_directory(a,"sort"))&&(t=a.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find('a[data-default="1"]').data("value")),a.data("sorting",t),(e=a.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]')).find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),e.find('a[data-value="'+t+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),a.find(".um-member-directory-sorting-a").find("> a").html(e.find('a[data-value="'+t+'"]').html())),a.find(".um-member-directory-view-type").length&&(void 0===(e=um_get_data_for_directory(a,"view_type"))&&(e=a.find('.um-member-directory-view-type-a[data-default="1"]').data("type")),a.data("view_type",e),a.find(".um-member-directory-view-type .um-member-directory-view-type-a").hide(),a.find('.um-member-directory-view-type .um-member-directory-view-type-a[data-type="'+e+'"]').show()),a.find(".um-datepicker-filter").each(function(){var e=jQuery(this),r=e.pickadate("picker"),t=e.data("filter_name"),e=e.data("range"),t=um_get_data_for_directory(a,"filter_"+t+"_"+e);void 0!==t?r.set("select",1e3*t):r.clear()}),a.find(".um-slider").each(function(){var e=jQuery(this),r=e.data("field_name"),t=um_get_data_for_directory(a,"filter_"+r+"_from"),r=um_get_data_for_directory(a,"filter_"+r+"_to");void 0===t&&(t=e.data("min")),t=parseInt(t),void 0===r&&(r=e.data("max")),r=parseInt(r),e.slider("values",[t,r]),um_set_range_label(e)}),a.find(".um-timepicker-filter").each(function(){var e=jQuery(this),r=e.pickatime("picker"),t=e.data("filter_name"),e=e.data("range"),t=um_get_data_for_directory(a,"filter_"+t+"_"+e);void 0!==t?(e=t.split(":"),r.set("select",60*e[0])):r.clear()}),wp.hooks.applyFilters("um_member_directory_ignore_after_search",!1,a));if(!t&&1===a.data("must-search")){var i=um_get_search(a);if(!um_get_filters_data(a).length&&!i)return a.data("searched",0),void um_members_hide_preloader(a);a.data("searched",1)}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,a,r)||(um_ajax_get_members(a),um_change_tag(a))})})});
|
assets/js/um-modal.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(){jQuery(document).on("click",".um-popup-overlay",function(){remove_Modal()}),jQuery(document).on("click",'.um-modal-overlay, a[data-action="um_remove_modal"]',function(){um_remove_modal()}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"], .um-modal:not(:has(.um-form)) a',function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-modal .um-single-file-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),
|
1 |
+
jQuery(document).ready(function(){jQuery(document).on("click",".um-popup-overlay",function(){remove_Modal()}),jQuery(document).on("click",'.um-modal-overlay, a[data-action="um_remove_modal"]',function(){um_remove_modal()}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"], .um-modal:not(:has(.um-form)) a',function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-modal .um-single-file-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),e=jQuery(this).parents(".um-modal-body").find(".um-single-fileinfo a").attr("href"),t=a.find(".um-single-file-upload").data("set_mode");return jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:e,mode:t,nonce:um_scripts.nonce},success:function(){a.find(".um-single-file-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive()}}),!1}),jQuery(document).on("click",".um-modal .um-single-image-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),e=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview img").attr("src"),t=a.find(".um-single-image-upload").data("set_mode");return jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:e,mode:t,nonce:um_scripts.nonce},success:function(){jQuery("img.cropper-hidden").cropper("destroy"),a.find(".um-single-image-preview img").attr("src",""),a.find(".um-single-image-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive()}}),!1}),jQuery(document).on("click",".um-finish-upload.file:not(.disabled)",function(){var e=jQuery(this).attr("data-key"),a=jQuery(this).parents(".um-modal-body").find(".um-single-file-preview").html(),a=(um_remove_modal(),jQuery(".um-single-file-preview[data-key="+e+"]").fadeIn().html(a),jQuery(".um-field[data-key="+e+"]").find(".um-single-fileinfo a").data("file"));jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find(".um-btn-auto-width").html(jQuery(this).attr("data-change")),jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find('input[type="hidden"]').val(a)}),jQuery(document).on("click",".um-finish-upload.image:not(.disabled)",function(){var a,e,t=jQuery(this),i=jQuery(this).attr("data-key"),r=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview"),u=r.find("img").attr("src"),d=r.attr("data-coord"),r=r.find("img").data("file"),m=0,n=(jQuery(this).parents("#um_upload_single").data("user_id")&&(m=jQuery(this).parents("#um_upload_single").data("user_id")),0),o="";1===jQuery('div.um-field-image[data-key="'+i+'"]').length&&(n=(e=jQuery('div.um-field-image[data-key="'+i+'"]').closest(".um-form")).find('input[name="form_id"]').val(),o=e.attr("data-mode")),d?(jQuery(this).html(jQuery(this).attr("data-processing")).addClass("disabled"),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_resize_image",src:u,coord:d,user_id:m,key:i,set_id:n,set_mode:o,nonce:um_scripts.nonce},success:function(e){e.success&&(a=new Date,"profile_photo"===i?jQuery(".um-profile-photo-img img").attr("src",e.data.image.source_url+"?"+a.getTime()):"cover_photo"===i&&(jQuery(".um-cover-e").empty().html('<img src="'+e.data.image.source_url+"?"+a.getTime()+'" alt="" />'),jQuery(".um").hasClass("um-editing")&&jQuery(".um-cover-overlay").show()),jQuery(".um-single-image-preview[data-key="+i+"]").fadeIn().find("img").attr("src",e.data.image.source_url+"?"+a.getTime()),um_remove_modal(),jQuery("img.cropper-invisible").remove(),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find(".um-btn-auto-width").html(t.attr("data-change")),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find('input[type="hidden"]').val(e.data.image.filename))}})):(a=new Date,jQuery(".um-single-image-preview[data-key="+i+"]").fadeIn().find("img").attr("src",u+"?"+a.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find(".um-btn-auto-width").html(t.attr("data-change")),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find("input[type=hidden]").val(r))}),jQuery(document.body).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var a=jQuery(this).attr("data-modal"),t="normal";jQuery(this).data("modal-size")&&(t=jQuery(this).data("modal-size")),jQuery(this).data("modal-copy")&&(jQuery("#"+a).html(jQuery(this).parents(".um-field").find(".um-modal-hidden-content").html()),jQuery(this).parents(".um-profile-photo").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-profile-photo").attr("data-user_id")),jQuery(this).parents(".um-cover").attr("data-ratio")&&jQuery("#"+a).attr("data-ratio",jQuery(this).parents(".um-cover").attr("data-ratio")),jQuery(this).parents(".um-cover").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-cover").attr("data-user_id")),0<jQuery('input[type="hidden"][name="user_id"]').length&&jQuery("#"+a).attr("data-user_id",jQuery('input[type="hidden"][name="user_id"]').val())),um_new_modal(a,t)})});
|
assets/js/um-profile.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(){jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-profile.um-viewing .um-profile-body").find(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document.body).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").trigger("submit"),!1}),jQuery(document.body).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document.body).on("click",".um-cover a.um-cover-add, .um-photo a",function(e){e.preventDefault()}),jQuery(document.body).on("click",".um-photo-modal",function(e){e.preventDefault();
|
1 |
+
jQuery(document).ready(function(){jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-profile.um-viewing .um-profile-body").find(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document.body).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").trigger("submit"),!1}),jQuery(document.body).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document.body).on("click",".um-cover a.um-cover-add, .um-photo a",function(e){e.preventDefault()}),jQuery(document.body).on("click",".um-photo-modal",function(e){e.preventDefault();e=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,e),!1}),jQuery(document.body).on("click",".um-reset-profile-photo",function(e){return jQuery(".um-profile-photo-img img").attr("src",jQuery(this).attr("data-default_src")),user_id=jQuery(this).attr("data-user_id"),metakey="profile_photo",UM.dropdown.hideAll(),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_delete_profile_photo",metakey:metakey,user_id:user_id,nonce:um_scripts.nonce}}),jQuery(this).parents("li").hide(),!1}),jQuery(document.body).on("click",".um-reset-cover-photo",function(e){var r=jQuery(this);return jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="javascript:void(0);" class="um-cover-add" style="height: 370px;"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" original-title="Upload a cover photo"></i></span></a>'),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_delete_cover_photo",metakey:metakey,user_id:user_id,nonce:um_scripts.nonce},success:function(e){r.hide()}}),UM.dropdown.hideAll(),!1}),jQuery(document.body).on("change, keyup",'textarea[id="um-meta-bio"]',function(){var e;void 0!==jQuery(this).val()&&(e=jQuery(this).attr("data-character-limit")-jQuery(this).val().length,jQuery("span.um-meta-bio-character span.um-bio-limit").text(e),e<5?jQuery("span.um-meta-bio-character").css("color","red"):jQuery("span.um-meta-bio-character").css("color",""))}),jQuery('textarea[id="um-meta-bio"]').trigger("change"),jQuery(".um-profile-edit a.um_delete-item").on("click",function(e){if(e.preventDefault(),!confirm(wp.i18n.__("Are you sure that you want to delete this user?","ultimate-member")))return!1}),jQuery(".um-profile-nav a").on("touchend",function(e){jQuery(e.currentTarget).trigger("click")})});
|
assets/js/um-raty.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(
|
1 |
+
!function(i){"use strict";var r={init:function(t){return this.each(function(){this.self=i(this),r.destroy.call(this.self),this.opt=i.extend(!0,{},i.fn.um_raty.defaults,t),r._adjustCallback.call(this),r._adjustNumber.call(this),"img"!==this.opt.starType&&r._adjustStarType.call(this),r._adjustPath.call(this),r._createStars.call(this),this.opt.cancel&&r._createCancel.call(this),this.opt.precision&&r._adjustPrecision.call(this),r._createScore.call(this),r._apply.call(this,this.opt.score),r._target.call(this,this.opt.score),this.opt.readOnly?r._lock.call(this):(this.style.cursor="pointer",r._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var t=["number","readOnly","score","scoreName","target"],e=0;e<t.length;e++)"function"==typeof this.opt[t[e]]&&(this.opt[t[e]]=this.opt[t[e]].call(this))},_adjustNumber:function(){this.opt.number=r._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var t=["cancelOff","cancelOn","starHalf","starOff","starOn"],e=0;e<t.length;e++)this.opt[t[e]]=this.opt[t[e]].replace(".","-")},_apply:function(t){r._fill.call(this,t),t&&(0<t&&this.score.val(r._between(t,0,this.opt.number)),r._roundStars.call(this,t))},_between:function(t,e,a){return Math.min(Math.max(parseFloat(t),e),a)},_binds:function(){this.cancel&&(r._bindOverCancel.call(this),r._bindClickCancel.call(this),r._bindOutCancel.call(this)),r._bindOver.call(this),r._bindClick.call(this),r._bindOut.call(this)},_bindClick:function(){var a=this;a.stars.on("click.um_raty",function(t){var e=i(this);a.score.val(a.opt.half||a.opt.precision?a.self.data("score"):this.alt||e.data("alt")),a.opt.click&&a.opt.click.call(a,+a.score.val(),t)})},_bindClickCancel:function(){var e=this;e.cancel.on("click.um_raty",function(t){e.score.removeAttr("value"),e.opt.click&&e.opt.click.call(e,null,t)})},_bindOut:function(){var a=this;a.self.on("mouseleave.um_raty",function(t){var e=+a.score.val()||void 0;r._apply.call(a,e),r._target.call(a,e,t),a.opt.mouseout&&a.opt.mouseout.call(a,e,t)})},_bindOutCancel:function(){var a=this;a.cancel.on("mouseleave.um_raty",function(t){var e=a.opt.cancelOff;"img"!==a.opt.starType&&(e=a.opt.cancelClass+" "+e),r._setIcon.call(a,this,e),a.opt.mouseout&&(e=+a.score.val()||void 0,a.opt.mouseout.call(a,e,t))})},_bindOver:function(){var a=this,t=a.opt.half?"mousemove.um_raty":"mouseover.um_raty";a.stars.on(t,function(t){var e=r._getScoreByPosition.call(a,t,this);r._fill.call(a,e),a.opt.half&&(r._roundStars.call(a,e),a.self.data("score",e)),r._target.call(a,e,t),a.opt.mouseover&&a.opt.mouseover.call(a,e,t)})},_bindOverCancel:function(){var s=this;s.cancel.on("mouseover.um_raty",function(t){var e=s.opt.path+s.opt.starOff,a=s.opt.cancelOn;"img"===s.opt.starType?s.stars.attr("src",e):(a=s.opt.cancelClass+" "+a,s.stars.attr("class",e)),r._setIcon.call(s,this,a),r._target.call(s,null,t),s.opt.mouseover&&s.opt.mouseover.call(s,null)})},_buildScoreField:function(){return i("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,e=i("<"+this.opt.starType+" />",{title:this.opt.cancelHint,class:this.opt.cancelClass});"img"===this.opt.starType?e.attr({src:t,alt:"x"}):e.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend(" ").prepend(e):this.self.append(" ").append(e),this.cancel=e},_createScore:function(){var t=i(this.opt.targetScore);this.score=t.length?t:r._buildScoreField.call(this)},_createStars:function(){for(var t=1;t<=this.opt.number;t++){var e=r._nameForIndex.call(this,t),e={alt:t,src:this.opt.path+this.opt[e]};(e="img"!==this.opt.starType?{"data-alt":t,class:e.src}:e).title=r._getHint.call(this,t),i("<"+this.opt.starType+" />",e).appendTo(this),this.opt.space&&this.self.append(t<this.opt.number?" ":"")}this.stars=this.self.children(this.opt.starType)},_error:function(t){i(this).text(t),i.error(t)},_fill:function(t){for(var e=0,a=1;a<=this.stars.length;a++){var s,i,o=this.stars[a-1],n=r._turnOn.call(this,a,t);this.opt.iconRange&&this.opt.iconRange.length>e?(s=this.opt.iconRange[e],i=r._getRangeIcon.call(this,s,n),a<=s.range&&r._setIcon.call(this,o,i),a===s.range&&e++):(i=this.opt[n?"starOn":"starOff"],r._setIcon.call(this,o,i))}},_getRangeIcon:function(t,e){return e?t.on||this.opt.starOn:t.off||this.opt.starOff},_getScoreByPosition:function(t,e){var a,s=parseInt(e.alt||e.getAttribute("data-alt"),10);return this.opt.half&&(a=r._getSize.call(this),t=parseFloat((t.pageX-i(e).offset().left)/a),s=this.opt.precision?s-1+t:s-1+(.5<t?1:.5)),s},_getSize:function(){var t="img"===this.opt.starType?this.stars[0].width:parseFloat(this.stars.eq(0).css("font-size"));return t||r._error.call(this,"Could not be possible get the icon size!"),t},_turnOn:function(t,e){return this.opt.single?t===e:t<=e},_getHint:function(t){var e=this.opt.hints[t-1];return""===e?"":e||t},_lock:function(){var t=parseInt(this.score.val(),10),t=t?r._getHint.call(this,t):this.opt.noRatedMsg;this.style.cursor="",this.title=t,this.score.prop("readonly",!0),this.stars.prop("title",t),this.cancel&&this.cancel.hide(),this.self.data("readonly",!0)},_nameForIndex:function(t){return this.opt.score&&this.opt.score>=t?"starOn":"starOff"},_roundStars:function(t){var e,a=(t%1).toFixed(2);a>this.opt.round.down&&(e="starOn",this.opt.halfShow&&a<this.opt.round.up?e="starHalf":a<this.opt.round.full&&(e="starOff"),a=this.opt[e],e=this.stars[Math.ceil(t)-1],r._setIcon.call(this,e,a))},_setIcon:function(t,e){t["img"===this.opt.starType?"src":"className"]=this.opt.path+e},_setTarget:function(t,e){e=e&&this.opt.targetFormat.toString().replace("{score}",e),t.is(":input")?t.val(e):t.html(e)},_target:function(t,e){var a,s;this.opt.target&&((a=i(this.opt.target)).length||r._error.call(this,"Target selector invalid or missing!"),s=e&&"mouseover"===e.type,void 0===t?t=this.opt.targetText:null===t?t=s?this.opt.cancelHint:this.opt.targetText:("hint"===this.opt.targetType?t=r._getHint.call(this,Math.ceil(t)):this.opt.precision&&(t=parseFloat(t).toFixed(1)),e=e&&"mousemove"===e.type,s||e||this.opt.targetKeep||(t=this.opt.targetText)),r._setTarget.call(this,a,t))},_unlock:function(){this.style.cursor="pointer",this.removeAttribute("title"),this.score.removeAttr("readonly"),this.self.data("readonly",!1);for(var t=0;t<this.opt.number;t++)this.stars[t].title=r._getHint.call(this,t+1);this.cancel&&this.cancel.css("display","")},cancel:function(e){return this.each(function(){var t=i(this);!0!==t.data("readonly")&&(r[e?"click":"score"].call(t,null),this.score.removeAttr("value"))})},click:function(t){return this.each(function(){!0!==i(this).data("readonly")&&(r._apply.call(this,t),this.opt.click&&this.opt.click.call(this,t,i.Event("click")),r._target.call(this,t))})},destroy:function(){return this.each(function(){var t=i(this),e=t.data("raw");e?t.off(".um_raty").empty().css({cursor:e.style.cursor}).removeData("readonly"):t.data("raw",t.clone()[0])})},getScore:function(){var t,e=[];return this.each(function(){t=this.score.val(),e.push(t?+t:void 0)}),1<e.length?e:e[0]},move:function(s){return this.each(function(){var t=parseInt(s,10),e=i(this).data("options"),a=(+s).toFixed(1).split(".")[1];t>=e.number&&(t=e.number-1,a=10);e=r._getSize.call(this)/10,t=i(this.stars[t]),e=t.offset().left+e*parseInt(a,10),a=i.Event("mousemove",{pageX:e});t.trigger(a)})},readOnly:function(e){return this.each(function(){var t=i(this);t.data("readonly")!==e&&(e?(t.off(".um_raty").children("img").off(".um_raty"),r._lock.call(this)):(r._binds.call(this),r._unlock.call(this)),t.data("readonly",e))})},reload:function(){return r.set.call(this,{})},score:function(){var t=i(this);return arguments.length?r.setScore.apply(t,arguments):r.getScore.call(t)},set:function(a){return this.each(function(){var t=i(this),e=t.data("options"),e=i.extend({},e,a);t.um_raty(e)})},setScore:function(t){return this.each(function(){!0!==i(this).data("readonly")&&(r._apply.call(this,t),r._target.call(this,t))})}};i.fn.um_raty=function(t){return r[t]?r[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void i.error("Method "+t+" does not exist!"):r.init.apply(this,arguments)},i.fn.um_raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:wp.i18n.__("Cancel this rating!","ultimate-member"),cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:wp.i18n.__("Not rated yet!","ultimate-member"),number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery);
|
assets/js/um-scripts.js
CHANGED
@@ -1,716 +1,716 @@
|
|
1 |
-
function um_sanitize_value( value, el ) {
|
2 |
-
var element = document.createElement( 'div' );
|
3 |
-
element.innerText = value;
|
4 |
-
var sanitized_value = element.innerHTML;
|
5 |
-
if ( el ) {
|
6 |
-
jQuery( el ).val( sanitized_value );
|
7 |
-
}
|
8 |
-
|
9 |
-
return sanitized_value;
|
10 |
-
}
|
11 |
-
|
12 |
-
function um_unsanitize_value( input ) {
|
13 |
-
var e = document.createElement( 'textarea' );
|
14 |
-
e.innerHTML = input;
|
15 |
-
// handle case of empty input
|
16 |
-
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
|
17 |
-
}
|
18 |
-
|
19 |
-
|
20 |
-
function um_init_datetimepicker() {
|
21 |
-
jQuery('.um-datepicker:not(.picker__input)').each(function(){
|
22 |
-
var elem = jQuery(this);
|
23 |
-
|
24 |
-
var disable = false;
|
25 |
-
if ( typeof elem.attr('data-disabled_weekdays') != 'undefined' && elem.attr('data-disabled_weekdays') !== '' ) {
|
26 |
-
disable = JSON.parse( elem.attr('data-disabled_weekdays') );
|
27 |
-
}
|
28 |
-
|
29 |
-
var years_n = null;
|
30 |
-
if ( typeof elem.attr('data-years') != 'undefined' ) {
|
31 |
-
years_n = elem.attr('data-years');
|
32 |
-
}
|
33 |
-
|
34 |
-
var minRange = elem.attr('data-date_min');
|
35 |
-
var maxRange = elem.attr('data-date_max');
|
36 |
-
|
37 |
-
var minSplit = [], maxSplit = [];
|
38 |
-
if ( typeof minRange != 'undefined' ) {
|
39 |
-
minSplit = minRange.split(",");
|
40 |
-
}
|
41 |
-
if ( typeof maxRange != 'undefined' ) {
|
42 |
-
maxSplit = maxRange.split(",");
|
43 |
-
}
|
44 |
-
|
45 |
-
var min = minSplit.length ? new Date(minSplit) : null;
|
46 |
-
var max = minSplit.length ? new Date(maxSplit) : null;
|
47 |
-
|
48 |
-
// fix min date for safari
|
49 |
-
if ( min && min.toString() == 'Invalid Date' && minSplit.length == 3 ) {
|
50 |
-
var minDateString = minSplit[1] + '/' + minSplit[2] + '/' + minSplit[0];
|
51 |
-
min = new Date(Date.parse(minDateString));
|
52 |
-
}
|
53 |
-
|
54 |
-
// fix max date for safari
|
55 |
-
if ( max && max.toString() == 'Invalid Date' && maxSplit.length == 3 ) {
|
56 |
-
var maxDateString = maxSplit[1] + '/' + maxSplit[2] + '/' + maxSplit[0];
|
57 |
-
max = new Date(Date.parse(maxDateString));
|
58 |
-
}
|
59 |
-
|
60 |
-
var data = {
|
61 |
-
disable: disable,
|
62 |
-
format: elem.attr( 'data-format' ),
|
63 |
-
formatSubmit: 'yyyy/mm/dd',
|
64 |
-
hiddenName: true,
|
65 |
-
onOpen: function() { elem.blur(); },
|
66 |
-
onClose: function() { elem.blur(); }
|
67 |
-
};
|
68 |
-
|
69 |
-
if ( years_n !== null ) {
|
70 |
-
data.selectYears = years_n;
|
71 |
-
}
|
72 |
-
|
73 |
-
if ( min !== null ) {
|
74 |
-
data.min = min;
|
75 |
-
}
|
76 |
-
|
77 |
-
if ( max !== null ) {
|
78 |
-
data.max = max;
|
79 |
-
}
|
80 |
-
|
81 |
-
elem.pickadate( data );
|
82 |
-
});
|
83 |
-
|
84 |
-
jQuery('.um-timepicker:not(.picker__input)').each(function(){
|
85 |
-
var elem = jQuery(this);
|
86 |
-
|
87 |
-
elem.pickatime({
|
88 |
-
format: elem.attr('data-format'),
|
89 |
-
interval: parseInt( elem.attr('data-intervals') ),
|
90 |
-
formatSubmit: 'HH:i',
|
91 |
-
hiddenName: true,
|
92 |
-
onOpen: function() { elem.blur(); },
|
93 |
-
onClose: function() { elem.blur(); }
|
94 |
-
});
|
95 |
-
});
|
96 |
-
}
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
function init_tipsy() {
|
101 |
-
if ( typeof( jQuery.fn.tipsy ) === 'function' ) {
|
102 |
-
jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live', offset: 3 });
|
103 |
-
jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live', offset: 3 });
|
104 |
-
jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live', offset: 3 });
|
105 |
-
jQuery('.um-tip-s').tipsy({gravity: 's', opacity: 1, live: 'a.live', offset: 3 });
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
jQuery(document).ready(function() {
|
110 |
-
|
111 |
-
jQuery( document.body ).on('click', '.um-dropdown a.real_url', function() {
|
112 |
-
window.location = jQuery(this).attr('href');
|
113 |
-
});
|
114 |
-
|
115 |
-
jQuery( document.body ).on( 'click', '.um-trigger-menu-on-click', function() {
|
116 |
-
var menu = jQuery(this).find('.um-dropdown');
|
117 |
-
UM.dropdown.show( menu );
|
118 |
-
return false;
|
119 |
-
});
|
120 |
-
|
121 |
-
jQuery( document.body ).on('click', '.um-dropdown-hide', function() {
|
122 |
-
UM.dropdown.hideAll();
|
123 |
-
return false;
|
124 |
-
});
|
125 |
-
|
126 |
-
jQuery( document.body ).on('click', 'a.um-manual-trigger', function() {
|
127 |
-
var child = jQuery(this).attr('data-child');
|
128 |
-
var parent = jQuery(this).attr('data-parent');
|
129 |
-
jQuery(this).parents( parent ).find( child ).trigger('click');
|
130 |
-
UM.dropdown.hideAll();
|
131 |
-
return false;
|
132 |
-
});
|
133 |
-
|
134 |
-
jQuery('.um-s1,.um-s2').css({'display':'block'});
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Unselect empty option if something is selected
|
138 |
-
*
|
139 |
-
* @since 2.1.16
|
140 |
-
* @param {object} e
|
141 |
-
* @returns {undefined}
|
142 |
-
*/
|
143 |
-
function unselectEmptyOption( e ) {
|
144 |
-
var $element = jQuery( e.currentTarget );
|
145 |
-
var $selected = $element.find(':selected');
|
146 |
-
|
147 |
-
if ( $selected.length > 1 ) {
|
148 |
-
$selected.each( function ( i, option ) {
|
149 |
-
if ( option.value === '' ) {
|
150 |
-
option.selected = false;
|
151 |
-
$element.trigger( 'change' );
|
152 |
-
}
|
153 |
-
});
|
154 |
-
}
|
155 |
-
}
|
156 |
-
|
157 |
-
if ( typeof( jQuery.fn.select2 ) === 'function' ) {
|
158 |
-
jQuery(".um-s1").each( function( e ) {
|
159 |
-
var obj = jQuery(this);
|
160 |
-
|
161 |
-
obj.select2({
|
162 |
-
allowClear: true,
|
163 |
-
dropdownParent: obj.parent()
|
164 |
-
}).on( 'change', unselectEmptyOption );
|
165 |
-
} );
|
166 |
-
|
167 |
-
jQuery(".um-s2").each( function( e ) {
|
168 |
-
var obj = jQuery(this);
|
169 |
-
|
170 |
-
// fix https://github.com/ultimatemember/ultimatemember/issues/941
|
171 |
-
// using .um-custom-shortcode-tab class as temporarily solution
|
172 |
-
var atts = {};
|
173 |
-
if ( obj.parents('.um-custom-shortcode-tab').length ) {
|
174 |
-
atts = {
|
175 |
-
allowClear: false
|
176 |
-
};
|
177 |
-
} else {
|
178 |
-
atts = {
|
179 |
-
allowClear: false,
|
180 |
-
minimumResultsForSearch: 10,
|
181 |
-
dropdownParent: obj.parent()
|
182 |
-
};
|
183 |
-
}
|
184 |
-
obj.select2( atts ).on( 'change', unselectEmptyOption );
|
185 |
-
} );
|
186 |
-
|
187 |
-
jQuery(".um-s3").each( function( e ) {
|
188 |
-
var obj = jQuery(this);
|
189 |
-
|
190 |
-
obj.select2({
|
191 |
-
allowClear: false,
|
192 |
-
minimumResultsForSearch: -1,
|
193 |
-
dropdownParent: obj.parent()
|
194 |
-
}).on( 'change', unselectEmptyOption );
|
195 |
-
} );
|
196 |
-
}
|
197 |
-
|
198 |
-
init_tipsy();
|
199 |
-
|
200 |
-
if ( typeof( jQuery.fn.um_raty ) === 'function' ) {
|
201 |
-
jQuery('.um-rating').um_raty({
|
202 |
-
half: false,
|
203 |
-
starType: 'i',
|
204 |
-
number: function() {
|
205 |
-
return jQuery(this).attr('data-number');
|
206 |
-
},
|
207 |
-
score: function() {
|
208 |
-
return jQuery(this).attr('data-score');
|
209 |
-
},
|
210 |
-
scoreName: function() {
|
211 |
-
return jQuery(this).attr('data-key');
|
212 |
-
},
|
213 |
-
hints: false,
|
214 |
-
click: function( score, evt ) {
|
215 |
-
um_live_field = this.id;
|
216 |
-
um_live_value = score;
|
217 |
-
um_apply_conditions( jQuery(this), false );
|
218 |
-
}
|
219 |
-
});
|
220 |
-
|
221 |
-
jQuery('.um-rating-readonly').um_raty({
|
222 |
-
half: false,
|
223 |
-
starType: 'i',
|
224 |
-
number: function() {
|
225 |
-
return jQuery(this).attr('data-number');
|
226 |
-
},
|
227 |
-
score: function() {
|
228 |
-
return jQuery(this).attr('data-score');
|
229 |
-
},
|
230 |
-
scoreName: function() {
|
231 |
-
return jQuery(this).attr('data-key');
|
232 |
-
},
|
233 |
-
hints: false,
|
234 |
-
readOnly: true
|
235 |
-
});
|
236 |
-
}
|
237 |
-
|
238 |
-
jQuery(document).on('change', '.um-field-area input[type="radio"]', function() {
|
239 |
-
var field = jQuery(this).parents('.um-field-area');
|
240 |
-
var this_field = jQuery(this).parents('label');
|
241 |
-
field.find('.um-field-radio').removeClass('active');
|
242 |
-
field.find('.um-field-radio').find('i').removeAttr('class').addClass('um-icon-android-radio-button-off');
|
243 |
-
this_field.addClass('active');
|
244 |
-
this_field.find('i').removeAttr('class').addClass('um-icon-android-radio-button-on');
|
245 |
-
});
|
246 |
-
|
247 |
-
jQuery(document).on('change', '.um-field-area input[type="checkbox"]', function() {
|
248 |
-
var this_field = jQuery(this).parents('label');
|
249 |
-
if ( this_field.hasClass('active') ) {
|
250 |
-
this_field.removeClass('active');
|
251 |
-
this_field.find('i').removeAttr('class').addClass('um-icon-android-checkbox-outline-blank');
|
252 |
-
} else {
|
253 |
-
this_field.addClass('active');
|
254 |
-
this_field.find('i').removeAttr('class').addClass('um-icon-android-checkbox-outline');
|
255 |
-
}
|
256 |
-
});
|
257 |
-
|
258 |
-
|
259 |
-
um_init_datetimepicker();
|
260 |
-
|
261 |
-
jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function( e ) {
|
262 |
-
e.preventDefault();
|
263 |
-
var parent = jQuery(this).parents('.um-field');
|
264 |
-
|
265 |
-
var filename = parent.find( 'input[type="hidden"]#' + parent.data('key') + '-' + jQuery(this).parents('form').find('input[type="hidden"][name="form_id"]').val() ).val();
|
266 |
-
|
267 |
-
var src = jQuery(this).parents('.um-field').find('.um-single-image-preview img').attr('src');
|
268 |
-
var mode = parent.data('mode');
|
269 |
-
|
270 |
-
var args = {
|
271 |
-
data: {
|
272 |
-
mode: mode,
|
273 |
-
filename: filename,
|
274 |
-
src: src,
|
275 |
-
nonce: um_scripts.nonce
|
276 |
-
},
|
277 |
-
success: function() {
|
278 |
-
parent.find('.um-single-image-preview img').attr( 'src', '' );
|
279 |
-
parent.find('.um-single-image-preview').hide();
|
280 |
-
parent.find('.um-btn-auto-width').html( parent.data('upload-label') );
|
281 |
-
parent.find('input[type="hidden"]').val( 'empty_file' );
|
282 |
-
}
|
283 |
-
};
|
284 |
-
|
285 |
-
if ( mode !== 'register' ) {
|
286 |
-
args.data.user_id = jQuery(this).parents('form' ).find( '#user_id' ).val();
|
287 |
-
}
|
288 |
-
|
289 |
-
wp.ajax.send( 'um_remove_file', args );
|
290 |
-
|
291 |
-
return false;
|
292 |
-
});
|
293 |
-
|
294 |
-
jQuery(document).on('click', '.um .um-single-file-preview a.cancel', function( e ) {
|
295 |
-
e.preventDefault();
|
296 |
-
var parent = jQuery(this).parents('.um-field');
|
297 |
-
var filename = parent.find( 'input[type="hidden"]#' + parent.data('key') + '-' + jQuery(this).parents('form').find('input[type="hidden"][name="form_id"]').val() ).val();
|
298 |
-
var src = jQuery(this).parents('.um-field').find('.um-single-fileinfo a').attr('href');
|
299 |
-
var mode = parent.data('mode');
|
300 |
-
|
301 |
-
var args = {
|
302 |
-
data: {
|
303 |
-
mode: mode,
|
304 |
-
filename: filename,
|
305 |
-
src: src,
|
306 |
-
nonce: um_scripts.nonce
|
307 |
-
},
|
308 |
-
success: function() {
|
309 |
-
parent.find('.um-single-file-preview').hide();
|
310 |
-
parent.find('.um-btn-auto-width').html( parent.data('upload-label') );
|
311 |
-
parent.find('input[type=hidden]').val( 'empty_file' );
|
312 |
-
}
|
313 |
-
};
|
314 |
-
|
315 |
-
if ( mode !== 'register' ) {
|
316 |
-
args.data.user_id = jQuery(this).parents('form' ).find( '#user_id' ).val();
|
317 |
-
}
|
318 |
-
|
319 |
-
wp.ajax.send( 'um_remove_file', args );
|
320 |
-
|
321 |
-
return false;
|
322 |
-
});
|
323 |
-
|
324 |
-
jQuery(document).on('click', '.um-field-group-head:not(.disabled)', function() {
|
325 |
-
var field = jQuery(this).parents('.um-field-group');
|
326 |
-
var limit = field.data('max_entries');
|
327 |
-
|
328 |
-
if ( field.find('.um-field-group-body').is(':hidden')){
|
329 |
-
field.find('.um-field-group-body').show();
|
330 |
-
} else {
|
331 |
-
field.find('.um-field-group-body:first').clone().appendTo( field );
|
332 |
-
}
|
333 |
-
|
334 |
-
var increase_id = 0;
|
335 |
-
field.find('.um-field-group-body').each(function(){
|
336 |
-
increase_id++;
|
337 |
-
jQuery(this).find('input').each(function(){
|
338 |
-
var input = jQuery(this);
|
339 |
-
input.attr('id', input.data('key') + '-' + increase_id );
|
340 |
-
input.attr('name', input.data('key') + '-' + increase_id );
|
341 |
-
input.parent().parent().find('label').attr('for', input.data('key') + '-' + increase_id );
|
342 |
-
});
|
343 |
-
});
|
344 |
-
|
345 |
-
if ( limit > 0 && field.find('.um-field-group-body').length == limit ) {
|
346 |
-
|
347 |
-
jQuery(this).addClass('disabled');
|
348 |
-
|
349 |
-
}
|
350 |
-
});
|
351 |
-
|
352 |
-
jQuery(document).on('click', '.um-field-group-cancel', function( e ) {
|
353 |
-
e.preventDefault();
|
354 |
-
var field = jQuery(this).parents('.um-field-group');
|
355 |
-
|
356 |
-
var limit = field.data('max_entries');
|
357 |
-
|
358 |
-
if ( field.find('.um-field-group-body').length > 1 ) {
|
359 |
-
jQuery(this).parents('.um-field-group-body').remove();
|
360 |
-
} else {
|
361 |
-
jQuery(this).parents('.um-field-group-body').hide();
|
362 |
-
}
|
363 |
-
|
364 |
-
if ( limit > 0 && field.find('.um-field-group-body').length < limit ) {
|
365 |
-
field.find('.um-field-group-head').removeClass('disabled');
|
366 |
-
}
|
367 |
-
|
368 |
-
return false;
|
369 |
-
});
|
370 |
-
|
371 |
-
|
372 |
-
jQuery( document.body ).on( 'click', '.um-ajax-paginate', function( e ) {
|
373 |
-
e.preventDefault();
|
374 |
-
|
375 |
-
var obj = jQuery(this);
|
376 |
-
var parent = obj.parent();
|
377 |
-
parent.addClass( 'loading' );
|
378 |
-
|
379 |
-
var pages = obj.data('pages')*1;
|
380 |
-
var next_page = obj.data('page')*1 + 1;
|
381 |
-
|
382 |
-
var hook = obj.data('hook');
|
383 |
-
|
384 |
-
if ( 'um_load_posts' === hook ) {
|
385 |
-
|
386 |
-
jQuery.ajax({
|
387 |
-
url: wp.ajax.settings.url,
|
388 |
-
type: 'post',
|
389 |
-
data: {
|
390 |
-
action: 'um_ajax_paginate_posts',
|
391 |
-
author: jQuery(this).data('author'),
|
392 |
-
page: next_page,
|
393 |
-
nonce: um_scripts.nonce
|
394 |
-
},
|
395 |
-
complete: function() {
|
396 |
-
parent.removeClass( 'loading' );
|
397 |
-
},
|
398 |
-
success: function( data ) {
|
399 |
-
parent.before( data );
|
400 |
-
if ( next_page === pages ) {
|
401 |
-
parent.remove();
|
402 |
-
} else {
|
403 |
-
obj.data( 'page', next_page );
|
404 |
-
}
|
405 |
-
}
|
406 |
-
});
|
407 |
-
} else if ( 'um_load_comments' === hook ) {
|
408 |
-
|
409 |
-
jQuery.ajax({
|
410 |
-
url: wp.ajax.settings.url,
|
411 |
-
type: 'post',
|
412 |
-
data: {
|
413 |
-
action: 'um_ajax_paginate_comments',
|
414 |
-
user_id: jQuery(this).data('user_id'),
|
415 |
-
page: next_page,
|
416 |
-
nonce: um_scripts.nonce
|
417 |
-
},
|
418 |
-
complete: function() {
|
419 |
-
parent.removeClass( 'loading' );
|
420 |
-
},
|
421 |
-
success: function( data ) {
|
422 |
-
parent.before( data );
|
423 |
-
if ( next_page === pages ) {
|
424 |
-
parent.remove();
|
425 |
-
} else {
|
426 |
-
obj.data( 'page', next_page );
|
427 |
-
}
|
428 |
-
}
|
429 |
-
});
|
430 |
-
} else {
|
431 |
-
var args = jQuery(this).data('args');
|
432 |
-
var container = jQuery(this).parents('.um').find('.um-ajax-items');
|
433 |
-
|
434 |
-
jQuery.ajax({
|
435 |
-
url: wp.ajax.settings.url,
|
436 |
-
type: 'post',
|
437 |
-
data: {
|
438 |
-
action: 'um_ajax_paginate',
|
439 |
-
hook: hook,
|
440 |
-
args: args,
|
441 |
-
nonce: um_scripts.nonce
|
442 |
-
},
|
443 |
-
complete: function() {
|
444 |
-
parent.removeClass( 'loading' );
|
445 |
-
},
|
446 |
-
success: function(data){
|
447 |
-
parent.remove();
|
448 |
-
container.append( data );
|
449 |
-
}
|
450 |
-
});
|
451 |
-
}
|
452 |
-
});
|
453 |
-
|
454 |
-
|
455 |
-
jQuery(document).on('click', '.um-ajax-action', function( e ) {
|
456 |
-
e.preventDefault();
|
457 |
-
var hook = jQuery(this).data('hook');
|
458 |
-
var user_id = jQuery(this).data('user_id');
|
459 |
-
var arguments = jQuery(this).data('arguments');
|
460 |
-
|
461 |
-
if ( jQuery(this).data('js-remove') ){
|
462 |
-
jQuery(this).parents('.'+jQuery(this).data('js-remove')).fadeOut('fast');
|
463 |
-
}
|
464 |
-
|
465 |
-
jQuery.ajax({
|
466 |
-
url: wp.ajax.settings.url,
|
467 |
-
type: 'post',
|
468 |
-
data: {
|
469 |
-
action: 'um_muted_action',
|
470 |
-
hook: hook,
|
471 |
-
user_id: user_id,
|
472 |
-
arguments: arguments,
|
473 |
-
nonce: um_scripts.nonce
|
474 |
-
},
|
475 |
-
success: function(data){
|
476 |
-
|
477 |
-
}
|
478 |
-
});
|
479 |
-
return false;
|
480 |
-
});
|
481 |
-
|
482 |
-
jQuery( document.body ).on('click', '#um-search-button', function() {
|
483 |
-
var action = jQuery(this).parents('.um-search-form').data('members_page');
|
484 |
-
|
485 |
-
var search_keys = [];
|
486 |
-
jQuery(this).parents('.um-search-form').find('input[name="um-search-keys[]"]').each( function() {
|
487 |
-
search_keys.push( jQuery(this).val() );
|
488 |
-
});
|
489 |
-
|
490 |
-
var search = jQuery(this).parents('.um-search-form').find('.um-search-field').val();
|
491 |
-
|
492 |
-
var url;
|
493 |
-
if ( search === '' ) {
|
494 |
-
url = action;
|
495 |
-
} else {
|
496 |
-
var query = '?';
|
497 |
-
for ( var i = 0; i < search_keys.length; i++ ) {
|
498 |
-
query += search_keys[i] + '=' + search;
|
499 |
-
if ( i !== search_keys.length - 1 ) {
|
500 |
-
query += '&';
|
501 |
-
}
|
502 |
-
}
|
503 |
-
|
504 |
-
url = action + query;
|
505 |
-
}
|
506 |
-
window.location = url;
|
507 |
-
});
|
508 |
-
|
509 |
-
//make search on Enter click
|
510 |
-
jQuery( document.body ).on( 'keypress', '.um-search-field', function(e) {
|
511 |
-
if ( e.which === 13 ) {
|
512 |
-
var action = jQuery(this).parents('.um-search-form').data('members_page');
|
513 |
-
|
514 |
-
var search_keys = [];
|
515 |
-
jQuery(this).parents('.um-search-form').find('input[name="um-search-keys[]"]').each( function() {
|
516 |
-
search_keys.push( jQuery(this).val() );
|
517 |
-
});
|
518 |
-
|
519 |
-
var search = jQuery(this).val();
|
520 |
-
|
521 |
-
var url;
|
522 |
-
if ( search === '' ) {
|
523 |
-
url = action;
|
524 |
-
} else {
|
525 |
-
var query = '?';
|
526 |
-
for ( var i = 0; i < search_keys.length; i++ ) {
|
527 |
-
query += search_keys[i] + '=' + search;
|
528 |
-
if ( i !== search_keys.length - 1 ) {
|
529 |
-
query += '&';
|
530 |
-
}
|
531 |
-
}
|
532 |
-
|
533 |
-
url = action + query;
|
534 |
-
}
|
535 |
-
window.location = url;
|
536 |
-
}
|
537 |
-
});
|
538 |
-
|
539 |
-
jQuery('.um-form input[class="um-button"][type="submit"]').prop('disabled', false);
|
540 |
-
|
541 |
-
jQuery(document).one('click', '.um:not(.um-account) .um-form input[class="um-button"][type="submit"]:not(.um-has-recaptcha)', function() {
|
542 |
-
jQuery(this).attr('disabled','disabled');
|
543 |
-
jQuery(this).parents('form').trigger('submit');
|
544 |
-
});
|
545 |
-
|
546 |
-
|
547 |
-
var um_select_options_cache = {};
|
548 |
-
|
549 |
-
/**
|
550 |
-
* Find all select fields with parent select fields
|
551 |
-
*/
|
552 |
-
jQuery('select[data-um-parent]').each( function() {
|
553 |
-
|
554 |
-
var me = jQuery(this);
|
555 |
-
var parent_option = me.data('um-parent');
|
556 |
-
var um_ajax_source = me.data('um-ajax-source');
|
557 |
-
|
558 |
-
me.attr('data-um-init-field', true );
|
559 |
-
|
560 |
-
jQuery(document).on('change','select[name="' + parent_option + '"]',function() {
|
561 |
-
var parent = jQuery(this);
|
562 |
-
var form_id = parent.closest( 'form' ).find( 'input[type="hidden"][name="form_id"]' ).val();
|
563 |
-
|
564 |
-
var arr_key;
|
565 |
-
if ( me.attr( 'data-member-directory' ) === 'yes' ) {
|
566 |
-
var directory = parent.parents('.um-directory');
|
567 |
-
arr_key = um_get_data_for_directory( directory, 'filter_' + parent_option );
|
568 |
-
if ( typeof arr_key != 'undefined' ) {
|
569 |
-
arr_key = arr_key.split('||');
|
570 |
-
} else {
|
571 |
-
arr_key = '';
|
572 |
-
}
|
573 |
-
} else {
|
574 |
-
arr_key = parent.val();
|
575 |
-
}
|
576 |
-
|
577 |
-
if ( typeof arr_key != 'undefined' && arr_key !== '' && typeof um_select_options_cache[ arr_key ] !== 'object' ) {
|
578 |
-
|
579 |
-
if ( typeof( me.um_wait ) === 'undefined' || me.um_wait === false ) {
|
580 |
-
me.um_wait = true;
|
581 |
-
} else {
|
582 |
-
return;
|
583 |
-
}
|
584 |
-
|
585 |
-
jQuery.ajax({
|
586 |
-
url: wp.ajax.settings.url,
|
587 |
-
type: 'post',
|
588 |
-
data: {
|
589 |
-
action: 'um_select_options',
|
590 |
-
parent_option_name: parent_option,
|
591 |
-
parent_option: arr_key,
|
592 |
-
child_callback: um_ajax_source,
|
593 |
-
child_name: me.attr('name'),
|
594 |
-
members_directory: me.attr('data-member-directory'),
|
595 |
-
form_id: form_id,
|
596 |
-
nonce: um_scripts.nonce
|
597 |
-
},
|
598 |
-
success: function( data ) {
|
599 |
-
if ( data.status === 'success' && arr_key !== '' ) {
|
600 |
-
um_select_options_cache[ arr_key ] = data;
|
601 |
-
um_field_populate_child_options( me, data, arr_key );
|
602 |
-
}
|
603 |
-
|
604 |
-
if ( typeof data.debug !== 'undefined' ) {
|
605 |
-
console.log( data );
|
606 |
-
}
|
607 |
-
|
608 |
-
me.um_wait = false;
|
609 |
-
},
|
610 |
-
error: function( e ) {
|
611 |
-
console.log( e );
|
612 |
-
me.um_wait = false;
|
613 |
-
}
|
614 |
-
});
|
615 |
-
|
616 |
-
}
|
617 |
-
|
618 |
-
if ( typeof arr_key != 'undefined' && arr_key !== '' && typeof um_select_options_cache[ arr_key ] == 'object' ) {
|
619 |
-
setTimeout( um_field_populate_child_options, 10, me, um_select_options_cache[ arr_key ], arr_key );
|
620 |
-
}
|
621 |
-
|
622 |
-
if ( typeof arr_key != 'undefined' || arr_key === '' ) {
|
623 |
-
me.find('option[value!=""]').remove();
|
624 |
-
me.val('').trigger('change');
|
625 |
-
}
|
626 |
-
|
627 |
-
});
|
628 |
-
|
629 |
-
jQuery('select[name="' + parent_option + '"]').trigger('change');
|
630 |
-
|
631 |
-
});
|
632 |
-
|
633 |
-
|
634 |
-
/**
|
635 |
-
* Populates child options and cache ajax response
|
636 |
-
*
|
637 |
-
* @param me
|
638 |
-
* @param data
|
639 |
-
* @param arr_key
|
640 |
-
*/
|
641 |
-
function um_field_populate_child_options( me, data, arr_key ) {
|
642 |
-
var directory = me.parents('.um-directory');
|
643 |
-
var child_name = me.attr('name');
|
644 |
-
me.find('option[value!=""]').remove();
|
645 |
-
|
646 |
-
if ( ! me.hasClass('um-child-option-disabled') ) {
|
647 |
-
me.prop('disabled', false);
|
648 |
-
}
|
649 |
-
|
650 |
-
var arr_items = [],
|
651 |
-
search_get = '';
|
652 |
-
|
653 |
-
if ( data.post.members_directory === 'yes' ) {
|
654 |
-
arr_items.push({id: '', text: '', selected: 1});
|
655 |
-
}
|
656 |
-
jQuery.each( data.items, function(k,v){
|
657 |
-
arr_items.push({id: k, text: v, selected: (v === search_get)});
|
658 |
-
});
|
659 |
-
|
660 |
-
me.select2('destroy');
|
661 |
-
me.select2({
|
662 |
-
data: arr_items,
|
663 |
-
allowClear: true,
|
664 |
-
minimumResultsForSearch: 10
|
665 |
-
});
|
666 |
-
|
667 |
-
if ( data.post.members_directory === 'yes' ) {
|
668 |
-
me.find('option').each( function() {
|
669 |
-
if ( jQuery(this).html() !== '' ) {
|
670 |
-
jQuery(this).data( 'value_label', jQuery(this).html() ).attr( 'data-value_label', jQuery(this).html() );
|
671 |
-
}
|
672 |
-
});
|
673 |
-
|
674 |
-
var current_filter_val = um_get_data_for_directory( directory, 'filter_' + child_name );
|
675 |
-
if ( typeof current_filter_val !== 'undefined' ) {
|
676 |
-
current_filter_val = current_filter_val.split('||');
|
677 |
-
|
678 |
-
var temp_filter_val = [];
|
679 |
-
jQuery.each( current_filter_val, function(i) {
|
680 |
-
if ( me.find('option[value="' + current_filter_val[ i ] + '"]').length ) {
|
681 |
-
temp_filter_val.push( current_filter_val[ i ] );
|
682 |
-
}
|
683 |
-
me.find('option[value="' + current_filter_val[ i ] + '"]').prop('disabled', true).hide();
|
684 |
-
if ( me.find('option:not(:disabled)').length === 1 ) {
|
685 |
-
me.prop('disabled', true);
|
686 |
-
}
|
687 |
-
|
688 |
-
me.select2('destroy').select2();
|
689 |
-
me.val('').trigger( 'change' );
|
690 |
-
});
|
691 |
-
|
692 |
-
temp_filter_val = temp_filter_val.join('||');
|
693 |
-
if ( current_filter_val !== temp_filter_val ) {
|
694 |
-
um_set_url_from_data( directory, 'filter_' + child_name, temp_filter_val );
|
695 |
-
um_ajax_get_members( directory );
|
696 |
-
}
|
697 |
-
}
|
698 |
-
|
699 |
-
um_change_tag( directory );
|
700 |
-
}
|
701 |
-
|
702 |
-
if ( data.post.members_directory !== 'yes' ) {
|
703 |
-
if ( typeof data.field.default !== 'undefined' && ! me.data('um-original-value') ) {
|
704 |
-
me.val( data.field.default ).trigger('change');
|
705 |
-
} else if ( me.data('um-original-value') !== '' ) {
|
706 |
-
me.val( me.data('um-original-value') ).trigger('change');
|
707 |
-
}
|
708 |
-
|
709 |
-
if ( data.field.editable == 0 ) {
|
710 |
-
me.addClass('um-child-option-disabled');
|
711 |
-
me.attr('disabled','disabled');
|
712 |
-
}
|
713 |
-
}
|
714 |
-
}
|
715 |
-
|
716 |
-
});
|
1 |
+
function um_sanitize_value( value, el ) {
|
2 |
+
var element = document.createElement( 'div' );
|
3 |
+
element.innerText = value;
|
4 |
+
var sanitized_value = element.innerHTML;
|
5 |
+
if ( el ) {
|
6 |
+
jQuery( el ).val( sanitized_value );
|
7 |
+
}
|
8 |
+
|
9 |
+
return sanitized_value;
|
10 |
+
}
|
11 |
+
|
12 |
+
function um_unsanitize_value( input ) {
|
13 |
+
var e = document.createElement( 'textarea' );
|
14 |
+
e.innerHTML = input;
|
15 |
+
// handle case of empty input
|
16 |
+
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
function um_init_datetimepicker() {
|
21 |
+
jQuery('.um-datepicker:not(.picker__input)').each(function(){
|
22 |
+
var elem = jQuery(this);
|
23 |
+
|
24 |
+
var disable = false;
|
25 |
+
if ( typeof elem.attr('data-disabled_weekdays') != 'undefined' && elem.attr('data-disabled_weekdays') !== '' ) {
|
26 |
+
disable = JSON.parse( elem.attr('data-disabled_weekdays') );
|
27 |
+
}
|
28 |
+
|
29 |
+
var years_n = null;
|
30 |
+
if ( typeof elem.attr('data-years') != 'undefined' ) {
|
31 |
+
years_n = elem.attr('data-years');
|
32 |
+
}
|
33 |
+
|
34 |
+
var minRange = elem.attr('data-date_min');
|
35 |
+
var maxRange = elem.attr('data-date_max');
|
36 |
+
|
37 |
+
var minSplit = [], maxSplit = [];
|
38 |
+
if ( typeof minRange != 'undefined' ) {
|
39 |
+
minSplit = minRange.split(",");
|
40 |
+
}
|
41 |
+
if ( typeof maxRange != 'undefined' ) {
|
42 |
+
maxSplit = maxRange.split(",");
|
43 |
+
}
|
44 |
+
|
45 |
+
var min = minSplit.length ? new Date(minSplit) : null;
|
46 |
+
var max = minSplit.length ? new Date(maxSplit) : null;
|
47 |
+
|
48 |
+
// fix min date for safari
|
49 |
+
if ( min && min.toString() == 'Invalid Date' && minSplit.length == 3 ) {
|
50 |
+
var minDateString = minSplit[1] + '/' + minSplit[2] + '/' + minSplit[0];
|
51 |
+
min = new Date(Date.parse(minDateString));
|
52 |
+
}
|
53 |
+
|
54 |
+
// fix max date for safari
|
55 |
+
if ( max && max.toString() == 'Invalid Date' && maxSplit.length == 3 ) {
|
56 |
+
var maxDateString = maxSplit[1] + '/' + maxSplit[2] + '/' + maxSplit[0];
|
57 |
+
max = new Date(Date.parse(maxDateString));
|
58 |
+
}
|
59 |
+
|
60 |
+
var data = {
|
61 |
+
disable: disable,
|
62 |
+
format: elem.attr( 'data-format' ),
|
63 |
+
formatSubmit: 'yyyy/mm/dd',
|
64 |
+
hiddenName: true,
|
65 |
+
onOpen: function() { elem.blur(); },
|
66 |
+
onClose: function() { elem.blur(); }
|
67 |
+
};
|
68 |
+
|
69 |
+
if ( years_n !== null ) {
|
70 |
+
data.selectYears = years_n;
|
71 |
+
}
|
72 |
+
|
73 |
+
if ( min !== null ) {
|
74 |
+
data.min = min;
|
75 |
+
}
|
76 |
+
|
77 |
+
if ( max !== null ) {
|
78 |
+
data.max = max;
|
79 |
+
}
|
80 |
+
|
81 |
+
elem.pickadate( data );
|
82 |
+
});
|
83 |
+
|
84 |
+
jQuery('.um-timepicker:not(.picker__input)').each(function(){
|
85 |
+
var elem = jQuery(this);
|
86 |
+
|
87 |
+
elem.pickatime({
|
88 |
+
format: elem.attr('data-format'),
|
89 |
+
interval: parseInt( elem.attr('data-intervals') ),
|
90 |
+
formatSubmit: 'HH:i',
|
91 |
+
hiddenName: true,
|
92 |
+
onOpen: function() { elem.blur(); },
|
93 |
+
onClose: function() { elem.blur(); }
|
94 |
+
});
|
95 |
+
});
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
function init_tipsy() {
|
101 |
+
if ( typeof( jQuery.fn.tipsy ) === 'function' ) {
|
102 |
+
jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live', offset: 3 });
|
103 |
+
jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live', offset: 3 });
|
104 |
+
jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live', offset: 3 });
|
105 |
+
jQuery('.um-tip-s').tipsy({gravity: 's', opacity: 1, live: 'a.live', offset: 3 });
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
jQuery(document).ready(function() {
|
110 |
+
|
111 |
+
jQuery( document.body ).on('click', '.um-dropdown a.real_url', function() {
|
112 |
+
window.location = jQuery(this).attr('href');
|
113 |
+
});
|
114 |
+
|
115 |
+
jQuery( document.body ).on( 'click', '.um-trigger-menu-on-click', function() {
|
116 |
+
var menu = jQuery(this).find('.um-dropdown');
|
117 |
+
UM.dropdown.show( menu );
|
118 |
+
return false;
|
119 |
+
});
|
120 |
+
|
121 |
+
jQuery( document.body ).on('click', '.um-dropdown-hide', function() {
|
122 |
+
UM.dropdown.hideAll();
|
123 |
+
return false;
|
124 |
+
});
|
125 |
+
|
126 |
+
jQuery( document.body ).on('click', 'a.um-manual-trigger', function() {
|
127 |
+
var child = jQuery(this).attr('data-child');
|
128 |
+
var parent = jQuery(this).attr('data-parent');
|
129 |
+
jQuery(this).parents( parent ).find( child ).trigger('click');
|
130 |
+
UM.dropdown.hideAll();
|
131 |
+
return false;
|
132 |
+
});
|
133 |
+
|
134 |
+
jQuery('.um-s1,.um-s2').css({'display':'block'});
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Unselect empty option if something is selected
|
138 |
+
*
|
139 |
+
* @since 2.1.16
|
140 |
+
* @param {object} e
|
141 |
+
* @returns {undefined}
|
142 |
+
*/
|
143 |
+
function unselectEmptyOption( e ) {
|
144 |
+
var $element = jQuery( e.currentTarget );
|
145 |
+
var $selected = $element.find(':selected');
|
146 |
+
|
147 |
+
if ( $selected.length > 1 ) {
|
148 |
+
$selected.each( function ( i, option ) {
|
149 |
+
if ( option.value === '' ) {
|
150 |
+
option.selected = false;
|
151 |
+
$element.trigger( 'change' );
|
152 |
+
}
|
153 |
+
});
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
if ( typeof( jQuery.fn.select2 ) === 'function' ) {
|
158 |
+
jQuery(".um-s1").each( function( e ) {
|
159 |
+
var obj = jQuery(this);
|
160 |
+
|
161 |
+
obj.select2({
|
162 |
+
allowClear: true,
|
163 |
+
dropdownParent: obj.parent()
|
164 |
+
}).on( 'change', unselectEmptyOption );
|
165 |
+
} );
|
166 |
+
|
167 |
+
jQuery(".um-s2").each( function( e ) {
|
168 |
+
var obj = jQuery(this);
|
169 |
+
|
170 |
+
// fix https://github.com/ultimatemember/ultimatemember/issues/941
|
171 |
+
// using .um-custom-shortcode-tab class as temporarily solution
|
172 |
+
var atts = {};
|
173 |
+
if ( obj.parents('.um-custom-shortcode-tab').length ) {
|
174 |
+
atts = {
|
175 |
+
allowClear: false
|
176 |
+
};
|
177 |
+
} else {
|
178 |
+
atts = {
|
179 |
+
allowClear: false,
|
180 |
+
minimumResultsForSearch: 10,
|
181 |
+
dropdownParent: obj.parent()
|
182 |
+
};
|
183 |
+
}
|
184 |
+
obj.select2( atts ).on( 'change', unselectEmptyOption );
|
185 |
+
} );
|
186 |
+
|
187 |
+
jQuery(".um-s3").each( function( e ) {
|
188 |
+
var obj = jQuery(this);
|
189 |
+
|
190 |
+
obj.select2({
|
191 |
+
allowClear: false,
|
192 |
+
minimumResultsForSearch: -1,
|
193 |
+
dropdownParent: obj.parent()
|
194 |
+
}).on( 'change', unselectEmptyOption );
|
195 |
+
} );
|
196 |
+
}
|
197 |
+
|
198 |
+
init_tipsy();
|
199 |
+
|
200 |
+
if ( typeof( jQuery.fn.um_raty ) === 'function' ) {
|
201 |
+
jQuery('.um-rating').um_raty({
|
202 |
+
half: false,
|
203 |
+
starType: 'i',
|
204 |
+
number: function() {
|
205 |
+
return jQuery(this).attr('data-number');
|
206 |
+
},
|
207 |
+
score: function() {
|
208 |
+
return jQuery(this).attr('data-score');
|
209 |
+
},
|
210 |
+
scoreName: function() {
|
211 |
+
return jQuery(this).attr('data-key');
|
212 |
+
},
|
213 |
+
hints: false,
|
214 |
+
click: function( score, evt ) {
|
215 |
+
um_live_field = this.id;
|
216 |
+
um_live_value = score;
|
217 |
+
um_apply_conditions( jQuery(this), false );
|
218 |
+
}
|
219 |
+
});
|
220 |
+
|
221 |
+
jQuery('.um-rating-readonly').um_raty({
|
222 |
+
half: false,
|
223 |
+
starType: 'i',
|
224 |
+
number: function() {
|
225 |
+
return jQuery(this).attr('data-number');
|
226 |
+
},
|
227 |
+
score: function() {
|
228 |
+
return jQuery(this).attr('data-score');
|
229 |
+
},
|
230 |
+
scoreName: function() {
|
231 |
+
return jQuery(this).attr('data-key');
|
232 |
+
},
|
233 |
+
hints: false,
|
234 |
+
readOnly: true
|
235 |
+
});
|
236 |
+
}
|
237 |
+
|
238 |
+
jQuery(document).on('change', '.um-field-area input[type="radio"]', function() {
|
239 |
+
var field = jQuery(this).parents('.um-field-area');
|
240 |
+
var this_field = jQuery(this).parents('label');
|
241 |
+
field.find('.um-field-radio').removeClass('active');
|
242 |
+
field.find('.um-field-radio').find('i').removeAttr('class').addClass('um-icon-android-radio-button-off');
|
243 |
+
this_field.addClass('active');
|
244 |
+
this_field.find('i').removeAttr('class').addClass('um-icon-android-radio-button-on');
|
245 |
+
});
|
246 |
+
|
247 |
+
jQuery(document).on('change', '.um-field-area input[type="checkbox"]', function() {
|
248 |
+
var this_field = jQuery(this).parents('label');
|
249 |
+
if ( this_field.hasClass('active') ) {
|
250 |
+
this_field.removeClass('active');
|
251 |
+
this_field.find('i').removeAttr('class').addClass('um-icon-android-checkbox-outline-blank');
|
252 |
+
} else {
|
253 |
+
this_field.addClass('active');
|
254 |
+
this_field.find('i').removeAttr('class').addClass('um-icon-android-checkbox-outline');
|
255 |
+
}
|
256 |
+
});
|
257 |
+
|
258 |
+
|
259 |
+
um_init_datetimepicker();
|
260 |
+
|
261 |
+
jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function( e ) {
|
262 |
+
e.preventDefault();
|
263 |
+
var parent = jQuery(this).parents('.um-field');
|
264 |
+
|
265 |
+
var filename = parent.find( 'input[type="hidden"]#' + parent.data('key') + '-' + jQuery(this).parents('form').find('input[type="hidden"][name="form_id"]').val() ).val();
|
266 |
+
|
267 |
+
var src = jQuery(this).parents('.um-field').find('.um-single-image-preview img').attr('src');
|
268 |
+
var mode = parent.data('mode');
|
269 |
+
|
270 |
+
var args = {
|
271 |
+
data: {
|
272 |
+
mode: mode,
|
273 |
+
filename: filename,
|
274 |
+
src: src,
|
275 |
+
nonce: um_scripts.nonce
|
276 |
+
},
|
277 |
+
success: function() {
|
278 |
+
parent.find('.um-single-image-preview img').attr( 'src', '' );
|
279 |
+
parent.find('.um-single-image-preview').hide();
|
280 |
+
parent.find('.um-btn-auto-width').html( parent.data('upload-label') );
|
281 |
+
parent.find('input[type="hidden"]').val( 'empty_file' );
|
282 |
+
}
|
283 |
+
};
|
284 |
+
|
285 |
+
if ( mode !== 'register' ) {
|
286 |
+
args.data.user_id = jQuery(this).parents('form' ).find( '#user_id' ).val();
|
287 |
+
}
|
288 |
+
|
289 |
+
wp.ajax.send( 'um_remove_file', args );
|
290 |
+
|
291 |
+
return false;
|
292 |
+
});
|
293 |
+
|
294 |
+
jQuery(document).on('click', '.um .um-single-file-preview a.cancel', function( e ) {
|
295 |
+
e.preventDefault();
|
296 |
+
var parent = jQuery(this).parents('.um-field');
|
297 |
+
var filename = parent.find( 'input[type="hidden"]#' + parent.data('key') + '-' + jQuery(this).parents('form').find('input[type="hidden"][name="form_id"]').val() ).val();
|
298 |
+
var src = jQuery(this).parents('.um-field').find('.um-single-fileinfo a').attr('href');
|
299 |
+
var mode = parent.data('mode');
|
300 |
+
|
301 |
+
var args = {
|
302 |
+
data: {
|
303 |
+
mode: mode,
|
304 |
+
filename: filename,
|
305 |
+
src: src,
|
306 |
+
nonce: um_scripts.nonce
|
307 |
+
},
|
308 |
+
success: function() {
|
309 |
+
parent.find('.um-single-file-preview').hide();
|
310 |
+
parent.find('.um-btn-auto-width').html( parent.data('upload-label') );
|
311 |
+
parent.find('input[type=hidden]').val( 'empty_file' );
|
312 |
+
}
|
313 |
+
};
|
314 |
+
|
315 |
+
if ( mode !== 'register' ) {
|
316 |
+
args.data.user_id = jQuery(this).parents('form' ).find( '#user_id' ).val();
|
317 |
+
}
|
318 |
+
|
319 |
+
wp.ajax.send( 'um_remove_file', args );
|
320 |
+
|
321 |
+
return false;
|
322 |
+
});
|
323 |
+
|
324 |
+
jQuery(document).on('click', '.um-field-group-head:not(.disabled)', function() {
|
325 |
+
var field = jQuery(this).parents('.um-field-group');
|
326 |
+
var limit = field.data('max_entries');
|
327 |
+
|
328 |
+
if ( field.find('.um-field-group-body').is(':hidden')){
|
329 |
+
field.find('.um-field-group-body').show();
|
330 |
+
} else {
|
331 |
+
field.find('.um-field-group-body:first').clone().appendTo( field );
|
332 |
+
}
|
333 |
+
|
334 |
+
var increase_id = 0;
|
335 |
+
field.find('.um-field-group-body').each(function(){
|
336 |
+
increase_id++;
|
337 |
+
jQuery(this).find('input').each(function(){
|
338 |
+
var input = jQuery(this);
|
339 |
+
input.attr('id', input.data('key') + '-' + increase_id );
|
340 |
+
input.attr('name', input.data('key') + '-' + increase_id );
|
341 |
+
input.parent().parent().find('label').attr('for', input.data('key') + '-' + increase_id );
|
342 |
+
});
|
343 |
+
});
|
344 |
+
|
345 |
+
if ( limit > 0 && field.find('.um-field-group-body').length == limit ) {
|
346 |
+
|
347 |
+
jQuery(this).addClass('disabled');
|
348 |
+
|
349 |
+
}
|
350 |
+
});
|
351 |
+
|
352 |
+
jQuery(document).on('click', '.um-field-group-cancel', function( e ) {
|
353 |
+
e.preventDefault();
|
354 |
+
var field = jQuery(this).parents('.um-field-group');
|
355 |
+
|
356 |
+
var limit = field.data('max_entries');
|
357 |
+
|
358 |
+
if ( field.find('.um-field-group-body').length > 1 ) {
|
359 |
+
jQuery(this).parents('.um-field-group-body').remove();
|
360 |
+
} else {
|
361 |
+
jQuery(this).parents('.um-field-group-body').hide();
|
362 |
+
}
|
363 |
+
|
364 |
+
if ( limit > 0 && field.find('.um-field-group-body').length < limit ) {
|
365 |
+
field.find('.um-field-group-head').removeClass('disabled');
|
366 |
+
}
|
367 |
+
|
368 |
+
return false;
|
369 |
+
});
|
370 |
+
|
371 |
+
|
372 |
+
jQuery( document.body ).on( 'click', '.um-ajax-paginate', function( e ) {
|
373 |
+
e.preventDefault();
|
374 |
+
|
375 |
+
var obj = jQuery(this);
|
376 |
+
var parent = obj.parent();
|
377 |
+
parent.addClass( 'loading' );
|
378 |
+
|
379 |
+
var pages = obj.data('pages')*1;
|
380 |
+
var next_page = obj.data('page')*1 + 1;
|
381 |
+
|
382 |
+
var hook = obj.data('hook');
|
383 |
+
|
384 |
+
if ( 'um_load_posts' === hook ) {
|
385 |
+
|
386 |
+
jQuery.ajax({
|
387 |
+
url: wp.ajax.settings.url,
|
388 |
+
type: 'post',
|
389 |
+
data: {
|
390 |
+
action: 'um_ajax_paginate_posts',
|
391 |
+
author: jQuery(this).data('author'),
|
392 |
+
page: next_page,
|
393 |
+
nonce: um_scripts.nonce
|
394 |
+
},
|
395 |
+
complete: function() {
|
396 |
+
parent.removeClass( 'loading' );
|
397 |
+
},
|
398 |
+
success: function( data ) {
|
399 |
+
parent.before( data );
|
400 |
+
if ( next_page === pages ) {
|
401 |
+
parent.remove();
|
402 |
+
} else {
|
403 |
+
obj.data( 'page', next_page );
|
404 |
+
}
|
405 |
+
}
|
406 |
+
});
|
407 |
+
} else if ( 'um_load_comments' === hook ) {
|
408 |
+
|
409 |
+
jQuery.ajax({
|
410 |
+
url: wp.ajax.settings.url,
|
411 |
+
type: 'post',
|
412 |
+
data: {
|
413 |
+
action: 'um_ajax_paginate_comments',
|
414 |
+
user_id: jQuery(this).data('user_id'),
|
415 |
+
page: next_page,
|
416 |
+
nonce: um_scripts.nonce
|
417 |
+
},
|
418 |
+
complete: function() {
|
419 |
+
parent.removeClass( 'loading' );
|
420 |
+
},
|
421 |
+
success: function( data ) {
|
422 |
+
parent.before( data );
|
423 |
+
if ( next_page === pages ) {
|
424 |
+
parent.remove();
|
425 |
+
} else {
|
426 |
+
obj.data( 'page', next_page );
|
427 |
+
}
|
428 |
+
}
|
429 |
+
});
|
430 |
+
} else {
|
431 |
+
var args = jQuery(this).data('args');
|
432 |
+
var container = jQuery(this).parents('.um').find('.um-ajax-items');
|
433 |
+
|
434 |
+
jQuery.ajax({
|
435 |
+
url: wp.ajax.settings.url,
|
436 |
+
type: 'post',
|
437 |
+
data: {
|
438 |
+
action: 'um_ajax_paginate',
|
439 |
+
hook: hook,
|
440 |
+
args: args,
|
441 |
+
nonce: um_scripts.nonce
|
442 |
+
},
|
443 |
+
complete: function() {
|
444 |
+
parent.removeClass( 'loading' );
|
445 |
+
},
|
446 |
+
success: function(data){
|
447 |
+
parent.remove();
|
448 |
+
container.append( data );
|
449 |
+
}
|
450 |
+
});
|
451 |
+
}
|
452 |
+
});
|
453 |
+
|
454 |
+
|
455 |
+
jQuery(document).on('click', '.um-ajax-action', function( e ) {
|
456 |
+
e.preventDefault();
|
457 |
+
var hook = jQuery(this).data('hook');
|
458 |
+
var user_id = jQuery(this).data('user_id');
|
459 |
+
var arguments = jQuery(this).data('arguments');
|
460 |
+
|
461 |
+
if ( jQuery(this).data('js-remove') ){
|
462 |
+
jQuery(this).parents('.'+jQuery(this).data('js-remove')).fadeOut('fast');
|
463 |
+
}
|
464 |
+
|
465 |
+
jQuery.ajax({
|
466 |
+
url: wp.ajax.settings.url,
|
467 |
+
type: 'post',
|
468 |
+
data: {
|
469 |
+
action: 'um_muted_action',
|
470 |
+
hook: hook,
|
471 |
+
user_id: user_id,
|
472 |
+
arguments: arguments,
|
473 |
+
nonce: um_scripts.nonce
|
474 |
+
},
|
475 |
+
success: function(data){
|
476 |
+
|
477 |
+
}
|
478 |
+
});
|
479 |
+
return false;
|
480 |
+
});
|
481 |
+
|
482 |
+
jQuery( document.body ).on('click', '#um-search-button', function() {
|
483 |
+
var action = jQuery(this).parents('.um-search-form').data('members_page');
|
484 |
+
|
485 |
+
var search_keys = [];
|
486 |
+
jQuery(this).parents('.um-search-form').find('input[name="um-search-keys[]"]').each( function() {
|
487 |
+
search_keys.push( jQuery(this).val() );
|
488 |
+
});
|
489 |
+
|
490 |
+
var search = jQuery(this).parents('.um-search-form').find('.um-search-field').val();
|
491 |
+
|
492 |
+
var url;
|
493 |
+
if ( search === '' ) {
|
494 |
+
url = action;
|
495 |
+
} else {
|
496 |
+
var query = '?';
|
497 |
+
for ( var i = 0; i < search_keys.length; i++ ) {
|
498 |
+
query += search_keys[i] + '=' + search;
|
499 |
+
if ( i !== search_keys.length - 1 ) {
|
500 |
+
query += '&';
|
501 |
+
}
|
502 |
+
}
|
503 |
+
|
504 |
+
url = action + query;
|
505 |
+
}
|
506 |
+
window.location = url;
|
507 |
+
});
|
508 |
+
|
509 |
+
//make search on Enter click
|
510 |
+
jQuery( document.body ).on( 'keypress', '.um-search-field', function(e) {
|
511 |
+
if ( e.which === 13 ) {
|
512 |
+
var action = jQuery(this).parents('.um-search-form').data('members_page');
|
513 |
+
|
514 |
+
var search_keys = [];
|
515 |
+
jQuery(this).parents('.um-search-form').find('input[name="um-search-keys[]"]').each( function() {
|
516 |
+
search_keys.push( jQuery(this).val() );
|
517 |
+
});
|
518 |
+
|
519 |
+
var search = jQuery(this).val();
|
520 |
+
|
521 |
+
var url;
|
522 |
+
if ( search === '' ) {
|
523 |
+
url = action;
|
524 |
+
} else {
|
525 |
+
var query = '?';
|
526 |
+
for ( var i = 0; i < search_keys.length; i++ ) {
|
527 |
+
query += search_keys[i] + '=' + search;
|
528 |
+
if ( i !== search_keys.length - 1 ) {
|
529 |
+
query += '&';
|
530 |
+
}
|
531 |
+
}
|
532 |
+
|
533 |
+
url = action + query;
|
534 |
+
}
|
535 |
+
window.location = url;
|
536 |
+
}
|
537 |
+
});
|
538 |
+
|
539 |
+
jQuery('.um-form input[class="um-button"][type="submit"]').prop('disabled', false);
|
540 |
+
|
541 |
+
jQuery(document).one('click', '.um:not(.um-account) .um-form input[class="um-button"][type="submit"]:not(.um-has-recaptcha)', function() {
|
542 |
+
jQuery(this).attr('disabled','disabled');
|
543 |
+
jQuery(this).parents('form').trigger('submit');
|
544 |
+
});
|
545 |
+
|
546 |
+
|
547 |
+
var um_select_options_cache = {};
|
548 |
+
|
549 |
+
/**
|
550 |
+
* Find all select fields with parent select fields
|
551 |
+
*/
|
552 |
+
jQuery('select[data-um-parent]').each( function() {
|
553 |
+
|
554 |
+
var me = jQuery(this);
|
555 |
+
var parent_option = me.data('um-parent');
|
556 |
+
var um_ajax_source = me.data('um-ajax-source');
|
557 |
+
|
558 |
+
me.attr('data-um-init-field', true );
|
559 |
+
|
560 |
+
jQuery(document).on('change','select[name="' + parent_option + '"]',function() {
|
561 |
+
var parent = jQuery(this);
|
562 |
+
var form_id = parent.closest( 'form' ).find( 'input[type="hidden"][name="form_id"]' ).val();
|
563 |
+
|
564 |
+
var arr_key;
|
565 |
+
if ( me.attr( 'data-member-directory' ) === 'yes' ) {
|
566 |
+
var directory = parent.parents('.um-directory');
|
567 |
+
arr_key = um_get_data_for_directory( directory, 'filter_' + parent_option );
|
568 |
+
if ( typeof arr_key != 'undefined' ) {
|
569 |
+
arr_key = arr_key.split('||');
|
570 |
+
} else {
|
571 |
+
arr_key = '';
|
572 |
+
}
|
573 |
+
} else {
|
574 |
+
arr_key = parent.val();
|
575 |
+
}
|
576 |
+
|
577 |
+
if ( typeof arr_key != 'undefined' && arr_key !== '' && typeof um_select_options_cache[ arr_key ] !== 'object' ) {
|
578 |
+
|
579 |
+
if ( typeof( me.um_wait ) === 'undefined' || me.um_wait === false ) {
|
580 |
+
me.um_wait = true;
|
581 |
+
} else {
|
582 |
+
return;
|
583 |
+
}
|
584 |
+
|
585 |
+
jQuery.ajax({
|
586 |
+
url: wp.ajax.settings.url,
|
587 |
+
type: 'post',
|
588 |
+
data: {
|
589 |
+
action: 'um_select_options',
|
590 |
+
parent_option_name: parent_option,
|
591 |
+
parent_option: arr_key,
|
592 |
+
child_callback: um_ajax_source,
|
593 |
+
child_name: me.attr('name'),
|
594 |
+
members_directory: me.attr('data-member-directory'),
|
595 |
+
form_id: form_id,
|
596 |
+
nonce: um_scripts.nonce
|
597 |
+
},
|
598 |
+
success: function( data ) {
|
599 |
+
if ( data.status === 'success' && arr_key !== '' ) {
|
600 |
+
um_select_options_cache[ arr_key ] = data;
|
601 |
+
um_field_populate_child_options( me, data, arr_key );
|
602 |
+
}
|
603 |
+
|
604 |
+
if ( typeof data.debug !== 'undefined' ) {
|
605 |
+
console.log( data );
|
606 |
+
}
|
607 |
+
|
608 |
+
me.um_wait = false;
|
609 |
+
},
|
610 |
+
error: function( e ) {
|
611 |
+
console.log( e );
|
612 |
+
me.um_wait = false;
|
613 |
+
}
|
614 |
+
});
|
615 |
+
|
616 |
+
}
|
617 |
+
|
618 |
+
if ( typeof arr_key != 'undefined' && arr_key !== '' && typeof um_select_options_cache[ arr_key ] == 'object' ) {
|
619 |
+
setTimeout( um_field_populate_child_options, 10, me, um_select_options_cache[ arr_key ], arr_key );
|
620 |
+
}
|
621 |
+
|
622 |
+
if ( typeof arr_key != 'undefined' || arr_key === '' ) {
|
623 |
+
me.find('option[value!=""]').remove();
|
624 |
+
me.val('').trigger('change');
|
625 |
+
}
|
626 |
+
|
627 |
+
});
|
628 |
+
|
629 |
+
jQuery('select[name="' + parent_option + '"]').trigger('change');
|
630 |
+
|
631 |
+
});
|
632 |
+
|
633 |
+
|
634 |
+
/**
|
635 |
+
* Populates child options and cache ajax response
|
636 |
+
*
|
637 |
+
* @param me
|
638 |
+
* @param data
|
639 |
+
* @param arr_key
|
640 |
+
*/
|
641 |
+
function um_field_populate_child_options( me, data, arr_key ) {
|
642 |
+
var directory = me.parents('.um-directory');
|
643 |
+
var child_name = me.attr('name');
|
644 |
+
me.find('option[value!=""]').remove();
|
645 |
+
|
646 |
+
if ( ! me.hasClass('um-child-option-disabled') ) {
|
647 |
+
me.prop('disabled', false);
|
648 |
+
}
|
649 |
+
|
650 |
+
var arr_items = [],
|
651 |
+
search_get = '';
|
652 |
+
|
653 |
+
if ( data.post.members_directory === 'yes' ) {
|
654 |
+
arr_items.push({id: '', text: '', selected: 1});
|
655 |
+
}
|
656 |
+
jQuery.each( data.items, function(k,v){
|
657 |
+
arr_items.push({id: k, text: v, selected: (v === search_get)});
|
658 |
+
});
|
659 |
+
|
660 |
+
me.select2('destroy');
|
661 |
+
me.select2({
|
662 |
+
data: arr_items,
|
663 |
+
allowClear: true,
|
664 |
+
minimumResultsForSearch: 10
|
665 |
+
});
|
666 |
+
|
667 |
+
if ( data.post.members_directory === 'yes' ) {
|
668 |
+
me.find('option').each( function() {
|
669 |
+
if ( jQuery(this).html() !== '' ) {
|
670 |
+
jQuery(this).data( 'value_label', jQuery(this).html() ).attr( 'data-value_label', jQuery(this).html() );
|
671 |
+
}
|
672 |
+
});
|
673 |
+
|
674 |
+
var current_filter_val = um_get_data_for_directory( directory, 'filter_' + child_name );
|
675 |
+
if ( typeof current_filter_val !== 'undefined' ) {
|
676 |
+
current_filter_val = current_filter_val.split('||');
|
677 |
+
|
678 |
+
var temp_filter_val = [];
|
679 |
+
jQuery.each( current_filter_val, function(i) {
|
680 |
+
if ( me.find('option[value="' + current_filter_val[ i ] + '"]').length ) {
|
681 |
+
temp_filter_val.push( current_filter_val[ i ] );
|
682 |
+
}
|
683 |
+
me.find('option[value="' + current_filter_val[ i ] + '"]').prop('disabled', true).hide();
|
684 |
+
if ( me.find('option:not(:disabled)').length === 1 ) {
|
685 |
+
me.prop('disabled', true);
|
686 |
+
}
|
687 |
+
|
688 |
+
me.select2('destroy').select2();
|
689 |
+
me.val('').trigger( 'change' );
|
690 |
+
});
|
691 |
+
|
692 |
+
temp_filter_val = temp_filter_val.join('||');
|
693 |
+
if ( current_filter_val !== temp_filter_val ) {
|
694 |
+
um_set_url_from_data( directory, 'filter_' + child_name, temp_filter_val );
|
695 |
+
um_ajax_get_members( directory );
|
696 |
+
}
|
697 |
+
}
|
698 |
+
|
699 |
+
um_change_tag( directory );
|
700 |
+
}
|
701 |
+
|
702 |
+
if ( data.post.members_directory !== 'yes' ) {
|
703 |
+
if ( typeof data.field.default !== 'undefined' && ! me.data('um-original-value') ) {
|
704 |
+
me.val( data.field.default ).trigger('change');
|
705 |
+
} else if ( me.data('um-original-value') !== '' ) {
|
706 |
+
me.val( me.data('um-original-value') ).trigger('change');
|
707 |
+
}
|
708 |
+
|
709 |
+
if ( data.field.editable == 0 ) {
|
710 |
+
me.addClass('um-child-option-disabled');
|
711 |
+
me.attr('disabled','disabled');
|
712 |
+
}
|
713 |
+
}
|
714 |
+
}
|
715 |
+
|
716 |
+
});
|
assets/js/um-scripts.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function um_sanitize_value(e,t){var a=document.createElement("div");a.innerText=e;var i=a.innerHTML;return t&&jQuery(t).val(i),i}function um_unsanitize_value(e){var t=document.createElement("textarea");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue}function um_init_datetimepicker(){jQuery(".um-datepicker:not(.picker__input)").each(function(){var e=jQuery(this),t=!1;void 0!==e.attr("data-disabled_weekdays")&&""!==e.attr("data-disabled_weekdays")&&(t=JSON.parse(e.attr("data-disabled_weekdays")));var a=null;void 0!==e.attr("data-years")&&(a=e.attr("data-years"));var i=e.attr("data-date_min"),r=e.attr("data-date_max"),n=[],u=[];void 0!==i&&(n=i.split(",")),void 0!==r&&(u=r.split(","));var o=n.length?new Date(n):null,d=n.length?new Date(u):null;if(o&&"Invalid Date"==o.toString()&&3==n.length){var s=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(s))}if(d&&"Invalid Date"==d.toString()&&3==u.length){var l=u[1]+"/"+u[2]+"/"+u[0];d=new Date(Date.parse(l))}var c={disable:t,format:e.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}};null!==a&&(c.selectYears=a),null!==o&&(c.min=o),null!==d&&(c.max=d),e.pickadate(c)}),jQuery(".um-timepicker:not(.picker__input)").each(function(){var e=jQuery(this);e.pickatime({format:e.attr("data-format"),interval:parseInt(e.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}})})}function init_tipsy(){"function"==typeof jQuery.fn.tipsy&&(jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}))}jQuery(document).ready(function(){function i(e){var a=jQuery(e.currentTarget),t=a.find(":selected");1<t.length&&t.each(function(e,t){""===t.value&&(t.selected=!1,a.trigger("change"))})}jQuery(document.body).on("click",".um-dropdown a.real_url",function(){window.location=jQuery(this).attr("href")}),jQuery(document.body).on("click",".um-trigger-menu-on-click",function(){var e=jQuery(this).find(".um-dropdown");return UM.dropdown.show(e),!1}),jQuery(document.body).on("click",".um-dropdown-hide",function(){return UM.dropdown.hideAll(),!1}),jQuery(document.body).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");return jQuery(this).parents(t).find(e).trigger("click"),UM.dropdown.hideAll(),!1}),jQuery(".um-s1,.um-s2").css({display:"block"}),"function"==typeof jQuery.fn.select2&&(jQuery(".um-s1").each(function(e){var t=jQuery(this);t.select2({allowClear:!0,dropdownParent:t.parent()}).on("change",i)}),jQuery(".um-s2").each(function(e){var t=jQuery(this),a={};a=t.parents(".um-custom-shortcode-tab").length?{allowClear:!1}:{allowClear:!1,minimumResultsForSearch:10,dropdownParent:t.parent()},t.select2(a).on("change",i)}),jQuery(".um-s3").each(function(e){var t=jQuery(this);t.select2({allowClear:!1,minimumResultsForSearch:-1,dropdownParent:t.parent()}).on("change",i)})),init_tipsy(),"function"==typeof jQuery.fn.um_raty&&(jQuery(".um-rating").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){um_live_field=this.id,um_live_value=e,um_apply_conditions(jQuery(this),!1)}}),jQuery(".um-rating-readonly").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0})),jQuery(document).on("change",'.um-field-area input[type="radio"]',function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeAttr("class").addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeAttr("class").addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",'.um-field-area input[type="checkbox"]',function(){var e=jQuery(this).parents("label");e.hasClass("active")?(e.removeClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline"))}),um_init_datetimepicker(),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=t.find('input[type="hidden"]#'+t.data("key")+"-"+jQuery(this).parents("form").find('input[type="hidden"][name="form_id"]').val()).val(),i=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src"),r=t.data("mode"),n={data:{mode:r,filename:a,src:i,nonce:um_scripts.nonce},success:function(){t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html(t.data("upload-label")),t.find('input[type="hidden"]').val("empty_file")}};return"register"!==r&&(n.data.user_id=jQuery(this).parents("form").find("#user_id").val()),wp.ajax.send("um_remove_file",n),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=t.find('input[type="hidden"]#'+t.data("key")+"-"+jQuery(this).parents("form").find('input[type="hidden"][name="form_id"]').val()).val(),i=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href"),r=t.data("mode"),n={data:{mode:r,filename:a,src:i,nonce:um_scripts.nonce},success:function(){t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html(t.data("upload-label")),t.find("input[type=hidden]").val("empty_file")}};return"register"!==r&&(n.data.user_id=jQuery(this).parents("form").find("#user_id").val()),wp.ajax.send("um_remove_file",n),!1}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e);var a=0;e.find(".um-field-group-body").each(function(){a++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+a),e.attr("name",e.data("key")+"-"+a),e.parent().parent().find("label").attr("for",e.data("key")+"-"+a)})}),0<t&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),a=t.data("max_entries");return 1<t.find(".um-field-group-body").length?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),0<a&&t.find(".um-field-group-body").length<a&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document.body).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this),a=t.parent();a.addClass("loading");var i=1*t.data("pages"),r=1*t.data("page")+1,n=t.data("hook");if("um_load_posts"===n)jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_posts",author:jQuery(this).data("author"),page:r,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),r==i?a.remove():t.data("page",r)}});else if("um_load_comments"===n)jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_comments",user_id:jQuery(this).data("user_id"),page:r,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),r==i?a.remove():t.data("page",r)}});else{var u=jQuery(this).data("args"),o=jQuery(this).parents(".um").find(".um-ajax-items");jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate",hook:n,args:u,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.remove(),o.append(e)}})}}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),a=jQuery(this).data("user_id"),arguments=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_muted_action",hook:t,user_id:a,arguments:arguments,nonce:um_scripts.nonce},success:function(e){}}),!1}),jQuery(document.body).on("click","#um-search-button",function(){var e=jQuery(this).parents(".um-search-form").data("members_page"),t=[];jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){t.push(jQuery(this).val())});var a,i=jQuery(this).parents(".um-search-form").find(".um-search-field").val();if(""===i)a=e;else{for(var r="?",n=0;n<t.length;n++)r+=t[n]+"="+i,n!==t.length-1&&(r+="&");a=e+r}window.location=a}),jQuery(document.body).on("keypress",".um-search-field",function(e){if(13===e.which){var t=jQuery(this).parents(".um-search-form").data("members_page"),a=[];jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){a.push(jQuery(this).val())});var i,r=jQuery(this).val();if(""===r)i=t;else{for(var n="?",u=0;u<a.length;u++)n+=a[u]+"="+r,u!==a.length-1&&(n+="&");i=t+n}window.location=i}}),jQuery('.um-form input[class="um-button"][type="submit"]').prop("disabled",!1),jQuery(document).one("click",'.um:not(.um-account) .um-form input[class="um-button"][type="submit"]:not(.um-has-recaptcha)',function(){jQuery(this).attr("disabled","disabled"),jQuery(this).parents("form").trigger("submit")});var o={};function d(t,e,a){var i=t.parents(".um-directory"),r=t.attr("name");t.find('option[value!=""]').remove(),t.hasClass("um-child-option-disabled")||t.prop("disabled",!1);var n=[];if("yes"===e.post.members_directory&&n.push({id:"",text:"",selected:1}),jQuery.each(e.items,function(e,t){n.push({id:e,text:t,selected:""===t})}),t.select2("destroy"),t.select2({data:n,allowClear:!0,minimumResultsForSearch:10}),"yes"===e.post.members_directory){t.find("option").each(function(){""!==jQuery(this).html()&&jQuery(this).data("value_label",jQuery(this).html()).attr("data-value_label",jQuery(this).html())});var u=um_get_data_for_directory(i,"filter_"+r);if(void 0!==u){u=u.split("||");var o=[];jQuery.each(u,function(e){t.find('option[value="'+u[e]+'"]').length&&o.push(u[e]),t.find('option[value="'+u[e]+'"]').prop("disabled",!0).hide(),1===t.find("option:not(:disabled)").length&&t.prop("disabled",!0),t.select2("destroy").select2(),t.val("").trigger("change")}),o=o.join("||"),u!==o&&(um_set_url_from_data(i,"filter_"+r,o),um_ajax_get_members(i))}um_change_tag(i)}"yes"!==e.post.members_directory&&(void 0===e.field.default||t.data("um-original-value")?""!==t.data("um-original-value")&&t.val(t.data("um-original-value")).trigger("change"):t.val(e.field.default).trigger("change"),0==e.field.editable&&(t.addClass("um-child-option-disabled"),t.attr("disabled","disabled")))}jQuery("select[data-um-parent]").each(function(){var r=jQuery(this),n=r.data("um-parent"),u=r.data("um-ajax-source");r.attr("data-um-init-field",!0),jQuery(document).on("change",'select[name="'+n+'"]',function(){var t,e=jQuery(this),a=e.closest("form").find('input[type="hidden"][name="form_id"]').val();if("yes"===r.attr("data-member-directory")){var i=e.parents(".um-directory");t=void 0!==(t=um_get_data_for_directory(i,"filter_"+n))?t.split("||"):""}else t=e.val();if(void 0!==t&&""!==t&&"object"!=typeof o[t]){if(void 0!==r.um_wait&&!1!==r.um_wait)return;r.um_wait=!0,jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_select_options",parent_option_name:n,parent_option:t,child_callback:u,child_name:r.attr("name"),members_directory:r.attr("data-member-directory"),form_id:a,nonce:um_scripts.nonce},success:function(e){"success"===e.status&&""!==t&&(o[t]=e,d(r,e,t)),void 0!==e.debug&&console.log(e),r.um_wait=!1},error:function(e){console.log(e),r.um_wait=!1}})}void 0!==t&&""!==t&&"object"==typeof o[t]&&setTimeout(d,10,r,o[t],t),void 0===t&&""!==t||(r.find('option[value!=""]').remove(),r.val("").trigger("change"))}),jQuery('select[name="'+n+'"]').trigger("change")})});
|
1 |
+
function um_sanitize_value(e,t){var a=document.createElement("div"),e=(a.innerText=e,a.innerHTML);return t&&jQuery(t).val(e),e}function um_unsanitize_value(e){var t=document.createElement("textarea");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue}function um_init_datetimepicker(){jQuery(".um-datepicker:not(.picker__input)").each(function(){var e=jQuery(this),t=!1,a=(void 0!==e.attr("data-disabled_weekdays")&&""!==e.attr("data-disabled_weekdays")&&(t=JSON.parse(e.attr("data-disabled_weekdays"))),null),i=(void 0!==e.attr("data-years")&&(a=e.attr("data-years")),e.attr("data-date_min")),n=e.attr("data-date_max"),r=[],u=[],i=(void 0!==i&&(r=i.split(",")),void 0!==n&&(u=n.split(",")),r.length?new Date(r):null),n=r.length?new Date(u):null,u=(i&&"Invalid Date"==i.toString()&&3==r.length&&(r=r[1]+"/"+r[2]+"/"+r[0],i=new Date(Date.parse(r))),n&&"Invalid Date"==n.toString()&&3==u.length&&(r=u[1]+"/"+u[2]+"/"+u[0],n=new Date(Date.parse(r))),{disable:t,format:e.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}});null!==a&&(u.selectYears=a),null!==i&&(u.min=i),null!==n&&(u.max=n),e.pickadate(u)}),jQuery(".um-timepicker:not(.picker__input)").each(function(){var e=jQuery(this);e.pickatime({format:e.attr("data-format"),interval:parseInt(e.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}})})}function init_tipsy(){"function"==typeof jQuery.fn.tipsy&&(jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}))}jQuery(document).ready(function(){function i(e){var a=jQuery(e.currentTarget),e=a.find(":selected");1<e.length&&e.each(function(e,t){""===t.value&&(t.selected=!1,a.trigger("change"))})}jQuery(document.body).on("click",".um-dropdown a.real_url",function(){window.location=jQuery(this).attr("href")}),jQuery(document.body).on("click",".um-trigger-menu-on-click",function(){var e=jQuery(this).find(".um-dropdown");return UM.dropdown.show(e),!1}),jQuery(document.body).on("click",".um-dropdown-hide",function(){return UM.dropdown.hideAll(),!1}),jQuery(document.body).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");return jQuery(this).parents(t).find(e).trigger("click"),UM.dropdown.hideAll(),!1}),jQuery(".um-s1,.um-s2").css({display:"block"}),"function"==typeof jQuery.fn.select2&&(jQuery(".um-s1").each(function(e){var t=jQuery(this);t.select2({allowClear:!0,dropdownParent:t.parent()}).on("change",i)}),jQuery(".um-s2").each(function(e){var t=jQuery(this),a={},a=t.parents(".um-custom-shortcode-tab").length?{allowClear:!1}:{allowClear:!1,minimumResultsForSearch:10,dropdownParent:t.parent()};t.select2(a).on("change",i)}),jQuery(".um-s3").each(function(e){var t=jQuery(this);t.select2({allowClear:!1,minimumResultsForSearch:-1,dropdownParent:t.parent()}).on("change",i)})),init_tipsy(),"function"==typeof jQuery.fn.um_raty&&(jQuery(".um-rating").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){um_live_field=this.id,um_live_value=e,um_apply_conditions(jQuery(this),!1)}}),jQuery(".um-rating-readonly").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0})),jQuery(document).on("change",'.um-field-area input[type="radio"]',function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeAttr("class").addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeAttr("class").addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",'.um-field-area input[type="checkbox"]',function(){var e=jQuery(this).parents("label");e.hasClass("active")?(e.removeClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline"))}),um_init_datetimepicker(),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),e=t.find('input[type="hidden"]#'+t.data("key")+"-"+jQuery(this).parents("form").find('input[type="hidden"][name="form_id"]').val()).val(),a=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src"),i=t.data("mode"),e={data:{mode:i,filename:e,src:a,nonce:um_scripts.nonce},success:function(){t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html(t.data("upload-label")),t.find('input[type="hidden"]').val("empty_file")}};return"register"!==i&&(e.data.user_id=jQuery(this).parents("form").find("#user_id").val()),wp.ajax.send("um_remove_file",e),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),e=t.find('input[type="hidden"]#'+t.data("key")+"-"+jQuery(this).parents("form").find('input[type="hidden"][name="form_id"]').val()).val(),a=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href"),i=t.data("mode"),e={data:{mode:i,filename:e,src:a,nonce:um_scripts.nonce},success:function(){t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html(t.data("upload-label")),t.find("input[type=hidden]").val("empty_file")}};return"register"!==i&&(e.data.user_id=jQuery(this).parents("form").find("#user_id").val()),wp.ajax.send("um_remove_file",e),!1}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries"),a=(e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e),0);e.find(".um-field-group-body").each(function(){a++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+a),e.attr("name",e.data("key")+"-"+a),e.parent().parent().find("label").attr("for",e.data("key")+"-"+a)})}),0<t&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");return 1<e.find(".um-field-group-body").length?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),0<t&&e.find(".um-field-group-body").length<t&&e.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document.body).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t,a,i=jQuery(this),n=i.parent(),r=(n.addClass("loading"),+i.data("pages")),u=+i.data("page")+1,e=i.data("hook");"um_load_posts"===e?jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_posts",author:jQuery(this).data("author"),page:u,nonce:um_scripts.nonce},complete:function(){n.removeClass("loading")},success:function(e){n.before(e),u==r?n.remove():i.data("page",u)}}):"um_load_comments"===e?jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_comments",user_id:jQuery(this).data("user_id"),page:u,nonce:um_scripts.nonce},complete:function(){n.removeClass("loading")},success:function(e){n.before(e),u==r?n.remove():i.data("page",u)}}):(t=jQuery(this).data("args"),a=jQuery(this).parents(".um").find(".um-ajax-items"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate",hook:e,args:t,nonce:um_scripts.nonce},complete:function(){n.removeClass("loading")},success:function(e){n.remove(),a.append(e)}}))}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),a=jQuery(this).data("user_id"),arguments=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_muted_action",hook:t,user_id:a,arguments:arguments,nonce:um_scripts.nonce},success:function(e){}}),!1}),jQuery(document.body).on("click","#um-search-button",function(){var e,t=jQuery(this).parents(".um-search-form").data("members_page"),a=[],i=(jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){a.push(jQuery(this).val())}),jQuery(this).parents(".um-search-form").find(".um-search-field").val());if(""===i)e=t;else{for(var n="?",r=0;r<a.length;r++)n+=a[r]+"="+i,r!==a.length-1&&(n+="&");e=t+n}window.location=e}),jQuery(document.body).on("keypress",".um-search-field",function(e){if(13===e.which){var t,e=jQuery(this).parents(".um-search-form").data("members_page"),a=[],i=(jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){a.push(jQuery(this).val())}),jQuery(this).val());if(""===i)t=e;else{for(var n="?",r=0;r<a.length;r++)n+=a[r]+"="+i,r!==a.length-1&&(n+="&");t=e+n}window.location=t}}),jQuery('.um-form input[class="um-button"][type="submit"]').prop("disabled",!1),jQuery(document).one("click",'.um:not(.um-account) .um-form input[class="um-button"][type="submit"]:not(.um-has-recaptcha)',function(){jQuery(this).attr("disabled","disabled"),jQuery(this).parents("form").trigger("submit")});var o={};function d(t,e,a){var i,n,r=t.parents(".um-directory"),u=t.attr("name"),o=(t.find('option[value!=""]').remove(),t.hasClass("um-child-option-disabled")||t.prop("disabled",!1),[]);"yes"===e.post.members_directory&&o.push({id:"",text:"",selected:1}),jQuery.each(e.items,function(e,t){o.push({id:e,text:t,selected:""===t})}),t.select2("destroy"),t.select2({data:o,allowClear:!0,minimumResultsForSearch:10}),"yes"===e.post.members_directory&&(t.find("option").each(function(){""!==jQuery(this).html()&&jQuery(this).data("value_label",jQuery(this).html()).attr("data-value_label",jQuery(this).html())}),void 0!==(i=um_get_data_for_directory(r,"filter_"+u))&&(i=i.split("||"),n=[],jQuery.each(i,function(e){t.find('option[value="'+i[e]+'"]').length&&n.push(i[e]),t.find('option[value="'+i[e]+'"]').prop("disabled",!0).hide(),1===t.find("option:not(:disabled)").length&&t.prop("disabled",!0),t.select2("destroy").select2(),t.val("").trigger("change")}),n=n.join("||"),i!==n&&(um_set_url_from_data(r,"filter_"+u,n),um_ajax_get_members(r))),um_change_tag(r)),"yes"!==e.post.members_directory&&(void 0===e.field.default||t.data("um-original-value")?""!==t.data("um-original-value")&&t.val(t.data("um-original-value")).trigger("change"):t.val(e.field.default).trigger("change"),0==e.field.editable&&(t.addClass("um-child-option-disabled"),t.attr("disabled","disabled")))}jQuery("select[data-um-parent]").each(function(){var n=jQuery(this),r=n.data("um-parent"),u=n.data("um-ajax-source");n.attr("data-um-init-field",!0),jQuery(document).on("change",'select[name="'+r+'"]',function(){var e,t,a=jQuery(this),i=a.closest("form").find('input[type="hidden"][name="form_id"]').val();if(void 0!==(t="yes"===n.attr("data-member-directory")?(e=a.parents(".um-directory"),void 0!==(t=um_get_data_for_directory(e,"filter_"+r))?t.split("||"):""):a.val())&&""!==t&&"object"!=typeof o[t]){if(void 0!==n.um_wait&&!1!==n.um_wait)return;n.um_wait=!0,jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_select_options",parent_option_name:r,parent_option:t,child_callback:u,child_name:n.attr("name"),members_directory:n.attr("data-member-directory"),form_id:i,nonce:um_scripts.nonce},success:function(e){"success"===e.status&&""!==t&&(o[t]=e,d(n,e)),void 0!==e.debug&&console.log(e),n.um_wait=!1},error:function(e){console.log(e),n.um_wait=!1}})}void 0!==t&&""!==t&&"object"==typeof o[t]&&setTimeout(d,10,n,o[t],t),void 0===t&&""!==t||(n.find('option[value!=""]').remove(),n.val("").trigger("change"))}),jQuery('select[name="'+r+'"]').trigger("change")})});
|
assets/js/um-tipsy.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(
|
1 |
+
!function(a){function l(t,e){return"function"==typeof t?t.call(e):t}function h(t,e){this.$element=a(t),this.options=e,this.enabled=!0,this.fixTitle()}h.prototype={show:function(){var t=this.getTitle();if(t&&this.enabled){var e,i=this.tip(),s=(i.find(".tipsy-inner")[this.options.html?"html":"text"](t),i[0].className="tipsy",i.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body),a.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})),n=i[0].offsetWidth,o=i[0].offsetHeight,t=l(this.options.gravity,this.$element[0]);switch(t.charAt(0)){case"n":e={top:s.top+s.height+this.options.offset,left:s.left+s.width/2-n/2};break;case"s":e={top:s.top-o-this.options.offset,left:s.left+s.width/2-n/2};break;case"e":e={top:s.top+s.height/2-o/2,left:s.left-n-this.options.offset};break;case"w":(extra_gap=0)<a("body").css("position").length&&"relative"==a("body").css("position")&&a("#wpadminbar").length&&(extra_gap=a("#wpadminbar").height()),e={top:s.top+s.height/2-o/2-extra_gap,left:s.left+s.width+this.options.offset}}2==t.length&&("w"==t.charAt(1)?e.left=s.left+s.width/2-15:e.left=s.left+s.width/2-n+15),i.css(e).addClass("tipsy-"+t),i.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+t.charAt(0),this.options.className&&i.addClass(l(this.options.className,this.$element[0])),this.options.fade?i.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):i.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){a(this).remove()}):this.tip().remove()},fixTitle:function(){var t=this.$element;!t.attr("title")&&"string"==typeof t.attr("original-title")||t.attr("original-title",t.attr("title")||"").removeAttr("title")},getTitle:function(){var t,e=this.$element,i=this.options;return this.fixTitle(),"string"==typeof(i=this.options).title?t=e.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(t=i.title.call(e[0])),(t=(""+t).replace(/(^\s*|\s*$)/,""))||i.fallback},tip:function(){return this.$tip||(this.$tip=a('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},a.fn.tipsy=function(i){return!0===i?this.data("tipsy"):("string"==typeof i?(t=this.data("tipsy"))&&t[i]():((i=a.extend({},a.fn.tipsy.defaults,i)).on||this.each(function(){s(this)}),"manual"!=i.trigger&&(t="hover"==i.trigger?"mouseenter":"focus",e="hover"==i.trigger?"mouseleave":"blur",i.on?a(document).on(t,this.selector,n).on(e,this.selector,o):this.on(t,n).on(e,o))),this);var t,e;function s(t){var e=a.data(t,"tipsy");return e||(e=new h(t,a.fn.tipsy.elementOptions(t,i)),a.data(t,"tipsy",e)),e}function n(){var t=s(this);t.hoverState="in",0==i.delayIn?t.show():(t.fixTitle(),setTimeout(function(){"in"==t.hoverState&&t.show()},i.delayIn))}function o(){var t=s(this);t.hoverState="out",0==i.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},i.delayOut)}},a.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},a.fn.tipsy.revalidate=function(){a(".tipsy").each(function(){var t=a.data(this,"tipsy-pointee");t&&function(t){for(;t=t.parentNode;)if(t==document)return 1}(t)||a(this).remove()})},a.fn.tipsy.elementOptions=function(t,e){return a.metadata?a.extend({},e,a(t).metadata()):e},a.fn.tipsy.autoNS=function(){return a(this).offset().top>a(document).scrollTop()+a(window).height()/2?"s":"n"},a.fn.tipsy.autoWE=function(){return a(this).offset().left>a(document).scrollLeft()+a(window).width()/2?"e":"w"},a.fn.tipsy.autoBounds=function(n,o){return function(){var t={ns:o[0],ew:1<o.length&&o[1]},e=a(document).scrollTop()+n,i=a(document).scrollLeft()+n,s=a(this);return s.offset().top<e&&(t.ns="n"),s.offset().left<i&&(t.ew="w"),a(window).width()+a(document).scrollLeft()-s.offset().left<n&&(t.ew="e"),a(window).height()+a(document).scrollTop()-s.offset().top<n&&(t.ns="s"),t.ns+(t.ew||"")}}}(jQuery);
|
includes/admin/core/class-admin-enqueue.php
CHANGED
@@ -657,7 +657,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
|
|
657 |
global $wp_version, $current_screen;
|
658 |
|
659 |
if ( version_compare( $wp_version, '5.0', '>=' ) ) {
|
660 |
-
if ( $current_screen->is_block_editor() ) {
|
661 |
$this->load_gutenberg_js();
|
662 |
$this->load_gutenberg_shortcode_blocks();
|
663 |
}
|
657 |
global $wp_version, $current_screen;
|
658 |
|
659 |
if ( version_compare( $wp_version, '5.0', '>=' ) ) {
|
660 |
+
if ( isset( $current_screen ) && $current_screen->is_block_editor() ) {
|
661 |
$this->load_gutenberg_js();
|
662 |
$this->load_gutenberg_shortcode_blocks();
|
663 |
}
|
includes/admin/core/class-admin-notices.php
CHANGED
@@ -1,715 +1,715 @@
|
|
1 |
-
<?php
|
2 |
-
namespace um\admin\core;
|
3 |
-
|
4 |
-
|
5 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
-
|
7 |
-
|
8 |
-
if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Class Admin_Notices
|
13 |
-
* @package um\admin\core
|
14 |
-
*/
|
15 |
-
class Admin_Notices {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Notices list
|
19 |
-
*
|
20 |
-
* @var array
|
21 |
-
*/
|
22 |
-
var $list = array();
|
23 |
-
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Admin_Notices constructor.
|
27 |
-
*/
|
28 |
-
function __construct() {
|
29 |
-
add_action( 'admin_init', array( &$this, 'create_languages_folder' ) );
|
30 |
-
|
31 |
-
add_action( 'admin_init', array( &$this, 'create_list' ), 10 );
|
32 |
-
add_action( 'admin_notices', array( &$this, 'render_notices' ), 1 );
|
33 |
-
|
34 |
-
add_action( 'wp_ajax_um_dismiss_notice', array( &$this, 'dismiss_notice' ) );
|
35 |
-
add_action( 'admin_init', array( &$this, 'force_dismiss_notice' ) );
|
36 |
-
}
|
37 |
-
|
38 |
-
|
39 |
-
/**
|
40 |
-
*
|
41 |
-
*/
|
42 |
-
function create_list() {
|
43 |
-
$this->old_extensions_notice();
|
44 |
-
$this->install_core_page_notice();
|
45 |
-
$this->exif_extension_notice();
|
46 |
-
$this->show_update_messages();
|
47 |
-
$this->check_wrong_install_folder();
|
48 |
-
$this->need_upgrade();
|
49 |
-
$this->check_wrong_licenses();
|
50 |
-
|
51 |
-
$this->lock_registration();
|
52 |
-
|
53 |
-
// removed for now to avoid the bad reviews
|
54 |
-
//$this->reviews_notice();
|
55 |
-
|
56 |
-
//$this->future_changed();
|
57 |
-
|
58 |
-
/**
|
59 |
-
* UM hook
|
60 |
-
*
|
61 |
-
* @type action
|
62 |
-
* @title um_admin_create_notices
|
63 |
-
* @description Add notices to wp-admin
|
64 |
-
* @change_log
|
65 |
-
* ["Since: 2.0"]
|
66 |
-
* @usage add_action( 'um_admin_create_notices', 'function_name', 10 );
|
67 |
-
* @example
|
68 |
-
* <?php
|
69 |
-
* add_action( 'um_admin_create_notices', 'my_admin_create_notices', 10 );
|
70 |
-
* function my_admin_create_notices() {
|
71 |
-
* // your code here
|
72 |
-
* }
|
73 |
-
* ?>
|
74 |
-
*/
|
75 |
-
do_action( 'um_admin_create_notices' );
|
76 |
-
}
|
77 |
-
|
78 |
-
|
79 |
-
/**
|
80 |
-
* @return array
|
81 |
-
*/
|
82 |
-
function get_admin_notices() {
|
83 |
-
return $this->list;
|
84 |
-
}
|
85 |
-
|
86 |
-
|
87 |
-
/**
|
88 |
-
* @param $admin_notices
|
89 |
-
*/
|
90 |
-
function set_admin_notices( $admin_notices ) {
|
91 |
-
$this->list = $admin_notices;
|
92 |
-
}
|
93 |
-
|
94 |
-
|
95 |
-
/**
|
96 |
-
* @param $a
|
97 |
-
* @param $b
|
98 |
-
*
|
99 |
-
* @return mixed
|
100 |
-
*/
|
101 |
-
function notice_priority_sort( $a, $b ) {
|
102 |
-
if ( $a['priority'] == $b['priority'] ) {
|
103 |
-
return 0;
|
104 |
-
}
|
105 |
-
return ( $a['priority'] < $b['priority'] ) ? -1 : 1;
|
106 |
-
}
|
107 |
-
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Add notice to UM notices array
|
111 |
-
*
|
112 |
-
* @param string $key
|
113 |
-
* @param array $data
|
114 |
-
* @param int $priority
|
115 |
-
*/
|
116 |
-
function add_notice( $key, $data, $priority = 10 ) {
|
117 |
-
$admin_notices = $this->get_admin_notices();
|
118 |
-
|
119 |
-
if ( empty( $admin_notices[ $key ] ) ) {
|
120 |
-
$admin_notices[ $key ] = array_merge( $data, array( 'priority' => $priority ) );
|
121 |
-
$this->set_admin_notices( $admin_notices );
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Remove notice from UM notices array
|
128 |
-
*
|
129 |
-
* @param string $key
|
130 |
-
*/
|
131 |
-
function remove_notice( $key ) {
|
132 |
-
$admin_notices = $this->get_admin_notices();
|
133 |
-
|
134 |
-
if ( ! empty( $admin_notices[ $key ] ) ) {
|
135 |
-
unset( $admin_notices[ $key ] );
|
136 |
-
$this->set_admin_notices( $admin_notices );
|
137 |
-
}
|
138 |
-
}
|
139 |
-
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Render all admin notices
|
143 |
-
*/
|
144 |
-
function render_notices() {
|
145 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
146 |
-
return;
|
147 |
-
}
|
148 |
-
|
149 |
-
$admin_notices = $this->get_admin_notices();
|
150 |
-
|
151 |
-
$hidden = get_option( 'um_hidden_admin_notices', array() );
|
152 |
-
|
153 |
-
uasort( $admin_notices, array( &$this, 'notice_priority_sort' ) );
|
154 |
-
|
155 |
-
foreach ( $admin_notices as $key => $admin_notice ) {
|
156 |
-
if ( empty( $hidden ) || ! in_array( $key, $hidden ) ) {
|
157 |
-
$this->display_notice( $key );
|
158 |
-
}
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* UM hook
|
163 |
-
*
|
164 |
-
* @type action
|
165 |
-
* @title um_admin_after_main_notices
|
166 |
-
* @description Insert some content after main admin notices
|
167 |
-
* @change_log
|
168 |
-
* ["Since: 2.0"]
|
169 |
-
* @usage add_action( 'um_admin_after_main_notices', 'function_name', 10 );
|
170 |
-
* @example
|
171 |
-
* <?php
|
172 |
-
* add_action( 'um_admin_after_main_notices', 'my_admin_after_main_notices', 10 );
|
173 |
-
* function my_admin_after_main_notices() {
|
174 |
-
* // your code here
|
175 |
-
* }
|
176 |
-
* ?>
|
177 |
-
*/
|
178 |
-
do_action( 'um_admin_after_main_notices' );
|
179 |
-
}
|
180 |
-
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Display single admin notice
|
184 |
-
*
|
185 |
-
* @param string $key
|
186 |
-
* @param bool $echo
|
187 |
-
*
|
188 |
-
* @return void|string
|
189 |
-
*/
|
190 |
-
function display_notice( $key, $echo = true ) {
|
191 |
-
$admin_notices = $this->get_admin_notices();
|
192 |
-
|
193 |
-
if ( empty( $admin_notices[ $key ] ) ) {
|
194 |
-
return;
|
195 |
-
}
|
196 |
-
|
197 |
-
$notice_data = $admin_notices[ $key ];
|
198 |
-
|
199 |
-
$class = ! empty( $notice_data['class'] ) ? $notice_data['class'] : 'updated';
|
200 |
-
|
201 |
-
$dismissible = ! empty( $admin_notices[ $key ]['dismissible'] );
|
202 |
-
|
203 |
-
ob_start(); ?>
|
204 |
-
|
205 |
-
<div class="<?php echo esc_attr( $class ) ?> um-admin-notice notice <?php echo $dismissible ? 'is-dismissible' : '' ?>" data-key="<?php echo esc_attr( $key ) ?>">
|
206 |
-
<?php echo ! empty( $notice_data['message'] ) ? |