!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}}})});
(function($){ "use strict";
if(jQuery(".dark-light-switcher").length){
jQuery(document).on("click",".dark-light-switcher",function (){
var switcher=jQuery(this);
var hasdark=(switcher.hasClass("dark-switcher")?true:false);
jQuery("html").removeClass((hasdark===true?"light-skin":"dark-skin"));
jQuery("html").addClass((hasdark===true?"dark-skin":"light-skin"));
switcher.removeClass((hasdark===true?"dark-switcher":"light-switcher")).find(" > i").removeClass((hasdark===true?"icon-ios-sunny icon-light-down":"icon-ios-sunny-outline icon-light-up"));
switcher.addClass((hasdark===true?"light-switcher":"dark-switcher")).find(" > i").addClass((hasdark===true?"icon-ios-sunny-outline icon-light-up":"icon-ios-sunny icon-light-down"));
switcher.find(" > input").toggleClass("switcher-dark-checked");
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_site_skin',site_skin:(hasdark===true?"dark":"light") },
});
});
}
if(jQuery(".activate-post-stats").length){
var meta_id=jQuery(".activate-post-stats").data("id");
var visits_nonce=jQuery(".activate-post-stats").data("nonce");
jQuery.post(wpqa_custom.admin_url,{action:"wpqa_update_post_stats",visits_nonce:visits_nonce,post_id:(jQuery(".page-visits-post").length?meta_id:0),user_id:(jQuery(".page-visits-user").length?meta_id:0)});
}
if(jQuery(".referral-invitation").length){
jQuery(".referral-invitation a").on("click",function(){
var copyText=jQuery(".referral-invitation input");
copyText.select();
document.execCommand ("copy");
return false;
});
}
if(jQuery(".age-datepicker").length){
jQuery(".age-datepicker").datepicker({changeMonth:true,changeYear:true,yearRange:"-90:+00",dateFormat:"yy-mm-dd"});
}
if(jQuery(".date-datepicker").length){
jQuery(".date-datepicker").datepicker({changeMonth:true,dateFormat:"yy-mm-dd"});
}
jQuery('.wpqa-custom-select').each(function (){
jQuery(this).select2({
width: '100%',
});
});
if(jQuery(".search-click").length){
jQuery(".search-click").on('touchstart click', function(){
jQuery(".header-search").addClass("header-search-active");
jQuery(".header-search input[type='search']").focus();
jQuery(".search-click").hide();
jQuery(".main-content").on("click",function (){
jQuery(".search-click").show();
jQuery(".header-search").removeClass("header-search-active");
});
});
}
if(jQuery(".search_type.user_filter_active").length){
jQuery(".search_type.user_filter_active").on("change",function (){
var ThisSelect=jQuery(this);
if(ThisSelect.val()=="users"){
jQuery(".post-search .row > .col,.post-search .row-warp > .col-warp").removeClass("col6 col-boot-sm-6").addClass("col4 col-boot-sm-4");
ThisSelect.parent().parent().parent().find(".user-filter-div select").attr("name","user_filter");
jQuery(".user-filter-div").animate({
opacity: 'show',
height: 'show'
},200, function(){
jQuery(".user-filter-div").removeClass('hide');
});
}else{
jQuery(".user-filter-div").animate({
opacity: 'hide',
height: 'hide'
},200, function(){
jQuery(".user-filter-div").addClass('hide');
jQuery(".post-search .row > .col,.post-search .row-warp > .col").removeClass("col4 col-boot-sm-4").addClass("col6 col-boot-sm-6");
ThisSelect.parent().parent().parent().removeAttr("name");
});
}});
}
if(jQuery(".mobile-bar-search").length){
jQuery(".mobile-bar-search > a").on("click",function (){
jQuery(".mobile-bar-search > form").animate({
opacity: 'show',
height: 'show'
},100, function(){
jQuery(".mobile-bar-search").addClass('mobile-bar-search-active');
jQuery(".mobile-bar-search > form input[type='search']").focus();
});
return false;
});
jQuery(".mobile-bar-search form i").on("click",function (){
jQuery(".mobile-bar-search > form").animate({
opacity: 'hide',
height: 'hide'
},100, function(){
jQuery(".mobile-bar-search").removeClass('mobile-bar-search-active');
});
});
}
if(jQuery(".live-search").length){
jQuery(".live-search").each(function (){
var main_live_search=jQuery(this);
var main_search_form=(main_live_search.hasClass("suggest-questions")?".the-title-div":".main-search-form");
var suggest_questions=(main_live_search.hasClass("suggest-questions")?"suggest-questions":"");
var doneTypingInterval=500;
var typingTimer;
main_live_search.on("keyup",function(){
var live_search=jQuery(this);
var search_value=live_search.val();
if(search_value==""){
live_search.closest(main_search_form).find(".search-results").addClass("results-empty").html("").hide();
}else{
var search_type=(main_live_search.hasClass("suggest-questions")?"questions":live_search.closest(main_search_form).find(".search_type").val());
var search_loader=live_search.closest(main_search_form).find(".search_loader");
clearTimeout(typingTimer);
typingTimer=setTimeout(function (){
if(live_search.hasClass("live-search-icon")){
live_search.closest(main_search_form).find("i.icon-search,i.icon-ios-search-strong").attr("class","icon-arrows-ccw icon-ios-loop-strong fa-spin");
}else{
search_loader.show(10);
}
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_live_search',search_value:search_value,search_type:search_type,suggest_questions:suggest_questions },
success:function(data){
if(data.indexOf('no_suggest_questions') > -1){
live_search.closest(main_search_form).find(".search-results").addClass("results-empty").html("").hide();
}else{
live_search.closest(main_search_form).find(".search-results").removeClass("results-empty").html(data).slideDown(300);
if(live_search.hasClass("live-search-icon")){
live_search.closest(main_search_form).find("i.icon-arrows-ccw,i.icon-ios-loop-strong").attr("class","icon-search icon-ios-search-strong");
}else{
search_loader.hide(10);
}}
}});
},500);
}});
main_live_search.on('focus',function(){
var live_search=jQuery(this);
if(live_search.closest(main_search_form).find(".results-empty").length==0){
live_search.closest(main_search_form).find(".search-results").show();
}});
jQuery(".search_type").on("change",function (){
if(jQuery(this).closest(main_search_form).find(".results-empty").length==0){
jQuery(this).closest(main_search_form).find(".search-results").addClass("results-empty").html("").hide();
}});
var outputContainer=main_live_search.closest(main_search_form).find(".search-results");
var input=main_live_search.get(0);
jQuery('body').on('click',function(e){
if(!jQuery.contains(outputContainer.get(0),e.target)&&e.target!=input){
outputContainer.hide();
main_live_search.closest(main_search_form).find(".search_loader").hide();
}});
});
}
jQuery(window).on('scroll',function (){
if(jQuery(this).scrollTop() > 50){
jQuery('.sticky-content').addClass('active');
}else{
jQuery('.sticky-content').removeClass('active');
}});
jQuery(document).on("change",".fileinputs input[type='file']",function (){
var file_fake=jQuery(this);
var file_value=file_fake.val().split('\\').pop();
file_fake.parent().find("button").text(file_value);
});
jQuery(document).on("click",".fakefile",function (){
jQuery(this).parent().find("input[type='file']").trigger("click");
});
jQuery('.close-contributor-card').on('click', function (){
jQuery(this).closest('.contributor-card').fadeOut();
});
if(jQuery(".wpqa-remove-image").length){
jQuery(".wpqa-remove-image").on("click",function (){
var image_this=jQuery(this);
var image_name=image_this.data("name");
var confirm_message=(image_name=="added_file"?wpqa_custom.wpqa_remove_attachment:wpqa_custom.wpqa_remove_image);
if(confirm(confirm_message)){
var image_type=image_this.data("type");
var meta_id=image_this.data("id");
var image_id=image_this.data("image");
var image_nonce=image_this.data("nonce");
image_this.hide();
image_this.parent().find(".loader_4").addClass("wpqa-remove-loader");
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_remove_image', wpqa_remove_image:image_nonce, image_name:image_name, image_type:image_type, meta_id:meta_id, image_id:image_id },
success:function(data){
if(data==""){
if(image_name=="added_file"){
image_this.parent().hide();
if(image_this.closest(".wpqa-delete-attachment").find("li").length==1){
image_this.closest(".wpqa-delete-attachment").hide().remove();
}}else{
image_this.closest(".wpqa-delete-image").hide().remove();
image_this.parent().find(".wpqa-delete-image-span").hide().remove();
}}else{
image_this.parent().find(".wpqa-delete-image-span").html(data);
}
image_this.parent().find(".loader_4").hide();
image_this.remove();
}});
}
return false;
});
}
if(jQuery(".delete-this-attachment").length){
jQuery(".delete-this-attachment").on("click",function (){
var answer=confirm(wpqa_custom.wpqa_remove_attachment);
if(answer){
var delete_attachment=jQuery(this);
var attachment_id=delete_attachment.attr("href");
var post_id=delete_attachment.data("id");
var single_attachment="No";
delete_attachment.hide();
delete_attachment.parent().find(".loader_4").addClass("wpqa-remove-loader");
if(delete_attachment.hasClass("single-attachment")){
single_attachment="Yes";
}
jQuery.post(wpqa_custom.admin_url,"action=wpqa_confirm_delete_attachment&attachment_id="+attachment_id+"&post_id="+post_id+"&single_attachment="+single_attachment,function (result){
delete_attachment.parent().find(".loader_4").hide();
delete_attachment.parent().fadeOut(function(){
jQuery(this).remove();
});
});
}
return false;
});
}
jQuery(document).on("click",".button-hide-click",function (){
var typingTimer;
var button_click=jQuery(this);
var load_span=button_click.hide().parent().find(".load_span");
load_span.show().css({"display":"block"});
clearTimeout(typingTimer);
typingTimer=setTimeout(function (){
button_click.show();
load_span.hide();
},5000);
});
if(jQuery(".cat-ajax").length){
jQuery('.category-wrap').on('change','.cat-ajax',function(){
var currentLevel=parseInt(jQuery(this).parent().parent().data('level'));
wpqa_child_cats(jQuery(this),'wpqa-level-',currentLevel+1);
});
jQuery('.category-wrap > span:last-child .cat-ajax').each(function(){
var currentLevel=parseInt(jQuery(this).parent().parent().data('level'));
wpqa_child_cats(jQuery(this),'wpqa-level-',currentLevel+1);
});
}
if(jQuery(".the-category-ajax").length){
jQuery(".p-category ul").on("click","a",function (){
var $this=jQuery(this);
$this.closest(".p-category").find(".the-category-ajax").val($this.text());
$this.closest(".p-category").find(".search-results").addClass("results-empty").html("").hide();
return false;
});
jQuery(".the-category-ajax").each(function (){
var main_category=jQuery(this);
var typingTimer;
var doneTypingInterval=500;
main_category.on("keyup",function(){
var category=jQuery(this);
var search_value=category.val();
if(search_value==""){
category.closest(".p-category").find(".search-results").addClass("results-empty").html("").hide();
}else{
var search_loader=category.closest(".p-category").find(".search_loader");
clearTimeout(typingTimer);
typingTimer=setTimeout(function (){
search_loader.show(10);
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_category',search_value:search_value },
success:function(data){
category.closest(".p-category").find(".search-results").removeClass("results-empty").html(data).slideDown(300);
search_loader.hide(10);
}});
},500);
}});
main_category.on('focus',function(){
var category=jQuery(this);
if(category.closest(".p-category").find(".results-empty").length==0){
category.closest(".p-category").find(".search-results").show();
}});
var outputContainer=main_category.closest(".p-category").find(".search-results");
var input=main_category.get(0);
jQuery('body').on('click',function(e){
if(!jQuery.contains(outputContainer.get(0),e.target)&&e.target!=input){
outputContainer.hide();
}});
});
}
if(jQuery(".question_tags,.post_tag").length){
jQuery('.question_tags,.post_tag').tag();
}
if(jQuery(".poll_options.not-poll-only").length){
jQuery(".poll_options.not-poll-only").each(function (){
var poll_this=jQuery(this);
var question_poll=poll_this.parent().find("input.question_poll");
var question_poll_input=question_poll.is(":checked");
if(question_poll_input==1||question_poll.length==0){
poll_this.slideDown(200);
}else{
poll_this.slideUp(200);
}
poll_this.parent().find("input.question_poll").on("click",function (){
var question_poll_c=jQuery(this);
var question_poll_input_c=question_poll_c.is(":checked");
if(question_poll_input_c==1){
poll_this.slideDown(200);
}else{
poll_this.slideUp(200);
}});
});
}
if(jQuery(".question_polls_item,.question_upload_item,#categories_left_menu_items").length){
jQuery(".question_polls_item,.question_upload_item,#categories_left_menu_items").sortable();
}
if(jQuery(".add_poll_button_js,.question_image_poll").length){
jQuery(".add_poll_button_js,.question_image_poll").each(function (){
var poll_this_e=jQuery(this);
if(poll_this_e.hasClass("question_image_poll")){
var poll_this_input=poll_this_e.is(":checked");
if(poll_this_input==1||poll_this_input.length==0){
poll_this_e.closest("form").find(".add_poll_button_js").attr("data-poll","image");
}else{
poll_this_e.closest("form").find(".add_poll_button_js").attr("data-poll","normal");
}}
poll_this_e.on("click",function(){
var poll_this=jQuery(this);
var wpqa_form=poll_this.closest(".wpqa_form");
var poll_options=poll_this.closest(".poll_options");
if(poll_this.hasClass("question_image_poll")){
var question_image_poll=poll_this;
poll_options.find(".question_polls_item > li").remove();
poll_options.toggleClass("poll-activated-image");
poll_max=0;
var poll_this_input=poll_this.is(":checked");
if(poll_this_input==1||poll_this_input.length==0){
wpqa_form.find(".add_poll_button_js").attr("data-poll","image");
}else{
wpqa_form.find(".add_poll_button_js").attr("data-poll","normal");
}}else{
var poll_max=poll_this.data("max");
poll_max=(poll_max!==undefined&&poll_max!==false&&poll_max > 2?poll_max:0);
var question_image_poll=poll_options.find(".question_image_poll");
}
var poll_button=(poll_this.hasClass("question_image_poll")?wpqa_form.find(".add_poll_button_js"):poll_this);
var button_poll=poll_button.attr("data-poll");
var add_poll=poll_options.find(".question_items > li").length;
var poll_min=poll_button.data("min");
var button_name=poll_button.data("name");
button_name=(button_name!==undefined&&button_name!==false?button_name:"ask");
poll_min=(poll_min!==undefined&&poll_min!==false&&poll_min > 2?poll_min:2);
if(poll_max==0||(poll_max > 0&&poll_max > add_poll)){
var question_image_poll_c=question_image_poll.is(":checked");
var question_image_poll_checked=question_image_poll_c;
if(button_poll=='image'){
question_image_poll_checked=1;
}
if(add_poll > 0){
var i_count=0;
while (i_count < add_poll){
if(poll_options.find(".question_items > #poll_li_"+add_poll).length){
add_poll++;
}
i_count++;
}}else{
add_poll++;
}
var wpqa_poll_image=(question_image_poll_checked==1&&button_poll=='image'?'<div class="attach-li"><div class="fileinputs"><input type="file" class="file" name="'+button_name+'['+add_poll+'][image]" id="'+button_name+'['+add_poll+'][image]"><i class="icon-camera"></i><div class="fakefile"><button type="button">'+wpqa_custom.select_file+'</button><span>'+wpqa_custom.browse+'</span></div></div></div>':'');
var wpqa_poll_title=(question_image_poll_checked!=1||button_poll!='image'||(button_poll=='image'&&wpqa_custom.poll_image_title=='on')?'<p><input class="form-control '+button_name+'" name="'+button_name+'['+add_poll+'][title]" value="" type="text"><i class="icon-comment"></i></p>':'');
var poll_elements='';
if(add_poll==1){
for (var k=2; k < poll_min + 1; k++){
var wpqa_poll_image_2=(question_image_poll_checked==1&&button_poll=='image'?'<div class="attach-li"><div class="fileinputs"><input type="file" class="file" name="'+button_name+'['+k+'][image]" id="'+button_name+'['+k+'][image]"><i class="icon-camera"></i><div class="fakefile"><button type="button">'+wpqa_custom.select_file+'</button><span>'+wpqa_custom.browse+'</span></div></div></div>':'');
var wpqa_poll_title_2=(question_image_poll_checked!=1||button_poll!='image'||(button_poll=='image'&&wpqa_custom.poll_image_title=='on')?'<p><input class="form-control '+button_name+'" name="'+button_name+'['+k+'][title]" value="" type="text"><i class="icon-comment"></i></p>':'');
var wpqa_poll_for='<li class="ui-sortable-handle" id="poll_li_'+k+'">'+wpqa_poll_image_2+'<div class="poll-li">'+wpqa_poll_title_2+'<input name="'+button_name+'['+k+'][id]" value="'+k+'" type="hidden"><div class="del-item-li remove-answer"><i class="icon-cancel"></i></div><div class="move-poll-li ui-icon darg-icon"><i class="icon-menu"></i></div></div></li>';
poll_elements +=wpqa_poll_for;
}}
poll_options.find('.question_items').append('\
<li class="ui-sortable-handle" id="poll_li_'+add_poll+'">'+wpqa_poll_image+'<div class="poll-li">'+wpqa_poll_title+'<input name="'+button_name+'['+add_poll+'][id]" value="'+add_poll+'" type="hidden"><div class="del-item-li remove-answer"><i class="icon-cancel"></i></div><div class="move-poll-li ui-icon darg-icon"><i class="icon-menu"></i></div></div></li>\
'+poll_elements+'\
');
jQuery('#poll_li_'+add_poll).hide().fadeIn();
jQuery(".del-item-li").on("click",function(){
wpqa_remove_item(jQuery(this));
});
}else{
wpqa_form.find(" > .wpqa_error").animate({opacity: 'hide' , height: 'hide'}, 400).remove();
wpqa_form.prepend('<div class="wpqa_error">'+wpqa_custom.poll_number_max+" "+poll_max+'</div>');
jQuery("html,body").animate({scrollTop: wpqa_form.find(" > .wpqa_error").offset().top-35},"slow");
wpqa_form.find(" > .wpqa_error").animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
}
if(!poll_this.hasClass("question_image_poll")){
return false;
}});
});
}
jQuery(document).on("click",".del-item-li,.remove-answer",function (){
wpqa_remove_item(jQuery(this));
});
function wpqa_remove_item(whatClass){
var remove_it="remove";
var remove_item=whatClass.parent().parent();
var poll_options=remove_item.closest(".poll_options");
if(poll_options.find(".add_poll_button_js").length){
var add_poll_button_js=poll_options.find(".add_poll_button_js");
var poll_min=add_poll_button_js.data("min");
poll_min=(poll_min!==undefined&&poll_min!==false&&poll_min > 1?poll_min:2);
var count_polls=poll_options.find(".question_polls_item > li").length;
count_polls=count_polls-1;
if(count_polls < poll_min){
var wpqa_form=whatClass.closest(".wpqa_form");
wpqa_form.find(" > .wpqa_error").animate({opacity: 'hide' , height: 'hide'}, 400).remove();
wpqa_form.prepend('<div class="wpqa_error">'+wpqa_custom.poll_number_min+" "+poll_min+'</div>');
jQuery("html,body").animate({scrollTop: wpqa_form.find(" > .wpqa_error").offset().top-35},"slow");
wpqa_form.find(" > .wpqa_error").animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
remove_it="no_remove";
}}
if(remove_it=="remove"){
remove_item.addClass('removered').fadeOut(function(){
jQuery(this).remove();
});
}}
if(jQuery(".video_description_input,.video_description").length){
jQuery(".video_description").each(function (){
var video_this=jQuery(this);
var video_description=video_this.parent().find(".video_description_input");
var video_description_input=video_description.is(":checked");
if(video_description_input==1||video_description.length==0){
video_this.slideDown(200);
}else{
video_this.slideUp(200);
}
video_this.parent().find(".video_description_input").on("click",function (){
var video_description_c=video_this.parent().find(".video_description_input");
var video_description_input_c=video_description_c.is(":checked");
if(video_description_input_c==1){
video_this.slideDown(200);
}else{
video_this.slideUp(200);
}});
});
}
if(jQuery(".video_answer_description_input,.video_answer_description").length){
var video_this=jQuery(".video_answer_description");
var video_description=video_this.parent().find(".video_answer_description_input");
var video_description_input=video_description.is(":checked");
if(video_description_input==1){
video_this.slideDown(200);
}else{
video_this.slideUp(200);
}
video_this.parent().find(".video_answer_description_input").on("click",function (){
var video_description_c=video_this.parent().find(".video_answer_description_input");
var video_description_input_c=video_description_c.is(":checked");
if(video_description_input_c==1){
video_this.slideDown(200);
}else{
video_this.slideUp(200);
}});
}
if(jQuery(".add_upload_button_js").length){
jQuery(".add_upload_button_js").on("click",function(){
var add_attach_1=jQuery(this).parent().find(".question_items > li").length;
var add_attach_2=jQuery(this).parent().parent().parent().find(".wpqa-delete-attachment > li").length;
var add_attach_3=(add_attach_2 > 0?add_attach_2+1:0);
var add_attach=add_attach_1+add_attach_3;
if(add_attach > 0){
var i_count=0;
while (i_count < add_attach){
if(jQuery(this).parent().find(".question_items > #attach_li_"+add_attach).length){
add_attach++;
}
i_count++;
}}else{
add_attach++;
}
jQuery(this).parent().find('.question_items').append('<li class="ui-sortable-handle" id="attach_li_'+add_attach+'"><div class="attach-li"><div class="fileinputs"><input type="file" class="file" name="attachment_m['+add_attach+'][file_url]" id="attachment_m['+add_attach+'][file_url]"><i class="icon-camera"></i><div class="fakefile"><button type="button">'+wpqa_custom.select_file+'</button><span>'+wpqa_custom.browse+'</span></div><div class="del-item-li remove-answer"><i class="icon-cancel"></i></div><div class="move-poll-li ui-icon darg-icon"><i class="icon-menu"></i></div></div></div></li>');
jQuery(".fileinputs input[type='file']").on("change",function (){
var file_fake=jQuery(this);
file_fake.parent().find("button").text(file_fake.val());
});
jQuery(".fakefile").on("click",function (){
jQuery(this).parent().find("input[type='file']").trigger("click");
});
jQuery('#attach_li_'+add_attach).hide().fadeIn();
jQuery(".del-item-li").on("click",function(){
jQuery(this).parent().parent().parent().fadeOut(function(){
jQuery(this).remove();
});
});
return false;
});
}
if(jQuery(".the-details").length){
jQuery("#wp-question-details-wrap").appendTo(".the-details");
jQuery("#wp-post-details-wrap").appendTo(".the-details");
}
if(jQuery(".author-image").length){
jQuery(document).on("mouseover",".author-image",function (){
var author_image=jQuery(this);
var author_image_pop=jQuery('.author-image-pop-2',author_image)
var user_id=parseInt(author_image_pop.attr("data-user"));
var loader=jQuery('.author-pop-loader',author_image);
if(user_id > 0&&loader.length > 0){
if(jQuery("#author-image-user-"+user_id).length > 0){
loader.fadeOut(function(){
jQuery(this).remove();
});
var exists_user=jQuery("#author-image-user-"+user_id).html();
author_image_pop.html(exists_user);
}else{
if(!author_image.hasClass("author_image_mouseover")){
jQuery.post(wpqa_custom.admin_url,{action:"wpqa_get_author_image_pop",user_id:user_id},function(data){
loader.fadeOut(function(){
jQuery(this).remove();
});
author_image_pop.html(data);
jQuery("body").prepend("<div id='author-image-user-"+user_id+"' class='wpqa_hide'>"+data+"</div>");
panel_pop("#wpqa-message",".wpqa-message");
});
}
author_image.addClass("author_image_mouseover");
}}
});
}
if(jQuery(".panel-pop > i").length){
jQuery(document).on("click",".panel-pop > i",function (){
var icon_close=jQuery(this);
var wrappop=icon_close.parent();
if(!wrappop.hasClass("pop-not-close")){
jQuery.when(wrappop.fadeOut(200)).done(function(){
jQuery("#wpqa-message .the-title").val("");
jQuery(".wrap-pop").remove();
jQuery("body").removeClass("body-open-pop-up");
});
}});
}
panel_pop("#signup-panel",".signup-panel,.button-sign-up,.mob-sign-up,.login-links-r a");
panel_pop("#lost-password",".lost-password,.main_for_all .reset-password");
panel_pop("#lost-password",".lost-passwords","no",".main_for_all");
panel_pop("#login-panel",".login-panel,.button-sign-in,.mob-sign-in,.comment-reply-login");
panel_pop("#login-panel",".login-panel-document","document",document);
panel_pop("#wpqa-question",".wpqa-question");
panel_pop("#wpqa-question-user",".ask-question-user");
panel_pop("#wpqa-post",".wpqa-post");
panel_pop("#wpqa-message",".wpqa-message,.message-reply a");
panel_pop("#wpqa-report",".report_c,.report_q,.report_user");
function panel_pop(whatId,whatClass,whatFrom,bodyClass){
jQuery((whatFrom=="document"?document:(whatFrom=="no"?(bodyClass!=""?bodyClass+" ":"")+".wpqa_form,":"")+whatClass)).on("click",(whatFrom=="no"||whatFrom=="document"?whatClass:""),function(){
var $return=true;
if(jQuery(whatId).length&&!jQuery(this).hasClass("wpqa-not-pop")){
$return=false;
if(jQuery(whatClass).parent().hasClass("message-reply")||jQuery(whatClass).hasClass("send-message-2")){
var user_id=jQuery(this).attr("data-user-id");
var message_id=jQuery(this).attr("data-id");
if(message_id!==undefined&&message_id!==false){
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_message_reply',message_id:message_id },
success:function(data){
jQuery("#wpqa-message .the-title").val(data);
}});
}
if(user_id!==undefined&&user_id!==false){
if(jQuery(".message_user_id").length){
jQuery(".message_user_id").attr("value",user_id);
}else{
jQuery("#wpqa-message .send-message").after('<input type="hidden" name="user_id" class="message_user_id" value="'+user_id+'">');
}}
}
var data_width=jQuery(whatId).attr("data-width");
jQuery(".panel-pop").css({"top":"-100%","display":"none"});
if(!jQuery(".wrap-pop").hasClass("wrap-pop-not-close")){
jQuery(".wrap-pop").remove();
jQuery("body").removeClass("body-open-pop-up");
}
var is_RTL=jQuery('body').hasClass('rtl')?true:false;
var cssMargin=(is_RTL==true?"margin-right":"margin-left");
var cssValue="-"+(data_width!==undefined&&data_width!==false?data_width/2:"")+"px";
jQuery(whatId).css("width",(data_width!==undefined&&data_width!==false?data_width:"")+"px").css(cssMargin,cssValue).show().animate({"top":"7%"},200);
jQuery("html,body").animate({scrollTop:0},200);
if(!jQuery(".wrap-pop").hasClass("wrap-pop-not-close")){
jQuery(".put-wrap-pop").prepend("<div class='wrap-pop'></div>");
jQuery("body").addClass("body-open-pop-up");
}
wrap_pop();
}
return $return;
});
}
function wrap_pop(){
if(!jQuery(".wrap-pop").hasClass("wrap-pop-not-close")){
jQuery(".wrap-pop").on("click",function (){
jQuery.when(jQuery(".panel-pop").fadeOut(200)).done(function(){
jQuery(this).css({"top":"-100%","display":"none"});
jQuery("#wpqa-message .the-title").val("");
jQuery(".wrap-pop").remove();
jQuery("body").removeClass("body-open-pop-up");
});
});
}}
jQuery('body').on('click', function(e){
var click_area=jQuery(".user-login-click,.user-notifications,.mobile-aside");
if(!jQuery(e.target).closest(click_area).length){
jQuery(".user-login-click").removeClass("user-click-open").find(" > ul").slideUp(200);
jQuery(".user-login-area .user-notifications > div").slideUp(200);
jQuery(".user-notifications-seen").removeClass("user-notifications-seen");
jQuery(".user-messages > div").slideUp(200);
jQuery('.mobile-menu-wrap').removeClass('mobile-aside-open');
}});
if(jQuery(".home_categories").length){
jQuery(".home_categories").on("change",function (){
var url=jQuery(this).val();
if(url){
window.location.href=url;
}
return false;
});
}
jQuery(document).on("click",".question-followers a",function(){
var question_follow=jQuery(this);
var question_class=question_follow.closest(".article-question.article-post.question");
var post_id=question_class.attr('id').replace("post-","");
var question_follow_class=question_follow.data("follow");
var question_unfollow_class=question_follow.data("unfollow");
question_follow.hide();
question_follow.parent().find(".loader_2").show();
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_question_'+(question_follow.hasClass("unfollow-question")?"unfollow":"follow"), post_id:post_id },
success:function(data){
if(question_follow.hasClass("unfollow-question")){
if(question_follow_class!=""&&question_unfollow_class!=""){
question_follow.removeClass(question_unfollow_class).addClass(question_follow_class);
}
question_follow.removeClass("unfollow-question").parent().removeClass("li-follow-question").find("i").addClass("icon-plus").removeClass("icon-minus");
}else{
if(question_follow_class!=""&&question_unfollow_class!=""){
question_follow.removeClass(question_follow_class).addClass(question_unfollow_class);
}
question_follow.addClass("unfollow-question").parent().addClass("li-follow-question").find("i").removeClass("icon-plus").addClass("icon-minus");
}
question_follow.attr("original-title",(question_follow.hasClass("unfollow-question")?wpqa_custom.follow_question_attr:wpqa_custom.unfollow_question_attr)).show().parent().find(".loader_2").hide().parent().find(".question-follow-count").text(data);
}});
return false;
});
if(jQuery(".wpqa-open-click").length){
jQuery(".wpqa-open-click").on("click",function (){
var whatsclass=jQuery(this).attr("data-class");
if(whatsclass!==undefined&&whatsclass!==false){
jQuery("."+whatsclass).addClass("wpqa-open-new");
}else{
jQuery(this).parent().find(".wpqa-open-div").addClass("wpqa-open-new");
}
jQuery(".wpqa-open-div:not(.wpqa-open-new)").slideUp(400);
if(whatsclass!==undefined&&whatsclass!==false){
jQuery("."+whatsclass).slideToggle(400);
}else{
jQuery(this).parent().find(".wpqa-open-div").slideToggle(400);
}
jQuery(".wpqa-open-new").removeClass("wpqa-open-new");
return false;
});
}
function vote_message(vote){
vote.find(".vote_result").show();
vote.find(".li_loader").hide();
}
jQuery(document).on("click",".wpqa_vote",function(){
var this_vote=jQuery(this);
var type=this_vote.attr("data-type");
var vote_type=this_vote.attr("data-vote-type");
this_vote.parent().parent().addClass("active-vote");
if(type==wpqa_custom.question||type==wpqa_custom.asked_question){
var vote_parent=this_vote.closest(".single-inner-content");
var error_class=vote_parent.find(".question-content > .wpqa_error");
}else{
var vote_parent=this_vote.closest(".comment-text");
var error_class=vote_parent.find(".wpqa_error");
}
vote_parent.find(".vote_result").hide();
vote_parent.find(".li_loader").show();
error_class.slideUp(200);
if(this_vote.hasClass("vote_not_user")){
error_class.text(wpqa_custom.no_vote_user).slideDown(200);
vote_message(vote_parent);
this_vote.parent().parent().removeClass("active-vote");
}else if(this_vote.hasClass("vote_not_allow")){
if(type==wpqa_custom.question||type==wpqa_custom.asked_question){
var text_vote=wpqa_custom.no_vote_question;
}else if(type=="comments"){
var text_vote=wpqa_custom.no_vote_comment;
}else{
var text_vote=wpqa_custom.no_vote_answer;
}
error_class.text(text_vote).slideDown(200);
vote_message(vote_parent);
this_vote.parent().parent().removeClass("active-vote");
}else if(this_vote.hasClass("vote_allow")){
var id=this_vote.data('id');
if(type==wpqa_custom.question||type==wpqa_custom.asked_question){
var action_vote='wpqa_question_vote_'+vote_type;
var vote_more=wpqa_custom.no_vote_more;
}else if(type=="comments"){
var action_vote='wpqa_comments_vote_'+vote_type;
var vote_more=wpqa_custom.no_vote_more_comment;
}else{
var action_vote='wpqa_comment_vote_'+vote_type;
var vote_more=wpqa_custom.no_vote_more_answer;
}
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:action_vote, id:id },
success:function(data){
if(data.indexOf('no_vote_more') >=0){
data=data.replace("no_vote_more","");
error_class.text(vote_more).slideDown(200);
}else{
if(data > 0){
vote_parent.find(".vote_result").removeClass("vote_red");
}else if(data==0){
vote_parent.find(".vote_result").removeClass("vote_red");
}else if(data < 0){
vote_parent.find(".vote_result").addClass("vote_red");
}
if(this_vote.hasClass("wpqa_voted_already")){
this_vote.removeClass("wpqa_voted_already");
}}
if(vote_parent.find("wpqa_voted_already").length > 0){
vote_parent.find(".wpqa_voted_already").removeClass("wpqa_voted_already");
}else{
vote_parent.find(".wpqa_voted_already").removeClass("wpqa_voted_already");
this_vote.addClass("wpqa_voted_already");
}
vote_parent.find(".vote_result").html(data);
vote_message(vote_parent);
this_vote.parent().parent().removeClass("active-vote");
}});
}
return false;
});
wpqa_report();
function wpqa_report(){
if(jQuery(".report_activated").length){
var report_type="";
jQuery(".report_activated > a").on("click",function(){
report_type=jQuery(this).attr("class");
report_type=report_type.replace('dropdown-item ','');
if(jQuery(".report_id").length){
jQuery(".report_id").remove();
}
if(report_type=="report_user"){
jQuery(".question_report,.answer_report").hide(10);
jQuery(".user_report").show(10);
var report_v=jQuery(this);
var report_id=report_v.attr("href");
jQuery(".submit-report").append('<input type="hidden" class="report_id" name="report_id" value="'+report_id+'">');
}else if(report_type=="report_c"){
jQuery(".question_report,.user_report").hide(10);
jQuery(".answer_report").show(10);
var report_v=jQuery(this);
var report_id=report_v.attr("href");
jQuery(".submit-report").append('<input type="hidden" class="report_id" name="report_id" value="'+report_id+'">');
}else{
jQuery(".question_report").show(10);
jQuery(".answer_report,.user_report").hide(10);
}
return false;
});
jQuery(".submit-report").on("submit",function (){
var report_v=jQuery(this);
var explain=report_v.find("textarea");
if(explain.val()==''){
explain.css("border-color","#e1e2e3");
if(explain.val()==''){
explain.css("border-color","#F00");
}
jQuery(".wpqa_error",report_v).html('<span class="required-error">'+wpqa_custom.wpqa_error_text+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
jQuery('.load_span',report_v).hide();
jQuery('input[type="submit"]',report_v).show();
}else{
var fromSerialize=report_v.serialize();
var fromWithAction=fromSerialize+"&action=wpqa_"+report_type;
jQuery.post(wpqa_custom.admin_url,fromWithAction,function(data){
if(data=="deleted_report"){
if(report_type=="report_c"){
location.reload();
}else{
window.location.href=wpqa_custom.home_url;
}}else{
explain.val("").css("border-color","#e1e2e3");
location.reload();
}
jQuery('.load_span',report_v).hide();
jQuery('input[type="submit"]',report_v).show();
});
}
return false;
});
}}
wpqa_favorite("add_favorite");
wpqa_favorite("remove_favorite");
function wpqa_favorite(favorite_type){
if(jQuery("."+favorite_type).length){
jQuery("."+favorite_type).on("click",function (){
var var_favorite=jQuery(this);
var question_class=var_favorite.closest(".article-question.article-post");
var post_id=question_class.attr("id").replace('post-',"");
var_favorite.hide();
var_favorite.parent().find(".loader_2").show();
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_'+var_favorite.attr("class"), post_id:post_id },
success:function(data){
var_favorite.find("span").text(data);
if(var_favorite.parent().hasClass("active-favorite")){
var_favorite.addClass("add_favorite").removeClass("remove_favorite").attr("title",wpqa_custom.add_favorite).parent().removeClass("active-favorite");
}else{
var_favorite.addClass("remove_favorite").removeClass("add_favorite").attr("title",wpqa_custom.remove_favorite).parent().addClass("active-favorite");
}
var_favorite.show();
var_favorite.parent().find(".loader_2").hide();
}});
return false;
});
}}
jQuery(document).on("click",".poll_results",function(){
var poll_area=jQuery(this).closest(".poll-area");
poll_area.find(".poll_2").fadeOut(200);
poll_area.find(".poll_1").delay(500).slideDown(200);
poll_area.find(".progressbar-percent").each(function(){
var $this=jQuery(this);
var percent=$this.attr("attr-percent");
$this.on("inview", function(event, isInView, visiblePartX, visiblePartY){
if(isInView&&!$this.hasClass("pro-viewed")){
$this.animate({ "width":percent + "%"}, 700).addClass("pro-viewed");
}});
});
return false;
});
jQuery(document).on("click",".poll_polls",function(){
var poll_area=jQuery(this).closest(".poll-area");
poll_area.find(".poll_1").fadeOut(200);
poll_area.find(".poll_2").delay(500).slideDown(200);
return false;
});
jQuery(document).on("click","p.wpqa_poll_image img",function(){
var wpqa_poll_image=jQuery(this);
var input=wpqa_poll_image.prev('input[type="radio"],input[type="checkbox"]');
if(input.is(':checkbox')){
if(input.is(':checked')){
wpqa_poll_image.removeClass('wpqa_poll_image_select');
input.prop('checked',false);
}else{
wpqa_poll_image.addClass('wpqa_poll_image_select');
input.prop('checked',true);
}}else if(input.is(':radio')){
wpqa_poll_image.parent().parent().parent().find('input[type="radio"]').prop('checked',false);
wpqa_poll_image.parent().parent().parent().find('.wpqa_poll_image_select').removeClass('wpqa_poll_image_select');
wpqa_poll_image.addClass('wpqa_poll_image_select').prev('input[type="radio"]').prop('checked',true);
}});
jQuery(document).on("click",".poll-submit",function(){
var question_poll=jQuery(this);
var poll_val=question_poll.parent().find('.required-item:checked');
var wpqa_form=question_poll.closest(".wpqa_form");
question_poll.parent().find("input,label").hide().parent().find(".load_span").show();
if(poll_val.length==0){
question_poll.parent().find("input,label").show().parent().find(".load_span").hide();
question_poll.closest(".question-content").find(".wpqa_error").text(wpqa_custom.wpqa_error_text).slideDown(200).delay(5000).slideUp(200);
}else{
var poll_id=poll_val.val().replace("poll_","");
var question_class=question_poll.closest(".article-question.article-post.question");
var post_id=question_class.attr("id").replace("post-","");
var pollfrom=question_poll.closest(".wpqa_form").serializeArray({ checkboxesAsBools: true });
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_question_poll', poll_id:poll_id, post_id:post_id, pollfrom:pollfrom },
success:function(data){
if(data=="no_poll"||data=="must_login"){
question_poll.closest(".question-content").find(".wpqa_error").text((data=="must_login"?wpqa_custom.must_login:wpqa_custom.no_poll_more)).slideDown(200).delay(5000).slideUp(200);
if(wpqa_form.find(".wpqa_poll_image").length==0){
question_poll.parent().find("input,label").show();
}
wpqa_form.show().find(".load_span").hide();
wpqa_form.find(".ed_button").show();
}else{
var poll_2=question_poll.closest(".poll_2");
var poll_main=poll_2.parent().parent();
poll_main.html(data);
jQuery(".progressbar-percent").each(function(){
var $this=jQuery(this);
var percent=$this.attr("attr-percent");
$this.on("inview", function(event, isInView, visiblePartX, visiblePartY){
if(isInView&&!$this.hasClass("pro-viewed")){
$this.animate({ "width":percent + "%"}, 700).addClass("pro-viewed");
}});
});
}}
});
}
return false;
});
if(jQuery(".ask_anonymously").length){
jQuery(".ask_anonymously").each(function (){
var ask_anonymously=jQuery(this);
var wpqa_setting=ask_anonymously.is(":checked");
if(wpqa_setting==1){
ask_anonymously.closest(".ask_anonymously_p").find(".ask_named").hide(10);
ask_anonymously.closest(".ask_anonymously_p").find(".ask_none").show(10);
}else{
ask_anonymously.closest(".ask_anonymously_p").find(".ask_named").show(10);
ask_anonymously.closest(".ask_anonymously_p").find(".ask_none").hide(10);
}
ask_anonymously.on("click",function (){
var ask_anonymously_c=ask_anonymously.is(":checked");
if(ask_anonymously_c==1){
ask_anonymously.closest(".ask_anonymously_p").find(".ask_named").hide(10);
ask_anonymously.closest(".ask_anonymously_p").find(".ask_none").show(10);
}else{
ask_anonymously.closest(".ask_anonymously_p").find(".ask_named").show(10);
ask_anonymously.closest(".ask_anonymously_p").find(".ask_none").hide(10);
}});
});
}
if(jQuery(".load-question-jquery").length){
jQuery(document).on("click",".load-question-jquery .post-read-more:not(.comment-read-more)",function (){
jQuery(this).closest(".article-question").find(".excerpt-question").hide().parent().find(".content-question-jquery").show();
if(jQuery(".question-masonry").length){
jQuery('.question-articles').isotope({
filter: "*",
animationOptions: {
duration: 750,
itemSelector: '.question-masonry',
easing: "linear",
queue: false,
}});
}
return false;
});
jQuery(document).on("click",".load-question-jquery .question-read-less",function (){
jQuery(this).closest(".article-question").find(".content-question-jquery").hide().parent().find(".excerpt-question").show();
if(jQuery(".question-masonry").length){
jQuery('.question-articles').isotope({
filter: "*",
animationOptions: {
duration: 750,
itemSelector: '.question-masonry',
easing: "linear",
queue: false,
}});
}
return false;
});
}
if(jQuery(".read_more_answer").length){
jQuery(document).on("click",".read_more_answer",function (){
jQuery(this).parent().parent().find(".less_answer_text").hide().parent().find(".full_answer_text").show();
setTimeout(function (){
jQuery(window).trigger('sticky_recalc');
},1000);
return false;
});
jQuery(document).on("click",".read_less_answer",function (){
jQuery(this).parent().parent().find(".full_answer_text").hide().parent().find(".less_answer_text").show();
setTimeout(function (){
jQuery(window).trigger('sticky_recalc');
},1000);
return false;
});
}
if(jQuery(".answer-question-jquery").length){
jQuery(document).on("click",".answer-question-jquery .meta-answer,.answer-question-jquery .best-answer-meta a",function (){
var answer_jquery=jQuery(this);
var main_question=answer_jquery.closest(".article-question");
var post_id=main_question.attr("id").replace('post-',"");
jQuery(".panel-pop").css({"top":"-100%","display":"none"});
jQuery(".wrap-pop").remove();
jQuery("body").removeClass("body-open-pop-up");
var is_RTL=jQuery('body').hasClass('rtl')?true:false;
var cssMargin=(is_RTL==true?"margin-right":"margin-left");
if(jQuery("#article-question-"+post_id).length > 0){
var data_width=jQuery("#article-question-"+post_id).attr("data-width");
var cssValue="-"+(data_width!==undefined&&data_width!==false?data_width/2:"")+"px";
jQuery("#article-question-"+post_id).css("width",(data_width!==undefined&&data_width!==false?data_width:"")+"px").css(cssMargin,cssValue).show().animate({"top":"7%"},200);
jQuery("html,body").animate({scrollTop: jQuery("#article-question-"+post_id).offset().top-35},"slow");
jQuery(".put-wrap-pop").prepend("<div class='wrap-pop'></div>");
jQuery("body").addClass("body-open-pop-up");
wrap_pop();
}else{
jQuery("#post-"+post_id+" > .question-fixed-area").show();
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_question_answer_popup', post_id:post_id },
success:function(data){
jQuery(".put-wrap-pop").after(data);
var data_width=jQuery("#article-question-"+post_id).attr("data-width");
var cssValue="-"+(data_width!==undefined&&data_width!==false?data_width/2:"")+"px";
jQuery("#article-question-"+post_id).css("width",(data_width!==undefined&&data_width!==false?data_width:"")+"px").css(cssMargin,cssValue).show().animate({"top":"7%"},200).find(" > .load_span").hide();
jQuery("html,body").animate({scrollTop: jQuery("#article-question-"+post_id).offset().top-35},"slow");
jQuery(".put-wrap-pop").prepend("<div class='wrap-pop'></div>");
jQuery("body").addClass("body-open-pop-up");
wrap_pop();
jQuery("#post-"+post_id+" > .question-fixed-area").hide();
}});
}
return false;
});
jQuery(document).on("click",".question-panel-pop .add-answer-ajax",function (){
var delete_comment=false;
if(jQuery(".delete-comment").length){
delete_comment=true;
}
var complete_answer=true;
var add_answer_jquery=jQuery(this);
var main_question=add_answer_jquery.closest(".question-panel-pop");
var post_id=main_question.attr("id").replace('article-question-',"");
var main_popup=add_answer_jquery.closest(".answers-form");
var main_form=add_answer_jquery.closest(".comment-form.answers-form");
var form_data=main_form.serialize();
var comment_text=main_form.find("textarea").val();
main_form.find(".wpqa_error").animate({opacity: 'hide' , height: 'hide'}, 400).remove();
if(comment_text==''||comment_text=='<p><br data-mce-bogus="1"></p>'||comment_text=='<p><br></p>'||comment_text=='<p></p>'){
main_form.find(".wpqa_error").animate({opacity: 'hide' , height: 'hide'}, 400).remove();
main_form.prepend('<div class="wpqa_error">'+wpqa_custom.wpqa_error_comment+'</div>');
main_form.find(".wpqa_error").animate({opacity: 'show' , height: 'show'}, 400);
main_form.find(".load_span").hide();
add_answer_jquery.show();
complete_answer=false;
}
var comment_limit_var=wpqa_custom.comment_limit;
var comment_min_limit_var=wpqa_custom.comment_min_limit;
if(add_answer_jquery.hasClass("button-default-question")){
comment_limit_var=wpqa_custom.answer_limit;
comment_min_limit_var=wpqa_custom.answer_min_limit;
}
if(comment_limit_var > 0||comment_min_limit_var > 0){
var message="";
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_comment_limit', comment_text:comment_text, comment_limit:comment_limit_var, comment_min_limit:comment_min_limit_var },
async:false,
success: function(data){
message=data;
}});
if(message.indexOf('wpqa_error') > -1||message.indexOf('wpqa_min_error') > -1){
main_form.find(".wpqa_error").animate({opacity: 'hide' , height: 'hide'}, 400).remove();
main_form.prepend('<div class="wpqa_error">'+(message.indexOf('wpqa_error') > -1?wpqa_custom.wpqa_error_limit+': '+comment_limit_var:wpqa_custom.wpqa_error_min_limit+': '+comment_min_limit_var)+'</div>');
main_form.find(".wpqa_error").animate({opacity: 'show' , height: 'show'}, 400);
main_form.find(".load_span").hide();
add_answer_jquery.show();
complete_answer=false;
}}
if(complete_answer==true){
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: form_data,
success:function(data){
var closest_popup=add_answer_jquery.closest(".panel-pop-content");
var cannt_answer_more=false;
if(closest_popup.find(".commentlist").length==0){
closest_popup.find(" > .alert-message").remove();
closest_popup.prepend("<div class='page-content commentslist'><ol class='commentlist clearfix'></ol></div>");
}
if(data.indexOf('wpqa_cannt_answer_more') > -1){
data=data.replace("wpqa_cannt_answer_more","");
cannt_answer_more=true;
}
closest_popup.find(".commentlist").prepend(data);
if(cannt_answer_more==true){
main_popup.parent().hide().css({"display":"none"});
}else{
add_answer_jquery.show();
main_popup.find("textarea").val("");
}
main_popup.find(".load_span").hide().css({"display":"none"});
jQuery("html,body").animate({scrollTop: closest_popup.find(".commentlist > li:first-child").offset().top-35},"slow");
if(delete_comment==false){
jQuery(document).on("click",".delete-comment",function (){
var var_delete=(jQuery(".delete-answer").length?wpqa_custom.sure_delete_answer:wpqa_custom.sure_delete_comment);
if(confirm(var_delete)){
return true;
}else{
return false;
}});
}}
});
}
return false;
});
}
jQuery(document).on("click",".show-replies",function (){
var replies=jQuery(this);
replies.closest(".comment").find(" > .children").slideToggle(30);
setTimeout(function (){
jQuery(window).trigger('sticky_recalc');
},1000);
return false;
});
if(jQuery(".reactions_action").length){
jQuery(".react__area").on("mouseover",function (){
jQuery(this).addClass("react__area__hovered");
}).mouseleave(function(){
setTimeout(()=> {
jQuery(this).removeClass("react__area__hovered");
},1000);
});
jQuery(document).on("click",".reactions_action",function (){
setTimeout(()=> {
jQuery('.react__area .reactions__list').removeAttr('style');
},500);
jQuery('.react__area .reactions__list').fadeOut();
var reactions=jQuery(this);
var type=reactions.data("type");
var like=reactions.data("like");
var react__area=reactions.closest(".react__area");
var reaction_id=reactions.closest(".reaction-id");
var post_id=reaction_id.data("id");
var comment_li=reactions.closest("li.comment");
var comment_id=(comment_li.length?comment_li.attr('id').replace("li-comment-",""):0);
reactions.removeClass("react__area__hovered");
if(comment_id > 0){
var like__button=jQuery("#comment-"+comment_id+" .like__button");
var reaction_small=jQuery("#comment-"+comment_id+" .reaction-small");
}else{
var like__button=react__area.find(".like__button");
if(like__button.hasClass("like__button__2")){
var reaction_small=react__area.parent().find(".reaction-small");
}else{
var reaction_small=react__area.find(".reaction-small");
}}
if(reactions.hasClass("like__button")){
if(reactions.hasClass("reacted")){
reactions.removeClass("reacted");
if(comment_id > 0){
like__button.html('<i class="icon-android-happy"></i><span class="like__button-text">'+wpqa_custom.add_emoji+'</span>');
}else{
reactions.html('<i class="icon-thumbsup"></i>');
}}else{
var react_clone=react__area.find(".reactions__list li:first-child img").clone();
if(!reactions.hasClass("like__button__2")){
like__button.addClass("reacted").html(react_clone);
}}
}else{
if(reactions.hasClass("reacted")){
like__button.removeClass("reacted");
}else{
like__button.addClass("reacted");
if(!like__button.hasClass("like__button__2")){
like__button.html(reactions.find("img").clone());
}}
}
jQuery.ajax({
type: "POST",
url: wpqa_custom.admin_url,
data: {action:"wpqa_reactions",post_id:post_id,comment_id:comment_id,type:type,like:like},
cache: false,
dataType: "json",
success: function (data){
if(reactions.hasClass("like__button")){
if(typeof(data)!=='undefined'&&data.hasOwnProperty('react')&&data.react=="unreact"){
reactions.removeClass("reacted");
if(comment_id > 0){
like__button.html(data.comment);
}else{
reactions.html(data.post);
}}else{
if(!reactions.hasClass("like__button__2")){
like__button.addClass("reacted").html(data.image);
}}
}else{
if(typeof(data)!=='undefined'&&data.hasOwnProperty('react')&&data.react=="unreact"){
like__button.removeClass("reacted");
}else{
like__button.addClass("reacted");
if(!like__button.hasClass("like__button__2")){
like__button.html(data.image);
}}
}
reaction_small.html(data.reactions);
if(data.number > 0){
reaction_small.addClass("reaction-small-reacted");
}else{
reaction_small.removeClass("reaction-small-reacted");
}
if(like__button.hasClass("like__button__2")){
react__area.parent().find(".reaction_strong").html(data.strong);
react__area.find(".reactions__count.him-user").text(data.count_male);
react__area.find(".reactions__count.her-user").text(data.count_female);
}},error: function (jqXHR, textStatus, errorThrown){
},complete: function (){
}});
});
}
jQuery(".progressbar-percent").each(function(){
var $this=jQuery(this);
var percent=$this.attr("attr-percent");
$this.on("inview", function(event, isInView, visiblePartX, visiblePartY){
if(isInView&&!$this.hasClass("pro-viewed")){
$this.animate({ "width":percent + "%"}, 700).addClass("pro-viewed");
}});
});
if(jQuery(".subscription-switcher").length){
jQuery(".subscription-switcher button,.subscription-switcher .switch-button").on("click",function (){
var switcher=jQuery(this);
var switcher_type=switcher.attr("data-type");
jQuery(".subscription-switcher button").removeClass("subscription-switcher-active");
if(switcher.hasClass("switch-button")){
jQuery(".subscription-switcher button[data-type='"+switcher_type+"']").addClass("subscription-switcher-active");
if(switcher_type=="yearly"){
switcher.attr("data-type","monthly");
}else{
switcher.attr("data-type","yearly");
}}
if(!switcher.hasClass("subscription-switcher-active")){
if(!switcher.hasClass("switch-button")){
switcher.addClass("subscription-switcher-active");
jQuery(".switch-button-checkbox").click();
}}
jQuery(".li-subscribe-plans").addClass("wpqa_hide");
jQuery(".li-subscribe-plan-"+switcher_type).removeClass("wpqa_hide");
});
}
jQuery(document).on("click",".important-notices-button",function (){
var widget_section=jQuery(this).closest(".widget");
var widget_id=widget_section.attr("id");
jQuery.post(wpqa_custom.admin_url,"action=wpqa_ajax_important_notices&widget_id="+widget_id,function (result){
widget_section.fadeOut(function(){
jQuery(this).remove();
});
});
return false;
});
if(jQuery(".categories-toggle-accordion").length){
jQuery(".categories-toggle-accordion .accordion-title").each(function (){
jQuery(this).find(" > a > i").on("click",function (){
var categories=jQuery(this);
categories.toggleClass("icon-minus").toggleClass("icon-plus").toggleClass("wpqa-minus");
categories.parent().parent().next().slideToggle(300);
return false;
});
});
}
jQuery(document).on("click",".following_not,.following_you",function (){
var following_var=jQuery(this);
var following_var_id=following_var.attr("data-rel");
var following_nonce=following_var.attr("data-nonce");
var user_follow_done=(following_var.parent().hasClass("user_follow_4")?"user_follow_done":"user_follow_yes");
var follow=(following_var.hasClass("following_not")?"following_not":"following_you");
var next_follow=(following_var.hasClass("following_not")?"following_you":"following_not");
var user_follow=following_var.data("follow");
var user_unfollow=following_var.data("unfollow");
following_var.hide();
following_var.parent().addClass("user_follow_active");
following_var.parent().find(".small_loader").show().css({"display":"inline-block"});
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: {action:'wpqa_'+follow+'_ajax',following_var_id:following_var_id,following_nonce:following_nonce},
success:function(result){
following_var.addClass(next_follow).removeClass(follow).attr("title",(follow=="following_not"?wpqa_custom.follow:wpqa_custom.unfollow)).show().parent().removeClass("user_follow_active");
if(following_var.parent().hasClass("user_follow_2")||following_var.parent().hasClass("user_follow_3")||following_var.parent().hasClass("user_follow_4")){
if(following_var.find(".follow-count").length){
following_var.find(".follow-count").text(result);
}
if(following_var.closest(".wpqa-profile-cover").find(".follow-cover-count").length){
following_var.closest(".wpqa-profile-cover").find(".follow-cover-count").text(result);
}
if(follow=="following_not"){
following_var.parent().removeClass(user_follow_done).find(".follow-value").text((follow=="following_not"?wpqa_custom.follow:wpqa_custom.unfollow));
}else{
following_var.parent().addClass(user_follow_done).find(".follow-value").text((follow=="following_not"?wpqa_custom.follow:wpqa_custom.unfollow));
}}else{
if(follow=="following_not"){
following_var.parent().removeClass(user_follow_done).find("i").removeClass("icon-minus").addClass("icon-plus");
}else{
following_var.parent().addClass(user_follow_done).find("i").removeClass("icon-plus").addClass("icon-minus");
}}
if(user_follow!=""&&user_unfollow!=""){
if(follow=="following_not"){
following_var.removeClass(user_unfollow).addClass(user_follow);
}else{
following_var.removeClass(user_follow).addClass(user_unfollow);
}}
if(jQuery(".finish-follow > a").length){
var post_id=jQuery(".finish-follow > a").data("post");
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: {action:'wpqa_finish_follow',post_id:post_id},
success:function(data){
jQuery(".finish-follow > a").text((data==0?wpqa_custom.click_not_finish:wpqa_custom.click_continue));
if(data==0){
jQuery(".finish-follow").addClass("not-finish-follow");
}else{
jQuery(".finish-follow").removeClass("not-finish-follow");
}}
});
}
following_var.parent().find(".small_loader").hide();
}});
return false;
});
if(jQuery(".unfollow_cat,.follow_cat").length){
wpqa_follow_cat("unfollow_cat","follow_cat");
wpqa_follow_cat("follow_cat","unfollow_cat");
function wpqa_follow_cat(follow,next_follow){
jQuery(document).on("click","."+follow,function (){
var following_var=jQuery(this);
var tax_id=following_var.data("id");
var tax_type=following_var.data("type");
var tax_follow=following_var.data("follow");
var tax_unfollow=following_var.data("unfollow");
var tax_nonce=following_var.data("nonce");
var cat_follow_done="cat_follow_done";
var closest_class=following_var.data("closest");
var count_class=following_var.data("count");
following_var.hide();
following_var.parent().addClass("user_follow_active");
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: {action:'wpqa_'+follow,tax_id:tax_id,tax_type:tax_type,tax_nonce:tax_nonce},
success:function(result){
following_var.addClass(next_follow).removeClass(follow).attr("title",(follow=="unfollow_cat"?wpqa_custom.follow:wpqa_custom.unfollow)).show().parent().removeClass("user_follow_active");
if(following_var.find(".follow-count").length||following_var.closest("."+closest_class).find("."+count_class).length){
if(following_var.find(".follow-count").length){
following_var.find(".follow-count").text(result);
}
if(following_var.closest("."+closest_class).find("."+count_class).length){
following_var.closest("."+closest_class).find("."+count_class).text(result);
}}
if(follow=="unfollow_cat"){
following_var.parent().removeClass(cat_follow_done).find(".follow-cat-value").text((follow=="unfollow_cat"?wpqa_custom.follow:wpqa_custom.unfollow));
following_var.parent().removeClass(cat_follow_done).find(".follow-cat-icon i").removeClass("icon-minus").addClass("icon-plus");
if(tax_follow!=""&&tax_unfollow!=""){
following_var.removeClass(tax_unfollow).addClass(tax_follow);
}}else{
following_var.parent().addClass(cat_follow_done).find(".follow-cat-value").text((follow=="unfollow_cat"?wpqa_custom.follow:wpqa_custom.unfollow));
following_var.parent().addClass(cat_follow_done).find(".follow-cat-icon i").removeClass("icon-plus").addClass("icon-minus");
if(tax_follow!=""&&tax_unfollow!=""){
following_var.removeClass(tax_follow).addClass(tax_unfollow);
}}
if(jQuery(".finish-follow > a").length){
var post_id=jQuery(".finish-follow > a").data("post");
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: {action:'wpqa_finish_follow',post_id:post_id},
success:function(data){
jQuery(".finish-follow > a").text((data==0?wpqa_custom.click_not_finish:wpqa_custom.click_continue));
if(data==0){
jQuery(".finish-follow").addClass("not-finish-follow");
}else{
jQuery(".finish-follow").removeClass("not-finish-follow");
}}
});
}}
});
return false;
});
}}
if(jQuery(".block-user,.unblock-user").length){
jQuery(document).on("click",".block-user,.unblock-user",function (){
var block_user=jQuery(this);
var block_nonce=block_user.data("nonce");
var user_id=block_user.data("id");
var block_type=(block_user.hasClass("block-user")?"block":"unblock");
block_user.hide();
block_user.parent().find(".small_loader").show().css({"display":"block"});
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_block_user', block_type:block_type, block_nonce:block_nonce, user_id:user_id },
success:function(data){
if(block_type=="block"){
block_user.find("i").removeClass("icon-block").addClass("icon-back");
block_user.removeClass("block-user").addClass("unblock-user").find("span").text(wpqa_custom.unblock_user);
}else{
block_user.find("i").removeClass("icon-back").addClass("icon-block");
block_user.removeClass("unblock-user").addClass("block-user").find("span").text(wpqa_custom.block_user);
}
block_user.show();
block_user.parent().find(".small_loader").hide();
}});
return false;
});
}
if(jQuery(".unblock-user-page,.block-user-page").length){
wpqa_block("unblock-user-page","block-user-page");
wpqa_block("block-user-page","unblock-user-page");
function wpqa_block(block,next_block){
jQuery(document).on("click","."+block,function (){
var blocking_var=jQuery(this);
var blocking_var_id=blocking_var.attr("data-rel");
var block_nonce=blocking_var.data("nonce");
var block_type=(block=="unblock-user-page"?"unblock":"block");
var user_block_done=(blocking_var.parent().hasClass("user_block_4")?"user_block_done":"user_block_yes");
blocking_var.hide();
blocking_var.parent().addClass("user_block_active");
blocking_var.parent().find(".small_loader").show().css({"display":"block"});
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: {action:'wpqa_block_user', block_type:block_type, block_nonce:block_nonce, user_id:blocking_var_id},
success:function(result){
blocking_var.addClass(next_block).removeClass(block).attr("title",(block=="unblock-user-page"?wpqa_custom.block_user:wpqa_custom.unblock_user)).show().parent().removeClass("user_block_active");
if(blocking_var.parent().hasClass("user_block_2")||blocking_var.parent().hasClass("user_block_3")||blocking_var.parent().hasClass("user_block_4")){
if(block=="unblock-user-page"){
blocking_var.parent().removeClass(user_block_done).find(".block-value").text((block=="unblock-user-page"?wpqa_custom.block_user:wpqa_custom.unblock_user));
}else{
blocking_var.parent().addClass(user_block_done).find(".block-value").text((block=="unblock-user-page"?wpqa_custom.block_user:wpqa_custom.unblock_user));
}}else{
if(block=="unblock-user-page"){
blocking_var.parent().removeClass(user_block_done).find("i").removeClass("icon-back").addClass("icon-block");
}else{
blocking_var.parent().addClass(user_block_done).find("i").removeClass("icon-block").addClass("icon-back");
}}
blocking_var.parent().find(".small_loader").hide();
}});
return false;
});
}}
if(jQuery(".ban-user,.unban-user").length){
jQuery(document).on("click",".ban-user,.unban-user",function (){
var ban_user=jQuery(this);
var ban_nonce=ban_user.data("nonce");
var user_id=ban_user.data("id");
var ban_type=(ban_user.hasClass("ban-user")?"ban":"unban");
ban_user.hide();
ban_user.parent().find(".small_loader").show().css({"display":"block"});
jQuery.ajax({
url: wpqa_custom.admin_url,
type: "POST",
data: { action:'wpqa_ban_user', ban_type:ban_type, ban_nonce:ban_nonce, user_id:user_id },
success:function(data){
if(ban_type=="ban"){
ban_user.find("i").removeClass("icon-cancel-circled").addClass("icon-back");
ban_user.removeClass("ban-user").addClass("unban-user").find("span").text(wpqa_custom.unban_user);
}else{
ban_user.find("i").removeClass("icon-back").addClass("icon-cancel-circled");
ban_user.removeClass("unban-user").addClass("ban-user").find("span").text(wpqa_custom.ban_user);
}
ban_user.show();
ban_user.parent().find(".small_loader").hide();
}});
return false;
});
}
if(jQuery(".notifications-click").length){
jQuery(".notifications-click").on("click mouseover",function (event){
var notifications_click=jQuery(this);
if(!notifications_click.hasClass("messages-click")){
if(event.type==="click"||(event.type==="mouseover"&&notifications_click.hasClass("notifications--hover"))){
jQuery('.mobile-menu-wrap').removeClass('mobile-aside-open');
jQuery(".user-messages").removeClass("user-notifications-seen").find(" > div").slideUp(200);
jQuery(".user-login-click").removeClass("user-click-open").find(" > ul").slideUp(200);
}
if(event.type==="click"){
notifications_click.parent().toggleClass("user-notifications-seen").find(" > div").slideToggle(200).parent().find(" > .notifications-number").remove();
}else{
notifications_click.parent().find(".notifications-count").remove();
}
jQuery.post(wpqa_custom.admin_url,{action:"wpqa_update_notifications"});
}});
}
if(jQuery(".messages-click").length){
jQuery(".messages-click").on("click",function (){
jQuery('.mobile-menu-wrap').removeClass('mobile-aside-open');
jQuery(".notifications-area").removeClass("user-notifications-seen").find(" > div").slideUp(200);
jQuery(".user-login-click").removeClass("user-click-open").find(" > ul").slideUp(200);
jQuery(this).parent().toggleClass("user-notifications-seen").find(" > div").slideToggle(200).parent().find(" > .notifications-number").remove();
});
}
if(jQuery(".delete-comment").length){
jQuery(document).on("click",".delete-comment",function (){
var var_delete=(jQuery(".delete-answer").length?wpqa_custom.sure_delete_answer:wpqa_custom.sure_delete_comment);
if(confirm(var_delete)){
return true;
}else{
return false;
}});
}
if(jQuery(".add_media,.mce-ico.mce-i-dashicon.dashicons-admin-media").length){
jQuery(".add_media,.mce-ico.mce-i-dashicon.dashicons-admin-media").on("click",function (event){
event.preventDefault();
wp.media.model.settings.post.id=0;
});
}
jQuery(window).on("load",function(){
if(jQuery('.wp-editor-wrap').length){
jQuery('.wp-editor-wrap').each(function(){
var editor_iframe=jQuery(this).find('iframe');
if(editor_iframe.height() < 150){
editor_iframe.css({'height':'150px'});
}});
}});
jQuery(document).on("keyup",function(event){
if(event.which=='27'){
if(!jQuery(".wrap-pop").hasClass("wrap-pop-not-close")){
jQuery.when(jQuery(".panel-pop").fadeOut(200)).done(function(){
jQuery(this).css({"top":"-100%","display":"none"});
jQuery(".wrap-pop").remove();
jQuery("body").removeClass("body-open-pop-up");
});
}
jQuery('.mobile-menu-wrap').removeClass('mobile-aside-open');
jQuery(".user-login-click").removeClass("user-click-open").find(" > ul").slideUp(200);
jQuery(".user-login-area .user-notifications > div").slideUp(200);
jQuery(".user-notifications-seen").removeClass("user-notifications-seen");
jQuery(".user-messages > div").slideUp(200);
}});
})(jQuery);
function wpqa_get_captcha(captcha_file,captcha_id){
jQuery("#"+captcha_id).attr("src",captcha_file+'&'+Math.random()).parent().find(".wpqa_captcha").val("");
}
function wpqa_child_cats(dropdown,result_div,level){
var cat=dropdown.val();
var results_div=result_div + level;
var field_attr=dropdown.attr('data-taxonomy');
jQuery.ajax({
type: 'post',
url: wpqa_custom.admin_url,
data: {
action: 'wpqa_child_cats',
catID: cat,
field_attr: field_attr
},
beforeSend: function(){
dropdown.parent().parent().parent().next('.loader_2').addClass("category_loader_show");
dropdown.parent().parent().parent().addClass("no-load");
},
complete: function(){
dropdown.parent().parent().parent().next('.loader_2').removeClass("category_loader_show");
dropdown.parent().parent().parent().removeClass("no-load");
},
success: function(html){
dropdown.parent().parent().nextAll().each(function(){
jQuery(this).remove();
});
if(html!=""){
dropdown.addClass('hasChild').parent().parent().parent().append('<span id="'+result_div+level+'" data-level="'+level+'"></span>');
dropdown.parent().parent().parent().find('#'+results_div).html(html).slideDown('fast');
}
jQuery('#'+result_div+level+' .wpqa-custom-select').select2({
width: '100%',
});
}});
};
(function($){ "use strict";
var $window=jQuery(window);
function panel_pop_share(whatId){
if(jQuery(whatId).length&&jQuery(".comments-popup-share").length==0&&jQuery(".respond-popup-share").length==0&&jQuery(".popup-share-show").length==0){
var data_width=jQuery(whatId).attr("data-width");
var data_height=jQuery(whatId).height();
jQuery(".panel-pop").css({"top":"-100%","display":"none"});
if(!jQuery(".wrap-pop").hasClass("wrap-pop-not-close")){
jQuery(".wrap-pop").remove();
jQuery("body").removeClass("body-open-pop-up");
}
var is_RTL=jQuery('body').hasClass('rtl')?true:false;
var cssMargin=(is_RTL==true?"margin-right":"margin-left");
var cssValue="-"+(data_width!==undefined&&data_width!==false?data_width/2:"")+"px";
var cssValue2="-"+(data_height!==undefined&&data_height!==false?data_height/2:"")+"px";
jQuery(whatId).css("width",(data_width!==undefined&&data_width!==false?data_width:"")+"px").css({"position":"fixed","top":"50%","margin-top":cssValue2}).css(cssMargin,cssValue).addClass("popup-share-show").show();
if(!jQuery(".wrap-pop").hasClass("wrap-pop-not-close")){
jQuery(".put-wrap-pop").prepend("<div class='wrap-pop'></div>");
jQuery("body").addClass("body-open-pop-up");
}
if(!jQuery(".wrap-pop").hasClass("wrap-pop-not-close")){
jQuery(".wrap-pop").on("click",function (){
jQuery.when(jQuery(".panel-pop").fadeOut(200)).done(function(){
jQuery(this).css({"top":"-100%","display":"none"});
jQuery("#wpqa-message .the-title").val("");
jQuery(".wrap-pop").remove();
jQuery("body").removeClass("body-open-pop-up");
});
});
}}
}
if(jQuery(".popup-share-visit").length){
var popup_share_seconds=wpqa_single.popup_share_seconds;
if(popup_share_seconds > 0){
setTimeout(function(){panel_pop_share("#wpqa-share");},popup_share_seconds*1000);
}else{
panel_pop_share("#wpqa-share");
}}else{
var scroll_position=0;
var ticking=false;
var hidden_comments=(jQuery("#comments").length?jQuery("#comments").offset().top:0);
var hidden_respond=(jQuery("#respond-all").length?jQuery("#respond-all").offset().top:0);
function wpqa_open_share_popup(scroll_pos){
var viewPortTop=$window.scrollTop();
var viewPortBottom=viewPortTop + $window.height();
var scroll_share='';
if(typeof(localStorage)!='undefined'){
scroll_share=localStorage.getItem('scroll-share');
}
if(scroll_share > 0&&scroll_share > scroll_pos){
if((hidden_comments > 0&&(hidden_comments - viewPortBottom) > 70&&(hidden_comments - viewPortBottom) < 300)||(hidden_respond > 0&&(hidden_respond - viewPortBottom) > 70&&(hidden_respond - viewPortBottom) < 300)){
panel_pop_share("#wpqa-share");
}}
}
window.addEventListener('scroll', function(e){
scroll_position=window.scrollY;
if(!ticking){
window.requestAnimationFrame(function(){
wpqa_open_share_popup(scroll_position);
if(typeof(localStorage)!='undefined'){
localStorage.setItem('scroll-share',scroll_position);
}
ticking=false;
});
ticking=true;
}});
if(jQuery("#comments").length){
jQuery("#comments").on("inview", function(event, isInView, visiblePartX, visiblePartY){
if(isInView){
panel_pop_share("#wpqa-share");
jQuery("#comments").addClass("comments-popup-share");
}});
}else if(jQuery("#respond-all").length){
jQuery("#respond-all").on("inview", function(event, isInView, visiblePartX, visiblePartY){
if(isInView){
panel_pop_share("#wpqa-share");
jQuery("#respond-all").addClass("respond-popup-share");
}});
}}
if(jQuery(".show-answer-form").length){
jQuery(".show-answer-form").on("click",function(){
jQuery(".show-answer-form").hide(10);
jQuery(".comment-form-hide").animate({opacity: 'show' , height: 'show'}, 400).addClass("comment-form-show");
setTimeout(function (){
jQuery(window).trigger('sticky_recalc');
},1000);
});
}
if(jQuery(".post-delete,.question-delete").length){
jQuery(".post-delete,.question-delete").on("click",function (){
var var_delete=(jQuery(".post-delete").length?wpqa_single.sure_delete_post:wpqa_single.sure_delete);
if(confirm(var_delete)){
return true;
}else{
return false;
}});
}
question_stats("close");
question_stats("open");
function question_stats(stats){
if(jQuery(".question-"+stats).length){
jQuery(".question-"+stats).on("click",function (){
var question_stats=jQuery(this);
var question_class=question_stats.closest(".article-question.article-post.question");
var post_id=question_class.attr('id').replace("post-","");
var wpqa_open_close_nonce=question_stats.data("nonce");
question_stats.hide();
jQuery.ajax({
url: wpqa_single.admin_url,
type: "POST",
data: { action:'wpqa_question_'+stats, wpqa_open_close_nonce:wpqa_open_close_nonce, post_id:post_id },
success:function(data){
location.reload();
}});
return false;
});
}}
if(jQuery(".bump-question-area a").length){
jQuery(".bump-question-area a").on("click",function (){
var point_a=jQuery(this);
var input_add=jQuery("#input-add-point");
var input_add_point=input_add.val();
var question_class=point_a.closest(".article-question.article-post.question");
var question_content=point_a.closest(".question-content");
var post_id=question_class.attr("id").replace('post-',"");
point_a.hide();
point_a.parent().find(".load_span").show();
jQuery.ajax({
url: wpqa_single.admin_url,
type: "POST",
data: {action:'wpqa_add_point',input_add_point:input_add_point,post_id:post_id},
success:function(data){
if(data=="get_points"){
question_content.find(".wpqa_success").hide(10).text(wpqa_single.get_points).slideDown(200).delay(5000).slideUp(200);
}else{
question_content.find(".wpqa_error").hide(10).text(data).slideDown(200).delay(5000).slideUp(200);
}
point_a.show();
point_a.parent().find(".load_span").hide();
input_add.val("");
}});
return false;
});
}
if(jQuery("#commentform").length){
jQuery("#commentform").attr("enctype","multipart/form-data").on("submit",function (){
var thisform=jQuery(this);
jQuery('.wpqa_error',thisform).hide().find(".required-error").remove();
if(jQuery('.wpqa_captcha',thisform).length){
var wpqa_captcha=jQuery('.wpqa_captcha',thisform).parent().find("input");
var url=wpqa_single.wpqa_dir+"captcha/captcha.php";
var captcha_val=wpqa_captcha.attr("name")+"="+encodeURIComponent(wpqa_captcha.val());
wpqa_captcha.css("border-color","#e1e2e3");
if(wpqa_captcha.val()==""){
wpqa_captcha.css("border-color","#F00").parent().parent().parent().find(".wpqa_error").html('<span class="required-error required-error-c">'+wpqa_single.wpqa_error_captcha+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
jQuery("#commentform .load_span").hide();
jQuery("#commentform .button-hide-click").show();
return false;
}else if(wpqa_captcha.hasClass("captcha_answer")){
if(wpqa_captcha.val()!=wpqa_single.captcha_answer){
wpqa_captcha.css("border-color","#F00").parent().parent().parent().find(".wpqa_error").html('<span class="required-error required-error-c">'+wpqa_single.wpqa_error_captcha+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
jQuery("#commentform .load_span").hide();
jQuery("#commentform .button-hide-click").show();
return false;
}else{
return true;
}}else{
var message="";
jQuery.ajax({
url:url,
type:"POST",
data:captcha_val,
async:false,
success: function(data){
message=data;
}});
if(message.indexOf('wpqa_captcha_0') > -1){
wpqa_captcha.css("border-color","#F00").parent().parent().parent().find(".wpqa_error").html('<span class="required-error required-error-c">'+wpqa_single.wpqa_error_captcha+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
jQuery("#commentform .load_span").hide();
jQuery("#commentform .button-hide-click").show();
return false;
}else{
return true;
}}
}});
}
if(jQuery("li.comment").length){
wpqa_best_answer("best_answer_re");
wpqa_best_answer("best_answer_a");
function wpqa_best_answer(type){
jQuery("li.comment").on("click","."+type,function (){
jQuery("#comments .wpqa_error").slideUp(200);
var best_answer=jQuery(this);
var comment_id=best_answer.closest("li.comment").attr('id').replace("li-comment-","");
var nonce=best_answer.data("nonce");
jQuery("."+type).hide();
jQuery.ajax({
url: wpqa_single.admin_url,
type: "POST",
data: { action:'wpqa_'+type, comment_id:comment_id, wpqa_best_answer_nonce:nonce },
success:function(result){
if(result=="best"){
if(type=="best_answer_a"){
jQuery("#comment-"+comment_id).addClass(".comment-best-answer");
jQuery("#comment-"+comment_id+" .comment-meta").before('<div class="best-answer">'+wpqa_single.best_answer+'</div>');
jQuery("#comment-"+comment_id+" .wpqa-add-remove-best-answer").html('<a class="best_answer_re" data-nonce="'+wpqa_single.wpqa_best_answer_nonce+'" href="#" title="'+wpqa_single.cancel_best_answer+'"><i class="icon-cancel"></i>'+wpqa_single.cancel_best_answer+'</a>');
}else{
jQuery(".commentlist .wpqa-add-remove-best-answer").html('<a class="best_answer_a" data-nonce="'+wpqa_single.wpqa_best_answer_nonce+'" href="#" title="'+wpqa_single.choose_best_answer+'"><i class="icon-check"></i>'+wpqa_single.choose_best_answer+'</a>');
jQuery(".best-answer,.answers-area.best-answers").remove();
jQuery(".comment-best-answer").removeClass("comment-best-answer");
}}else if(result=="remove_best"){
jQuery(".commentlist .wpqa-add-remove-best-answer").html('<a class="best_answer_a" data-nonce="'+wpqa_single.wpqa_best_answer_nonce+'" href="#" title="'+wpqa_single.choose_best_answer+'"><i class="icon-check"></i>'+wpqa_single.choose_best_answer+'</a>');
jQuery(".best-answer,.answers-area.best-answers").remove();
jQuery(".comment-best-answer").removeClass("comment-best-answer");
}else{
jQuery("#comment-"+result).addClass(".comment-best-answer").find(".wpqa_error").text(wpqa_single.best_answer_selected).slideDown(200);
jQuery("#comment-"+result+" .comment-meta").before('<div class="best-answer">'+wpqa_single.best_answer+'</div>');
jQuery("#comment-"+result+" .wpqa-add-remove-best-answer").html('<a class="best_answer_re" data-nonce="'+wpqa_single.wpqa_best_answer_nonce+'" href="#" title="'+wpqa_single.cancel_best_answer+'"><i class="icon-cancel"></i>'+wpqa_single.cancel_best_answer+'</a>');
jQuery("html,body").animate({scrollTop: jQuery("#comment-"+result).offset().top-35},"slow");
}
jQuery("."+type).parent().remove();
}});
return false;
});
}}
if(jQuery(".single-question .comment-best-answer.not-activate-gender").length){
jQuery(".comment-best-answer").prependTo("ol.commentlist");
}
if(jQuery("#comments").length){
jQuery(document).on("click",".answer-question-not-jquery .best-answer-meta a,.comments-link",function (){
jQuery("html,body").animate({scrollTop: jQuery("#comments").offset().top-35},"slow");
});
}
if(jQuery("#comments-female,#comments-male,#comments-best,#comments-other").length){
jQuery(".answer-meta-gender.answer-meta-her,.answer-meta-gender.answer-meta-him,.answer-meta-gender.answer-meta-other,.best-answer-icon").each(function (){
jQuery(this).on("click",function (){
if(jQuery(this).hasClass("best-answer-icon")){
jQuery("html,body").animate({scrollTop: jQuery("#comments-best").offset().top-35},"slow");
}else if(!jQuery(this).hasClass("best-answer-meta")){
var idAnimate=(jQuery(this).hasClass("answer-meta-her")?"#comments-female":(jQuery(this).hasClass("answer-meta-him")?"#comments-male":"#comments-other"));
jQuery("html,body").animate({scrollTop: jQuery(idAnimate).offset().top-35},"slow");
}});
});
}
if(jQuery(".single-question").length){
if(window.location.hash=="#respond"){
jQuery(".show-answer-form").remove();
jQuery(".comment-form-hide,.comment-form-hide").show().addClass("comment-form-show");
if(jQuery("#respond").length){
jQuery("html,body").animate({scrollTop: jQuery("#respond").offset().top-35},"slow");
}else if(jQuery(".question-adv-comments .alert-message").length){
jQuery("html,body").animate({scrollTop: jQuery(".question-adv-comments .alert-message").offset().top-35},"slow");
}}
}
if(jQuery("#respond").length){
jQuery(document).on("click",".meta-answer",function (){
jQuery(".show-answer-form").remove();
jQuery(".comment-form-hide,.comment-form-hide").show().addClass("comment-form-show");
jQuery("html,body").animate({scrollTop: jQuery("#respond").offset().top-35},"slow");
setTimeout(function (){
jQuery(window).trigger('sticky_recalc');
},1000);
});
jQuery(".single").on("click",".wpqa-reply-link",function (){
if((wpqa_single.allow_to_reply==true&&wpqa_single.allow_to_answer==true&&wpqa_single.activate_editor_reply=="on")||wpqa_single.is_logged=="unlogged"){
jQuery(".show-answer-form").remove();
jQuery(".comment-form-hide,.comment-form-hide").show().addClass("comment-form-show");
var reply_link=jQuery(this);
jQuery(".wpqa-cancel-link").remove();
jQuery("html,body").animate({scrollTop: jQuery("#respond").offset().top-35},"slow");
jQuery(".respond-edit-delete").show();
jQuery("#respond #comment_parent").val(reply_link.attr("data-id"));
jQuery("#respond .section-title").append('<div class="wpqa-cancel-link cancel-comment-reply"><a rel="nofollow" id="cancel-comment-reply-link" href="#respond">'+wpqa_single.cancel_reply+'</a></div>');
}else{
var commentthis=jQuery(this);
var post_id=commentthis.data("post_id");
var comment_id=commentthis.data("id");
var aria_label=commentthis.attr("aria-label");
var comment_parent=jQuery("#li-comment-"+comment_id);
jQuery("#respond-all,.comment #respond").hide(10);
if(comment_parent.find(" > .comment-respond").length==0){
comment_parent.find(" > .comment-body").after('<div id="respond" class="comment-respond wpqa_hide">\
<h3 class="section-title">'+aria_label+'\
<div class="wpqa-cancel-link cancel-comment-reply">\
<a rel="nofollow" id="cancel-comment-reply-link" href="#respond">'+wpqa_single.cancel_reply+'</a>\
</div>\
</h3>\
<form action="'+wpqa_single.comment_action+'" method="post" id="commentform" class="post-section comment-form answers-form">\
<p class="comment-login">\
'+wpqa_single.logged_as+'\
<a class="comment-login-login" href="'+wpqa_single.profile_url+'"><i class="icon-user"></i>'+wpqa_single.display_name+'</a>\
<a class="comment-login-logout" href="'+wpqa_single.logout_url+'" title="'+wpqa_single.logout_title+'"><i class="icon-logout"></i>'+wpqa_single.logout+'</a>\
</p>\
<div class="wpqa_error"></div>\
<div class="form-input form-textarea form-comment-normal">\
<textarea id="comment" name="comment" rows="5" class="form-control" aria-required="true" placeholder="'+wpqa_single.reply+'"></textarea>\
<i class="icon-pencil"></i>\
</div>\
<div class="clearfix"></div>\
<p class="form-submit">\
<input name="submit" type="submit" id="submit" class="button-default button-hide-click btn btn__primary" value="'+wpqa_single.submit+'">\
<span class="clearfix"></span>\
<span class="load_span"><span class="loader_2"></span></span>\
<input type="hidden" name="comment_post_ID" value="'+post_id+'" id="comment_post_ID">\
<input type="hidden" name="comment_parent" id="comment_parent" value="'+comment_id+'">\
</p>\
</form>\
</div>');
}
comment_parent.find(" > .comment-respond").show();
jQuery("html,body").animate({scrollTop: jQuery("#li-comment-"+comment_id+" > .comment-respond").offset().top-35},"slow");
}
setTimeout(function (){
jQuery(window).trigger('sticky_recalc');
},1000);
return false;
});
jQuery(document).on("click",".wpqa-cancel-link a",function (){
jQuery(".wpqa-cancel-link,.comment #respond").remove();
jQuery(".respond-edit-delete").hide();
jQuery("#respond-all").show();
setTimeout(function (){
jQuery(window).trigger('sticky_recalc');
},1000);
return false;
});
var check_email=/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
jQuery("#respond").on("click","#submit",function (){
var submint_button=jQuery(this);
var respond=submint_button.closest("#respond");
if(respond.closest("#respond-all").length&&wpqa_single.comment_editor=="on"){
if(respond.find(".tmce-active").length){
var comment_text=respond.find(".form-comment-editor iframe").contents().find("body").html();
}else{
var comment_text=respond.find(".wp-editor-area").val();
}}else{
var comment_text=respond.find("#comment").val();
}
var comment_name=(respond.find("#comment_name").length?respond.find("#comment_name").val():"not_empty");
var comment_email=(respond.find("#comment_email").length?respond.find("#comment_email").val():"not_empty");
if(wpqa_single.terms_active_comment=="on"){
var agree_terms=respond.find("#agree_terms_comment").is(":checked");
if(agree_terms!=1){
respond.find(".wpqa_error").animate({opacity: 'hide' , height: 'hide'}, 400).remove();
respond.find(".comment-form").prepend('<div class="wpqa_error">'+wpqa_single.wpqa_error_terms+'</div>');
respond.find(".wpqa_error").animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
jQuery("html,body").animate({scrollTop: respond.find(".wpqa_error").offset().top-35},"slow");
jQuery("#commentform .load_span").hide();
jQuery("#commentform .button-hide-click").show();
return false;
}}
if((wpqa_single.require_name_email=='require_name_email'&&comment_email!='not_empty'&&!check_email.test(comment_email))||(wpqa_single.require_name_email=='require_name_email'&&(comment_name==''||comment_email==''))||comment_text==''||comment_text=='<p><br data-mce-bogus="1"></p>'||comment_text=='<p><br></p>'||comment_text=='<p></p>'){
if((wpqa_single.require_name_email=='require_name_email'&&comment_email!='not_empty'&&!check_email.test(comment_email))||(wpqa_single.require_name_email=='require_name_email'&&(comment_name==''||comment_email==''))){
if(comment_name==''){
var wpqa_text_error=wpqa_single.wpqa_error_name;
}else if(comment_email==''){
var wpqa_text_error=wpqa_single.wpqa_error_email;
}else if(comment_email!='not_empty'&&!check_email.test(comment_email)){
var wpqa_text_error=wpqa_single.wpqa_valid_email;
}}else{
var wpqa_text_error=wpqa_single.wpqa_error_comment;
}
respond.find(".wpqa_error").animate({opacity: 'hide' , height: 'hide'}, 400).remove();
if(wpqa_text_error!==undefined&&wpqa_text_error!==false){
respond.find(".comment-form").prepend('<div class="wpqa_error">'+wpqa_text_error+'</div>');
}
respond.find(".wpqa_error").animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
jQuery("html,body").animate({scrollTop: respond.find(".wpqa_error").offset().top-35},"slow");
jQuery("#commentform .load_span").hide();
jQuery("#commentform .button-hide-click").show();
return false;
}
var comment_limit_var=wpqa_single.comment_limit;
var comment_min_limit_var=wpqa_single.comment_min_limit;
if(respond.find(".button-default-question")){
comment_limit_var=wpqa_single.answer_limit;
comment_min_limit_var=wpqa_single.answer_min_limit;
}
if(comment_limit_var > 0||comment_min_limit_var > 0){
var message="";
jQuery.ajax({
url: wpqa_single.admin_url,
type: "POST",
data: { action:'wpqa_comment_limit', comment_text:comment_text, comment_limit:comment_limit_var, comment_min_limit:comment_min_limit_var },
async:false,
success: function(data){
message=data;
}});
var wpqa_error_limit=wpqa_single.wpqa_error_limit;
if(message.indexOf('wpqa_error') > -1||message.indexOf('wpqa_min_error') > -1){
respond.find(".wpqa_error").animate({opacity: 'hide' , height: 'hide'}, 400).remove();
respond.find(".comment-form").prepend('<div class="wpqa_error">'+(message.indexOf('wpqa_error') > -1?wpqa_single.wpqa_error_limit+': '+comment_limit_var:wpqa_single.wpqa_error_min_limit+': '+comment_min_limit_var)+'</div>');
respond.find(".wpqa_error").animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
jQuery("html,body").animate({scrollTop: respond.find(".wpqa_error").offset().top-35},"slow");
jQuery("#commentform .load_span").hide();
jQuery("#commentform .button-hide-click").show();
return false;
}}
});
}})(jQuery);
(function($){ "use strict";
wpqa_forms(".login-form","login");
wpqa_forms(".wpqa-lost-password","password");
wpqa_forms(".signup_form","signup");
function wpqa_forms(whatClass,whatAction){
if(jQuery(whatClass).length&&!jQuery(whatClass).hasClass("wpqa-no-ajax")){
jQuery(whatClass).on("submit",function(){
var thisform=jQuery(this);
jQuery('input[type="submit"],button[type="submit"]',thisform).hide();
jQuery('.load_span',thisform).show().css({"display":"block"});
jQuery('.required-item',thisform).each(function (){
var required=jQuery(this);
required.css("border-color","#e1e2e3");
if(required.val()==''&&required.attr("type")!="file"){
required.css("border-color","#F00");
return false;
}});
if(jQuery('.wpqa_captcha',thisform).length){
var wpqa_captcha=jQuery('.wpqa_captcha',thisform);
var url=wpqa_unlogged.wpqa_dir+"captcha/captcha.php";
var postStr=wpqa_captcha.attr("name")+"="+encodeURIComponent(wpqa_captcha.val());
wpqa_captcha.css("border-color","#e1e2e3");
if(wpqa_captcha.val()==""){
jQuery(".wpqa_error",thisform).html('<span class="required-error required-error-c">'+wpqa_unlogged.wpqa_error_text+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
wpqa_captcha.css("border-color","#F00");
jQuery('.load_span',thisform).hide().css({"display":"none"});
jQuery('input[type="submit"],button[type="submit"]',thisform).show();
return false;
}else if(wpqa_captcha.hasClass("captcha_answer")){
if(wpqa_captcha.val()!=wpqa_unlogged.captcha_answer){
jQuery(".wpqa_error",thisform).html('<span class="required-error required-error-c">'+wpqa_unlogged.wpqa_error_captcha+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
wpqa_captcha.css("border-color","#F00");
jQuery('.load_span',thisform).hide().css({"display":"none"});
jQuery('input[type="submit"],button[type="submit"]',thisform).show();
return false;
}}else{
var message="";
jQuery.ajax({
url:   url,
type:  "POST",
data:  postStr,
async: false,
success: function(data){
message=data;
}});
if(message.indexOf('wpqa_captcha_0') > -1){
jQuery(".wpqa_error",thisform).html('<span class="required-error required-error-c">'+wpqa_unlogged.wpqa_error_captcha+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
wpqa_captcha.css("border-color","#F00");
jQuery('.load_span',thisform).hide().css({"display":"none"});
jQuery('input[type="submit"],button[type="submit"]',thisform).show();
return false;
}}
}
var data=thisform.serialize();
jQuery.ajax({
url: wpqa_unlogged.admin_url,
type: "POST",
dataType: "json",
data: data,
success:function(result){
if(result.success==1){
if(whatAction=="password"){
jQuery('input[type="email"]',thisform).val("");
jQuery('.wpqa_captcha',thisform).val("");
jQuery(".wpqa_success",thisform).html(result.done).animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
}else{
window.location.href=result.redirect;
}}else if(result.error){
jQuery(".wpqa_error",thisform).html('<span class="required-error">'+result.error+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400);
}else{
return true;
}
jQuery('.load_span',thisform).hide().css({"display":"none"});
jQuery('input[type="submit"],button[type="submit"]',thisform).show();
},
error: function(errorThrown){
}});
return false;
});
}}
un_login_panel("#signup-panel",".signup-panel-un");
un_login_panel("#lost-password",".main_users_only .reset-password,.lost-password-login");
un_login_panel("#lost-password",".lost-passwords","no",".main_users_only");
un_login_panel("#login-panel",".login-panel-un");
function un_login_panel(whatId,whatClass,whatFrom,bodyClass){
if(jQuery(whatId).length&&!jQuery(whatClass).hasClass("wpqa-not-pop")){
jQuery((whatFrom=="no"?(bodyClass!=""?bodyClass+" ":"")+".wpqa_form,":"")+whatClass).on("click",(whatFrom=="no"?whatClass:""),function(){
var data_width=jQuery(whatId).attr("data-width");
jQuery(".panel-un-login").hide(10);
jQuery(whatId).animate({opacity: 'show' , height: 'show'}, 400);
if(jQuery(".activate-pop-register").length){
if(whatClass==".login-panel-un"){
jQuery(".activate-pop-register").removeClass("wpqa_hide");
jQuery("#signup-panel").addClass("wpqa_hide").animate({opacity: 'hide' , height: 'hide'}, 400);
}else if(whatClass==".signup-panel-un"){
jQuery(".activate-pop-register,#login-panel").addClass("wpqa_hide").animate({opacity: 'hide' , height: 'hide'}, 400);
jQuery("#signup-panel").removeClass("wpqa_hide");
}}
return false;
});
}}
})(jQuery);
(()=>{var t={507:(t,e,r)=>{"use strict";r.d(e,{A:()=>A});var n=function(t){return"string"!=typeof t||""===t?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(t)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)};var i=function(t){return"string"!=typeof t||""===t?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(t)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(t)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)};var o=function(t,e){return function(r,o,s,c=10){const l=t[e];if(!i(r))return;if(!n(o))return;if("function"!=typeof s)return void console.error("The hook callback must be a function.");if("number"!=typeof c)return void console.error("If specified, the hook priority must be a number.");const a={callback:s,priority:c,namespace:o};if(l[r]){const t=l[r].handlers;let e;for(e=t.length;e>0&&!(c>=t[e-1].priority);e--);e===t.length?t[e]=a:t.splice(e,0,a),l.__current.forEach((t=>{t.name===r&&t.currentIndex>=e&&t.currentIndex++}))}else l[r]={handlers:[a],runs:0};"hookAdded"!==r&&t.doAction("hookAdded",r,o,s,c)}};var s=function(t,e,r=!1){return function(o,s){const c=t[e];if(!i(o))return;if(!r&&!n(s))return;if(!c[o])return 0;let l=0;if(r)l=c[o].handlers.length,c[o]={runs:c[o].runs,handlers:[]};else{const t=c[o].handlers;for(let e=t.length-1;e>=0;e--)t[e].namespace===s&&(t.splice(e,1),l++,c.__current.forEach((t=>{t.name===o&&t.currentIndex>=e&&t.currentIndex--})))}return"hookRemoved"!==o&&t.doAction("hookRemoved",o,s),l}};var c=function(t,e){return function(r,n){const i=t[e];return void 0!==n?r in i&&i[r].handlers.some((t=>t.namespace===n)):r in i}};var l=function(t,e,r,n){return function(i,...o){const s=t[e];s[i]||(s[i]={handlers:[],runs:0}),s[i].runs++;const c=s[i].handlers;if(!c||!c.length)return r?o[0]:void 0;const l={name:i,currentIndex:0};return(n?async function(){try{s.__current.add(l);let t=r?o[0]:void 0;for(;l.currentIndex<c.length;){const e=c[l.currentIndex];t=await e.callback.apply(null,o),r&&(o[0]=t),l.currentIndex++}return r?t:void 0}finally{s.__current.delete(l)}}:function(){try{s.__current.add(l);let t=r?o[0]:void 0;for(;l.currentIndex<c.length;){t=c[l.currentIndex].callback.apply(null,o),r&&(o[0]=t),l.currentIndex++}return r?t:void 0}finally{s.__current.delete(l)}})()}};var a=function(t,e){return function(){const r=t[e],n=Array.from(r.__current);return n.at(-1)?.name??null}};var d=function(t,e){return function(r){const n=t[e];return void 0===r?n.__current.size>0:Array.from(n.__current).some((t=>t.name===r))}};var u=function(t,e){return function(r){const n=t[e];if(i(r))return n[r]&&n[r].runs?n[r].runs:0}};class h{actions;filters;addAction;addFilter;removeAction;removeFilter;hasAction;hasFilter;removeAllActions;removeAllFilters;doAction;doActionAsync;applyFilters;applyFiltersAsync;currentAction;currentFilter;doingAction;doingFilter;didAction;didFilter;constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=o(this,"actions"),this.addFilter=o(this,"filters"),this.removeAction=s(this,"actions"),this.removeFilter=s(this,"filters"),this.hasAction=c(this,"actions"),this.hasFilter=c(this,"filters"),this.removeAllActions=s(this,"actions",!0),this.removeAllFilters=s(this,"filters",!0),this.doAction=l(this,"actions",!1,!1),this.doActionAsync=l(this,"actions",!1,!0),this.applyFilters=l(this,"filters",!0,!1),this.applyFiltersAsync=l(this,"filters",!0,!0),this.currentAction=a(this,"actions"),this.currentFilter=a(this,"filters"),this.doingAction=d(this,"actions"),this.doingFilter=d(this,"filters"),this.didAction=u(this,"actions"),this.didFilter=u(this,"filters")}}var A=function(){return new h}},8770:()=>{}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{actions:()=>x,addAction:()=>s,addFilter:()=>c,applyFilters:()=>m,applyFiltersAsync:()=>v,createHooks:()=>t.A,currentAction:()=>y,currentFilter:()=>F,defaultHooks:()=>o,didAction:()=>b,didFilter:()=>k,doAction:()=>f,doActionAsync:()=>p,doingAction:()=>_,doingFilter:()=>g,filters:()=>w,hasAction:()=>d,hasFilter:()=>u,removeAction:()=>l,removeAllActions:()=>h,removeAllFilters:()=>A,removeFilter:()=>a});var t=r(507),e=r(8770),i={};for(const t in e)["default","actions","addAction","addFilter","applyFilters","applyFiltersAsync","createHooks","currentAction","currentFilter","defaultHooks","didAction","didFilter","doAction","doActionAsync","doingAction","doingFilter","filters","hasAction","hasFilter","removeAction","removeAllActions","removeAllFilters","removeFilter"].indexOf(t)<0&&(i[t]=()=>e[t]);r.d(n,i);const o=(0,t.A)(),{addAction:s,addFilter:c,removeAction:l,removeFilter:a,hasAction:d,hasFilter:u,removeAllActions:h,removeAllFilters:A,doAction:f,doActionAsync:p,applyFilters:m,applyFiltersAsync:v,currentAction:y,currentFilter:F,doingAction:_,doingFilter:g,didAction:b,didFilter:k,actions:x,filters:w}=o})(),(window.wp=window.wp||{}).hooks=n})();
(()=>{"use strict";var t={d:(n,e)=>{for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{__:()=>F,_n:()=>L,_nx:()=>D,_x:()=>w,createI18n:()=>h,defaultI18n:()=>b,getLocaleData:()=>g,hasTranslation:()=>O,isRTL:()=>P,resetLocaleData:()=>x,setLocaleData:()=>v,sprintf:()=>l,subscribe:()=>m});var e,r,a,i,o=/%(((\d+)\$)|(\(([$_a-zA-Z][$_a-zA-Z0-9]*)\)))?[ +0#-]*\d*(\.(\d+|\*))?(ll|[lhqL])?([cduxXefgsp%])/g;function l(t,...n){return function(t,...n){var e=0;return Array.isArray(n[0])&&(n=n[0]),t.replace(o,(function(){var t,r,a,i,o;return t=arguments[3],r=arguments[5],"%"===(i=arguments[9])?"%":("*"===(a=arguments[7])&&(a=n[e],e++),void 0===r?(void 0===t&&(t=e+1),e++,o=n[t-1]):n[0]&&"object"==typeof n[0]&&n[0].hasOwnProperty(r)&&(o=n[0][r]),"f"===i?o=parseFloat(o)||0:"d"===i&&(o=parseInt(o)||0),void 0!==a&&("f"===i?o=o.toFixed(a):"s"===i&&(o=o.substr(0,a))),null!=o?o:"")}))}(t,...n)}e={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},r=["(","?"],a={")":["("],":":["?","?:"]},i=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var s={"!":function(t){return!t},"*":function(t,n){return t*n},"/":function(t,n){return t/n},"%":function(t,n){return t%n},"+":function(t,n){return t+n},"-":function(t,n){return t-n},"<":function(t,n){return t<n},"<=":function(t,n){return t<=n},">":function(t,n){return t>n},">=":function(t,n){return t>=n},"==":function(t,n){return t===n},"!=":function(t,n){return t!==n},"&&":function(t,n){return t&&n},"||":function(t,n){return t||n},"?:":function(t,n,e){if(t)throw n;return e}};function u(t){var n=function(t){for(var n,o,l,s,u=[],d=[];n=t.match(i);){for(o=n[0],(l=t.substr(0,n.index).trim())&&u.push(l);s=d.pop();){if(a[o]){if(a[o][0]===s){o=a[o][1]||o;break}}else if(r.indexOf(s)>=0||e[s]<e[o]){d.push(s);break}u.push(s)}a[o]||d.push(o),t=t.substr(n.index+o.length)}return(t=t.trim())&&u.push(t),u.concat(d.reverse())}(t);return function(t){return function(t,n){var e,r,a,i,o,l,u=[];for(e=0;e<t.length;e++){if(o=t[e],i=s[o]){for(r=i.length,a=Array(r);r--;)a[r]=u.pop();try{l=i.apply(null,a)}catch(t){return t}}else l=n.hasOwnProperty(o)?n[o]:+o;u.push(l)}return u[0]}(n,t)}}var d={contextDelimiter:"",onMissingKey:null};function c(t,n){var e;for(e in this.data=t,this.pluralForms={},this.options={},d)this.options[e]=void 0!==n&&e in n?n[e]:d[e]}c.prototype.getPluralForm=function(t,n){var e,r,a,i=this.pluralForms[t];return i||("function"!=typeof(a=(e=this.data[t][""])["Plural-Forms"]||e["plural-forms"]||e.plural_forms)&&(r=function(t){var n,e,r;for(n=t.split(";"),e=0;e<n.length;e++)if(0===(r=n[e].trim()).indexOf("plural="))return r.substr(7)}(e["Plural-Forms"]||e["plural-forms"]||e.plural_forms),a=function(t){var n=u(t);return function(t){return+n({n:t})}}(r)),i=this.pluralForms[t]=a),i(n)},c.prototype.dcnpgettext=function(t,n,e,r,a){var i,o,l;return i=void 0===a?0:this.getPluralForm(t,a),o=e,n&&(o=n+this.options.contextDelimiter+e),(l=this.data[t][o])&&l[i]?l[i]:(this.options.onMissingKey&&this.options.onMissingKey(e,t),0===i?e:r)};const p={plural_forms:t=>1===t?0:1},f=/^i18n\.(n?gettext|has_translation)(_|$)/,h=(t,n,e)=>{const r=new c({}),a=new Set,i=()=>{a.forEach((t=>t()))},o=(t,n="default")=>{r.data[n]={...r.data[n],...t},r.data[n][""]={...p,...r.data[n]?.[""]},delete r.pluralForms[n]},l=(t,n)=>{o(t,n),i()},s=(t="default",n,e,a,i)=>(r.data[t]||o(void 0,t),r.dcnpgettext(t,n,e,a,i)),u=t=>t||"default",d=(t,n,r)=>{let a=s(r,n,t);return e?(a=e.applyFilters("i18n.gettext_with_context",a,t,n,r),e.applyFilters("i18n.gettext_with_context_"+u(r),a,t,n,r)):a};if(t&&l(t,n),e){const t=t=>{f.test(t)&&i()};e.addAction("hookAdded","core/i18n",t),e.addAction("hookRemoved","core/i18n",t)}return{getLocaleData:(t="default")=>r.data[t],setLocaleData:l,addLocaleData:(t,n="default")=>{r.data[n]={...r.data[n],...t,"":{...p,...r.data[n]?.[""],...t?.[""]}},delete r.pluralForms[n],i()},resetLocaleData:(t,n)=>{r.data={},r.pluralForms={},l(t,n)},subscribe:t=>(a.add(t),()=>a.delete(t)),__:(t,n)=>{let r=s(n,void 0,t);return e?(r=e.applyFilters("i18n.gettext",r,t,n),e.applyFilters("i18n.gettext_"+u(n),r,t,n)):r},_x:d,_n:(t,n,r,a)=>{let i=s(a,void 0,t,n,r);return e?(i=e.applyFilters("i18n.ngettext",i,t,n,r,a),e.applyFilters("i18n.ngettext_"+u(a),i,t,n,r,a)):i},_nx:(t,n,r,a,i)=>{let o=s(i,a,t,n,r);return e?(o=e.applyFilters("i18n.ngettext_with_context",o,t,n,r,a,i),e.applyFilters("i18n.ngettext_with_context_"+u(i),o,t,n,r,a,i)):o},isRTL:()=>"rtl"===d("ltr","text direction"),hasTranslation:(t,n,a)=>{const i=n?n+""+t:t;let o=!!r.data?.[a??"default"]?.[i];return e&&(o=e.applyFilters("i18n.has_translation",o,t,n,a),o=e.applyFilters("i18n.has_translation_"+u(a),o,t,n,a)),o}}},_=window.wp.hooks,y=h(void 0,void 0,_.defaultHooks);var b=y;const g=y.getLocaleData.bind(y),v=y.setLocaleData.bind(y),x=y.resetLocaleData.bind(y),m=y.subscribe.bind(y),F=y.__.bind(y),w=y._x.bind(y),L=y._n.bind(y),D=y._nx.bind(y),P=y.isRTL.bind(y),O=y.hasTranslation.bind(y);(window.wp=window.wp||{}).i18n=n})();