Your IP : 216.73.217.80


Current Path : /home/jlgagfroyt/www/templates/yoo_digit copie/js/
Upload File :
Current File : /home/jlgagfroyt/www/templates/yoo_digit copie/js/circlechart.js

/* Copyright (C) YOOtheme GmbH, YOOtheme Proprietary Use License (http://www.yootheme.com/license) */

(function($,UI){var template=['<svg class="uk-circlechart" preserveAspectRatio="xMinYMin meet" xmlns="http://www.w3.org/2000/svg">',"<path />",'<circle cx="90" cy="90" r="60"/>','<text x="50%" y="50%"></text>',"</svg>"].join("");var Circle=function(element,options){var $this=this;this.element=$(element);this.options=$.extend({},Circle.defaults,options);if(this.element.data("circle")){return}var $svg=$(template),size=this.options.size,halfsize=size/2;this.element.replaceWith($svg);if(navigator.userAgent.match(/AppleWebKit\/(.+?) Version\/(.+?) Safari\//)){var ele,props,pattern;for(var i=0;i<document.styleSheets.length;i++){var rules=document.styleSheets[i].cssRules;for(var z=0;z<rules.length;z++){if(rules[z].type===CSSRule.STYLE_RULE&&rules[z].selectorText.match(/uk-circlechart/)){pattern=rules[z].cssText.replace(/\n/g,"").match(/(.+)\{(.+)\}/);if(pattern){props=pattern[2].split(";");ele=false;if(pattern[1].indexOf(" path")!=-1){if($svg.is($.trim(pattern[1]).replace(" path","")))ele="path"}if(pattern[1].indexOf(" circle")!=-1){if($svg.is($.trim(pattern[1]).replace(" circle","")))ele="circle"}if(pattern[1].indexOf(" text")!=-1){if($svg.is($.trim(pattern[1]).replace(" text","")))ele="text"}if(ele){var path=$svg.find(ele);props.forEach(function(prop){var parts=prop.split(":");if(parts.length==2)path.attr($.trim(parts[0]),$.trim(parts[1]))})}}}}}}this.element=$svg.attr({width:size,height:size,viewbox:"0 0 "+[size,size].join(" ")});this.circle=this.element.find("circle").attr({cx:halfsize,cy:halfsize,r:halfsize-this.options.border});this.border=this.element.find("path").attr("transform","translate("+[halfsize,halfsize].join(",")+")");this.text=this.element.find("text");this.update(0);this.element.on("uk.scrollspy.inview",function(){var percent=0,timer=function circletimer(){if(percent>100||percent>$this.options.maxPercent){return}$this.update(percent++);setTimeout(circletimer,20)}()});this.scrollspy=new UI["scrollspy"](this.element);this.element.data("circle",this)};$.extend(Circle.prototype,{update:function(percent){var α=percent==100?359.9999:360*(percent/100),halfsize=this.options.size/2;α%=360;var r=α*Math.PI/180,x=Math.sin(r)*halfsize,y=Math.cos(r)*-halfsize,mid=α>180?1:0,anim="M 0 0 v -"+halfsize+" A "+halfsize+" "+halfsize+" 0 "+mid+" 1 "+x+" "+y+" z";this.border.attr("d",anim);this.text.text(Math.ceil(percent)+"%")}});Circle.defaults={timerSeconds:5,callback:function(){},timerCurrent:0,showPercentage:true,maxPercent:100,size:180,border:10};$(document).ready(function(e){$("[data-uk-circle-chart]").each(function(){var ele=$(this),obj;if(!ele.data("circle")){obj=new Circle(ele,UI.Utils.options(ele.attr("data-uk-circle-chart")))}})})})(jQuery,jQuery.UIkit);