0byt3m1n1-V2
Path:
/
home
/
yvffpqmy
/
public_html
/
wp-content
/
plugins
/
arforms
/
js
/
[
Home
]
File: arf_timer.js
!function(l){function s(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function _(t,e,i,a,s){for(var n={},r={},o={},h={},d={},u={},l=null,c=0;c<a.length;c++){var f=a[c],m=null===l?i/y[f]:y[l]/y[f],p=t/y[f],_=e/y[f];s&&(p=0<p?Math.floor(p):Math.ceil(p),_=0<_?Math.floor(_):Math.ceil(_)),"Days"!==f&&(p%=m,_%=m),n[f]=p,o[f]=Math.abs(p),r[f]=_,u[f]=Math.abs(_),h[f]=Math.abs(p)/m,d[f]=Math.abs(_)/m,l=f}return{raw_time:n,raw_old_time:r,time:o,old_time:u,pct:h,old_pct:d}}function a(){void 0!==b.TC_Instance_List?o=b.TC_Instance_List:b.TC_Instance_List=o,function(r){for(var t=["webkit","moz"],e=0;e<t.length&&!r.requestAnimationFrame;++e)r.requestAnimationFrame=r[t[e]+"RequestAnimationFrame"],r.cancelAnimationFrame=r[t[e]+"CancelAnimationFrame"];r.requestAnimationFrame&&r.cancelAnimationFrame||(r.requestAnimationFrame=function(t,e,i){void 0===i&&(i={data:{last_frame:0}});var a=(new Date).getTime(),s=Math.max(0,16-(a-i.data.last_frame)),n=r.setTimeout(function(){t(a+s)},s);return i.data.last_frame=a+s,n},r.cancelAnimationFrame=function(t){clearTimeout(t)})}(b)}var b=window;Object.keys||(Object.keys=function(){"use strict";var s=Object.prototype.hasOwnProperty,n=!{toString:null}.propertyIsEnumerable("toString"),r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o=r.length;return function(t){if("object"!=typeof t&&("function"!=typeof t||null===t))throw new TypeError("Object.keys called on non-object");var e,i,a=[];for(e in t)s.call(t,e)&&a.push(e);if(n)for(i=0;i<o;i++)s.call(t,r[i])&&a.push(r[i]);return a}}());var g=!1,v=(location.hash,["Days","Hours","Minutes","Seconds"]),n={Seconds:"Minutes",Minutes:"Hours",Hours:"Days",Days:"Years"},y={Seconds:1,Minutes:60,Hours:3600,Days:86400,Months:2678400,Years:31536e3};Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=this.length>>>0,i=Number(arguments[1])||0;for((i=i<0?Math.ceil(i):Math.floor(i))<0&&(i+=e);i<e;i++)if(i in this&&this[i]===t)return i;return-1});function r(t,e){this.element=t,this.container,this.listeners=null,this.data={paused:!1,last_frame:0,animation_frame:null,interval_fallback:null,timer:!1,total_duration:null,prev_time:null,drawn_units:[],text_elements:{Days:null,Hours:null,Minutes:null,Seconds:null},attributes:{canvas:null,context:null,item_size:null,line_width:null,radius:null,outer_radius:null},state:{fading:{Days:!1,Hours:!1,Minutes:!1,Seconds:!1}}},this.config=null,this.setOptions(e),this.initialize()}var o={};r.prototype.clearListeners=function(){this.listeners={all:[],visible:[]}},r.prototype.addTime=function(t){var e;this.data.attributes.ref_date instanceof Date?(e=this.data.attributes.ref_date).setSeconds(e.getSeconds()+t):isNaN(this.data.attributes.ref_date)||(this.data.attributes.ref_date+=1e3*t)},r.prototype.initialize=function(t){this.data.drawn_units=[];for(var e=0;e<Object.keys(this.config.time).length;e++){var i=Object.keys(this.config.time)[e];this.config.time[i].show&&this.data.drawn_units.push(i)}l(this.element).children("div.time_circles").remove(),!(t=void 0===t?!0:t)&&null!==this.listeners||this.clearListeners(),this.container=l("<div>"),this.container.addClass("time_circles"),this.container.appendTo(this.element);var a=this.element.offsetHeight,s=this.element.offsetWidth;0===a&&(a=l(this.element).height()),0===s&&(s=l(this.element).width()),0===a&&0<s?a=s/3:0===s&&0<a&&(s=3*a);var n=document.createElement("canvas"),s=177,t=this.data.drawn_units.length;1==t?s=59:2==t&&(s=118),a=59,this.element.classList.contains("pagebreak_style_number")&&(s=118,a=36,1==t?s=36:2==t&&(s=72)),n.width=s,n.height=a,this.data.attributes.canvas=l(n),this.data.attributes.canvas.appendTo(this.container);t=!(!(t=document.createElement("canvas")).getContext||!t.getContext("2d"));t||"undefined"==typeof G_vmlCanvasManager||(G_vmlCanvasManager.initElement(n),t=g=!0),t&&(this.data.attributes.context=n.getContext("2d")),this.data.attributes.item_size=Math.min(s/this.data.drawn_units.length,a),this.data.attributes.line_width=this.data.attributes.item_size*this.config.fg_width,this.data.attributes.radius=(.8*this.data.attributes.item_size-this.data.attributes.line_width)/2,this.data.attributes.outer_radius=this.data.attributes.radius+.5*Math.max(this.data.attributes.line_width,this.data.attributes.line_width*this.config.bg_width);var r,e=0;for(r in this.data.text_elements)if(this.config.time[r].show){let t="left";"rtl"==(this.element.parentNode.getAttribute("data-direction")||"ltr")&&(t="right");var o=l("<div>");o.addClass("textDiv_"+r),o.css("top",Math.round(.35*this.data.attributes.item_size)),o.css(t,Math.round(e++*this.data.attributes.item_size)),o.css("width",this.data.attributes.item_size),o.appendTo(this.container);var h=l("<span>");h.css("font-size",Math.round(3*this.config.text_size*this.data.attributes.item_size)),this.element.classList.contains("pagebreak_style_number")||h.css("line-height",Math.round(this.config.text_size*this.data.attributes.item_size)+"px"),h.appendTo(o);var d=l("<h4>");d.text(this.config.time[r].text),d.css("font-size",Math.round(this.config.text_size*this.data.attributes.item_size)),this.element.classList.contains("pagebreak_style_number")||d.css("line-height",Math.round(this.config.text_size*this.data.attributes.item_size)+"px"),d.appendTo(o),this.data.text_elements[r]=h}this.start(),this.config.start||(this.data.paused=!0);var u=this;this.data.interval_fallback=b.setInterval(function(){u.update.call(u,!0)},100)},r.prototype.update=function(t){if(void 0===t)t=!1;else if(t&&this.data.paused)return;g&&this.data.attributes.context.clearRect(0,0,this.data.attributes.canvas[0].width,this.data.attributes.canvas[0].hright);var e=this.data.prev_time,i=new Date;if(this.data.prev_time=i,null===e&&(e=i),!this.config.count_past_zero&&i>this.data.attributes.ref_date){for(var a=0;a<this.data.drawn_units.length;a++){var s=this.data.drawn_units[a];this.data.text_elements[s].text("00");var n=a*this.data.attributes.item_size+this.data.attributes.item_size/2,r=this.data.attributes.item_size/2,o=this.config.time[s].color;this.drawArc(n,r,o,0)}this.stop()}else{var h,d,u=(this.data.attributes.ref_date-i)/1e3,i=(this.data.attributes.ref_date-e)/1e3,e="smooth"!==this.config.animation,l=_(u,i,this.data.total_duration,this.data.drawn_units,e),c=_(u,i,y.Years,v,e),a=0,f=0,m=null,p=this.data.drawn_units.slice();for(a in v){s=v[a];if(Math.floor(c.raw_time[s])!==Math.floor(c.raw_old_time[s])&&this.notifyListeners(s,Math.floor(c.time[s]),Math.floor(u),"all"),!(p.indexOf(s)<0)){if(Math.floor(l.raw_time[s])!==Math.floor(l.raw_old_time[s])&&this.notifyListeners(s,Math.floor(l.time[s]),Math.floor(u),"visible"),!t){let t=Math.floor(Math.abs(l.time[s]));t<10&&(t="0"+t),this.data.text_elements[s].text(t);n=f*this.data.attributes.item_size+this.data.attributes.item_size/2,r=this.data.attributes.item_size/2;if("transparent"==(o=this.config.time[s].color))continue;"smooth"===this.config.animation?(null===m||g||(Math.floor(l.time[m])>Math.floor(l.old_time[m])?(this.radialFade(n,r,o,1,s),this.data.state.fading[s]=!0):Math.floor(l.time[m])<Math.floor(l.old_time[m])&&(this.radialFade(n,r,o,0,s),this.data.state.fading[s]=!0)),this.data.state.fading[s]||this.drawArc(n,r,o,l.pct[s])):this.animateArc(n,r,o,l.pct[s],l.old_pct[s],(new Date).getTime()+200)}m=s,f++}}this.data.paused||t||(d=function(){h.update.call(h)},"smooth"===(h=this).config.animation?this.data.animation_frame=b.requestAnimationFrame(d,h.element,h):((e=u%1*1e3)<0&&(e=1e3+e),h.data.animation_frame=b.setTimeout(function(){h.data.animation_frame=b.requestAnimationFrame(d,h.element,h)},e+=50)))}},r.prototype.animateArc=function(t,e,i,a,s,n){var r,o;null!==this.data.attributes.context&&(.5<Math.abs(s-a)?0===a?this.radialFade(t,e,i,1):this.radialFade(t,e,i,0):(r=(200-(n-(new Date).getTime()))/200,this.drawArc(t,e,i,s*(1-(r=1<r?1:r))+a*r),1<=r||b.requestAnimationFrame(function(){o.animateArc(t,e,i,a,s,n)},(o=this).element)))},r.prototype.drawArc=function(t,e,i,a){var s,n,r;null!==this.data.attributes.context&&(r=Math.max(this.data.attributes.outer_radius,this.data.attributes.item_size/2),g||this.data.attributes.context.clearRect(t-r,e-r,2*r,2*r),this.config.use_background&&(this.data.attributes.context.beginPath(),this.data.attributes.context.arc(t,e,this.data.attributes.radius,0,2*Math.PI,!1),this.data.attributes.context.lineWidth=this.data.attributes.line_width*this.config.bg_width,this.data.attributes.context.strokeStyle=this.config.circle_bg_color,this.data.attributes.context.stroke()),n=-.5*Math.PI,r=2*Math.PI,r=n+this.config.start_angle/360*r,a=2*a*Math.PI,a="Both"===this.config.direction?(s=!1,(r-=a/2)+a):"Clockwise"===this.config.direction?(s=!1,r+a):(s=!0,r-a),this.data.attributes.context.beginPath(),this.data.attributes.context.arc(t,e,this.data.attributes.radius,r,a,s),this.data.attributes.context.lineWidth=this.data.attributes.line_width,this.data.attributes.context.strokeStyle=i,this.data.attributes.context.stroke())},r.prototype.radialFade=function(i,a,t,s,e){for(var n=(t=(t=t).replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(t,e,i,a){return e+e+i+i+a+a}),(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null),r=this,o=.2*(1===s?-1:1),h=0;s<=1&&0<=s;h++)!function(){var t=50*h,e="rgba("+n.r+", "+n.g+", "+n.b+", "+Math.round(10*s)/10+")";b.setTimeout(function(){r.drawArc(i,a,e,1)},t)}(),s+=o;b.setTimeout(function(){r.data.state.fading[e]=!1},50*h)},r.prototype.timeLeft=function(){if(this.data.paused&&"number"==typeof this.data.timer)return this.data.timer;var t=new Date;return(this.data.attributes.ref_date-t)/1e3},r.prototype.start=function(){b.cancelAnimationFrame(this.data.animation_frame),b.clearTimeout(this.data.animation_frame);var t=l(this.element).data("date");"string"==typeof(t=void 0===t?l(this.element).attr("data-date"):t)?this.data.attributes.ref_date=function(t){if(null!==(i=t.match(/^[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{1,2}:[0-9]{2}:[0-9]{2}$/))&&0<i.length){var e=t.split(" "),i=e[0].split("-"),e=e[1].split(":");return new Date(i[0],i[1]-1,i[2],e[0],e[1],e[2])}return e=Date.parse(t),isNaN(e)?(e=Date.parse(t.replace(/-/g,"/").replace("T"," ")),isNaN(e)?new Date:e):e}(t):"number"==typeof this.data.timer?this.data.paused&&(this.data.attributes.ref_date=(new Date).getTime()+1e3*this.data.timer):(this.data.attributes.ref_date=(new Date).getTime()+1e3*(this.config.set_time+1),this.data.timer=this.config.set_time+1),this.data.paused=!1,this.update.call(this)},r.prototype.restart=function(){this.data.timer=!1,this.start()},r.prototype.stop=function(){"number"==typeof this.data.timer&&(this.data.timer=this.timeLeft(this)),this.data.paused=!0,b.cancelAnimationFrame(this.data.animation_frame)},r.prototype.destroy=function(){this.clearListeners(),this.stop(),b.clearInterval(this.data.interval_fallback),this.data.interval_fallback=null,this.container.remove(),l(this.element).removeAttr("data-tc-id"),l(this.element).removeData("tc-id")},r.prototype.setOptions=function(t){if(null===this.config&&(this.default_options.ref_date=new Date,this.config=l.extend(!0,{},this.default_options)),l.extend(!0,this.config,t),b=this.config.use_top_frame?window.top:window,a(),this.data.total_duration=this.config.total_duration,"string"==typeof this.data.total_duration)if(void 0!==y[this.data.total_duration])this.data.total_duration=y[this.data.total_duration];else if("Auto"===this.data.total_duration)for(var e=0;e<Object.keys(this.config.time).length;e++){var i=Object.keys(this.config.time)[e];if(this.config.time[i].show){this.data.total_duration=y[n[i]];break}}else this.data.total_duration=y.Years,console.error("Valid values for TimeCircles config.total_duration are either numeric, or (string) Years, Months, Days, Hours, Minutes, Auto")},r.prototype.addListener=function(t,e,i){"function"==typeof t&&this.listeners[i=void 0===i?"visible":i].push({func:t,scope:e})},r.prototype.notifyListeners=function(t,e,i,a){for(var s=0;s<this.listeners[a].length;s++){var n=this.listeners[a][s];n.func.apply(n.scope,[t,e,i])}},r.prototype.default_options={ref_date:new Date,start:!0,animation:"smooth",count_past_zero:!0,circle_bg_color:"#60686F",use_background:!0,fg_width:.09,bg_width:.1,text_size:.1,total_duration:"Auto",direction:"Clockwise",use_top_frame:!1,start_angle:0,time:{Days:{show:!0,color:"#FC6"},Hours:{show:!0,color:"#9CF"},Minutes:{show:!0,color:"#BFB"},Seconds:{show:!0,color:"#F99"}}};function e(t,e){this.elements=t,this.options=e,this.foreach()}e.prototype.getInstance=function(t){var e,i,a=l(t).data("tc-id");return void 0===a&&(a=s()+s()+"-"+s()+"-"+s()+"-"+s()+"-"+s()+s()+s(),l(t).attr("data-tc-id",a)),void 0===o[a]?(e=this.options,"object"==typeof(i="string"==typeof(i=l(t).data("options"))?JSON.parse(i):i)&&(e=l.extend(!0,{},this.options,i)),e=new r(t,e),o[a]=e):(e=o[a],void 0!==this.options&&e.setOptions(this.options)),e},e.prototype.addTime=function(e){this.foreach(function(t){t.addTime(e)})},e.prototype.foreach=function(e){var i=this;return this.elements.each(function(){var t=i.getInstance(this);"function"==typeof e&&e(t)}),this},e.prototype.start=function(){return this.foreach(function(t){t.start()}),this},e.prototype.stop=function(){return this.foreach(function(t){t.stop()}),this},e.prototype.restart=function(){return this.foreach(function(t){t.restart()}),this},e.prototype.rebuild=function(){return this.foreach(function(t){t.initialize(!1)}),this},e.prototype.getTime=function(){return this.getInstance(this.elements[0]).timeLeft()},e.prototype.addListener=function(e,i){void 0===i&&(i="visible");var a=this;return this.foreach(function(t){t.addListener(e,a.elements,i)}),this},e.prototype.destroy=function(){return this.foreach(function(t){t.destroy()}),this},e.prototype.end=function(){return this.elements},l.fn.TimeCircles=function(t){return new e(this,t)}}(jQuery);
©
2018.