!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(a){var e,t,n,i;function r(e,t){var n,i,r=e.nodeName.toLowerCase();return"area"===r?(i=(n=e.parentNode).name,!(!e.href||!i||"map"!==n.nodeName.toLowerCase())&&(!!(i=a("img[usemap='#"+i+"']")[0])&&o(i))):(/^(input|select|textarea|button|object)$/.test(r)?!e.disabled:"a"===r&&e.href||t)&&o(e)}function o(e){return a.expr.filters.visible(e)&&!a(e).parents().addBack().filter(function(){return"hidden"===a.css(this,"visibility")}).length}a.ui=a.ui||{},a.extend(a.ui,{version:"1.11.4",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}}),a.fn.extend({scrollParent:function(e){var t=this.css("position"),n="absolute"===t,i=e?/(auto|scroll|hidden)/:/(auto|scroll)/,e=this.parents().filter(function(){var e=a(this);return(!n||"static"!==e.css("position"))&&i.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==t&&e.length?e:a(this[0].ownerDocument||document)},uniqueId:(e=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&a(this).removeAttr("id")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(t){return function(e){return!!a.data(e,t)}}):function(e,t,n){return!!a.data(e,n[3])},focusable:function(e){return r(e,!isNaN(a.attr(e,"tabindex")))},tabbable:function(e){var t=a.attr(e,"tabindex"),n=isNaN(t);return(n||0<=t)&&r(e,!n)}}),a("").outerWidth(1).jquery||a.each(["Width","Height"],function(e,n){var r="Width"===n?["Left","Right"]:["Top","Bottom"],i=n.toLowerCase(),o={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};function s(e,t,n,i){return a.each(r,function(){t-=parseFloat(a.css(e,"padding"+this))||0,n&&(t-=parseFloat(a.css(e,"border"+this+"Width"))||0),i&&(t-=parseFloat(a.css(e,"margin"+this))||0)}),t}a.fn["inner"+n]=function(e){return void 0===e?o["inner"+n].call(this):this.each(function(){a(this).css(i,s(this,e)+"px")})},a.fn["outer"+n]=function(e,t){return"number"!=typeof e?o["outer"+n].call(this,e):this.each(function(){a(this).css(i,s(this,e,!0,t)+"px")})}}),a.fn.addBack||(a.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),a("").data("a-b","a").removeData("a-b").data("a-b")&&(a.fn.removeData=(t=a.fn.removeData,function(e){return arguments.length?t.call(this,a.camelCase(e)):t.call(this)})),a.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),a.fn.extend({focus:(i=a.fn.focus,function(t,n){return"number"==typeof t?this.each(function(){var e=this;setTimeout(function(){a(e).focus(),n&&n.call(e)},t)}):i.apply(this,arguments)}),disableSelection:(n="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.bind(n+".ui-disableSelection",function(e){e.preventDefault()})}),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(e){if(void 0!==e)return this.css("zIndex",e);if(this.length)for(var t,n,i=a(this[0]);i.length&&i[0]!==document;){if(("absolute"===(t=i.css("position"))||"relative"===t||"fixed"===t)&&(n=parseInt(i.css("zIndex"),10),!isNaN(n)&&0!==n))return n;i=i.parent()}return 0}}),a.ui.plugin={add:function(e,t,n){var i,r=a.ui[e].prototype;for(i in n)r.plugins[i]=r.plugins[i]||[],r.plugins[i].push([t,n[i]])},call:function(e,t,n,i){var r,o=e.plugins[t];if(o&&(i||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(r=0;r"))}function a(e){var t="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(t,"mouseout",function(){M(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&M(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&M(this).removeClass("ui-datepicker-next-hover")}).delegate(t,"mouseover",r)}function r(){M.datepicker._isDisabledDatepicker((n.inline?n.dpDiv.parent():n.input)[0])||(M(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),M(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&M(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&M(this).addClass("ui-datepicker-next-hover"))}function c(e,t){for(var a in M.extend(e,t),t)null==t[a]&&(e[a]=t[a]);return e}return M.extend(M.ui,{datepicker:{version:"1.11.4"}}),M.extend(e.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return c(this._defaults,e||{}),this},_attachDatepicker:function(e,t){var a,i=e.nodeName.toLowerCase(),s="div"===i||"span"===i;e.id||(this.uuid+=1,e.id="dp"+this.uuid),(a=this._newInst(M(e),s)).settings=M.extend({},t||{}),"input"===i?this._connectDatepicker(e,a):s&&this._inlineDatepicker(e,a)},_newInst:function(e,t){return{id:e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:t,dpDiv:t?a(M("
")):this.dpDiv}},_connectDatepicker:function(e,t){var a=M(e);t.append=M([]),t.trigger=M([]),a.hasClass(this.markerClassName)||(this._attachments(a,t),a.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(t),M.data(e,"datepicker",t),t.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,t){var a,i=this._get(t,"appendText"),s=this._get(t,"isRTL");t.append&&t.append.remove(),i&&(t.append=M(""+i+""),e[s?"before":"after"](t.append)),e.unbind("focus",this._showDatepicker),t.trigger&&t.trigger.remove(),"focus"!==(a=this._get(t,"showOn"))&&"both"!==a||e.focus(this._showDatepicker),"button"!==a&&"both"!==a||(i=this._get(t,"buttonText"),a=this._get(t,"buttonImage"),t.trigger=M(this._get(t,"buttonImageOnly")?M("").addClass(this._triggerClass).attr({src:a,alt:i,title:i}):M("").addClass(this._triggerClass).html(a?M("").attr({src:a,alt:i,title:i}):i)),e[s?"before":"after"](t.trigger),t.trigger.click(function(){return M.datepicker._datepickerShowing&&M.datepicker._lastInput===e[0]?M.datepicker._hideDatepicker():(M.datepicker._datepickerShowing&&M.datepicker._lastInput!==e[0]&&M.datepicker._hideDatepicker(),M.datepicker._showDatepicker(e[0])),!1}))},_autoSize:function(e){var t,a,i,s,n,r;this._get(e,"autoSize")&&!e.inline&&(n=new Date(2009,11,20),(r=this._get(e,"dateFormat")).match(/[DM]/)&&(n.setMonth((t=function(e){for(s=i=a=0;sa&&(a=e[s].length,i=s);return i})(this._get(e,r.match(/MM/)?"monthNames":"monthNamesShort"))),n.setDate(t(this._get(e,r.match(/DD/)?"dayNames":"dayNamesShort"))+20-n.getDay())),e.input.attr("size",this._formatDate(e,n).length))},_inlineDatepicker:function(e,t){var a=M(e);a.hasClass(this.markerClassName)||(a.addClass(this.markerClassName).append(t.dpDiv),M.data(e,"datepicker",t),this._setDate(t,this._getDefaultDate(t),!0),this._updateDatepicker(t),this._updateAlternate(t),t.settings.disabled&&this._disableDatepicker(e),t.dpDiv.css("display","block"))},_dialogDatepicker:function(e,t,a,i,s){var n,r=this._dialogInst;return r||(this.uuid+=1,n="dp"+this.uuid,this._dialogInput=M(""),this._dialogInput.keydown(this._doKeyDown),M("body").append(this._dialogInput),(r=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},M.data(this._dialogInput[0],"datepicker",r)),c(r.settings,i||{}),t=t&&t.constructor===Date?this._formatDate(r,t):t,this._dialogInput.val(t),this._pos=s?s.length?s:[s.pageX,s.pageY]:null,this._pos||(n=document.documentElement.clientWidth,i=document.documentElement.clientHeight,t=document.documentElement.scrollLeft||document.body.scrollLeft,s=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[n/2-100+t,i/2-150+s]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),r.settings.onSelect=a,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),M.blockUI&&M.blockUI(this.dpDiv),M.data(this._dialogInput[0],"datepicker",r),this},_destroyDatepicker:function(e){var t,a=M(e),i=M.data(e,"datepicker");a.hasClass(this.markerClassName)&&(t=e.nodeName.toLowerCase(),M.removeData(e,"datepicker"),"input"===t?(i.append.remove(),i.trigger.remove(),a.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):"div"!==t&&"span"!==t||a.removeClass(this.markerClassName).empty(),n===i&&(n=null))},_enableDatepicker:function(t){var e,a=M(t),i=M.data(t,"datepicker");a.hasClass(this.markerClassName)&&("input"===(e=t.nodeName.toLowerCase())?(t.disabled=!1,i.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):"div"!==e&&"span"!==e||((a=a.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=M.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var e,a=M(t),i=M.data(t,"datepicker");a.hasClass(this.markerClassName)&&("input"===(e=t.nodeName.toLowerCase())?(t.disabled=!0,i.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):"div"!==e&&"span"!==e||((a=a.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=M.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;td&&ic&&st;)--B<0&&(B=11,J--);for(e.drawMonth=B,e.drawYear=J,E=this._get(e,"prevText"),E=L?this.formatDate(E,this._daylightSavingAdjust(new Date(J,B-A,1)),this._getFormatConfig(e)):E,a=this._canAdjustMonth(e,-1,J,B)?"
"+E+"":R?"":""+E+"",E=this._get(e,"nextText"),E=L?this.formatDate(E,this._daylightSavingAdjust(new Date(J,B+A,1)),this._getFormatConfig(e)):E,i=this._canAdjustMonth(e,1,J,B)?""+E+"":R?"":""+E+"",R=this._get(e,"currentText"),E=this._get(e,"gotoCurrent")&&e.currentDay?P:K,R=L?this.formatDate(R,E,this._getFormatConfig(e)):R,L=e.inline?"":"",L=O?"
"+(j?L:"")+(this._isInRange(e,E)?"":"")+(j?"":L)+"
":"",s=parseInt(this._get(e,"firstDay"),10),s=isNaN(s)?0:s,n=this._get(e,"showWeek"),r=this._get(e,"dayNames"),d=this._get(e,"dayNamesMin"),c=this._get(e,"monthNames"),o=this._get(e,"monthNamesShort"),l=this._get(e,"beforeShowDay"),h=this._get(e,"showOtherMonths"),u=this._get(e,"selectOtherMonths"),p=this._getDefaultDate(e),g="",f=0;f"+(/all|left/.test(y)&&0===f?j?i:a:"")+(/all|right/.test(y)&&0===f?j?a:i:"")+this._generateMonthYearHeader(e,B,J,U,z,0",M=n?"":"",_=0;_<7;_++)M+="";for(v+=M+"",C=this._getDaysInMonth(J,B),J===e.selectedYear&&B===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,C)),w=(this._getFirstDayOfMonth(J,B)-s+7)%7,C=Math.ceil((w+C)/7),I=H&&this.maxRows>C?this.maxRows:C,this.maxRows=I,x=this._daylightSavingAdjust(new Date(J,B,1-w)),Y=0;Y",S=n?"":"",_=0;_<7;_++)N=l?l.apply(e.input?e.input[0]:null,[x]):[!0,""],T=(F=x.getMonth()!==B)&&!u||!N[0]||U&&x"+(F&&!h?" ":T?""+x.getDate()+"":""+x.getDate()+"")+"",x.setDate(x.getDate()+1),x=this._daylightSavingAdjust(x);v+=S+""}11<++B&&(B=0,J++),k+=v+="
"+this._get(e,"weekHeader")+""+d[b]+"
"+this._get(e,"calculateWeek")(x)+"
"+(H?""+(0":""):"")}g+=k}return g+=L,e._keyEvent=!1,g},_generateMonthYearHeader:function(e,t,a,i,s,n,r,d){var c,o,l,h,u,p,g,_=this._get(e,"changeMonth"),f=this._get(e,"changeYear"),k=this._get(e,"showMonthAfterYear"),D="
",m="";if(n||!_)m+=""+r[t]+"";else{for(c=i&&i.getFullYear()===a,o=s&&s.getFullYear()===a,m+=""}if(k||(D+=m+(!n&&_&&f?"":" ")),!e.yearshtml)if(e.yearshtml="",n||!f)D+=""+a+"";else{for(h=this._get(e,"yearRange").split(":"),u=(new Date).getFullYear(),p=(r=function(e){e=e.match(/c[+\-].*/)?a+parseInt(e.substring(1),10):e.match(/[+\-].*/)?u+parseInt(e,10):parseInt(e,10);return isNaN(e)?u:e})(h[0]),g=Math.max(p,r(h[1]||"")),p=i?Math.max(p,i.getFullYear()):p,g=s?Math.min(g,s.getFullYear()):g,e.yearshtml+="",D+=e.yearshtml,e.yearshtml=null}return D+=this._get(e,"yearSuffix"),k&&(D+=(!n&&_&&f?"":" ")+m),D+="
"},_adjustInstDate:function(e,t,a){var i=e.drawYear+("Y"===a?t:0),s=e.drawMonth+("M"===a?t:0),t=Math.min(e.selectedDay,this._getDaysInMonth(i,s))+("D"===a?t:0),t=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(i,s,t)));e.selectedDay=t.getDate(),e.drawMonth=e.selectedMonth=t.getMonth(),e.drawYear=e.selectedYear=t.getFullYear(),"M"!==a&&"Y"!==a||this._notifyChange(e)},_restrictMinMax:function(e,t){var a=this._getMinMaxDate(e,"min"),e=this._getMinMaxDate(e,"max"),t=a&&t=a.getTime())&&(!i||t.getTime()<=i.getTime())&&(!s||t.getFullYear()>=s)&&(!n||t.getFullYear()<=n)},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return{shortYearCutoff:t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,a,i){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);t=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(i,a,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),t,this._getFormatConfig(e))}}),M.fn.datepicker=function(e){if(!this.length)return this;M.datepicker.initialized||(M(document).mousedown(M.datepicker._checkExternalClick),M.datepicker.initialized=!0),0===M("#"+M.datepicker._mainDivId).length&&M("body").append(M.datepicker.dpDiv);var t=Array.prototype.slice.call(arguments,1);return"string"==typeof e&&("isDisabled"===e||"getDate"===e||"widget"===e)||"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?M.datepicker["_"+e+"Datepicker"].apply(M.datepicker,[this[0]].concat(t)):this.each(function(){"string"==typeof e?M.datepicker["_"+e+"Datepicker"].apply(M.datepicker,[this].concat(t)):M.datepicker._attachDatepicker(this,e)})},M.datepicker=new e,M.datepicker.initialized=!1,M.datepicker.uuid=(new Date).getTime(),M.datepicker.version="1.11.4",M.datepicker}); !function(e,n){e.wp=e.wp||{},e.wp.mediaelement=new function(){var e={};return{initialize:function(){(e="undefined"!=typeof _wpmejsSettings?n.extend(!0,{},_wpmejsSettings):e).classPrefix="mejs-",e.success=e.success||function(e){var n,t;e.rendererName&&-1!==e.rendererName.indexOf("flash")&&(n=e.attributes.autoplay&&"false"!==e.attributes.autoplay,t=e.attributes.loop&&"false"!==e.attributes.loop,n&&e.addEventListener("canplay",function(){e.play()},!1),t&&e.addEventListener("ended",function(){e.play()},!1))},e.customError=function(e,n){if(-1!==e.rendererName.indexOf("flash")||-1!==e.rendererName.indexOf("flv"))return''+mejsL10n.strings["mejs.download-video"]+""},n(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").filter(function(){return!n(this).parent().hasClass("mejs-mediaelement")}).mediaelementplayer(e)}}},n(e.wp.mediaelement.initialize)}(window,jQuery); !function(r,e,i){"use strict";window.wp=window.wp||{};var t=i.View.extend({initialize:function(t){this.index=0,this.settings={},this.data=t.metadata||r.parseJSON(this.$("script.wp-playlist-script").html()),this.playerNode=this.$(this.data.type),this.tracks=new i.Collection(this.data.tracks),this.current=this.tracks.first(),"audio"===this.data.type&&(this.currentTemplate=wp.template("wp-playlist-current-item"),this.currentNode=this.$(".wp-playlist-current-item")),this.renderCurrent(),this.data.tracklist&&(this.itemTemplate=wp.template("wp-playlist-item"),this.playingClass="wp-playlist-playing",this.renderTracks()),this.playerNode.attr("src",this.current.get("src")),e.bindAll(this,"bindPlayer","bindResetPlayer","setPlayer","ended","clickTrack"),e.isUndefined(window._wpmejsSettings)||(this.settings=e.clone(_wpmejsSettings)),this.settings.success=this.bindPlayer,this.setPlayer()},bindPlayer:function(t){this.mejs=t,this.mejs.addEventListener("ended",this.ended)},bindResetPlayer:function(t){this.bindPlayer(t),this.playCurrentSrc()},setPlayer:function(t){this.player&&(this.player.pause(),this.player.remove(),this.playerNode=this.$(this.data.type)),t&&(this.playerNode.attr("src",this.current.get("src")),this.settings.success=this.bindResetPlayer),this.player=new MediaElementPlayer(this.playerNode.get(0),this.settings)},playCurrentSrc:function(){this.renderCurrent(),this.mejs.setSrc(this.playerNode.attr("src")),this.mejs.load(),this.mejs.play()},renderCurrent:function(){var t;"video"===this.data.type?(this.data.images&&this.current.get("image")&&-1===this.current.get("image").src.indexOf("wp-includes/images/media/video.png")&&this.playerNode.attr("poster",this.current.get("image").src),t=this.current.get("dimensions").resized,this.playerNode.attr(t)):(this.data.images||this.current.set("image",!1),this.currentNode.html(this.currentTemplate(this.current.toJSON())))},renderTracks:function(){var e=this,i=1,s=r('
');this.tracks.each(function(t){e.data.images||t.set("image",!1),t.set("artists",e.data.artists),t.set("index",!!e.data.tracknumbers&&i),s.append(e.itemTemplate(t.toJSON())),i+=1}),this.$el.append(s),this.$(".wp-playlist-item").eq(0).addClass(this.playingClass)},events:{"click .wp-playlist-item":"clickTrack","click .wp-playlist-next":"next","click .wp-playlist-prev":"prev"},clickTrack:function(t){t.preventDefault(),this.index=this.$(".wp-playlist-item").index(t.currentTarget),this.setCurrent()},ended:function(){this.index+1=this.tracks.length?0:this.index+1,this.setCurrent()},prev:function(){this.index=this.index-1<0?this.tracks.length-1:this.index-1,this.setCurrent()},loadCurrent:function(){var t=this.playerNode.attr("src")&&this.playerNode.attr("src").split(".").pop(),e=this.current.get("src").split(".").pop();this.mejs&&this.mejs.pause(),t!==e?this.setPlayer(!0):(this.playerNode.attr("src",this.current.get("src")),this.playCurrentSrc())},setCurrent:function(){this.current=this.tracks.at(this.index),this.data.tracklist&&this.$(".wp-playlist-item").removeClass(this.playingClass).eq(this.index).addClass(this.playingClass),this.loadCurrent()}});function s(){r(".wp-playlist:not(:has(.mejs-container))").each(function(){new t({el:this})})}window.wp.playlist={initialize:s},r(document).ready(s),window.WPPlaylistView=t}(jQuery,_,Backbone); var WPViews=WPViews||{}; var wpv_stop_rollover={}; window.wpvPaginationAjaxLoaded={}; window.wpvPaginationAnimationFinished={}; window.wpvPaginationQueue={}; ;(function(){ jQuery.fn.wpv_clone=function(){ var result=jQuery.fn.clone.apply(this, arguments), my_textareas=this.find('textarea').add(this.filter('textarea')), result_textareas=result.find('textarea').add(result.filter('textarea')), my_selects=this.find('select').add(this.filter('select')), result_selects=result.find('select').add(result.filter('select')); for(var i=0, l=my_textareas.length; i < l; ++i){ jQuery(result_textareas[i]).val(jQuery(my_textareas[i]).val()); } for(var i=0, l=my_selects.length; i < l; ++i){ for(var j=0, m=my_selects[i].options.length; j < m; ++j){ if(my_selects[i].options[j].selected===true){ result_selects[i].options[j].selected=true; }else{ result_selects[i].options[j].selected=false; }} } return result; };})(); WPViews.ViewFrontendUtils=function($){ var self=this; self.datepicker_style_id='js-toolset-datepicker-style'; self.is_datepicker_style_loaded=false; self.just_return=function(){ return; }; self.extract_url_query_parameters=function(query_string){ var query_string_pairs={}; if(query_string==""){ return query_string_pairs; } var query_string_split=query_string.split('&'), query_string_split_length=query_string_split.length; for(var i=0; i < query_string_split_length; ++i){ var qs_part=query_string_split[i].split('='); if(qs_part.length!=2){ continue; }; var thiz_key=qs_part[0], thiz_val=decodeURIComponent(qs_part[1].replace(/\+/g, " ")); thiz_key=thiz_key.replace(/(\[)\d?(\])/, ""); thiz_key=thiz_key.replace("[]", ""); thiz_key=thiz_key.replace(/(%5B)\d?(%5D)/, ""); thiz_key=thiz_key.replace("%5B%5D", ""); thiz_key=thiz_key.replace(/(%255B)\d?(%255D)/, ""); thiz_key=thiz_key.replace("%255B%255D", ""); if(query_string_pairs.hasOwnProperty(thiz_key)){ if(query_string_pairs[thiz_key]!=thiz_val){ query_string_pairs[thiz_key] +='##URLARRAYVALHACK##' + thiz_val; }else{ query_string_pairs[thiz_key]=thiz_val; }}else{ query_string_pairs[thiz_key]=thiz_val; }} return query_string_pairs; }; self.get_extra_url_query_parameters_by_form=function(form){ var query_string=self.extract_url_query_parameters(window.location.search.substr(1)), data={}, force_from_form = !(form.hasClass('js-wpv-dps-enabled') || form.hasClass('js-wpv-ajax-results-enabled') || form.hasClass('js-wpv-ajax-results-submit-enabled') ); for(var prop in query_string){ var $matchExisting=form.find('[name="' + prop + '"], [name="' + prop + '\\[\\]"]'); if(query_string.hasOwnProperty(prop) && ! data.hasOwnProperty(prop) && ( force_from_form || $matchExisting.length===0 || $matchExisting .filter('.js-wpv-extra-url-param') .length > 0 ) ){ data[ prop ]=query_string[ prop ]; }} return data; }; self.set_extra_url_query_parameters_by_form=function(form){ var extra=self.get_extra_url_query_parameters_by_form(form); $.each(extra, function(key, value){ if(form.find('[name="' + key + '"], [name="' + key + '\\[\\]"]').length===0){ var pieces=value.split('##URLARRAYVALHACK##'), pieces_length=pieces.length; if(pieces_length < 2){ $('').attr({ type: 'hidden', name: key, value: value, class: 'js-wpv-extra-url-param' }) .appendTo(form); }else{ for(var iter=0; iter < pieces_length; iter++){ $('').attr({ type: 'hidden', name: key + "[]", value: pieces[iter], class: 'js-wpv-extra-url-param' }) .appendTo(form); }} }}); }; self.maybe_load_datepicker_style=function(){ if(! self.is_datepicker_style_loaded){ if(document.getElementById(self.datepicker_style_id)){ self.is_datepicker_style_loaded=true; }else{ var head=document.getElementsByTagName('head')[0], link=document.createElement('link'); link.id=self.datepicker_style_id; link.rel='stylesheet'; link.type='text/css'; link.href=wpv_pagination_local.datepicker_style_url; link.media='all'; head.appendChild(link); self.is_datepicker_style_loaded=true; }} }; self.destroy_frontend_datepicker=function(){ $(".js-wpv-frontend-datepicker.js-wpv-frontend-datepicker-inited") .removeClass('js-wpv-frontend-datepicker-inited') .datepicker("destroy"); }; self.render_frontend_datepicker=function(){ $('.js-wpv-frontend-datepicker:not(.js-wpv-frontend-datepicker-inited)').each(function(){ self.maybe_load_datepicker_style(); var thiz=$(this); thiz .addClass('js-wpv-frontend-datepicker-inited') .datepicker({ onSelect: function(dateText, inst){ var url_param=thiz.data('param'), data='date=' + dateText, form=thiz.closest('form'); data +='&date-format=' + $('.js-wpv-date-param-' + url_param + '-format').val(); data +='&action=wpv_format_date'; $.post(wpv_pagination_local.front_ajaxurl, data, function(response){ response=$.parseJSON(response); form.find('.js-wpv-date-param-' + url_param).html(response['display']); form.find('.js-wpv-date-front-end-clear-' + url_param).show(); form.find('.js-wpv-date-param-' + url_param + '-value').val(response['timestamp']).trigger('change'); }); }, dateFormat: 'ddmmyy', minDate: wpv_pagination_local.datepicker_min_date, maxDate: wpv_pagination_local.datepicker_max_date, showOn: "button", buttonImage: wpv_pagination_local.calendar_image, buttonText: wpv_pagination_local.calendar_text, buttonImageOnly: true, changeMonth: true, changeYear: true }); }); }; self.clone_form=function(fil, targets){ var cloned=fil.wpv_clone(); targets.each(function(){ $(this).replaceWith(cloned); }); }; self.render_frontend_media_shortcodes=function(container){ container.find('.wp-audio-shortcode, .wp-video-shortcode').each(function(){ var thiz=$(this); thiz.mediaelementplayer(); }); container.find('.wp-playlist').each(function(){ var thiz=$(this); return new WPPlaylistView({ el: this }); }); }; self.get_form_element_type=function(selector){ if(selector.length > 0){ return selector[0].tagName=="INPUT" ? selector[0].type.toLowerCase():selector[0].tagName.toLowerCase(); }else{ return ''; }} self.get_hidden_item_width=function(item){ var item_clone=item .clone() .css({ 'display': 'block', 'visibility': 'visible', 'position': 'absolute', 'z-index': '-99999', 'left': '99999999px', 'top': '0px', 'white-space': 'nowrap' }) .appendTo('body'), width=item_clone.outerWidth(); item_clone.remove(); return width; }; self.get_updated_query_results=function(view_number, page, form, expect){ var data={}, sort={}, environment={}, search={}, extra={}. attributes={}, lang=wpv_pagination_local.wpmlLang, parametric_data=form.data('parametric'); sort=WPViews.view_sorting.get_sort_data(view_number, form); if(parametric_data['environment'].current_post_id > 0){ environment['wpv_aux_current_post_id']=parametric_data['environment'].current_post_id; } if(parametric_data['environment'].parent_post_id > 0){ environment['wpv_aux_parent_post_id']=parametric_data['environment'].parent_post_id; } if(parametric_data['environment'].parent_term_id > 0){ environment['wpv_aux_parent_term_id']=parametric_data['environment'].parent_term_id; } if(parametric_data['environment'].parent_user_id > 0){ environment['wpv_aux_parent_user_id']=parametric_data['environment'].parent_user_id; } environment['archive']=parametric_data['environment'].archive; if(form.find('.js-wpv-post-relationship-update').length){ search['dps_pr']=form.find('.js-wpv-post-relationship-update').serializeArray(); } if(form.hasClass('js-wpv-dps-enabled') || form.hasClass('js-wpv-ajax-results-enabled') || form.hasClass('js-wpv-ajax-results-submit-enabled') ){ search['dps_general']=form.find('.js-wpv-filter-trigger, .js-wpv-filter-trigger-delayed').serializeArray(); } attributes=parametric_data['attributes']; extra=self.get_extra_url_query_parameters_by_form(form, true); data={ 'view_number': view_number, page: page, sort: sort, attributes: attributes, environment: environment, search: search, extra: extra, expect: expect }; if(lang){ data['lang']=lang; } switch(parametric_data.query){ case 'archive': data['action']='wpv_get_archive_query_results'; data['loop']=parametric_data.loop; break; default: data['action']='wpv_get_view_query_results'; data['id']=parametric_data.id; if(form.attr('data-targetid')){ data['target_id']=form.data('targetid'); }else if($('.js-wpv-form-only.js-wpv-filter-form-' + view_number).length > 0){ data['target_id']=$('.js-wpv-form-only.js-wpv-filter-form-' + view_number).data('targetid'); } data['wpv_view_widget_id']=parametric_data['widget_id']; break; } return $.ajax({ type: "POST", dataType: "json", url: wpv_pagination_local.front_ajaxurl, data: data }); }; self.updateUrlQuery=function(key, value, url){ if(!url){ url=window.location.href; } var re=new RegExp("([?&])" + key + "=.*?(&|#|$)(.*)", "gi"); var hash; if(re.test(url)){ if(typeof value!=='undefined'&&value!==null){ return url.replace(re, '$1' + key + "=" + value + '$2$3'); }else{ hash=url.split('#'); url=hash[0].replace(re, '$1$3').replace(/(&|\?)$/, ''); if(typeof hash[1]!=='undefined'&&hash[1]!==null){ url +='#' + hash[1]; } return url; }}else{ if(typeof value!=='undefined'&&value!==null){ var separator=url.indexOf('?')!==-1 ? '&':'?'; hash=url.split('#'); url=hash[0] + separator + key + '=' + value; if(typeof hash[1]!=='undefined'&&hash[1]!==null){ url +='#' + hash[1]; } return url; }else{ return url; }} }; $(window).on('resize', _.debounce(function(){ $('.js-wpv-layout-responsive').each(function(){ $(this).css('width', ''); }) .promise() .done(function(){ $(document).trigger('js_event_wpv_layout_responsive_resize_completed'); }); }, wpv_pagination_local.resize_debounce_tolerance )); self.init=function(){ self.render_frontend_datepicker(); }; self.init(); }; WPViews.ViewSorting=function($){ var self=this; self.get_sort_data=function(view_number, form){ var sort={}, parametric_data=form.data('parametric'); sort['wpv_sort_orderby']=parametric_data['sort']['orderby']; sort['wpv_sort_order']=parametric_data['sort']['order']; sort['wpv_sort_orderby_as']=parametric_data['sort']['orderby_as']; sort['wpv_sort_orderby_second']=parametric_data['sort']['orderby_second']; sort['wpv_sort_order_second']=parametric_data['sort']['order_second']; if(form.find('.js-wpv-sort-control-orderby').length > 0){ var orderby_type=WPViews.view_frontend_utils.get_form_element_type(form.find('.js-wpv-sort-control-orderby')); switch(orderby_type){ case 'select': sort['wpv_sort_orderby']=form.find('.js-wpv-sort-control-orderby').val(); if(form.find('.js-wpv-sort-control-orderby option:selected').data('orderbyas')){ sort['wpv_sort_orderby_as']=form.find('.js-wpv-sort-control-orderby option:selected').data('orderbyas'); }else if(sort['wpv_sort_orderby']!=parametric_data['sort']['orderby']){ sort['wpv_sort_orderby_as']=''; } break; case 'radio': sort['wpv_sort_orderby']=form.find('.js-wpv-sort-control-orderby:checked').val(); if(form.find('.js-wpv-sort-control-orderby:checked').data('orderbyas')){ sort['wpv_sort_orderby_as']=form.find('.js-wpv-sort-control-orderby:checked').data('orderbyas'); }else if(sort['wpv_sort_orderby']!=parametric_data['sort']['orderby']){ sort['wpv_sort_orderby_as']=''; } break; case 'text': case 'hidden': sort['wpv_sort_orderby']=form.find('.js-wpv-sort-control-orderby').val(); if(form.find('.js-wpv-sort-control-orderby').data('orderbyas')){ sort['wpv_sort_orderby_as']=form.find('.js-wpv-sort-control-orderby').data('orderbyas'); }else if(sort['wpv_sort_orderby']!=parametric_data['sort']['orderby']){ sort['wpv_sort_orderby_as']=''; } break; }} if(form.find('.js-wpv-sort-control-order').length > 0){ var order_type=WPViews.view_frontend_utils.get_form_element_type(form.find('.js-wpv-sort-control-order')); switch(order_type){ case 'select': sort['wpv_sort_order']=form.find('.js-wpv-sort-control-order').val(); break; case 'radio': sort['wpv_sort_order']=form.find('.js-wpv-sort-control-order:checked').val(); break; case 'text': case 'hidden': sort['wpv_sort_order']=form.find('.js-wpv-sort-control-order').val(); break; }} if(''===sort['wpv_sort_order'] && form.find('.js-wpv-sort-control-orderby').length > 0 ){ var order_type=WPViews.view_frontend_utils.get_form_element_type(form.find('.js-wpv-sort-control-orderby')); switch(order_type){ case 'select': sort['wpv_sort_order']=form.find('.js-wpv-sort-control-orderby option:selected').data('forceorder'); break; case 'radio': sort['wpv_sort_order']=form.find('.js-wpv-sort-control-orderby:checked').data('forceorder'); break; case 'text': case 'hidden': sort['wpv_sort_order']=form.find('.js-wpv-sort-control-orderby').data('forceorder'); break; }} return sort; } self.set_sort_data=function(form, sort){ self.set_sort_data_inside_form(form, sort) .set_sort_data_outside_form(form, sort); return self; }; self.set_sort_data_for_pagination=function(form){ var sort={}, parametric_data=form.data('parametric');; if(form.find('.js-wpv-sort-control-orderby').length > 0){ var orderby_type=WPViews.view_frontend_utils.get_form_element_type(form.find('.js-wpv-sort-control-orderby')); switch(orderby_type){ case 'select': sort['orderby']=form.find('.js-wpv-sort-control-orderby').val(); if(form.find('.js-wpv-sort-control-orderby option:selected').data('orderbyas')){ sort['orderby_as']=form.find('.js-wpv-sort-control-orderby option:selected').data('orderbyas'); }else if(sort['orderby']!=parametric_data['sort']['orderby']){ sort['orderby_as']=''; } if(form.find('.js-wpv-sort-control-orderby option:selected').data('forceorder')){ sort['order']=form.find('.js-wpv-sort-control-orderby option:selected').data('forceorder'); } break; case 'radio': sort['orderby']=form.find('.js-wpv-sort-control-orderby:checked').val(); if(form.find('.js-wpv-sort-control-orderby:checked').data('orderbyas')){ sort['orderby_as']=form.find('.js-wpv-sort-control-orderby:checked').data('orderbyas'); }else if(sort['orderby']!=parametric_data['sort']['orderby']){ sort['orderby_as']=''; } if(form.find('.js-wpv-sort-control-orderby:checked').data('forceorder')){ sort['order']=form.find('.js-wpv-sort-control-orderby:checked').data('forceorder'); } break; case 'text': case 'hidden': sort['orderby']=form.find('.js-wpv-sort-control-orderby').val(); if(form.find('.js-wpv-sort-control-orderby').data('orderbyas')){ sort['orderby_as']=form.find('.js-wpv-sort-control-orderby').data('orderbyas'); }else if(sort['orderby']!=parametric_data['sort']['orderby']){ sort['orderby_as']=''; } if(form.find('.js-wpv-sort-control-orderby').data('forceorder')){ sort['order']=form.find('.js-wpv-sort-control-orderby').data('forceorder'); } break; }} self.set_sort_data(form, sort); }; self.set_sort_data_orderby_select=function(orderby_control, sort){ if(orderby_control.find('option[value="' + sort['orderby'] + '"]').length==0){ orderby_control.append($('