(function ($){
'use strict';
$.ajaxChimp={
responses: {
'We have sent you a confirmation email':0,
'Please enter a value':1,
'An email address must contain a single @':2,
'The domain portion of the email address is invalid (the portion after the @:)':3,
'The username portion of the email address is invalid (the portion before the @:)':4,
'This email address looks fake or invalid. Please enter a real email address':5
},
translations: {
'en': null
},
init: function (selector, options){
$(selector).ajaxChimp(options);
}};
$.fn.ajaxChimp=function (options){
$(this).each(function(i, elem){
var form=$(elem);
var name=form.find('.mc-name');
var email=form.find('input[type=email]');
var label=form.find('label');
$.ajaxChimp.translations=$(this).data('response');
var settings=$.extend({
'url': form.attr('action')
}, options);
var url=settings.url.replace('/post?', '/post-json?').concat('&c=?');
form.attr('novalidate', 'true');
email.attr('name', 'EMAIL');
if(name.length){
name.attr('name', 'MERGE1');
}
form.submit(function (){
var msg;
function successCallback(resp){
$('.ajax-overlay',form).hide();
if(resp.result==='success'){
msg='We have sent you a confirmation email';
label.removeClass('error').addClass('valid');
email.removeClass('error').addClass('valid');
}else{
email.removeClass('valid').addClass('error');
label.removeClass('valid').addClass('error');
var index=-1;
try {
var parts=resp.msg.split(' - ', 2);
if(parts[1]===undefined){
msg=resp.msg;
}else{
var i=parseInt(parts[0], 10);
if(i.toString()===parts[0]){
index=parts[0];
msg=parts[1];
}else{
index=-1;
msg=resp.msg;
}}
}
catch (e){
index=-1;
msg=resp.msg;
}}
if($.ajaxChimp.responses[msg]!==undefined
&& $.ajaxChimp.translations
&& $.ajaxChimp.translations
&& $.ajaxChimp.translations[$.ajaxChimp.responses[msg]]
){
msg=$.ajaxChimp.translations[$.ajaxChimp.responses[msg]];
}
label.html(msg);
label.show(2000);
if(settings.callback){
settings.callback(resp);
}}
var data={};
var dataArray=form.serializeArray();
$.each(dataArray, function (index, item){
data[item.name]=item.value;
});
if(!data.EMAIL||data.EMAIL===''){
alert('Please enter your email');
return false;
}
$('.ajax-overlay',form).show();
$.ajax({
url: url,
data: data,
success: successCallback,
dataType: 'jsonp',
error: function (resp, text){
$('.ajax-overlay',form).hide();
console.log('mailchimp ajax submit error: ' + text);
}});
var submitMsg='Submitting...';
if($.ajaxChimp.translations
&& $.ajaxChimp.translations
&& $.ajaxChimp.translations['submit']
){
submitMsg=$.ajaxChimp.translations['submit'];
}
label.html(submitMsg).show(2000);
return false;
});
});
return this;
};
$('.iw-mailchimp-form form').ajaxChimp();
})(jQuery);
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(x){"use strict";var t,e,i,n,W,C,o,s,r,l,a,h,u;function E(t,e,i){return[parseFloat(t[0])*(a.test(t[0])?e/100:1),parseFloat(t[1])*(a.test(t[1])?i/100:1)]}function L(t,e){return parseInt(x.css(t,e),10)||0}function N(t){return null!=t&&t===t.window}x.ui=x.ui||{},x.ui.version="1.13.3",
x.extend(x.expr.pseudos,{data:x.expr.createPseudo?x.expr.createPseudo(function(e){return function(t){return!!x.data(t,e)}}):function(t,e,i){return!!x.data(t,i[3])}}),
x.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}}),
x.ui.focusable=function(t,e){var i,n,o,s=t.nodeName.toLowerCase();return"area"===s?(o=(i=t.parentNode).name,!(!t.href||!o||"map"!==i.nodeName.toLowerCase())&&0<(i=x("img[usemap='#"+o+"']")).length&&i.is(":visible")):(/^(input|select|textarea|button|object)$/.test(s)?(n=!t.disabled)&&(o=x(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===s&&t.href||e,n&&x(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(x(t)))},x.extend(x.expr.pseudos,{focusable:function(t){return x.ui.focusable(t,null!=x.attr(t,"tabindex"))}}),x.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):x(this[0].form)},
x.ui.formResetMixin={_formResetHandler:function(){var e=x(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");x.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(x.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}},x.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),
x.expr.pseudos||(x.expr.pseudos=x.expr[":"]),x.uniqueSort||(x.uniqueSort=x.unique),x.escapeSelector||(e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,i=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},x.escapeSelector=function(t){return(t+"").replace(e,i)}),x.fn.even&&x.fn.odd||x.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}}),
x.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},
x.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+x.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},x.ui.plugin={add:function(t,e,i){var n,o=x.ui[t].prototype;for(n in i)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([e,i[n]])},call:function(t,e,i,n){var o,s=t.plugins[e];if(s&&(n||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(o=0;o<s.length;o++)t.options[s[o][0]]&&s[o][1].apply(t.element,i)}},
W=Math.max,C=Math.abs,o=/left|center|right/,s=/top|center|bottom/,r=/[\+\-]\d+(\.[\d]+)?%?/,l=/^\w+/,a=/%$/,h=x.fn.position,x.position={scrollbarWidth:function(){var t,e,i;return void 0!==n?n:(i=(e=x("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>")).children()[0],x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),n=t-i)},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?x.position.scrollbarWidth():0,height:e?x.position.scrollbarWidth():0}},getWithinInfo:function(t){var e=x(t||window),i=N(e[0]),n=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:i,isDocument:n,offset:!i&&!n?x(t).offset():{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:e.outerWidth(),height:e.outerHeight()}}},x.fn.position=function(f){var c,d,p,g,m,v,y,w,b,_,t,e;return f&&f.of?(v="string"==typeof(f=x.extend({},f)).of?x(document).find(f.of):x(f.of),y=x.position.getWithinInfo(f.within),w=x.position.getScrollInfo(y),b=(f.collision||"flip").split(" "),_={},e=9===(e=(t=v)[0]).nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:N(e)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:e.preventDefault?{width:0,height:0,offset:{top:e.pageY,left:e.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()},v[0].preventDefault&&(f.at="left top"),d=e.width,p=e.height,m=x.extend({},g=e.offset),x.each(["my","at"],function(){var t,e,i=(f[this]||"").split(" ");(i=1===i.length?o.test(i[0])?i.concat(["center"]):s.test(i[0])?["center"].concat(i):["center","center"]:i)[0]=o.test(i[0])?i[0]:"center",i[1]=s.test(i[1])?i[1]:"center",t=r.exec(i[0]),e=r.exec(i[1]),_[this]=[t?t[0]:0,e?e[0]:0],f[this]=[l.exec(i[0])[0],l.exec(i[1])[0]]}),1===b.length&&(b[1]=b[0]),"right"===f.at[0]?m.left+=d:"center"===f.at[0]&&(m.left+=d/2),"bottom"===f.at[1]?m.top+=p:"center"===f.at[1]&&(m.top+=p/2),c=E(_.at,d,p),m.left+=c[0],m.top+=c[1],this.each(function(){var i,t,r=x(this),l=r.outerWidth(),a=r.outerHeight(),e=L(this,"marginLeft"),n=L(this,"marginTop"),o=l+e+L(this,"marginRight")+w.width,s=a+n+L(this,"marginBottom")+w.height,h=x.extend({},m),u=E(_.my,r.outerWidth(),r.outerHeight());"right"===f.my[0]?h.left-=l:"center"===f.my[0]&&(h.left-=l/2),"bottom"===f.my[1]?h.top-=a:"center"===f.my[1]&&(h.top-=a/2),h.left+=u[0],h.top+=u[1],i={marginLeft:e,marginTop:n},x.each(["left","top"],function(t,e){x.ui.position[b[t]]&&x.ui.position[b[t]][e](h,{targetWidth:d,targetHeight:p,elemWidth:l,elemHeight:a,collisionPosition:i,collisionWidth:o,collisionHeight:s,offset:[c[0]+u[0],c[1]+u[1]],my:f.my,at:f.at,within:y,elem:r})}),f.using&&(t=function(t){var e=g.left-h.left,i=e+d-l,n=g.top-h.top,o=n+p-a,s={target:{element:v,left:g.left,top:g.top,width:d,height:p},element:{element:r,left:h.left,top:h.top,width:l,height:a},horizontal:i<0?"left":0<e?"right":"center",vertical:o<0?"top":0<n?"bottom":"middle"};d<l&&C(e+i)<d&&(s.horizontal="center"),p<a&&C(n+o)<p&&(s.vertical="middle"),W(C(e),C(i))>W(C(n),C(o))?s.important="horizontal":s.important="vertical",f.using.call(this,t,s)}),r.offset(x.extend(h,{using:t}))})):h.apply(this,arguments)},x.ui.position={fit:{left:function(t,e){var i,n=e.within,o=n.isWindow?n.scrollLeft:n.offset.left,n=n.width,s=t.left-e.collisionPosition.marginLeft,r=o-s,l=s+e.collisionWidth-n-o;n<e.collisionWidth?0<r&&l<=0?(i=t.left+r+e.collisionWidth-n-o,t.left+=r-i):t.left=!(0<l&&r<=0)&&l<r?o+n-e.collisionWidth:o:0<r?t.left+=r:0<l?t.left-=l:t.left=W(t.left-s,t.left)},top:function(t,e){var i,n=e.within,n=n.isWindow?n.scrollTop:n.offset.top,o=e.within.height,s=t.top-e.collisionPosition.marginTop,r=n-s,l=s+e.collisionHeight-o-n;o<e.collisionHeight?0<r&&l<=0?(i=t.top+r+e.collisionHeight-o-n,t.top+=r-i):t.top=!(0<l&&r<=0)&&l<r?n+o-e.collisionHeight:n:0<r?t.top+=r:0<l?t.top-=l:t.top=W(t.top-s,t.top)}},flip:{left:function(t,e){var i=e.within,n=i.offset.left+i.scrollLeft,o=i.width,i=i.isWindow?i.scrollLeft:i.offset.left,s=t.left-e.collisionPosition.marginLeft,r=s-i,s=s+e.collisionWidth-o-i,l="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,a="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,h=-2*e.offset[0];r<0?((o=t.left+l+a+h+e.collisionWidth-o-n)<0||o<C(r))&&(t.left+=l+a+h):0<s&&(0<(n=t.left-e.collisionPosition.marginLeft+l+a+h-i)||C(n)<s)&&(t.left+=l+a+h)},top:function(t,e){var i=e.within,n=i.offset.top+i.scrollTop,o=i.height,i=i.isWindow?i.scrollTop:i.offset.top,s=t.top-e.collisionPosition.marginTop,r=s-i,s=s+e.collisionHeight-o-i,l="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,a="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,h=-2*e.offset[1];r<0?((o=t.top+l+a+h+e.collisionHeight-o-n)<0||o<C(r))&&(t.top+=l+a+h):0<s&&(0<(n=t.top-e.collisionPosition.marginTop+l+a+h-i)||C(n)<s)&&(t.top+=l+a+h)}},flipfit:{left:function(){x.ui.position.flip.left.apply(this,arguments),x.ui.position.fit.left.apply(this,arguments)},top:function(){x.ui.position.flip.top.apply(this,arguments),x.ui.position.fit.top.apply(this,arguments)}}},x.ui.safeActiveElement=function(e){var i;try{i=e.activeElement}catch(t){i=e.body}return i=(i=i||e.body).nodeName?i:e.body},x.ui.safeBlur=function(t){t&&"body"!==t.nodeName.toLowerCase()&&x(t).trigger("blur")},
x.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var t=x(this);return(!i||"static"!==t.css("position"))&&n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&t.length?t:x(this[0].ownerDocument||document)},
x.extend(x.expr.pseudos,{tabbable:function(t){var e=x.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&x.ui.focusable(t,i)}}),
x.fn.extend({uniqueId:(u=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++u)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&x(this).removeAttr("id")})}});
var f,c=0,d=Array.prototype.hasOwnProperty,p=Array.prototype.slice;x.cleanData=(f=x.cleanData,function(t){for(var e,i,n=0;null!=(i=t[n]);n++)(e=x._data(i,"events"))&&e.remove&&x(i).triggerHandler("remove");f(t)}),x.widget=function(t,i,e){var n,o,s,r={},l=t.split(".")[0],a=l+"-"+(t=t.split(".")[1]);return e||(e=i,i=x.Widget),Array.isArray(e)&&(e=x.extend.apply(null,[{}].concat(e))),x.expr.pseudos[a.toLowerCase()]=function(t){return!!x.data(t,a)},x[l]=x[l]||{},n=x[l][t],o=x[l][t]=function(t,e){if(!this||!this._createWidget)return new o(t,e);arguments.length&&this._createWidget(t,e)},x.extend(o,n,{version:e.version,_proto:x.extend({},e),_childConstructors:[]}),(s=new i).options=x.widget.extend({},s.options),x.each(e,function(e,n){function o(){return i.prototype[e].apply(this,arguments)}function s(t){return i.prototype[e].apply(this,t)}r[e]="function"!=typeof n?n:function(){var t,e=this._super,i=this._superApply;return this._super=o,this._superApply=s,t=n.apply(this,arguments),this._super=e,this._superApply=i,t}}),o.prototype=x.widget.extend(s,{widgetEventPrefix:n&&s.widgetEventPrefix||t},r,{constructor:o,namespace:l,widgetName:t,widgetFullName:a}),n?(x.each(n._childConstructors,function(t,e){var i=e.prototype;x.widget(i.namespace+"."+i.widgetName,o,e._proto)}),delete n._childConstructors):i._childConstructors.push(o),x.widget.bridge(t,o),o},x.widget.extend=function(t){for(var e,i,n=p.call(arguments,1),o=0,s=n.length;o<s;o++)for(e in n[o])i=n[o][e],d.call(n[o],e)&&void 0!==i&&(x.isPlainObject(i)?t[e]=x.isPlainObject(t[e])?x.widget.extend({},t[e],i):x.widget.extend({},i):t[e]=i);return t},x.widget.bridge=function(s,e){var r=e.prototype.widgetFullName||s;x.fn[s]=function(i){var t="string"==typeof i,n=p.call(arguments,1),o=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=x.data(this,r);return"instance"===i?(o=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?x.error("no such method '"+i+"' for "+s+" widget instance"):(t=e[i].apply(e,n))!==e&&void 0!==t?(o=t&&t.jquery?o.pushStack(t.get()):t,!1):void 0:x.error("cannot call methods on "+s+" prior to initialization; attempted to call method '"+i+"'")}):o=void 0:(n.length&&(i=x.widget.extend.apply(null,[i].concat(n))),this.each(function(){var t=x.data(this,r);t?(t.option(i||{}),t._init&&t._init()):x.data(this,r,new e(i,this))})),o}},x.Widget=function(){},x.Widget._childConstructors=[],x.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,n,o,s=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(s={},t=(i=t.split(".")).shift(),i.length){for(n=s[t]=x.widget.extend({},this.options[t]),o=0;o<i.length-1;o++)n[i[o]]=n[i[o]]||{},n=n[i[o]];if(t=i.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];s[t]=e}return this._setOptions(s),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,n;for(e in t)n=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&n&&n.length&&(i=x(n.get()),this._removeClass(n,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(o){var s=[],r=this;function t(t,e){for(var i,n=0;n<t.length;n++)i=r.classesElementLookup[t[n]]||x(),i=o.add?(function(){var i=[];o.element.each(function(t,e){x.map(r.classesElementLookup,function(t){return t}).some(function(t){return t.is(e)})||i.push(e)}),r._on(x(i),{remove:"_untrackClassesElement"})}(),x(x.uniqueSort(i.get().concat(o.element.get())))):x(i.not(o.element).get()),r.classesElementLookup[t[n]]=i,s.push(t[n]),e&&o.classes[t[n]]&&s.push(o.classes[t[n]])}return(o=x.extend({element:this.element,classes:this.options.classes||{}},o)).keys&&t(o.keys.match(/\S+/g)||[],!0),o.extra&&t(o.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(i){var n=this;x.each(n.classesElementLookup,function(t,e){-1!==x.inArray(i.target,e)&&(n.classesElementLookup[t]=x(e.not(i.target).get()))}),this._off(x(i.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,n){var o="string"==typeof t||null===t,e={extra:o?e:i,keys:o?t:e,element:o?this.element:t,add:n="boolean"==typeof n?n:i};return e.element.toggleClass(this._classes(e),n),this},_on:function(o,s,t){var r,l=this;"boolean"!=typeof o&&(t=s,s=o,o=!1),t?(s=r=x(s),this.bindings=this.bindings.add(s)):(t=s,s=this.element,r=this.widget()),x.each(t,function(t,e){function i(){if(o||!0!==l.options.disabled&&!x(this).hasClass("ui-state-disabled"))return("string"==typeof e?l[e]:e).apply(l,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||x.guid++);var t=t.match(/^([\w:-]*)\s*(.*)$/),n=t[1]+l.eventNamespace,t=t[2];t?r.on(n,t,i):s.on(n,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e),this.bindings=x(this.bindings.not(t).get()),this.focusable=x(this.focusable.not(t).get()),this.hoverable=x(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(x(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(x(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,e,i){var n,o,s=this.options[t];if(i=i||{},(e=x.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],o=e.originalEvent)for(n in o)n in e||(e[n]=o[n]);return this.element.trigger(e,i),!("function"==typeof s&&!1===s.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},x.each({show:"fadeIn",hide:"fadeOut"},function(s,r){x.Widget.prototype["_"+s]=function(e,t,i){var n,o=(t="string"==typeof t?{effect:t}:t)?!0!==t&&"number"!=typeof t&&t.effect||r:s;"number"==typeof(t=t||{})?t={duration:t}:!0===t&&(t={}),n=!x.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),n&&x.effects&&x.effects.effect[o]?e[s](t):o!==s&&e[o]?e[o](t.duration,t.easing,i):e.queue(function(t){x(this)[s](),i&&i.call(e[0]),t()})}})});
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","../ie","../version","../widget"],e):e(jQuery)}(function(o){"use strict";var n=!1;return o(document).on("mouseup",function(){n=!1}),o.widget("ui.mouse",{version:"1.13.3",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.on("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).on("click."+this.widgetName,function(e){if(!0===o.data(e.target,t.widgetName+".preventClickEvent"))return o.removeData(e.target,t.widgetName+".preventClickEvent"),e.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){var t,i,s;if(!n)return this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),i=1===(this._mouseDownEvent=e).which,s=!("string"!=typeof(t=this).options.cancel||!e.target.nodeName)&&o(e.target).closest(this.options.cancel).length,i&&!s&&this._mouseCapture(e)&&(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){t.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(e),!this._mouseStarted)?e.preventDefault():(!0===o.data(e.target,this.widgetName+".preventClickEvent")&&o.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return t._mouseMove(e)},this._mouseUpDelegate=function(e){return t._mouseUp(e)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0)),!0},_mouseMove:function(e){if(this._mouseMoved){if(o.ui.ie&&(!document.documentMode||document.documentMode<9)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,e),this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&o.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","./mouse","../data","../ie","../scroll-parent","../version","../widget"],t):t(jQuery)}(function(u){"use strict";return u.widget("ui.sortable",u.ui.mouse,{version:"1.13.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return e<=t&&t<e+i},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var t=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),u.each(this.items,function(){t._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;0<=t;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,e){var i=null,s=!1,o=this;return!(this.reverting||this.options.disabled||"static"===this.options.type||(this._refreshItems(t),u(t.target).parents().each(function(){if(u.data(this,o.widgetName+"-item")===o)return i=u(this),!1}),!(i=u.data(t.target,o.widgetName+"-item")===o?u(t.target):i))||(this.options.handle&&!e&&(u(this.options.handle,i).find("*").addBack().each(function(){this===t.target&&(s=!0)}),!s)||(this.currentItem=i,this._removeCurrentsFromItems(),0)))},_mouseStart:function(t,e,i){var s,o,r=this.options;if((this.currentContainer=this).refreshPositions(),this.appendTo=u("parent"!==r.appendTo?r.appendTo:this.currentItem.parent()),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},u.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),r.cursorAt&&this._adjustOffsetFromHelper(r.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),this.scrollParent=this.placeholder.scrollParent(),u.extend(this.offset,{parent:this._getParentOffset()}),r.containment&&this._setContainment(),r.cursor&&"auto"!==r.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",r.cursor),this.storedStylesheet=u("<style>*{ cursor: "+r.cursor+" !important; }</style>").appendTo(o)),r.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",r.zIndex)),r.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",r.opacity)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(s=this.containers.length-1;0<=s;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return u.ui.ddmanager&&(u.ui.ddmanager.current=this),u.ui.ddmanager&&!r.dropBehaviour&&u.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this.helper.parent().is(this.appendTo)||(this.helper.detach().appendTo(this.appendTo),this.offset.parent=this._getParentOffset()),this.position=this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,this.lastPositionAbs=this.positionAbs=this._convertPositionTo("absolute"),this._mouseDrag(t),!0},_scroll:function(t){var e=this.options,i=!1;return this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<e.scrollSensitivity?this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop+e.scrollSpeed:t.pageY-this.overflowOffset.top<e.scrollSensitivity&&(this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop-e.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<e.scrollSensitivity?this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft+e.scrollSpeed:t.pageX-this.overflowOffset.left<e.scrollSensitivity&&(this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft-e.scrollSpeed)):(t.pageY-this.document.scrollTop()<e.scrollSensitivity?i=this.document.scrollTop(this.document.scrollTop()-e.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<e.scrollSensitivity&&(i=this.document.scrollTop(this.document.scrollTop()+e.scrollSpeed)),t.pageX-this.document.scrollLeft()<e.scrollSensitivity?i=this.document.scrollLeft(this.document.scrollLeft()-e.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<e.scrollSensitivity&&(i=this.document.scrollLeft(this.document.scrollLeft()+e.scrollSpeed))),i},_mouseDrag:function(t){var e,i,s,o,r=this.options;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),r.scroll&&!1!==this._scroll(t)&&(this._refreshItemPositions(!0),u.ui.ddmanager)&&!r.dropBehaviour&&u.ui.ddmanager.prepareOffsets(this,t),this.dragDirection={vertical:this._getDragVerticalDirection(),horizontal:this._getDragHorizontalDirection()},e=this.items.length-1;0<=e;e--)if(s=(i=this.items[e]).item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer&&!(s===this.currentItem[0]||this.placeholder[1===o?"next":"prev"]()[0]===s||u.contains(this.placeholder[0],s)||"semi-dynamic"===this.options.type&&u.contains(this.element[0],s))){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;this._rearrange(t,i),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),u.ui.ddmanager&&u.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,e){var i,s,o,r;if(t)return u.ui.ddmanager&&!this.options.dropBehaviour&&u.ui.ddmanager.drop(this,t),this.options.revert?(s=(i=this).placeholder.offset(),r={},(o=this.options.axis)&&"x"!==o||(r.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(r.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,u(this.helper).animate(r,parseInt(this.options.revert,10)||500,function(){i._clear(t)})):this._clear(t,e),!1},cancel:function(){if(this.dragging){this._mouseUp(new u.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var t=this.containers.length-1;0<=t;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),u.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?u(this.domPosition.prev).after(this.currentItem):u(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var t=this._getItemsAsjQuery(e&&e.connected),i=[];return e=e||{},u(t).each(function(){var t=(u(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);t&&i.push((e.key||t[1]+"[]")+"="+(e.key&&e.expression?t[1]:t[2]))}),!i.length&&e.key&&i.push(e.key+"="),i.join("&")},toArray:function(t){var e=this._getItemsAsjQuery(t&&t.connected),i=[];return t=t||{},e.each(function(){i.push(u(t.item||this).attr(t.attribute||"id")||"")}),i},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,o=s+this.helperProportions.height,r=t.left,n=r+t.width,h=t.top,a=h+t.height,l=this.offset.click.top,c=this.offset.click.left,l="x"===this.options.axis||h<s+l&&s+l<a,c="y"===this.options.axis||r<e+c&&e+c<n;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?l&&c:r<e+this.helperProportions.width/2&&i-this.helperProportions.width/2<n&&h<s+this.helperProportions.height/2&&o-this.helperProportions.height/2<a},_intersectsWithPointer:function(t){var e="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),t="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width);return!(!e||!t)&&(e=this.dragDirection.vertical,t=this.dragDirection.horizontal,this.floating?"right"===t||"down"===e?2:1:e&&("down"===e?2:1))},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),t=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),i=this.dragDirection.vertical,s=this.dragDirection.horizontal;return this.floating&&s?"right"===s&&t||"left"===s&&!t:i&&("down"===i&&e||"up"===i&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!=t&&(0<t?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!=t&&(0<t?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(t){var e,i,s,o,r=[],n=[],h=this._connectWith();if(h&&t)for(e=h.length-1;0<=e;e--)for(i=(s=u(h[e],this.document[0])).length-1;0<=i;i--)(o=u.data(s[i],this.widgetFullName))&&o!==this&&!o.options.disabled&&n.push(["function"==typeof o.options.items?o.options.items.call(o.element):u(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);function a(){r.push(this)}for(n.push(["function"==typeof this.options.items?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):u(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),e=n.length-1;0<=e;e--)n[e][0].each(a);return u(r)},_removeCurrentsFromItems:function(){var i=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=u.grep(this.items,function(t){for(var e=0;e<i.length;e++)if(i[e]===t.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var e,i,s,o,r,n,h,a,l=this.items,c=[["function"==typeof this.options.items?this.options.items.call(this.element[0],t,{item:this.currentItem}):u(this.options.items,this.element),this]],p=this._connectWith();if(p&&this.ready)for(e=p.length-1;0<=e;e--)for(i=(s=u(p[e],this.document[0])).length-1;0<=i;i--)(o=u.data(s[i],this.widgetFullName))&&o!==this&&!o.options.disabled&&(c.push(["function"==typeof o.options.items?o.options.items.call(o.element[0],t,{item:this.currentItem}):u(o.options.items,o.element),o]),this.containers.push(o));for(e=c.length-1;0<=e;e--)for(r=c[e][1],a=(n=c[e][i=0]).length;i<a;i++)(h=u(n[i])).data(this.widgetName+"-item",r),l.push({item:h,instance:r,width:0,height:0,left:0,top:0})},_refreshItemPositions:function(t){for(var e,i,s=this.items.length-1;0<=s;s--)e=this.items[s],this.currentContainer&&e.instance!==this.currentContainer&&e.item[0]!==this.currentItem[0]||(i=this.options.toleranceElement?u(this.options.toleranceElement,e.item):e.item,t||(e.width=i.outerWidth(),e.height=i.outerHeight()),i=i.offset(),e.left=i.left,e.top=i.top)},refreshPositions:function(t){var e,i;if(this.floating=!!this.items.length&&("x"===this.options.axis||this._isFloating(this.items[0].item)),this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset()),this._refreshItemPositions(t),this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(e=this.containers.length-1;0<=e;e--)i=this.containers[e].element.offset(),this.containers[e].containerCache.left=i.left,this.containers[e].containerCache.top=i.top,this.containers[e].containerCache.width=this.containers[e].element.outerWidth(),this.containers[e].containerCache.height=this.containers[e].element.outerHeight();return this},_createPlaceholder:function(i){var s,o,r=(i=i||this).options;r.placeholder&&r.placeholder.constructor!==String||(s=r.placeholder,o=i.currentItem[0].nodeName.toLowerCase(),r.placeholder={element:function(){var t=u("<"+o+">",i.document[0]);return i._addClass(t,"ui-sortable-placeholder",s||i.currentItem[0].className)._removeClass(t,"ui-sortable-helper"),"tbody"===o?i._createTrPlaceholder(i.currentItem.find("tr").eq(0),u("<tr>",i.document[0]).appendTo(t)):"tr"===o?i._createTrPlaceholder(i.currentItem,t):"img"===o&&t.attr("src",i.currentItem.attr("src")),s||t.css("visibility","hidden"),t},update:function(t,e){s&&!r.forcePlaceholderSize||(e.height()&&(!r.forcePlaceholderSize||"tbody"!==o&&"tr"!==o)||e.height(i.currentItem.innerHeight()-parseInt(i.currentItem.css("paddingTop")||0,10)-parseInt(i.currentItem.css("paddingBottom")||0,10)),e.width())||e.width(i.currentItem.innerWidth()-parseInt(i.currentItem.css("paddingLeft")||0,10)-parseInt(i.currentItem.css("paddingRight")||0,10))}}),i.placeholder=u(r.placeholder.element.call(i.element,i.currentItem)),i.currentItem.after(i.placeholder),r.placeholder.update(i,i.placeholder)},_createTrPlaceholder:function(t,e){var i=this;t.children().each(function(){u("<td>&#160;</td>",i.document[0]).attr("colspan",u(this).attr("colspan")||1).appendTo(e)})},_contactContainers:function(t){for(var e,i,s,o,r,n,h,a,l,c=null,p=null,f=this.containers.length-1;0<=f;f--)u.contains(this.currentItem[0],this.containers[f].element[0])||(this._intersectsWith(this.containers[f].containerCache)?c&&u.contains(this.containers[f].element[0],c.element[0])||(c=this.containers[f],p=f):this.containers[f].containerCache.over&&(this.containers[f]._trigger("out",t,this._uiHash(this)),this.containers[f].containerCache.over=0));if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(i=1e4,s=null,o=(a=c.floating||this._isFloating(this.currentItem))?"left":"top",r=a?"width":"height",l=a?"pageX":"pageY",e=this.items.length-1;0<=e;e--)u.contains(this.containers[p].element[0],this.items[e].item[0])&&this.items[e].item[0]!==this.currentItem[0]&&(n=this.items[e].item.offset()[o],h=!1,t[l]-n>this.items[e][r]/2&&(h=!0),Math.abs(t[l]-n)<i)&&(i=Math.abs(t[l]-n),s=this.items[e],this.direction=h?"up":"down");(s||this.options.dropOnEmpty)&&(this.currentContainer===this.containers[p]?this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1):(s?this._rearrange(t,s,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.scrollParent=this.placeholder.scrollParent(),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1))}},_createHelper:function(t){var e=this.options,t="function"==typeof e.helper?u(e.helper.apply(this.element[0],[t,this.currentItem])):"clone"===e.helper?this.currentItem.clone():this.currentItem;return t.parents("body").length||this.appendTo[0].appendChild(t[0]),t[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),t[0].style.width&&!e.forceHelperSize||t.width(this.currentItem.width()),t[0].style.height&&!e.forceHelperSize||t.height(this.currentItem.height()),t},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}:t)&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&u.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&u.ui.ie?{top:0,left:0}:t).top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){var t;return"relative"===this.cssPosition?{top:(t=this.currentItem.position()).top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}:{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e,i=this.options;"parent"===i.containment&&(i.containment=this.helper[0].parentNode),"document"!==i.containment&&"window"!==i.containment||(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===i.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===i.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(i.containment)||(t=u(i.containment)[0],i=u(i.containment).offset(),e="hidden"!==u(t).css("overflow"),this.containment=[i.left+(parseInt(u(t).css("borderLeftWidth"),10)||0)+(parseInt(u(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(u(t).css("borderTopWidth"),10)||0)+(parseInt(u(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(e?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(u(t).css("borderLeftWidth"),10)||0)-(parseInt(u(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(e?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(u(t).css("borderTopWidth"),10)||0)-(parseInt(u(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,e){e=e||this.position;var t="absolute"===t?1:-1,i="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&u.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(i[0].tagName);return{top:e.top+this.offset.relative.top*t+this.offset.parent.top*t-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():s?0:i.scrollTop())*t,left:e.left+this.offset.relative.left*t+this.offset.parent.left*t-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():s?0:i.scrollLeft())*t}},_generatePosition:function(t){var e=this.options,i=t.pageX,s=t.pageY,o="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&u.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,r=/(html|body)/i.test(o[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(i=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(s=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(i=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3])&&(s=this.containment[3]+this.offset.click.top),e.grid)&&(t=this.originalPageY+Math.round((s-this.originalPageY)/e.grid[1])*e.grid[1],s=!this.containment||t-this.offset.click.top>=this.containment[1]&&t-this.offset.click.top<=this.containment[3]?t:t-this.offset.click.top>=this.containment[1]?t-e.grid[1]:t+e.grid[1],t=this.originalPageX+Math.round((i-this.originalPageX)/e.grid[0])*e.grid[0],i=!this.containment||t-this.offset.click.left>=this.containment[0]&&t-this.offset.click.left<=this.containment[2]?t:t-this.offset.click.left>=this.containment[0]?t-e.grid[0]:t+e.grid[0]),{top:s-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():r?0:o.scrollTop()),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():r?0:o.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var o=this.counter;this._delay(function(){o===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)"auto"!==this._storedCSS[i]&&"static"!==this._storedCSS[i]||(this._storedCSS[i]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();function o(e,i,s){return function(t){s._trigger(e,t,i._uiHash(i))}}for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this===this.currentContainer||e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer))),i=this.containers.length-1;0<=i;i--)e||s.push(o("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(o("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(i=0;i<s.length;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){!1===u.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(t){var e=t||this;return{helper:e.helper,placeholder:e.placeholder||u([]),position:e.position,originalPosition:e.originalPosition,offset:e.positionAbs,item:e.currentItem,sender:t?t.element:null}}})});
jQuery(function ($){
'use strict';
var cloneIndex={
set: function ($clone, index){
$clone.find(':input[class|="iwjmb"]').each(function (){
var $field=$(this);
var name=$field.attr('name');
/*
if(name&&! $field.closest('.iwjmb-group-clone').length){
$field.attr('name', cloneIndex.replace(index, name, '[', ']', false));
}*/
if(name){
$field.attr('name', cloneIndex.replace(index, name, '[', ']', false));
}
var id=this.id;
if(id){
$field.attr('id', cloneIndex.replace(index, id, '_'));
}});
var $address=$clone.find('.iwjmb-map-goto-address-button');
if($address.length){
var value=$address.attr('value');
$address.attr('value', cloneIndex.replace(index, value, '_'));
}},
replace: function (index, value, before, after, alternative){
before=before||'';
after=after||'';
alternative=alternative||true;
var regex=new RegExp(cloneIndex.escapeRegex(before) + '(\\d+)' + cloneIndex.escapeRegex(after)),
newValue=before + index + after;
return regex.test(value) ? value.replace(regex, newValue):(alternative ? value + newValue:value);
},
escapeRegex: function (string){
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
},
nextIndex: function ($container){
var nextIndex=$container.data('next-index');
$container.data('next-index', nextIndex + 1);
return nextIndex;
}};
function clone($container){
var $last=$container.children('.iwjmb-clone:last'),
$clone=$last.clone(),
$input=$clone.find(':input[class|="iwjmb"]'),
nextIndex=cloneIndex.nextIndex($container);
$input.each(function (){
var $field=$(this);
if($field.is(':radio')||$field.is(':checkbox')){
$field.prop('checked', false);
}else if($field.is('select')){
$field.prop('selectedIndex', -1);
}else if(!$field.hasClass('iwjmb-hidden')){
$field.val('');
}
if($field.hasClass('iwjmb-date')){
var options=$field.data('options');
if(options.lang){
$.datetimepicker.setLocale(options.lang);
}else{
$.datetimepicker.setLocale(iwjmbDateTime.locale_short);
}
$field.datetimepicker(options);
}});
$clone.insertAfter($last);
$clone.trigger('clone_instance', nextIndex);
cloneIndex.set($clone, nextIndex);
$input.trigger('clone', nextIndex);
}
function toggleRemoveButtons($container){
var $clones=$container.children('.iwjmb-clone');
$clones.children('.remove-clone').toggle($clones.length > 1);
$container.find('.iwjmb-input').each(function (){
toggleRemoveButtons($(this));
});
}
function toggleAddButton($container){
var $button=$container.find('.add-clone'),
maxClone=parseInt($container.data('max-clone')),
numClone=$container.find('.iwjmb-clone').length;
$button.toggle(isNaN(maxClone)||(maxClone&&numClone < maxClone));
}
$('#wpbody-content, body.page')
.on('click', '.add-clone', function (e){
e.preventDefault();
var $container=$(this).closest('.iwjmb-input');
clone($container);
toggleRemoveButtons($container);
toggleAddButton($container);
})
.on('click', '.remove-clone', function (e){
e.preventDefault();
var $this=$(this),
$container=$this.closest('.iwjmb-input');
if($container.children('.iwjmb-clone').length < 2){
return;
}
$this.parent().trigger('remove').remove();
toggleRemoveButtons($container);
toggleAddButton($container)
});
$('.iwjmb-input').each(function (){
var $container=$(this);
toggleRemoveButtons($container);
toggleAddButton($container);
$container
.data('next-index', $container.children('.iwjmb-clone').length)
.sortable({
handle: '.iwjmb-clone-icon',
placeholder: ' iwjmb-clone iwjmb-clone-placeholder',
items: '.iwjmb-clone',
start: function (event, ui){
ui.placeholder.height(ui.item.height());
}});
});
});
!function ($){
"use strict";
if(typeof ko!=='undefined'&&ko.bindingHandlers&&!ko.bindingHandlers.multiselect){
ko.bindingHandlers.multiselect={
after: ['options', 'value', 'selectedOptions', 'enable', 'disable'],
init: function(element, valueAccessor, allBindings, viewModel, bindingContext){
var $element=$(element);
var config=ko.toJS(valueAccessor());
$element.multiselect(config);
if(allBindings.has('options')){
var options=allBindings.get('options');
if(ko.isObservable(options)){
ko.computed({
read: function(){
options();
setTimeout(function(){
var ms=$element.data('multiselect');
if(ms)
ms.updateOriginalOptions();
$element.multiselect('rebuild');
}, 1);
},
disposeWhenNodeIsRemoved: element
});
}}
if(allBindings.has('value')){
var value=allBindings.get('value');
if(ko.isObservable(value)){
ko.computed({
read: function(){
value();
setTimeout(function(){
$element.multiselect('refresh');
}, 1);
},
disposeWhenNodeIsRemoved: element
}).extend({ rateLimit: 100, notifyWhenChangesStop: true });
}}
if(allBindings.has('selectedOptions')){
var selectedOptions=allBindings.get('selectedOptions');
if(ko.isObservable(selectedOptions)){
ko.computed({
read: function(){
selectedOptions();
setTimeout(function(){
$element.multiselect('refresh');
}, 1);
},
disposeWhenNodeIsRemoved: element
}).extend({ rateLimit: 100, notifyWhenChangesStop: true });
}}
var setEnabled=function (enable){
setTimeout(function (){
if(enable)
$element.multiselect('enable');
else
$element.multiselect('disable');
});
};
if(allBindings.has('enable')){
var enable=allBindings.get('enable');
if(ko.isObservable(enable)){
ko.computed({
read: function (){
setEnabled(enable());
},
disposeWhenNodeIsRemoved: element
}).extend({ rateLimit: 100, notifyWhenChangesStop: true });
}else{
setEnabled(enable);
}}
if(allBindings.has('disable')){
var disable=allBindings.get('disable');
if(ko.isObservable(disable)){
ko.computed({
read: function (){
setEnabled(!disable());
},
disposeWhenNodeIsRemoved: element
}).extend({ rateLimit: 100, notifyWhenChangesStop: true });
}else{
setEnabled(!disable);
}}
ko.utils.domNodeDisposal.addDisposeCallback(element, function(){
$element.multiselect('destroy');
});
},
update: function(element, valueAccessor, allBindings, viewModel, bindingContext){
var $element=$(element);
var config=ko.toJS(valueAccessor());
$element.multiselect('setOptions', config);
$element.multiselect('rebuild');
}};}
function forEach(array, callback){
for (var index=0; index < array.length; ++index){
callback(array[index], index);
}}
function Multiselect(select, options){
this.$select=$(select);
this.options=this.mergeOptions($.extend({}, options, this.$select.data()));
if(this.$select.attr("data-placeholder")){
this.options.nonSelectedText=this.$select.data("placeholder");
}
this.originalOptions=this.$select.clone()[0].options;
this.query='';
this.searchTimeout=null;
this.lastToggledInput=null;
this.options.multiple=this.$select.attr('multiple')==="multiple";
this.options.onChange=$.proxy(this.options.onChange, this);
this.options.onSelectAll=$.proxy(this.options.onSelectAll, this);
this.options.onDeselectAll=$.proxy(this.options.onDeselectAll, this);
this.options.onDropdownShow=$.proxy(this.options.onDropdownShow, this);
this.options.onDropdownHide=$.proxy(this.options.onDropdownHide, this);
this.options.onDropdownShown=$.proxy(this.options.onDropdownShown, this);
this.options.onDropdownHidden=$.proxy(this.options.onDropdownHidden, this);
this.options.onInitialized=$.proxy(this.options.onInitialized, this);
this.options.onFiltering=$.proxy(this.options.onFiltering, this);
this.buildContainer();
this.buildButton();
this.buildDropdown();
this.buildSelectAll();
this.buildDropdownOptions();
this.buildFilter();
this.updateButtonText();
this.updateSelectAll(true);
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}
this.options.wasDisabled=this.$select.prop('disabled');
if(this.options.disableIfEmpty&&$('option', this.$select).length <=0){
this.disable();
}
this.$select.wrap('<span class="multiselect-native-select" />').after(this.$container);
this.options.onInitialized(this.$select, this.$container);
}
Multiselect.prototype={
defaults: {
buttonText: function(options, select){
if(this.disabledText.length > 0
&& (select.prop('disabled')||(options.length==0&&this.disableIfEmpty))){
return this.disabledText;
}
else if(options.length===0){
return this.nonSelectedText;
}
else if(this.allSelectedText
&& options.length===$('option', $(select)).length
&& $('option', $(select)).length!==1
&& this.multiple){
if(this.selectAllNumber){
return this.allSelectedText + ' (' + options.length + ')';
}else{
return this.allSelectedText;
}}
else if(options.length > this.numberDisplayed){
return options.length + ' ' + this.nSelectedText;
}else{
var selected='';
var delimiter=this.delimiterText;
options.each(function(){
var label=($(this).attr('label')!==undefined) ? $(this).attr('label'):$(this).text();
selected +=label + delimiter;
});
return selected.substr(0, selected.length - this.delimiterText.length);
}},
buttonTitle: function(options, select){
if(options.length===0){
return this.nonSelectedText;
}else{
var selected='';
var delimiter=this.delimiterText;
options.each(function (){
var label=($(this).attr('label')!==undefined) ? $(this).attr('label'):$(this).text();
selected +=label + delimiter;
});
return selected.substr(0, selected.length - this.delimiterText.length);
}},
checkboxName: function(option){
return false;
},
optionLabel: function(element){
return $(element).attr('label')||$(element).text();
},
optionClass: function(element){
return $(element).attr('class')||'';
},
onChange:function(option, checked){
},
onDropdownShow: function(event){
},
onDropdownHide: function(event){
},
onDropdownShown: function(event){
},
onDropdownHidden: function(event){
},
onSelectAll: function(){
},
onDeselectAll: function(){
},
onInitialized: function($select, $container){
},
onFiltering: function($filter){
},
enableHTML: false,
buttonClass: 'btn btn-default',
inheritClass: false,
buttonWidth: 'auto',
buttonContainer: '<div class="btn-group" />',
dropRight: false,
dropUp: false,
selectedClass: 'active',
maxHeight: false,
includeSelectAllOption: false,
includeSelectAllIfMoreThan: 0,
selectAllText: i18niwjmbmultiselect.selectAllText,
selectAllValue: 'multiselect-all',
selectAllName: false,
selectAllNumber: true,
selectAllJustVisible: true,
enableFiltering: false,
enableCaseInsensitiveFiltering: false,
enableFullValueFiltering: false,
enableClickableOptGroups: false,
enableCollapsibleOptGroups: false,
filterPlaceholder: i18niwjmbmultiselect.filterPlaceholder,
filterBehavior: 'text',
includeFilterClearBtn: true,
preventInputChangeEvent: false,
nonSelectedText: i18niwjmbmultiselect.nonSelectedText,
nSelectedText: 'selected',
allSelectedText: i18niwjmbmultiselect.allSelectedText,
numberDisplayed: 3,
disableIfEmpty: false,
disabledText: '',
delimiterText: ', ',
templates: {
button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"><span class="multiselect-selected-text"></span> <b class="caret"></b></button>',
ul: '<ul class="multiselect-container dropdown-menu"></ul>',
filter: '<li class="multiselect-item multiselect-filter"><div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span><input class="form-control multiselect-search" type="text"></div></li>',
filterClearBtn: '<span class="input-group-btn"><button class="btn btn-default multiselect-clear-filter" type="button"><i class="glyphicon glyphicon-remove-circle"></i></button></span>',
li: '<li><a tabindex="0"><label></label></a></li>',
divider: '<li class="multiselect-item divider"></li>',
liGroup: '<li class="multiselect-item multiselect-group"><label></label></li>'
}},
constructor: Multiselect,
buildContainer: function(){
this.$container=$(this.options.buttonContainer);
this.$container.on('show.bs.dropdown', this.options.onDropdownShow);
this.$container.on('hide.bs.dropdown', this.options.onDropdownHide);
this.$container.on('shown.bs.dropdown', this.options.onDropdownShown);
this.$container.on('hidden.bs.dropdown', this.options.onDropdownHidden);
},
buildButton: function(){
this.$button=$(this.options.templates.button).addClass(this.options.buttonClass);
if(this.$select.attr('class')&&this.options.inheritClass){
this.$button.addClass(this.$select.attr('class'));
}
if(this.$select.prop('disabled')){
this.disable();
}else{
this.enable();
}
if(this.options.buttonWidth&&this.options.buttonWidth!=='auto'){
this.$button.css({
'width':'100%', //this.options.buttonWidth,
'overflow':'hidden',
'text-overflow':'ellipsis'
});
this.$container.css({
'width': this.options.buttonWidth
});
}
var tabindex=this.$select.attr('tabindex');
if(tabindex){
this.$button.attr('tabindex', tabindex);
}
this.$container.prepend(this.$button);
},
buildDropdown: function(){
this.$ul=$(this.options.templates.ul);
if(this.options.dropRight){
this.$ul.addClass('pull-right');
}
if(this.options.maxHeight){
this.$ul.css({
'max-height': this.options.maxHeight + 'px',
'overflow-y': 'auto',
'overflow-x': 'hidden'
});
}
if(this.options.dropUp){
var height=Math.min(this.options.maxHeight, $('option[data-role!="divider"]', this.$select).length*26 + $('option[data-role="divider"]', this.$select).length*19 + (this.options.includeSelectAllOption ? 26:0) + (this.options.enableFiltering||this.options.enableCaseInsensitiveFiltering ? 44:0));
var moveCalc=height + 34;
this.$ul.css({
'max-height': height + 'px',
'overflow-y': 'auto',
'overflow-x': 'hidden',
'margin-top': "-" + moveCalc + 'px'
});
}
this.$container.append(this.$ul);
},
buildDropdownOptions: function(){
this.$select.children().each($.proxy(function(index, element){
var $element=$(element);
var tag=$element.prop('tagName')
.toLowerCase();
if($element.prop('value')===this.options.selectAllValue){
return;
}
if(tag==='optgroup'){
this.createOptgroup(element);
}
else if(tag==='option'){
if($element.data('role')==='divider'){
this.createDivider();
}else{
this.createOptionValue(element);
}}
}, this));
$('li:not(.multiselect-group) input', this.$ul).on('change', $.proxy(function(event){
var $target=$(event.target);
var checked=$target.prop('checked')||false;
var isSelectAllOption=$target.val()===this.options.selectAllValue;
if(this.options.selectedClass){
if(checked){
$target.closest('li')
.addClass(this.options.selectedClass);
}else{
$target.closest('li')
.removeClass(this.options.selectedClass);
}}
var value=$target.val();
var $option=this.getOptionByValue(value);
var $optionsNotThis=$('option', this.$select).not($option);
var $checkboxesNotThis=$('input', this.$container).not($target);
if(isSelectAllOption){
if(checked){
this.selectAll(this.options.selectAllJustVisible, true);
}else{
this.deselectAll(this.options.selectAllJustVisible, true);
}}else{
if(checked){
$option.prop('selected', true);
if(this.options.multiple){
$option.prop('selected', true);
}else{
if(this.options.selectedClass){
$($checkboxesNotThis).closest('li').removeClass(this.options.selectedClass);
}
$($checkboxesNotThis).prop('checked', false);
$optionsNotThis.prop('selected', false);
this.$button.click();
}
if(this.options.selectedClass==="active"){
$optionsNotThis.closest("a").css("outline", "");
}}else{
$option.prop('selected', false);
}
this.options.onChange($option, checked);
this.updateSelectAll();
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}}
this.$select.change();
this.updateButtonText();
if(this.options.preventInputChangeEvent){
return false;
}}, this));
$('li a', this.$ul).on('mousedown', function(e){
if(e.shiftKey){
return false;
}});
$('li a', this.$ul).on('touchstart click', $.proxy(function(event){
event.stopPropagation();
var $target=$(event.target);
if(event.shiftKey&&this.options.multiple){
if($target.is("label")){
event.preventDefault();
$target=$target.find("input");
$target.prop("checked", !$target.prop("checked"));
}
var checked=$target.prop('checked')||false;
if(this.lastToggledInput!==null&&this.lastToggledInput!==$target){
var from=$target.closest("li").index();
var to=this.lastToggledInput.closest("li").index();
if(from > to){
var tmp=to;
to=from;
from=tmp;
}
++to;
var range=this.$ul.find("li").slice(from, to).find("input");
range.prop('checked', checked);
if(this.options.selectedClass){
range.closest('li')
.toggleClass(this.options.selectedClass, checked);
}
for (var i=0, j=range.length; i < j; i++){
var $checkbox=$(range[i]);
var $option=this.getOptionByValue($checkbox.val());
$option.prop('selected', checked);
}}
$target.trigger("change");
}
if($target.is("input")&&!$target.closest("li").is(".multiselect-item")){
this.lastToggledInput=$target;
}
$target.blur();
}, this));
this.$container.off('keydown.multiselect').on('keydown.multiselect', $.proxy(function(event){
if($('input[type="text"]', this.$container).is(':focus')){
return;
}
if(event.keyCode===9&&this.$container.hasClass('open')){
this.$button.click();
}else{
var $items=$(this.$container).find("li:not(.divider):not(.disabled) a").filter(":visible");
if(!$items.length){
return;
}
var index=$items.index($items.filter(':focus'));
if(event.keyCode===38&&index > 0){
index--;
}
else if(event.keyCode===40&&index < $items.length - 1){
index++;
}
else if(!~index){
index=0;
}
var $current=$items.eq(index);
$current.focus();
if(event.keyCode===32||event.keyCode===13){
var $checkbox=$current.find('input');
$checkbox.prop("checked", !$checkbox.prop("checked"));
$checkbox.change();
}
event.stopPropagation();
event.preventDefault();
}}, this));
if(this.options.enableClickableOptGroups&&this.options.multiple){
$("li.multiselect-group input", this.$ul).on("change", $.proxy(function(event){
event.stopPropagation();
var $target=$(event.target);
var checked=$target.prop('checked')||false;
var $li=$(event.target).closest('li');
var $group=$li.nextUntil("li.multiselect-group")
.not('.multiselect-filter-hidden')
.not('.disabled');
var $inputs=$group.find("input");
var values=[];
var $options=[];
if(this.options.selectedClass){
if(checked){
$li.addClass(this.options.selectedClass);
}else{
$li.removeClass(this.options.selectedClass);
}}
$.each($inputs, $.proxy(function(index, input){
var value=$(input).val();
var $option=this.getOptionByValue(value);
if(checked){
$(input).prop('checked', true);
$(input).closest('li')
.addClass(this.options.selectedClass);
$option.prop('selected', true);
}else{
$(input).prop('checked', false);
$(input).closest('li')
.removeClass(this.options.selectedClass);
$option.prop('selected', false);
}
$options.push(this.getOptionByValue(value));
}, this))
this.options.onChange($options, checked);
this.updateButtonText();
this.updateSelectAll();
}, this));
}
if(this.options.enableCollapsibleOptGroups&&this.options.multiple){
$("li.multiselect-group .caret-container", this.$ul).on("click", $.proxy(function(event){
var $li=$(event.target).closest('li');
var $inputs=$li.nextUntil("li.multiselect-group")
.not('.multiselect-filter-hidden');
var visible=true;
$inputs.each(function(){
visible=visible&&$(this).is(':visible');
});
if(visible){
$inputs.hide()
.addClass('multiselect-collapsible-hidden');
}else{
$inputs.show()
.removeClass('multiselect-collapsible-hidden');
}}, this));
$("li.multiselect-all", this.$ul).css('background', '#f3f3f3').css('border-bottom', '1px solid #eaeaea');
$("li.multiselect-all > a > label.checkbox", this.$ul).css('padding', '3px 20px 3px 35px');
$("li.multiselect-group > a > input", this.$ul).css('margin', '4px 0px 5px -20px');
}},
createOptionValue: function(element){
var $element=$(element);
if($element.is(':selected')){
$element.prop('selected', true);
}
var label=this.options.optionLabel(element);
var classes=this.options.optionClass(element);
var value=$element.val();
var inputType=this.options.multiple ? "checkbox":"radio";
var $li=$(this.options.templates.li);
var $label=$('label', $li);
$label.addClass(inputType);
$li.addClass(classes);
if(this.options.enableHTML){
$label.html(" " + label);
}else{
$label.text(" " + label);
}
var $checkbox=$('<input/>').attr('type', inputType);
var name=this.options.checkboxName($element);
if(name){
$checkbox.attr('name', name);
}
$label.prepend($checkbox);
var selected=$element.prop('selected')||false;
$checkbox.val(value);
if(value===this.options.selectAllValue){
$li.addClass("multiselect-item multiselect-all");
$checkbox.parent().parent()
.addClass('multiselect-all');
}
$label.attr('title', $element.attr('title'));
this.$ul.append($li);
if($element.is(':disabled')){
$checkbox.attr('disabled', 'disabled')
.prop('disabled', true)
.closest('a')
.attr("tabindex", "-1")
.closest('li')
.addClass('disabled');
}
$checkbox.prop('checked', selected);
if(selected&&this.options.selectedClass){
$checkbox.closest('li')
.addClass(this.options.selectedClass);
}},
createDivider: function(element){
var $divider=$(this.options.templates.divider);
this.$ul.append($divider);
},
createOptgroup: function(group){
var label=$(group).attr("label");
var value=$(group).attr("value");
var $li=$('<li class="multiselect-item multiselect-group"><a href="javascript:void(0);"><label><b></b></label></a></li>');
var classes=this.options.optionClass(group);
$li.addClass(classes);
if(this.options.enableHTML){
$('label b', $li).html(" " + label);
}else{
$('label b', $li).text(" " + label);
}
if(this.options.enableCollapsibleOptGroups&&this.options.multiple){
$('a', $li).append('<span class="caret-container"><b class="caret"></b></span>');
}
if(this.options.enableClickableOptGroups&&this.options.multiple){
$('a label', $li).prepend('<input type="checkbox" value="' + value + '"/>');
}
if($(group).is(':disabled')){
$li.addClass('disabled');
}
this.$ul.append($li);
$("option", group).each($.proxy(function($, group){
this.createOptionValue(group);
}, this))
},
buildSelectAll: function(){
if(typeof this.options.selectAllValue==='number'){
this.options.selectAllValue=this.options.selectAllValue.toString();
}
var alreadyHasSelectAll=this.hasSelectAll();
if(!alreadyHasSelectAll&&this.options.includeSelectAllOption&&this.options.multiple
&& $('option', this.$select).length > this.options.includeSelectAllIfMoreThan){
if(this.options.includeSelectAllDivider){
this.$ul.prepend($(this.options.templates.divider));
}
var $li=$(this.options.templates.li);
$('label', $li).addClass("checkbox");
if(this.options.enableHTML){
$('label', $li).html(" " + this.options.selectAllText);
}else{
$('label', $li).text(" " + this.options.selectAllText);
}
if(this.options.selectAllName){
$('label', $li).prepend('<input type="checkbox" name="' + this.options.selectAllName + '" />');
}else{
$('label', $li).prepend('<input type="checkbox" />');
}
var $checkbox=$('input', $li);
$checkbox.val(this.options.selectAllValue);
$li.addClass("multiselect-item multiselect-all");
$checkbox.parent().parent()
.addClass('multiselect-all');
this.$ul.prepend($li);
$checkbox.prop('checked', false);
}},
buildFilter: function(){
if(this.options.enableFiltering||this.options.enableCaseInsensitiveFiltering){
var enableFilterLength=Math.max(this.options.enableFiltering, this.options.enableCaseInsensitiveFiltering);
if(this.$select.find('option').length >=enableFilterLength){
this.$filter=$(this.options.templates.filter);
$('input', this.$filter).attr('placeholder', this.options.filterPlaceholder);
if(this.options.includeFilterClearBtn){
var clearBtn=$(this.options.templates.filterClearBtn);
clearBtn.on('click', $.proxy(function(event){
clearTimeout(this.searchTimeout);
this.$filter.find('.multiselect-search').val('');
$('li', this.$ul).show().removeClass('multiselect-filter-hidden');
this.updateSelectAll();
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}}, this));
this.$filter.find('.input-group').append(clearBtn);
}
this.$ul.prepend(this.$filter);
this.$filter.val(this.query).on('click', function(event){
event.stopPropagation();
}).on('input keydown', $.proxy(function(event){
if(event.which===13){
event.preventDefault();
}
clearTimeout(this.searchTimeout);
this.searchTimeout=this.asyncFunction($.proxy(function(){
if(this.query!==event.target.value){
this.query=event.target.value;
var currentGroup, currentGroupVisible;
$.each($('li', this.$ul), $.proxy(function(index, element){
var value=$('input', element).length > 0 ? $('input', element).val():"";
var text=$('label', element).text();
var filterCandidate='';
if((this.options.filterBehavior==='text')){
filterCandidate=text;
}
else if((this.options.filterBehavior==='value')){
filterCandidate=value;
}
else if(this.options.filterBehavior==='both'){
filterCandidate=text + '\n' + value;
}
if(value!==this.options.selectAllValue&&text){
var showElement=false;
if(this.options.enableCaseInsensitiveFiltering){
filterCandidate=filterCandidate.toLowerCase();
this.query=this.query.toLowerCase();
}
if(this.options.enableFullValueFiltering&&this.options.filterBehavior!=='both'){
var valueToMatch=filterCandidate.trim().substring(0, this.query.length);
if(this.query.indexOf(valueToMatch) > -1){
showElement=true;
}}
else if(filterCandidate.indexOf(this.query) > -1){
showElement=true;
}
$(element).toggle(showElement)
.toggleClass('multiselect-filter-hidden', !showElement);
if($(element).hasClass('multiselect-group')){
currentGroup=element;
currentGroupVisible=showElement;
}else{
if(showElement){
$(currentGroup).show()
.removeClass('multiselect-filter-hidden');
}
if(!showElement&&currentGroupVisible){
$(element).show()
.removeClass('multiselect-filter-hidden');
}}
}}, this));
}
this.updateSelectAll();
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}
this.options.onFiltering(event.target);
}, this), 300, this);
}, this));
}}
},
destroy: function(){
this.$container.remove();
this.$select.show();
this.$select.prop('disabled', this.options.wasDisabled);
this.$select.data('multiselect', null);
},
refresh: function (){
var inputs=$.map($('li input', this.$ul), $);
$('option', this.$select).each($.proxy(function (index, element){
var $elem=$(element);
var value=$elem.val();
var $input;
for (var i=inputs.length; 0 < i--; ){
if(value!==($input=inputs[i]).val())
continue;
if($elem.is(':selected')){
$input.prop('checked', true);
if(this.options.selectedClass){
$input.closest('li')
.addClass(this.options.selectedClass);
}}else{
$input.prop('checked', false);
if(this.options.selectedClass){
$input.closest('li')
.removeClass(this.options.selectedClass);
}}
if($elem.is(":disabled")){
$input.attr('disabled', 'disabled')
.prop('disabled', true)
.closest('li')
.addClass('disabled');
}else{
$input.prop('disabled', false)
.closest('li')
.removeClass('disabled');
}
break;
}}, this));
this.updateButtonText();
this.updateSelectAll();
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}},
select: function(selectValues, triggerOnChange){
if(!$.isArray(selectValues)){
selectValues=[selectValues];
}
for (var i=0; i < selectValues.length; i++){
var value=selectValues[i];
if(value===null||value===undefined){
continue;
}
var $option=this.getOptionByValue(value);
var $checkbox=this.getInputByValue(value);
if($option===undefined||$checkbox===undefined){
continue;
}
if(!this.options.multiple){
this.deselectAll(false);
}
if(this.options.selectedClass){
$checkbox.closest('li')
.addClass(this.options.selectedClass);
}
$checkbox.prop('checked', true);
$option.prop('selected', true);
if(triggerOnChange){
this.options.onChange($option, true);
}}
this.updateButtonText();
this.updateSelectAll();
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}},
clearSelection: function (){
this.deselectAll(false);
this.updateButtonText();
this.updateSelectAll();
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}},
deselect: function(deselectValues, triggerOnChange){
if(!$.isArray(deselectValues)){
deselectValues=[deselectValues];
}
for (var i=0; i < deselectValues.length; i++){
var value=deselectValues[i];
if(value===null||value===undefined){
continue;
}
var $option=this.getOptionByValue(value);
var $checkbox=this.getInputByValue(value);
if($option===undefined||$checkbox===undefined){
continue;
}
if(this.options.selectedClass){
$checkbox.closest('li')
.removeClass(this.options.selectedClass);
}
$checkbox.prop('checked', false);
$option.prop('selected', false);
if(triggerOnChange){
this.options.onChange($option, false);
}}
this.updateButtonText();
this.updateSelectAll();
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}},
selectAll: function (justVisible, triggerOnSelectAll){
var justVisible=typeof justVisible==='undefined' ? true:justVisible;
var allLis=$("li:not(.divider):not(.disabled):not(.multiselect-group)", this.$ul);
var visibleLis=$("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)", this.$ul).filter(':visible');
if(justVisible){
$('input:enabled' , visibleLis).prop('checked', true);
visibleLis.addClass(this.options.selectedClass);
$('input:enabled' , visibleLis).each($.proxy(function(index, element){
var value=$(element).val();
var option=this.getOptionByValue(value);
$(option).prop('selected', true);
}, this));
}else{
$('input:enabled' , allLis).prop('checked', true);
allLis.addClass(this.options.selectedClass);
$('input:enabled' , allLis).each($.proxy(function(index, element){
var value=$(element).val();
var option=this.getOptionByValue(value);
$(option).prop('selected', true);
}, this));
}
$('li input[value="' + this.options.selectAllValue + '"]', this.$ul).prop('checked', true);
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}
if(triggerOnSelectAll){
this.options.onSelectAll();
}},
deselectAll: function (justVisible, triggerOnDeselectAll){
var justVisible=typeof justVisible==='undefined' ? true:justVisible;
var allLis=$("li:not(.divider):not(.disabled):not(.multiselect-group)", this.$ul);
var visibleLis=$("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)", this.$ul).filter(':visible');
if(justVisible){
$('input[type="checkbox"]:enabled' , visibleLis).prop('checked', false);
visibleLis.removeClass(this.options.selectedClass);
$('input[type="checkbox"]:enabled' , visibleLis).each($.proxy(function(index, element){
var value=$(element).val();
var option=this.getOptionByValue(value);
$(option).prop('selected', false);
}, this));
}else{
$('input[type="checkbox"]:enabled' , allLis).prop('checked', false);
allLis.removeClass(this.options.selectedClass);
$('input[type="checkbox"]:enabled' , allLis).each($.proxy(function(index, element){
var value=$(element).val();
var option=this.getOptionByValue(value);
$(option).prop('selected', false);
}, this));
}
$('li input[value="' + this.options.selectAllValue + '"]', this.$ul).prop('checked', false);
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}
if(triggerOnDeselectAll){
this.options.onDeselectAll();
}},
rebuild: function(){
this.$ul.html('');
this.options.multiple=this.$select.attr('multiple')==="multiple";
this.buildSelectAll();
this.buildDropdownOptions();
this.buildFilter();
this.updateButtonText();
this.updateSelectAll(true);
if(this.options.enableClickableOptGroups&&this.options.multiple){
this.updateOptGroups();
}
if(this.options.disableIfEmpty&&$('option', this.$select).length <=0){
this.disable();
}else{
this.enable();
}
if(this.options.dropRight){
this.$ul.addClass('pull-right');
}},
dataprovider: function(dataprovider){
var groupCounter=0;
var $select=this.$select.empty();
$.each(dataprovider, function (index, option){
var $tag;
if($.isArray(option.children)){
groupCounter++;
$tag=$('<optgroup/>').attr({
label: option.label||'Group ' + groupCounter,
disabled: !!option.disabled
});
forEach(option.children, function(subOption){
var attributes={
value: subOption.value,
label: subOption.label||subOption.value,
title: subOption.title,
selected: !!subOption.selected,
disabled: !!subOption.disabled
};
for (var key in subOption.attributes){
attributes['data-' + key]=subOption.attributes[key];
}
$tag.append($('<option/>').attr(attributes));
});
}else{
var attributes={
'value': option.value,
'label': option.label||option.value,
'title': option.title,
'class': option.class,
'selected': !!option.selected,
'disabled': !!option.disabled
};
for (var key in option.attributes){
attributes['data-' + key]=option.attributes[key];
}
$tag=$('<option/>').attr(attributes);
$tag.text(option.label||option.value);
}
$select.append($tag);
});
this.rebuild();
},
enable: function(){
this.$select.prop('disabled', false);
this.$button.prop('disabled', false)
.removeClass('disabled');
},
disable: function(){
this.$select.prop('disabled', true);
this.$button.prop('disabled', true)
.addClass('disabled');
},
setOptions: function(options){
this.options=this.mergeOptions(options);
},
mergeOptions: function(options){
return $.extend(true, {}, this.defaults, this.options, options);
},
hasSelectAll: function(){
return $('li.multiselect-all', this.$ul).length > 0;
},
updateOptGroups: function(){
var $groups=$('li.multiselect-group', this.$ul)
var selectedClass=this.options.selectedClass;
$groups.each(function(){
var $options=$(this).nextUntil('li.multiselect-group')
.not('.multiselect-filter-hidden')
.not('.disabled');
var checked=true;
$options.each(function(){
var $input=$('input', this);
if(!$input.prop('checked')){
checked=false;
}});
if(selectedClass){
if(checked){
$(this).addClass(selectedClass);
}else{
$(this).removeClass(selectedClass);
}}
$('input', this).prop('checked', checked);
});
},
updateSelectAll: function(notTriggerOnSelectAll){
if(this.hasSelectAll()){
var allBoxes=$("li:not(.multiselect-item):not(.multiselect-filter-hidden):not(.multiselect-group):not(.disabled) input:enabled", this.$ul);
var allBoxesLength=allBoxes.length;
var checkedBoxesLength=allBoxes.filter(":checked").length;
var selectAllLi=$("li.multiselect-all", this.$ul);
var selectAllInput=selectAllLi.find("input");
if(checkedBoxesLength > 0&&checkedBoxesLength===allBoxesLength){
selectAllInput.prop("checked", true);
selectAllLi.addClass(this.options.selectedClass);
}else{
selectAllInput.prop("checked", false);
selectAllLi.removeClass(this.options.selectedClass);
}}
},
updateButtonText: function(){
var options=this.getSelected();
if(this.options.enableHTML){
$('.multiselect .multiselect-selected-text', this.$container).html(this.options.buttonText(options, this.$select));
}else{
$('.multiselect .multiselect-selected-text', this.$container).text(this.options.buttonText(options, this.$select));
}
$('.multiselect', this.$container).attr('title', this.options.buttonTitle(options, this.$select));
},
getSelected: function(){
return $('option', this.$select).filter(":selected");
},
getOptionByValue: function (value){
var options=$('option', this.$select);
var valueToCompare=value.toString();
for (var i=0; i < options.length; i=i + 1){
var option=options[i];
if(option.value===valueToCompare){
return $(option);
}}
},
getInputByValue: function (value){
var checkboxes=$('li input:not(.multiselect-search)', this.$ul);
var valueToCompare=value.toString();
for (var i=0; i < checkboxes.length; i=i + 1){
var checkbox=checkboxes[i];
if(checkbox.value===valueToCompare){
return $(checkbox);
}}
},
updateOriginalOptions: function(){
this.originalOptions=this.$select.clone()[0].options;
},
asyncFunction: function(callback, timeout, self){
var args=Array.prototype.slice.call(arguments, 3);
return setTimeout(function(){
callback.apply(self||window, args);
}, timeout);
},
setAllSelectedText: function(allSelectedText){
this.options.allSelectedText=allSelectedText;
this.updateButtonText();
}};
$.fn.multiselect=function(option, parameter, extraOptions){
return this.each(function(){
var data=$(this).data('multiselect');
var options=typeof option==='object'&&option;
if(!data){
data=new Multiselect(this, options);
$(this).data('multiselect', data);
}
if(typeof option==='string'){
data[option](parameter, extraOptions);
if(option==='destroy'){
$(this).data('multiselect', false);
}}
});
};
$.fn.multiselect.Constructor=Multiselect;
$(function(){
$("select[data-role=multiselect]").multiselect();
});
}(window.jQuery);
jQuery(function($){
'use strict';
function update(){
function htmlDecode(value){
return $("<textarea/>").html(value).text();
}
var $this=$(this);
var options=$this.data('options');
if(!options){
options={}}
if(!options.selectAllText){
options.selectAllText=i18niwjmbTaxonomy2.selectAllText;
}
if(!options.filterPlaceholder){
options.filterPlaceholder=i18niwjmbTaxonomy2.filterPlaceholder;
}
if(!options.filterPlaceholder){
options.nonSelectedText=i18niwjmbTaxonomy2.nonSelectedText;
}
options.allSelectedText=i18niwjmbTaxonomy2.allSelectedText;
options.onChange=function(option, checked){
var $select=$(this.$select.get(0));
var max_items=options.maxSelectItems ? options.maxSelectItems:'';
if(max_items){
var selectedOptions=$select.find('option:selected');
if(selectedOptions.length >=max_items){
var nonSelectedOptions=$select.find('option').filter(function(){
return !$(this).is(':selected');
});
nonSelectedOptions.each(function(){
var input=$('input[value="' + $(this).val() + '"]');
input.prop('disabled', true);
input.parent('li').addClass('disabled');
});
}else{
$select.find('option').each(function(){
var input=$('input[value="' + $(this).val() + '"]');
input.prop('disabled', false);
input.parent('li').addClass('disabled');
});
}}
};
options.buttonText=function(options, select){
if(options.length==0){
return this.nonSelectedText;
}else{
var selected=[];
var i=0;
var numberDisplayed=this.numberDisplayed;
options.each(function(){
var label=($(this).attr('label')!==undefined) ? $(this).attr('label'):$(this).html();
if(i < numberDisplayed){
selected.push(label);
}else{
selected.push('...('+options.length+')');
return false;
}
i++;
});
return htmlDecode(selected.join(', '));
}};
options.onDropdownShow=function(options, select){
if(!this.$ul.mark_checkbox){
$(this.$ul).find('input[type="checkbox"]').after('<span><i></i></span>');
this.$ul.mark_checkbox=true;
}};
options.optionClass=function(element){
var level=$(element).data('level');
if(level){
return 'level-'+level;
}else{
return '';
}};
$this.multiselect(options);
}
$(':input.iwjmb-taxonomy2').each(update);
$('.iwjmb-input').on('clone', ':input.iwjmb-taxonomy2', update);
});
jQuery(function($){
'use strict';
var select=window.iwjmbSelect={
selectAllNone: function($input){
var $element=$input.find('select');
$input.on('click', '.iwjmb-select-all-none a', function(e){
e.preventDefault();
if('all'==$(this).data('type')){
var selected=[];
$element.find('option').each(function(i, e){
var $value=$(e).attr('value');
if($value!=''){
selected.push($value);
}});
$element.val(selected).trigger('change');
}else{
$element.val('');
}});
},
bindEvents: function($el){
var $input=$el.closest('.iwjmb-input'),
$clone=$input.find('.iwjmb-clone');
if($clone.length){
$clone.each(function (){
select.selectAllNone($(this));
});
}else{
select.selectAllNone($input);
}}
};
function update(){
select.bindEvents($(this));
}
$(':input.iwjmb-select').each(update);
$('.iwjmb-input').on('clone', ':input.iwjmb-select', update);
});
jQuery(function($){
'use strict';
function update(){
var $this=$(this),
options=$this.data('options');
if(typeof options==='undefined'||!options){
options={}}
if(options&&(options.minimumResultsForSearch&&(options.minimumResultsForSearch==-1||options.minimumResultsForSearch=='Infinity'))||options.multiple){
options.dropdownCssClass='iwj-select-2-wsearch';
}
options.dropdownParent=$this.parents('body');
$this.siblings('.select2-container').remove();
$this.show().select2(options);
iwjmbSelect.bindEvents($this);
}
$(':input.iwjmb-select_advanced').each(update);
$('.iwjmb-input').on('clone', ':input.iwjmb-select_advanced', update);
});