(function($, wpreview, Cookies){
"use strict";
wpreview.initNotificationBar=function(){
if($('#hello-bar').length){
$('body').addClass('has-hello-bar');
}
$('#hello-bar.hello-bar--top:not(.hello-bar--floating)').prependTo('body');
if($('#hello-bar.hello-bar--top.hello-bar--floating').length){
$('body').css({ paddingTop: $('#hello-bar').height() + 10 });
}};
wpreview.getAnimateDuration=function(animation){
if(! animation){
return 0;
}
switch(animation){
case 'flipOutX':
case 'flipOutY':
case 'bounceIn':
case 'bounceOut':
return 750;
case 'hinge':
return 2000;
}
return 1000;
};
wpreview.openPopup=function(popup){
if(! popup){
popup='#wp-review-popup';
}
$.magnificPopup.open({
items: {
src: popup,
type: 'inline'
},
removalDelay: wpreview.getAnimateDuration(wpreview.popup.animation_out),
callbacks: {
beforeOpen: function(){
this.st.mainClass='animated ' + wpreview.popup.animation_in;
},
beforeClose: function(){
var $wrap=this.wrap,
$bg=$wrap.prev(),
$mfp=$wrap.add($bg);
$mfp.removeClass(wpreview.popup.animation_in).addClass(wpreview.popup.animation_out);
}}
});
};
wpreview.initPopup=function(){
if(! $('#wp-review-popup').length){
return;
}
var popupShown=false,
expiration=parseInt(wpreview.popup.expiration),
cookieName=wpreview.popup.cookie_name||'wpr-popup';
function canShowPopup(){
if(popupShown){
return false;
}
if(expiration&&Cookies.get(cookieName)){
return false;
}
if(wpreview.popup.screen_size_check&&$(window).width() <=parseInt(wpreview.popup.screen_width)){
return false;
}
return true;
}
function showPopup(){
wpreview.openPopup('#wp-review-popup');
popupShown=true;
if(expiration){
Cookies.set(cookieName, 1, {
expires: expiration
});
}}
if(wpreview.popup.show_on_load){
var delay=parseInt(wpreview.popup.delay) * 1000;
setTimeout(function(){
if(! canShowPopup()){
return;
}
showPopup();
}, delay);
}
if(wpreview.popup.show_on_reach_bottom&&$('#wp-review-content-bottom').length){
var offsetTop=$('#wp-review-content-bottom').offset().top;
$(window).on('scroll', function(){
if(! canShowPopup()){
return;
}
var scrollTop=$(window).scrollTop();
if(scrollTop >=offsetTop){
showPopup();
}});
}
if(wpreview.popup.exit_intent){
$(document).exitIntent(function(){
if(! canShowPopup()){
return;
}
showPopup();
});
}};
wpreview.loadReviews=function($el, options){
$el.html('<div class="loading"></div>');
function onSuccess(response){
$el.removeClass('js-reviews-placeholder loading').html(response);
};
function onError(response){
console.log(response);
};
wp.ajax.send('wp-review-load-reviews', {
success: onSuccess,
error: onError,
data: options
});
};
wpreview.ajaxReviewsLoading=function(){
$('.js-reviews-placeholder').each(function(){
var options=$(this).attr('data-options') ? JSON.parse($(this).attr('data-options')):{};
wpreview.loadReviews($(this), options);
});
$(document).on('click', '.reviews-pagination a', function(ev){
ev.preventDefault();
var $pagination, $reviews, options, page;
$pagination=$(this).closest('.reviews-pagination');
$reviews=$pagination.closest('.wp-reviews-list');
options=$reviews.attr('data-options') ? JSON.parse($reviews.attr('data-options')):{};
page=$pagination.attr('data-page') ? parseInt($pagination.attr('data-page')):1;
options.page=$(this).hasClass('previous') ?(page - 1):(page + 1);
options.no_cache=true;
wpreview.loadReviews($reviews, options);
});
};
wpreview.featuresRating=function($wrapper){
var data=$wrapper.data();
if(! data.rating){
return;
}
data.action='wpr-visitor-features-rating';
$.ajax ({
beforeSend: function(){
$wrapper.addClass('wp-review-loading');
},
data: data,
type: 'post',
url: wpreview.ajaxurl,
success: function(response){
$wrapper.removeClass('wp-review-loading');
if(typeof response!='object'){
response=JSON.parse(response);
}
if('ok'!=response.status){
console.error(response);
return;
}
response.html=response.html.replace('delay-animation', '');
$wrapper.closest('#review').replaceWith(response.html);
Cookies.set('wpr_visitor_has_reviewed_post_' + data.post_id, 1, {
expires: 315360000000 
});
},
error: function(response){
$wrapper.removeClass('wp-review-loading');
console.log(response);
}});
};
wpreview.initResponsiveTable=function(){
if('function'!==typeof $.fn.stacktable){
return;
}
$('.comparison-table').stacktable();
};
wpreview.addVerifiedPurchase=function(){
$('.wp_review_comment.verified cite, .wp_review_comment.verified .fn').after('<em> ' + wpreview.verifiedPurchase + '</em>');
};
$(document).ready(function(){
wpreview.initNotificationBar();
wpreview.initPopup();
wpreview.ajaxReviewsLoading();
wpreview.initResponsiveTable();
wpreview.addVerifiedPurchase();
$('[data-wp-review-tabs] .tab-title:first-child').addClass('active');
$('[data-wp-review-tabs] .tab-content:first-of-type').fadeIn();
$('[data-wp-review-tabs] .tab-title button').on('click', function(ev){
ev.preventDefault();
var $btn, $tabs, href;
$btn=$(this);
$tabs=$btn.closest('[data-wp-review-tabs]');
href=$btn.attr('data-href');
$tabs.find('.tab-title').removeClass('active');
$btn.closest('.tab-title').addClass('active');
$tabs.find('.tab-content').hide();
$tabs.find(href).fadeIn();
});
$('#commentform').on('submit', function(ev){
$(this).find('.wpr-error').remove();
if($(this).hasClass('wpr-uncompleted-rating')){
$(this).append('<div class="wpr-error">' + wpreview.rateAllFeatures + '</div>');
ev.preventDefault();
}});
});
})(jQuery, window.wpreview||{}, Cookies);
jQuery(document).ready(function($){
$('.wp-review-comment-field.allowed-to-rate a').on('click', function(){
var $this=$(this),
$elem=$this.closest('.wp-review-comment-field');
if($elem.hasClass('allowed-to-rate')){
$elem.removeClass('has-not-rated-yet');
$elem.find('.review-result').css('width', parseInt($this.data('input-value'))*20+'%');
$elem.find('.wp_review_comment_rating').val($this.data('input-value'));
}});
if($('.review-wrapper').length){
$('.review-wrapper').wpr_appear().on('wpr_appear', function(event){
var $this=$(this);
if($this.hasClass('delay-animation')){
$this.removeClass('delay-animation');
if($this.find('.wp-review-circle-rating').length){
$this.find('.wp-review-circle-rating').each(function(index, el){
if($(el).closest('.wp-review-user-rating').length)
return true;
var initial_value=$(el).data('initial_value');
$({value: 0}).animate({value: initial_value}, {
duration: 2000,
easing:'swing',
step: function(){
$(el).val(Math.floor(this.value)).trigger('change');
},
complete: function(){
$(el).val(initial_value).trigger('change');
}});
});
}}
}).on('wpr_disappear', function(event){
var $this=$(this);
});
$(window).load(function(){
$.wpr_force_appear();
});
}
var $commentFeedback=$('.wp-review-feedback');
$commentFeedback.on('click', 'a', function(e){
var $this=$(this);
e.preventDefault();
if($this.hasClass('voted')||$this.siblings().hasClass('voted')||$commentFeedback.hasClass('processing')) return;
$.ajax({
type: 'POST',
url: wpreview.ajaxurl,
beforeSend: function(){
$commentFeedback.addClass('processing');
},
data: { action: 'mts_review_feedback', isHelpful: $this.data('value'), commentId: $this.data('comment-id') },
success: function(data){
$this.closest('.wp-review-feedback').find('a').removeClass('voted');
$this.addClass('voted').find('.feedback-count').text('('+data+')');
},
error: function(jqXHR){
alert(jqXHR.responseText);
},
complete: function(){
$commentFeedback.removeClass('processing');
}});
});
if($('#wp-review-comment-title-field').length){
$('#wp-review-comment-title-field').closest('form').addClass('wp-review-comment-form');
}
$(document).on('click', '.wp-review-comment-img-field a', function(e){
e.preventDefault();
$(this).parents('.wp-review-comment-form-photo').find('.hide').removeClass('hide');
$(this).parent().addClass('hide').find('input').val('');
return false;
});
$(document).on('change', '.wp-review-comment-attachment-source .input-file', function(e){
e.preventDefault();
var $this=$(this);
if($this.parents('.wp-review-comment-form-photo').find('#comment_image_spinner').length!=0){
return;
}
$this.parents('form').find('input[type="submit"]').attr('disabled', 'disabled');
$('<i id="comment_image_spinner" class="fa fa-spinner fa-spin"></i>').insertAfter($this.parent('p'));
var $fd=new FormData(),
files=$(this)[0].files[0];
$fd.append("files[]", files);
$fd.append('action', 'wpr-upload-comment-image');
$fd.append('_ajax_nonce', wpreview.commentImageUploadNonce);
$.ajax({
type: 'POST',
url: wpreview.ajaxurl,
processData: false,
contentType: false,
data: $fd,
success: function (response){
if(response){
$this.next('input').val(response);
}else{
alert('Something went wrong. Please upload different image.');
}
$this.parents('form').find('input[type="submit"]').removeAttr('disabled');
$this.parents('.wp-review-comment-form-photo').find('#comment_image_spinner').remove();
},
error: function(){
alert('Something went wrong. Please upload different image.');
$this.parents('form').find('input[type="submit"]').removeAttr('disabled');
$this.parents('.wp-review-comment-form-photo').find('#comment_image_spinner').remove();
}});
return false;
});
});
function wp_review_rate($elem){
var is_comment_rating=($elem.is('.wp-review-comment-rating-star')||!!$elem.closest('.wp-review-comment-rating-star').length);
if(is_comment_rating){
return '';
}
var rating=$elem.find('.wp-review-user-rating-val').val();
var postId=$elem.find('.wp-review-user-rating-postid').val();
var token=$elem.find('.wp-review-user-rating-nonce').val();
var $target=$elem;
if(! $target.is('.wp-review-user-rating'))
$target=$elem.closest('.wp-review-user-rating');
if(rating==0){
return '';
}
jQuery.ajax ({
beforeSend: function(){
$target.addClass('wp-review-loading');
},
data: { action: 'wp_review_rate', post_id: postId, nonce: token, review: rating },
type: 'post',
dataType: 'json',
url: wpreview.ajaxurl,
success: function(response){
$target.removeClass('wp-review-loading');
if(typeof response.html!=='undefined'&&response.html!=''){
$target.empty().append(response.html).addClass('has-rated').removeClass('wp-review-user-rating');
}
if(typeof response.rating_total!=='undefined'&&response.rating_total!=''){
$target.parent().find('.wp-review-user-rating-total').text(response.rating_total);
}
if(typeof response.rating_count!=='undefined'&&response.rating_count!=''){
$target.parent().find('.wp-review-user-rating-counter').text(response.rating_count);
}
if(response.awaiting_moderation!=undefined){
$target.parent().find('.user-total-wrapper .awaiting-response-wrapper').text(response.awaiting_moderation);
}
Cookies.set('wpr_visitor_has_reviewed_post_' + postId, 1, {
expires: 315360000000 
});
}});
};
(function (factory){
if(typeof exports==='object'){
module.exports=factory(require('jquery'));
}else if(typeof define==='function'&&define.amd){
define(['jquery'], factory);
}else{
factory(jQuery);
}}(function ($){
"use strict";
var k={},
max=Math.max,
min=Math.min;
k.c={};
k.c.d=$(document);
k.c.t=function (e){
return e.originalEvent.touches.length - 1;
};
k.o=function (){
var s=this;
this.o=null;
this.$=null;
this.i=null;
this.g=null;
this.v=null;
this.cv=null;
this.x=0;
this.y=0;
this.w=0;
this.h=0;
this.$c=null;
this.c=null;
this.t=0;
this.isInit=false;
this.fgColor=null;
this.pColor=null;
this.dH=null;
this.cH=null;
this.eH=null;
this.rH=null;
this.scale=1;
this.relative=false;
this.relativeWidth=false;
this.relativeHeight=false;
this.$div=null;
this.run=function (){
var cf=function (e, conf){
var k;
for (k in conf){
s.o[k]=conf[k];
}
s._carve().init();
s._configure()
._draw();
};
if(this.$.data('kontroled')) return;
this.$.data('kontroled', true);
this.extend();
this.o=$.extend({
min: this.$.data('min')!==undefined ? this.$.data('min'):0,
max: this.$.data('max')!==undefined ? this.$.data('max'):100,
stopper: true,
readOnly: this.$.data('readonly')||(this.$.attr('readonly')==='readonly'),
cursor: this.$.data('cursor')===true&&30
|| this.$.data('cursor')||0,
thickness: this.$.data('thickness')
&& Math.max(Math.min(this.$.data('thickness'), 1), 0.01)
|| 0.35,
lineCap: this.$.data('linecap')||'butt',
width: this.$.data('width')||200,
height: this.$.data('height')||200,
displayInput: this.$.data('displayinput')==null||this.$.data('displayinput'),
displayPrevious: this.$.data('displayprevious'),
fgColor: this.$.data('fgcolor')||'#87CEEB',
inputColor: this.$.data('inputcolor'),
font: this.$.data('font')||'Arial',
fontWeight: this.$.data('font-weight')||'bold',
inline: false,
step: this.$.data('step')||1,
rotation: this.$.data('rotation'),
draw: null,
change: null,
cancel: null,
release: null,
format: function(v){
return v;
},
parse: function (v){
return parseFloat(v);
}}, this.o
);
this.o.flip=this.o.rotation==='anticlockwise'||this.o.rotation==='acw';
if(!this.o.inputColor){
this.o.inputColor=this.o.fgColor;
}
if(this.$.is('fieldset')){
this.v={};
this.i=this.$.find('input');
this.i.each(function(k){
var $this=$(this);
s.i[k]=$this;
s.v[k]=s.o.parse($this.val());
$this.bind('change blur',
function (){
var val={};
val[k]=$this.val();
s.val(s._validate(val));
}
);
});
this.$.find('legend').remove();
}else{
this.i=this.$;
this.v=this.o.parse(this.$.val());
this.v===''&&(this.v=this.o.min);
this.$.bind('change blur',
function (){
s.val(s._validate(s.o.parse(s.$.val())));
}
);
}
!this.o.displayInput&&this.$.hide();
this.$c=$(document.createElement('canvas')).attr({
width: this.o.width,
height: this.o.height
});
this.$div=$('<div style="'
+ (this.o.inline ? 'display:inline;':'')
+ 'width:' + this.o.width + 'px;height:' + this.o.height + 'px;'
+ '"></div>');
this.$.wrap(this.$div).before(this.$c);
this.$div=this.$.parent();
if(typeof G_vmlCanvasManager!=='undefined'){
G_vmlCanvasManager.initElement(this.$c[0]);
}
this.c=this.$c[0].getContext ? this.$c[0].getContext('2d'):null;
if(!this.c){
throw {
name:        "CanvasNotSupportedException",
message:     "Canvas not supported. Please use excanvas on IE8.0.",
toString:    function(){return this.name + ": " + this.message}}
}
this.scale=(window.devicePixelRatio||1) / (
this.c.webkitBackingStorePixelRatio ||
this.c.mozBackingStorePixelRatio ||
this.c.msBackingStorePixelRatio ||
this.c.oBackingStorePixelRatio ||
this.c.backingStorePixelRatio||1
);
this.relativeWidth=this.o.width % 1!==0
&& this.o.width.indexOf('%');
this.relativeHeight=this.o.height % 1!==0
&& this.o.height.indexOf('%');
this.relative=this.relativeWidth||this.relativeHeight;
this._carve();
if(this.v instanceof Object){
this.cv={};
this.copy(this.v, this.cv);
}else{
this.cv=this.v;
}
this.$
.bind("configure", cf)
.parent()
.bind("configure", cf);
this._listen()
._configure()
._xy()
.init();
this.isInit=true;
this.$.val(this.o.format(this.v));
this._draw();
return this;
};
this._carve=function(){
if(this.relative){
var w=this.relativeWidth ?
this.$div.parent().width() *
parseInt(this.o.width) / 100
: this.$div.parent().width(),
h=this.relativeHeight ?
this.$div.parent().height() *
parseInt(this.o.height) / 100
: this.$div.parent().height();
this.w=this.h=Math.min(w, h);
}else{
this.w=this.o.width;
this.h=this.o.height;
}
this.$div.css({
'width': this.w + 'px',
'height': this.h + 'px'
});
this.$c.attr({
width: this.w,
height: this.h
});
if(this.scale!==1){
this.$c[0].width=this.$c[0].width * this.scale;
this.$c[0].height=this.$c[0].height * this.scale;
this.$c.width(this.w);
this.$c.height(this.h);
}
return this;
};
this._draw=function (){
var d=true;
s.g=s.c;
s.clear();
s.dH&&(d=s.dH());
d!==false&&s.draw();
};
this._touch=function (e){
var touchMove=function (e){
var v=s.xy2val(
e.originalEvent.touches[s.t].pageX,
e.originalEvent.touches[s.t].pageY
);
if(v==s.cv) return;
if(s.cH&&s.cH(v)===false) return;
s.change(s._validate(v));
s._draw();
};
this.t=k.c.t(e);
touchMove(e);
k.c.d
.bind("touchmove.k", touchMove)
.bind("touchend.k",
function (){
k.c.d.unbind('touchmove.k touchend.k');
s.val(s.cv);
}
);
return this;
};
this._mouse=function (e){
var mouseMove=function (e){
var v=s.xy2val(e.pageX, e.pageY);
if(v==s.cv) return;
if(s.cH&&(s.cH(v)===false)) return;
s.change(s._validate(v));
s._draw();
};
mouseMove(e);
k.c.d
.bind("mousemove.k", mouseMove)
.bind("keyup.k",
function (e){
if(e.keyCode===27){
k.c.d.unbind("mouseup.k mousemove.k keyup.k");
if(s.eH&&s.eH()===false)
return;
s.cancel();
}}
)
.bind("mouseup.k",
function (e){
k.c.d.unbind('mousemove.k mouseup.k keyup.k');
s.val(s.cv);
}
);
return this;
};
this._xy=function (){
var o=this.$c.offset();
this.x=o.left;
this.y=o.top;
return this;
};
this._listen=function (){
if(!this.o.readOnly){
this.$c
.bind("mousedown",
function (e){
e.preventDefault();
s._xy()._mouse(e);
}
)
.bind("touchstart",
function (e){
e.preventDefault();
s._xy()._touch(e);
}
);
this.listen();
}else{
this.$.attr('readonly', 'readonly');
}
if(this.relative){
$(window).resize(function(){
s._carve().init();
s._draw();
});
}
return this;
};
this._configure=function (){
if(this.o.draw) this.dH=this.o.draw;
if(this.o.change) this.cH=this.o.change;
if(this.o.cancel) this.eH=this.o.cancel;
if(this.o.release) this.rH=this.o.release;
if(this.o.displayPrevious){
this.pColor=this.h2rgba(this.o.fgColor, "0.4");
this.fgColor=this.h2rgba(this.o.fgColor, "0.6");
}else{
this.fgColor=this.o.fgColor;
}
return this;
};
this._clear=function (){
this.$c[0].width=this.$c[0].width;
};
this._validate=function (v){
var val=(~~ (((v < 0) ? -0.5:0.5) + (v/this.o.step))) * this.o.step;
return Math.round(val * 100) / 100;
};
this.listen=function (){};
this.extend=function (){};
this.init=function (){};
this.change=function (v){};
this.val=function (v){};
this.xy2val=function (x, y){};
this.draw=function (){};
this.clear=function (){ this._clear(); };
this.h2rgba=function (h, a){
var rgb;
h=h.substring(1,7);
rgb=[
parseInt(h.substring(0,2), 16),
parseInt(h.substring(2,4), 16),
parseInt(h.substring(4,6), 16)
];
return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + a + ")";
};
this.copy=function (f, t){
for (var i in f){
t[i]=f[i];
}};};
k.Dial=function (){
k.o.call(this);
this.startAngle=null;
this.xy=null;
this.radius=null;
this.lineWidth=null;
this.cursorExt=null;
this.w2=null;
this.PI2=2*Math.PI;
this.extend=function (){
this.o=$.extend({
bgColor: this.$.data('bgcolor')||'#e4e4e4',
angleOffset: this.$.data('angleoffset')||0,
angleArc: this.$.data('anglearc')||360,
inline: true
}, this.o);
};
this.val=function (v, triggerRelease){
if(null!=v){
v=this.o.parse(v);
if(triggerRelease!==false
&& v!=this.v
&& this.rH
&& this.rH(v)===false){ return; }
this.cv=this.o.stopper ? max(min(v, this.o.max), this.o.min):v;
this.v=this.cv;
this.$.val(this.o.format(this.v));
this._draw();
}else{
return this.v;
}};
this.xy2val=function (x, y){
var a, ret;
a=Math.atan2(
x - (this.x + this.w2),
- (y - this.y - this.w2)
) - this.angleOffset;
if(this.o.flip){
a=this.angleArc - a - this.PI2;
}
if(this.angleArc!=this.PI2&&(a < 0)&&(a > -0.5)){
a=0;
}else if(a < 0){
a +=this.PI2;
}
ret=(a * (this.o.max - this.o.min) / this.angleArc) + this.o.min;
this.o.stopper&&(ret=max(min(ret, this.o.max), this.o.min));
return ret;
};
this.listen=function (){
var s=this, mwTimerStop,
mwTimerRelease,
mw=function (e){
e.preventDefault();
var ori=e.originalEvent,
deltaX=ori.detail||ori.wheelDeltaX,
deltaY=ori.detail||ori.wheelDeltaY,
v=s._validate(s.o.parse(s.$.val()))
+ (
deltaX > 0||deltaY > 0
? s.o.step
: deltaX < 0||deltaY < 0 ? -s.o.step:0
);
v=max(min(v, s.o.max), s.o.min);
s.val(v, false);
if(s.rH){
clearTimeout(mwTimerStop);
mwTimerStop=setTimeout(function (){
s.rH(v);
mwTimerStop=null;
}, 100);
if(!mwTimerRelease){
mwTimerRelease=setTimeout(function (){
if(mwTimerStop)
s.rH(v);
mwTimerRelease=null;
}, 200);
}}
},
kval,
to,
m=1,
kv={
37: -s.o.step,
38: s.o.step,
39: s.o.step,
40: -s.o.step
};
this.$
.bind("keydown",
function (e){
var kc=e.keyCode;
if(kc >=96&&kc <=105){
kc=e.keyCode=kc - 48;
}
kval=parseInt(String.fromCharCode(kc));
if(isNaN(kval)){
(kc!==13)
&& kc!==8 
&& kc!==9 
&& kc!==189 
&& (kc!==190
|| s.$.val().match(/\./))
&& e.preventDefault();
if($.inArray(kc,[37,38,39,40]) > -1){
e.preventDefault();
var v=s.o.parse(s.$.val()) + kv[kc] * m;
s.o.stopper&&(v=max(min(v, s.o.max), s.o.min));
s.change(s._validate(v));
s._draw();
to=window.setTimeout(function (){
m *=2;
}, 30);
}}
}
)
.bind("keyup",
function (e){
if(isNaN(kval)){
if(to){
window.clearTimeout(to);
to=null;
m=1;
s.val(s.$.val());
}}else{
(s.$.val() > s.o.max&&s.$.val(s.o.max))
|| (s.$.val() < s.o.min&&s.$.val(s.o.min));
}}
);
};
this.init=function (){
if(this.v < this.o.min
|| this.v > this.o.max){ this.v=this.o.min; }
this.$.val(this.v);
this.w2=this.w / 2;
this.cursorExt=this.o.cursor / 100;
this.xy=this.w2 * this.scale;
this.lineWidth=this.xy * this.o.thickness;
this.lineCap=this.o.lineCap;
this.radius=this.xy - this.lineWidth / 2;
this.o.angleOffset
&& (this.o.angleOffset=isNaN(this.o.angleOffset) ? 0:this.o.angleOffset);
this.o.angleArc
&& (this.o.angleArc=isNaN(this.o.angleArc) ? this.PI2:this.o.angleArc);
this.angleOffset=this.o.angleOffset * Math.PI / 180;
this.angleArc=this.o.angleArc * Math.PI / 180;
this.startAngle=1.5 * Math.PI + this.angleOffset;
this.endAngle=1.5 * Math.PI + this.angleOffset + this.angleArc;
var s=max(
String(Math.abs(this.o.max)).length,
String(Math.abs(this.o.min)).length,
2
) + 2;
this.o.displayInput
&& this.i.css({
'width':((this.w / 2 + 4) >> 0) + 'px',
'height':((this.w / 3) >> 0) + 'px',
'position':'absolute',
'vertical-align':'middle',
'margin-top':((this.w / 3) >> 0) + 'px',
'margin-left':'-' + ((this.w * 3 / 4 + 2) >> 0) + 'px',
'border':0,
'background':'none',
'font':this.o.fontWeight + ' ' + ((this.w / s) >> 0) + 'px ' + this.o.font,
'text-align':'center',
'color':this.o.inputColor||this.o.fgColor,
'padding':'0px',
'-webkit-appearance': 'none'
})||this.i.css({
'width': '0px',
'visibility': 'hidden'
});
};
this.change=function (v){
this.cv=v;
this.$.val(this.o.format(v));
};
this.angle=function (v){
return (v - this.o.min) * this.angleArc / (this.o.max - this.o.min);
};
this.arc=function (v){
var sa, ea;
v=this.angle(v);
if(this.o.flip){
sa=this.endAngle + 0.00001;
ea=sa - v - 0.00001;
}else{
sa=this.startAngle - 0.00001;
ea=sa + v + 0.00001;
}
this.o.cursor
&& (sa=ea - this.cursorExt)
&& (ea=ea + this.cursorExt);
return {
s: sa,
e: ea,
d: this.o.flip&&!this.o.cursor
};};
this.draw=function (){
var c=this.g,
a=this.arc(this.cv),
pa,
r=1;
c.lineWidth=this.lineWidth;
c.lineCap=this.lineCap;
if(this.o.bgColor!=="none"){
c.beginPath();
c.strokeStyle=this.o.bgColor;
c.arc(this.xy, this.xy, this.radius, this.endAngle - 0.00001, this.startAngle + 0.00001, true);
c.stroke();
}
if(this.o.displayPrevious){
pa=this.arc(this.v);
c.beginPath();
c.strokeStyle=this.pColor;
c.arc(this.xy, this.xy, this.radius, pa.s, pa.e, pa.d);
c.stroke();
r=this.cv==this.v;
}
c.beginPath();
c.strokeStyle=r ? this.o.fgColor:this.fgColor ;
c.arc(this.xy, this.xy, this.radius, a.s, a.e, a.d);
c.stroke();
};
this.cancel=function (){
this.val(this.v);
};};
$.fn.dial=$.fn.knob=function (o){
return this.each(function (){
var d=new k.Dial();
d.o=o;
d.$=$(this);
d.run();
}
).parent();
};}));
(function($, wpreview){
"use strict";
$.fn.wprUserStarRating=function(options){
var $wrapper, defaults;
$wrapper=this;
defaults={
rate: null
};
options=$.extend({}, defaults, options);
$wrapper.find('.review-result-wrapper > span').click(function(event){
var stars=$(this).data('input-value');
$wrapper.find('.review-result').css('width', '' +(20 * stars) + '%');
$wrapper.find('.wp-review-user-rating-val').val(stars);
if(typeof options.rate=='function'){
options.rate.call($wrapper, stars);
}});
};
$(document).ready(function(){
$('.wp-review-user-rating-star, .wp-review-comment-rating-star').each(function(){
$(this).wprUserStarRating({
rate: function(value){
wp_review_rate(this);
}})
});
$('.wpr-user-features-rating[data-type="star"]').each(function(){
var $wrapper=$(this),
rating={},
$accept=$wrapper.find('.wpr-rating-accept-btn');
$wrapper.find('.wp-review-user-feature-rating-star').each(function(){
var featureId=$(this).attr('data-feature-id');
$(this).wprUserStarRating({
rate: function(value){
$accept.show();
this.attr('data-rated', '');
rating[ featureId ]=value;
$('#commentform :submit').prop('disabled', true);
if(! $wrapper.find('.wp-review-user-feature-rating-star:not([data-rated])').length){
$accept.prop('disabled', false);
$wrapper.data('rating', rating);
$('#commentform :submit').prop('disabled', false);
}}
});
});
$accept.on('click', function(){
wpreview.featuresRating($wrapper);
});
});
$('.wpr-comment-features-rating[data-type="star"]').each(function(){
var $wrapper=$(this),
rating={},
$accept=$wrapper.find('.wpr-rating-accept-btn');
$wrapper.find('input[name="wp-review-user-rating-val"]').remove();
$wrapper.find('input[name="wp-review-comment-feature-rating"]').remove();
function submit(){
var rating=$wrapper.data('rating'),
total=0,
count=0;
for(var i in rating){
total +=parseFloat(rating[ i ]);
count++;
}
$wrapper.find('input[name="wp-review-user-rating-val"]').remove();
$wrapper.find('input[name="wp-review-comment-feature-rating"]').remove();
$('<input type="hidden" name="wp-review-user-rating-val">').val(total / count).appendTo($wrapper);
$('<input type="hidden" name="wp-review-comment-feature-rating">').val(JSON.stringify(rating)).appendTo($wrapper);
}
$wrapper.find('.wp-review-user-feature-rating-star').each(function(){
var featureId=$(this).attr('data-feature-id');
$(this).wprUserStarRating({
rate: function(value){
var commentForm=this.closest('form');
commentForm.addClass('wpr-uncompleted-rating');
this.attr('data-rated', '');
rating[ featureId ]=value;
if(! $wrapper.find('.wp-review-user-feature-rating-star:not([data-rated])').length){
$wrapper.data('rating', rating);
submit();
commentForm.removeClass('wpr-uncompleted-rating');
}}
});
});
});
});
})(jQuery, wpreview);
!function(){var o,l,n,e,g,m=function(t,e){var i,n={};for(i in t)n[i]=t[i];for(i in e)n[i]=e[i];return n},t=function(t){return t},c=(o={duration:300,action:"close",startTime:null,startHeight:null,endHeight:null,easing:t},l=function(e,i){cancelAnimationFrame(e.getAttribute("data-lwptoc-animation-request-id")),e.setAttribute("data-lwptoc-animation-request-id",window.requestAnimationFrame(function(t){n(e,i,t)}))},n=function(t,e,i){e.startTime||(e.startTime=i);var n,o=i-e.startTime;o<e.duration?(t.style.height=((e.endHeight-e.startingHeight)*e.easing(o/e.duration)+e.startingHeight).toFixed(2)+"px",l(t,e)):("close"===e.action&&(t.style.display="none"),"open"===e.action&&(t.style.display="block"),(n=t).style.height=null,n.style.overflow=null)},function(t,e){if(window.requestAnimationFrame){var i=m(o,{});i.action=e,t.style.height?i.startingHeight=parseFloat(t.style.height):i.startingHeight="close"===e?t.scrollHeight:0,(n=t).style.display="block",n.style.overflow="hidden",i.endHeight="close"===e?0:(t.style.height="0px",t.scrollHeight),l(t,i)}else t.style.display="close"===e?"none":"block";var n}),a=function(t){for(var e,i=document.querySelectorAll('[id="'+t+'"]'),n=0;n<i.length;n++)if((e=i[n]).offsetWidth||e.offsetHeight||e.getClientRects().length)return i[n];return null},i=(e={offset:0,duration:500,easing:t,onComplete:function(t,e){}},g=function(t,e){var i=t.getBoundingClientRect().top+window.pageYOffset-e;return i<0?0:i},function(o,t){var l,a=m(e,t);if(window.requestAnimationFrame&&"smooth"!==window.getComputedStyle(document.getElementsByTagName("HTML")[0]).scrollBehavior){var r,s,c=window.pageYOffset,d=null,u=function(t){l=g(o,a.offset),r=l-c;var e=window.pageYOffset;if(!s||!(0<r&&e<s||r<0&&s<e)){s=e,d||(d=t-1);var i=t-d,n=((l-c)*a.easing(i/a.duration)+c).toFixed();window.scroll(0,n),i<a.duration?window.requestAnimationFrame(u):(window.scroll(0,l),a.onComplete(0,l))}};window.requestAnimationFrame(u)}else l=g(o,a.offset),window.scroll(0,l),a.onComplete(0,l)}),u={scrollTo:function(t,e){i(t,e)},registerScrollTrigger:function(t,i){for(var e=0;e<t.length;e++)t[e].addEventListener("click",function(t){t.preventDefault();var e=this.getAttribute("href"),c=e.substring(1),d=a(c);d&&(e!==document.location.hash&&(i.onComplete=function(t,e){var i,n,o,l,a,r,s;d.setAttribute("id",""),i=c,n=t,o=e,(s=document.createElement("a")).setAttribute("id",i),s.setAttribute("style","position:absolute;visibility:hidden;left:"+n+"px;top:"+o+"px;"),l=document.body,a=s,l.prepend?l.prepend(a):l.insertBefore(a,l.firstChild),document.location.hash=i,(r=s).remove?r.remove():r.parentNode.removeChild(r),d.setAttribute("id",c)}),u.scrollTo(d,i))})},init:function(t){if("1"!==t.getAttribute("data-lwptoc-initialized")){t.setAttribute("data-lwptoc-initialized","1");var a,r=t.getElementsByClassName("lwptoc_toggle_label")[0],s=t.getElementsByClassName("lwptoc_items")[0];if(r)r.addEventListener("click",function(t){var e,i,n,o,l;t.preventDefault(),a=r.getAttribute("data-label"),r.setAttribute("data-label",r.innerHTML),r.innerHTML=a,l="lwptoc_items-visible",-1<(" "+s.className+" ").indexOf(" "+l+" ")?(o="lwptoc_items-visible",(n=s).className=(" "+n.className+" ").replace(" "+o+" ","").trim(),c(s,"close")):(i="lwptoc_items-visible",(e=s).className=e.className.trim()+" "+i,c(s,"open"))});"1"===t.getAttribute("data-smooth-scroll")&&u.registerScrollTrigger(s.getElementsByTagName("A"),{offset:t.getAttribute("data-smooth-scroll-offset")})}},globalInit:function(){for(var t=document.getElementsByClassName("lwptoc"),e=0;e<t.length;e++)u.init(t[e])}};window.lwptoc=u,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",u.globalInit):u.globalInit()}();
window.addComment=function(v){var I,C,h,E=v.document,b={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=v.MutationObserver||v.WebKitMutationObserver||v.MozMutationObserver,r="querySelector"in E&&"addEventListener"in v,n=!!E.documentElement.dataset;function t(){d(),e&&new e(o).observe(E.body,{childList:!0,subtree:!0})}function d(e){if(r&&(I=g(b.cancelReplyId),C=g(b.commentFormId),I)){I.addEventListener("touchstart",l),I.addEventListener("click",l);function t(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode&&"a"!==E.activeElement.tagName.toLowerCase())return C.removeEventListener("keydown",t),e.preventDefault(),C.submit.click(),!1}C&&C.addEventListener("keydown",t);for(var n,d=function(e){var t=b.commentReplyClass;e&&e.childNodes||(e=E);e=E.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return e}(e),o=0,i=d.length;o<i;o++)(n=d[o]).addEventListener("touchstart",a),n.addEventListener("click",a)}}function l(e){var t,n,d=g(b.temporaryFormId);d&&h&&(g(b.parentIdFieldId).value="0",t=d.textContent,d.parentNode.replaceChild(h,d),this.style.display="none",n=(d=(d=g(b.commentReplyTitleId))&&d.firstChild)&&d.nextSibling,d&&d.nodeType===Node.TEXT_NODE&&t&&(n&&"A"===n.nodeName&&n.id!==b.cancelReplyId&&(n.style.display=""),d.textContent=t),e.preventDefault())}function a(e){var t=g(b.commentReplyTitleId),t=t&&t.firstChild.textContent,n=this,d=m(n,"belowelement"),o=m(n,"commentid"),i=m(n,"respondelement"),r=m(n,"postid"),n=m(n,"replyto")||t;d&&o&&i&&r&&!1===v.addComment.moveForm(d,o,i,r,n)&&e.preventDefault()}function o(e){for(var t=e.length;t--;)if(e[t].addedNodes.length)return void d()}function m(e,t){return n?e.dataset[t]:e.getAttribute("data-"+t)}function g(e){return E.getElementById(e)}return r&&"loading"!==E.readyState?t():r&&v.addEventListener("DOMContentLoaded",t,!1),{init:d,moveForm:function(e,t,n,d,o){var i,r,l,a,m,c,s,e=g(e),n=(h=g(n),g(b.parentIdFieldId)),y=g(b.postIdFieldId),p=g(b.commentReplyTitleId),u=(p=p&&p.firstChild)&&p.nextSibling;if(e&&h&&n){void 0===o&&(o=p&&p.textContent),a=h,m=b.temporaryFormId,c=g(m),s=(s=g(b.commentReplyTitleId))?s.firstChild.textContent:"",c||((c=E.createElement("div")).id=m,c.style.display="none",c.textContent=s,a.parentNode.insertBefore(c,a)),d&&y&&(y.value=d),n.value=t,I.style.display="",e.parentNode.insertBefore(h,e.nextSibling),p&&p.nodeType===Node.TEXT_NODE&&(u&&"A"===u.nodeName&&u.id!==b.cancelReplyId&&(u.style.display="none"),p.textContent=o),I.onclick=function(){return!1};try{for(var f=0;f<C.elements.length;f++)if(i=C.elements[f],r=!1,"getComputedStyle"in v?l=v.getComputedStyle(i):E.documentElement.currentStyle&&(l=i.currentStyle),(i.offsetWidth<=0&&i.offsetHeight<=0||"hidden"===l.visibility)&&(r=!0),"hidden"!==i.type&&!i.disabled&&!r){i.focus();break}}catch(e){}return!1}}}}(window);