/** * jquery-circle-progress - jQuery Plugin to draw animated circular progress bars: * {@link http://kottenator.github.io/jquery-circle-progress/} * * @author Rostyslav Bryzgunov * @version 1.2.2 * @licence MIT * @preserve */ (function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else if(typeof module==='object'&&module.exports){var $=require('jquery');factory($);module.exports=$}else{factory(jQuery)}})(function($){function CircleProgress(config){this.init(config)} CircleProgress.prototype={value:0.0,size:100.0,startAngle:-Math.PI,thickness:'auto',fill:{gradient:['#3aeabb','#fdd250']},emptyFill:'rgba(0, 0, 0, .1)',animation:{duration:1200,easing:'circleProgressEasing'},animationStartValue:0.0,reverse:!1,lineCap:'butt',insertMode:'prepend',constructor:CircleProgress,el:null,canvas:null,ctx:null,radius:0.0,arcFill:null,lastFrameValue:0.0,init:function(config){$.extend(this,config);this.radius=this.size/2;this.initWidget();this.initFill();this.draw();this.el.trigger('circle-inited')},initWidget:function(){if(!this.canvas) this.canvas=$('')[this.insertMode=='prepend'?'prependTo':'appendTo'](this.el)[0];var canvas=this.canvas;canvas.width=this.size;canvas.height=this.size;this.ctx=canvas.getContext('2d');if(window.devicePixelRatio>1){var scaleBy=window.devicePixelRatio;canvas.style.width=canvas.style.height=this.size+'px';canvas.width=canvas.height=this.size*scaleBy;this.ctx.scale(scaleBy,scaleBy)}},initFill:function(){var self=this,fill=this.fill,ctx=this.ctx,size=this.size;if(!fill) throw Error("The fill is not specified!");if(typeof fill=='string') fill={color:fill};if(fill.color) this.arcFill=fill.color;if(fill.gradient){var gr=fill.gradient;if(gr.length==1){this.arcFill=gr[0]}else if(gr.length>1){var ga=fill.gradientAngle||0,gd=fill.gradientDirection||[size/2*(1-Math.cos(ga)),size/2*(1+Math.sin(ga)),size/2*(1+Math.cos(ga)),size/2*(1-Math.sin(ga))];var lg=ctx.createLinearGradient.apply(ctx,gd);for(var i=0;i')[0];bg.width=self.size;bg.height=self.size;bg.getContext('2d').drawImage(img,0,0,size,size);self.arcFill=self.ctx.createPattern(bg,'no-repeat');self.drawFrame(self.lastFrameValue)}},draw:function(){if(this.animation) this.drawAnimated(this.value);else this.drawFrame(this.value)},drawFrame:function(v){this.lastFrameValue=v;this.ctx.clearRect(0,0,this.size,this.size);this.drawEmptyArc(v);this.drawArc(v)},drawArc:function(v){if(v===0) return;var ctx=this.ctx,r=this.radius,t=this.getThickness(),a=this.startAngle;ctx.save();ctx.beginPath();if(!this.reverse){ctx.arc(r,r,r-t/2,a,a+Math.PI*2*v)}else{ctx.arc(r,r,r-t/2,a-Math.PI*2*v,a)} ctx.lineWidth=t;ctx.lineCap=this.lineCap;ctx.strokeStyle=this.arcFill;ctx.stroke();ctx.restore()},drawEmptyArc:function(v){var ctx=this.ctx,r=this.radius,t=this.getThickness(),a=this.startAngle;if(v<1){ctx.save();ctx.beginPath();if(v<=0){ctx.arc(r,r,r-t/2,0,Math.PI*2)}else{if(!this.reverse){ctx.arc(r,r,r-t/2,a+Math.PI*2*v,a)}else{ctx.arc(r,r,r-t/2,a,a-Math.PI*2*v)}} ctx.lineWidth=t;ctx.strokeStyle=this.emptyFill;ctx.stroke();ctx.restore()}},drawAnimated:function(v){var self=this,el=this.el,canvas=$(this.canvas);canvas.stop(!0,!1);el.trigger('circle-animation-start');canvas.css({animationProgress:0}).animate({animationProgress:1},$.extend({},this.animation,{step:function(animationProgress){var stepValue=self.animationStartValue*(1-animationProgress)+v*animationProgress;self.drawFrame(stepValue);el.trigger('circle-animation-progress',[animationProgress,stepValue])}})).promise().always(function(){el.trigger('circle-animation-end')})},getThickness:function(){return $.isNumeric(this.thickness)?this.thickness:this.size/14},getValue:function(){return this.value},setValue:function(newValue){if(this.animation) this.animationStartValue=this.lastFrameValue;this.value=newValue;this.draw()}};$.circleProgress={defaults:CircleProgress.prototype};$.easing.circleProgressEasing=function(x){if(x<0.5){x=2*x;return 0.5*x*x*x}else{x=2-2*x;return 1-0.5*x*x*x}};$.fn.circleProgress=function(configOrCommand,commandArgument){var dataName='circle-progress',firstInstance=this.data(dataName);if(configOrCommand=='widget'){if(!firstInstance) throw Error('Calling "widget" method on not initialized instance is forbidden');return firstInstance.canvas} if(configOrCommand=='value'){if(!firstInstance) throw Error('Calling "value" method on not initialized instance is forbidden');if(typeof commandArgument=='undefined'){return firstInstance.getValue()}else{var newValue=arguments[1];return this.each(function(){$(this).data(dataName).setValue(newValue)})}} return this.each(function(){var el=$(this),instance=el.data(dataName),config=$.isPlainObject(configOrCommand)?configOrCommand:{};if(instance){instance.init(config)}else{var initialConfig=$.extend({},el.data());if(typeof initialConfig.fill=='string') initialConfig.fill=JSON.parse(initialConfig.fill);if(typeof initialConfig.animation=='string') initialConfig.animation=JSON.parse(initialConfig.animation);config=$.extend(initialConfig,config);config.el=el;instance=new CircleProgress(config);el.data(dataName,instance)}})}}); jQuery(function(){if(jQuery(".bwg-container").length){var html='
';html+='';html+='';html+='
';jQuery(".twb_admin_bar_menu").html(html).on("click",function(){window.open(twb.href,'_blank')});jQuery(".twb_admin_bar_menu_main").remove()} twb_inprogress=!1;jQuery(".twb-notoptimized").each(function(){if(jQuery(this).data("status")=='inprogress'){twb_disable_check()}});jQuery(".twb-notoptimized .twb_check_score_button").on("click",function(){if(!twb_inprogress){twb_check_score(this)}});jQuery("th[id^='twb-speed-']").hover(function(){jQuery(this).find(".twb-dismiss-container").removeClass("twb-hidden")},function(){jQuery(this).find(".twb-dismiss-container").addClass("twb-hidden")});jQuery(".twb-see-score").hover(function(){jQuery(this).parent().parent().find(".twb-score-container").removeClass("twb-hidden")},function(){jQuery(this).parent().parent().find(".twb-score-container").addClass("twb-hidden")});jQuery(".twb-score-container:not(.twb_admin_bar_menu_content .twb-score-container), .twb-score-disabled-container").hover(function(){jQuery(this).removeClass("twb-hidden")},function(){jQuery(this).addClass("twb-hidden")});jQuery(".twb-score-circle").each(function(){twb_draw_score_circle(this)});jQuery("#wp-admin-bar-twb_adminbar_info").mouseenter(function(){jQuery(".twb_admin_bar_menu_main .twb-score-container").removeClass("twb-hidden");jQuery(".twb_admin_bar_menu_main").removeClass("twb-hidden")}).mouseleave(function(){jQuery(".twb_admin_bar_menu_main").addClass("twb-hidden")});jQuery('.twb-score-circle').each(function(){twb_draw_score_circle(this)});if(jQuery(".twb_admin_bar_menu.twb_backend span").hasClass("twb_backend_optimizing_logo")){twb_run_notif_check=setInterval(twb_run_notif_check,30000)}});function twb_run_notif_check(){jQuery.ajax({type:"POST",url:twb.ajax_url,data:{action:"twb_notif_check",twb_nonce:twb.nonce,}}).success(function(results){var result=jQuery.parseJSON(results);if(result.html!=""){if(result.changeLogo==1){jQuery(".twb_admin_bar_menu_header span").addClass("twb_counted")} jQuery("#wp-admin-bar-twb_adminbar_info").append(result.html);jQuery(".twb_admin_bar_menu_content .twb-score-container").removeClass("twb-hidden");jQuery(".twb_admin_bar_menu_content .twb-score-container .twb-score-circle").each(function(){twb_draw_score_circle(this)});clearInterval(twb_run_notif_check)}}).error(function(){clearInterval(twb_run_notif_check)})} function twb_disable_check(){twb_inprogress=!0;jQuery(".twb-notoptimized").hover(function(){jQuery(this).parent().find(".twb-score-disabled-container").removeClass("twb-hidden")},function(){jQuery(this).parent().find(".twb-score-disabled-container").addClass("twb-hidden")})} function twb_check_score(that){var post_id=jQuery(that).data("post_id");var parent=jQuery(that).parent().parent().parent();jQuery(".twb_admin_bar_menu.twb_frontend").addClass("twb_score_inprogress");if(parent.find(".twb-optimized").hasClass("twb-hidden")){parent.find(".twb-optimizing").removeClass("twb-hidden")}else{parent.find(".twb-score-overlay").removeClass("twb-hidden");parent.find(".twb-score-overlay div").removeClass("twb-reload").addClass("twb-loader")} parent.find(".twb-notoptimized").addClass("twb-hidden");if(parent.hasClass("twb_elementor_settings_content")){jQuery(".twb_elementor_control_title").text(twb.checking).removeClass("twb_not_optimized").prepend("")} twb_disable_check();jQuery.ajax({url:twb.ajax_url,type:"POST",dataType:'json',data:{action:"twb_check_score",post_id:post_id,twb_nonce:twb.nonce},success:function(data){if(data.error){parent.find(".twb-score-overlay").removeClass("twb-hidden");parent.find(".twb-score-overlay div").removeClass("twb-loader").addClass("twb-reload")}else{parent.find(".twb-score-overlay").addClass("twb-hidden");var desktop=parent.find(".twb-score-desktop").find(".twb-score-circle");desktop.data({"score":data.desktop_score,"tti":data.desktop_tti,});twb_draw_score_circle(desktop);var mobile=parent.find(".twb-score-mobile").find(".twb-score-circle");mobile.data({"score":data.mobile_score,"tti":data.mobile_tti,});twb_draw_score_circle(mobile)}},error:function(xhr,textStatus,errorThrown){parent.find(".twb-score-overlay").removeClass("twb-hidden");parent.find(".twb-score-overlay div").removeClass("twb-loader").addClass("twb-reload")},complete:function(xhr,textStatus){parent.find(".twb-optimizing").addClass("twb-hidden");parent.find(".twb-optimized").removeClass("twb-hidden");jQuery("#wpadminbar .twb-optimized .twb-score-container").removeClass("twb-hidden");jQuery("#wpadminbar .twb_admin_bar_menu").removeClass("twb_score_inprogress");jQuery("#wpadminbar .twb_menu_logo").remove();jQuery("#wpadminbar .twb_not_optimized_logo").removeClass("twb-hidden");jQuery("#wpadminbar .twb_admin_bar_menu_header").addClass("twb_not_optimized");twb_inprogress=!1;jQuery(".twb-notoptimized").hover(function(){jQuery(this).parent().find(".twb-score-disabled-container").addClass("twb-hidden")});if(parent.hasClass("twb_elementor_settings_content")){jQuery(".twb_elementor_control_title").text(twb.notoptimized).remove("span.twb_inprogress").addClass("twb_not_optimized")}}})} function twb_draw_score_circle(that){var score=parseInt(jQuery(that).data('score'));var size=parseInt(jQuery(that).data('size'));var thickness=parseInt(jQuery(that).data('thickness'));var color=score<=49?"rgb(253, 60, 49)":(score>=90?"rgb(12, 206, 107)":"rgb(255, 164, 0)");jQuery(that).parent().find('.twb-load-time').html(jQuery(that).data('tti'));var _this=that;if(typeof jQuery(_this).circleProgress!='function'){return} jQuery(_this).circleProgress({value:score/100,size:size,startAngle:-Math.PI/4*2,lineCap:'round',emptyFill:"rgba(255, 255, 255, 0)",thickness:thickness,fill:{color:color}}).on('circle-animation-progress',function(event,progress){var content='';if(score!=0){content=Math.round(score*progress)} jQuery(that).find('.twb-score-circle-animated').html(content).css({"color":color});jQuery(that).find('canvas').html(Math.round(score*progress))})} function twb_add_elementor_button(){window.elementor.modules.layouts.panel.pages.menu.Menu.addItem({name:twb.title,icon:"twb-element-menu-icon",title:twb.title,type:"page",callback:()=>{try{window.$e.route("panel/page-settings/twb_optimize")}catch(e){window.$e.route("panel/page-settings/settings"),window.$e.route("panel/page-settings/twb_optimize")}}},"more")} jQuery(window).on("elementor:init",()=>{window.elementor.on("panel:init",()=>{setTimeout(twb_add_elementor_button)})}); /*! jQuery & Zepto Lazy v1.7.11 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */ !function(t,e){"use strict";function r(r,a,i,u,l){function f(){L=t.devicePixelRatio>1,i=c(i),a.delay>=0&&setTimeout(function(){s(!0)},a.delay),(a.delay<0||a.combined)&&(u.e=v(a.throttle,function(t){"resize"===t.type&&(w=B=-1),s(t.all)}),u.a=function(t){t=c(t),i.push.apply(i,t)},u.g=function(){return i=n(i).filter(function(){return!n(this).data(a.loadedName)})},u.f=function(t){for(var e=0;ee.top&&-ne.left&&-n=0?w:w=n(t).width()}function h(){return B>=0?B:B=n(t).height()}function m(t){return t.tagName.toLowerCase()}function b(t,e){if(e){var r=t.split(",");t="";for(var a=0,n=r.length;at||!a.enableThrottle||u?l():n=setTimeout(l,t-f)}}function p(){--z,i.length||z||y("onFinishedAll")}function y(t,e,n){return!!(t=a[t])&&(t.apply(r,[].slice.call(arguments,1)),!0)}var z=0,w=-1,B=-1,L=!1,T="afterLoad",D="load",I="error",N="img",E="src",F="srcset",C="sizes",O="background-image";"event"===a.bind||o?f():n(t).on(D+"."+l,f)}function a(a,o){var u=this,l=n.extend({},u.config,o),f={},c=l.name+"-"+ ++i;return u.config=function(t,r){return r===e?l[t]:(l[t]=r,u)},u.addItems=function(t){return f.a&&f.a("string"===n.type(t)?n(t):t),u},u.getItems=function(){return f.g?f.g():{}},u.update=function(t){return f.e&&f.e({},!t),u},u.force=function(t){return f.f&&f.f("string"===n.type(t)?n(t):t),u},u.loadAll=function(){return f.e&&f.e({all:!0},!0),u},u.destroy=function(){return n(l.appendScroll).off("."+c,f.e),n(t).off("."+c),f={},e},r(u,l,a,f,c),l.chainable?a:u}var n=t.jQuery||t.Zepto,i=0,o=!1;n.fn.Lazy=n.fn.lazy=function(t){return new a(this,t)},n.Lazy=n.lazy=function(t,r,i){if(n.isFunction(r)&&(i=r,r=[]),n.isFunction(i)){t=n.isArray(t)?t:[t],r=n.isArray(r)?r:[r];for(var o=a.prototype.config,u=o._f||(o._f={}),l=0,f=t.length;l