/** * Copyright: Codetipi * Plugin: Lets Review * Version: 3.4.1 */ !function(k){"use strict";var S={initMethods:function(){this.cacheDom(),this.cacheData(),1===parseInt(lrJS.letsReviewUReviews)&&this.sliderLoaders(),this.bindEvents(),this.lightboxInit(),this.tempAni()},init:function(){"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype?this.initMethods():this.loadScript(lrJS.intersectionObserver)},cacheDom:function(){this.$doc=k(document),this.$win=k(window),this.$body=k("body"),this.$lrCheck=k("#lr-check"),this.rtl=!!this.$body.hasClass("rtl"),this.$formLabels=k(".lets-review-ur-onoff-label"),this.$lrForm=k(".lets-review-form"),this.$toolTipOutput="",this.$toolTipCurrent="",this.cookies=Cookies.get("lets_review_user_rating"),1===parseInt(lrJS.letsReviewUReviews)&&(this.dataGather=k(".lets-review-form-crits:first").data(),this.$cSliders=k(".lets-review-c-slider"))},cacheData:function(){this.$winWidth=this.$win.width()},bindEvents:function(){this.$lrCheck.hasClass("lr-binded")||(this.$lrCheck.addClass("lr-binded"),this.$win.on("resize",this.resize.bind(this)),this.$body.on("click",this.$formLabels,this.formLabels),this.$body.on("click",".lets-review__up-down",this.upDown),this.$body.on("mouseenter",".lr-tip",this.toolTipInit),this.$body.on("mousemove mouseleave click",".lr-user__rating",this.userRatingBlock),this.$body.on("click touchend","#swipebox-slider .current img",function(){return!1}).on("click touchend","#swipebox-slider .current",function(){k("#swipebox-close").trigger("click")}),this.$doc.on("slide",".lets-review-c-slider",this.slideIt),this.$doc.on("input",".lr-input-score",this.visitorInput))},formLabels:function(){0!==S.$formLabels.length&&("on"===k(this).find("input[name=lets_review_ur_onoff]:checked").val()?S.$lrForm.slideDown(200):S.$lrForm.slideUp(200))},lightboxInit:function(){S.$body.on("click",".lets-review-lightbox",S.openPhotoswipe)},openPhotoswipe:function(e){e.preventDefault();var t=[],i=k(e.currentTarget),r=i.data("gallery-uid"),s={bgOpacity:.9,showHideOpacity:!0,shareButtons:!1};void 0!==r?(s.index=i.data("index"),k("#lr-gallery-uid-"+r).find(".lets-review-lightbox").each(function(){t.push(S.itemPusher(k(this)))})):t.push(S.itemPusher(i)),new PhotoSwipe(k("#pswp")[0],PhotoSwipeUI_Default,t,s).init()},itemPusher:function(e){var t,i=e.find("img"),r=i.attr("data-caption")?i.attr("data-caption"):i.attr("title");return void 0===r&&(t=e.next()).is("figcaption")&&(r=t.text()),{alt:i.attr("alt"),src:e.attr("href"),title:r}},loadScript:function(e){var t=document.createElement("script");t.src=e,t.onload=function(){S.initMethods()},t.onerror=function(){console.log("ERROR: JS")},document.head.appendChild(t)},toolTipInit:function(e){if(!(S.$winWidth<1200)){S.$toolTipCurrent=k(this),S.$toolTipCurrent.addClass("lr-tipped");var t="lr-tip-wrap-b";S.$toolTipCurrent.hasClass("lr-tip-r")&&(t="lr-tip-wrap-r"),S.$toolTipCurrent.hasClass("lr-tip-l")&&(t="lr-tip-wrap-l");var i='