{"version":3,"file":"TimeCircles.min.js","sources":["https:\/\/udl.id\/theme\/remui\/amd\/src\/TimeCircles.js"],"sourcesContent":["\/* eslint-disable *\/\n\/**\n * Basic structure: TC_Class is the public class that is returned upon being called\n *\n * So, if you do\n * var tc = $(\".timer\").TimeCircles();\n *\n * tc will contain an instance of the public TimeCircles class. It is important to\n * note that TimeCircles is not chained in the conventional way, check the\n * documentation for more info on how TimeCircles can be chained.\n *\n * After being called\/created, the public TimerCircles class will then- for each element\n * within it's collection, either fetch or create an instance of the private class.\n * Each function called upon the public class will be forwarded to each instance\n * of the private classes within the relevant element collection\n **\/\n 'use strict';\n (function(factory) {\n if (typeof define === 'function' && define.amd) {\n \/\/ AMD. Register as an anonymous module.\n define(['jquery', 'core\/notification'], factory);\n } else if (typeof exports === 'object') {\n \/\/ Node\/CommonJS.\n factory(require('jquery', 'core\/notification'));\n } else {\n \/\/ Browser globals.\n factory(jQuery);\n }\n }(function($, notification) {\n\n var useWindow = window;\n\n \/\/ From https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Object\/keys.\n if (!Object.keys) {\n Object.keys = (function() {\n var hasOwnProperty = Object.prototype.hasOwnProperty,\n hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\n dontEnums = [\n 'toString',\n 'toLocaleString',\n 'valueOf',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'constructor'\n ],\n dontEnumsLength = dontEnums.length;\n\n return function(obj) {\n if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\n throw new TypeError('Object.keys called on non-object');\n }\n\n var result = [], prop, i;\n\n for (prop in obj) {\n if (hasOwnProperty.call(obj, prop)) {\n result.push(prop);\n }\n }\n\n if (hasDontEnumBug) {\n for (i = 0; i < dontEnumsLength; i++) {\n if (hasOwnProperty.call(obj, dontEnums[i])) {\n result.push(dontEnums[i]);\n }\n }\n }\n return result;\n };\n }());\n }\n\n \/\/ Used to disable some features on IE8.\n var limited_mode = false;\n var tick_duration = 200; \/\/ In ms.\n\n var debug = (location.hash === \"#debug\");\n function debug_log(msg) {\n if (debug) {\n notification.exception({\n debuginfo: '',\n msg: msg\n });\n }\n }\n\n var allUnits = [\"Days\", \"Hours\", \"Minutes\", \"Seconds\"];\n var nextUnits = {\n Seconds: \"Minutes\",\n Minutes: \"Hours\",\n Hours: \"Days\",\n Days: \"Years\"\n };\n var secondsIn = {\n Seconds: 1,\n Minutes: 60,\n Hours: 3600,\n Days: 86400,\n Months: 2678400,\n Years: 31536000\n };\n\n \/**\n * Converts hex color code into object containing integer values for the r,g,b use\n * This function (hexToRgb) originates from:\n * http:\/\/stackoverflow.com\/questions\/5623838\/rgb-to-hex-and-hex-to-rgb\n * @param {string} hex color code\n *\/\n function hexToRgb(hex) {\n\n \/\/ Verify already RGB (e.g. \"rgb(0,0,0)\") or RGBA (e.g. \"rgba(0,0,0,0.5)\").\n var rgba = \/^rgba?\\(([\\d]+),([\\d]+),([\\d]+)(,([\\d\\.]+))?\\)$\/;\n if (rgba.test(hex)) {\n var result = rgba.exec(hex);\n return {\n r: parseInt(result[1]),\n g: parseInt(result[2]),\n b: parseInt(result[3]),\n a: parseInt(result[5] ? result[5] : 1)\n };\n }\n\n \/\/ Expand shorthand form (e.g. \"03F\") to full form (e.g. \"0033FF\").\n var shorthandRegex = \/^#?([a-f\\d])([a-f\\d])([a-f\\d])$\/i;\n hex = hex.replace(shorthandRegex, function(m, r, g, b) {\n return r + r + g + g + b + b;\n });\n\n var result = \/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$\/i.exec(hex);\n return result ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16)\n } : null;\n }\n\n function isCanvasSupported() {\n var elem = document.createElement('canvas');\n return !!(elem.getContext && elem.getContext('2d'));\n }\n\n \/**\n * Function s4() and guid() originate from:\n * http:\/\/stackoverflow.com\/questions\/105034\/how-to-create-a-guid-uuid-in-javascript\n *\/\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n\n \/**\n * Creates a unique id\n * @returns {String}\n *\/\n function guid() {\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\n s4() + '-' + s4() + s4() + s4();\n }\n\n if (!Array.prototype.indexOf) {\n \/**\n * Array.prototype.indexOf fallback for IE8\n * @param {Mixed} mixed\n * @returns {Number}\n *\/\n Array.prototype.indexOf = function(elt \/*, from*\/) {\n var len = this.length >>> 0;\n\n var from = Number(arguments[1]) || 0;\n from = (from < 0) ? Math.ceil(from) : Math.floor(from);\n if (from < 0) {\n from += len;\n }\n\n for (; from < len; from++) {\n if (from in this && this[from] === elt) {\n return from;\n }\n }\n return -1;\n };\n }\n\n function parse_date(str) {\n var match = str.match(\/^[0-9]{4}-[0-9]{2}-[0-9]{2}\\s[0-9]{1,2}:[0-9]{2}:[0-9]{2}$\/);\n if (match !== null && match.length > 0) {\n var parts = str.split(\" \");\n var date = parts[0].split(\"-\");\n var time = parts[1].split(\":\");\n return new Date(date[0], date[1] - 1, date[2], time[0], time[1], time[2]);\n }\n \/\/ Fallback for different date formats.\n var d = Date.parse(str);\n if (!isNaN(d)) {\n return d;\n }\n d = Date.parse(str.replace(\/-\/g, '\/').replace('T', ' '));\n if (!isNaN(d)) {\n return d;\n }\n \/\/ Cant find anything.\n return new Date();\n }\n\n function parse_times(diff, old_diff, total_duration, units, floor) {\n var raw_time = {};\n var raw_old_time = {};\n var time = {};\n var pct = {};\n var old_pct = {};\n var old_time = {};\n\n var greater_unit = null;\n for (var i = 0; i < units.length; i++) {\n var unit = units[i];\n var maxUnits;\n\n if (greater_unit === null) {\n maxUnits = total_duration \/ secondsIn[unit];\n } else {\n maxUnits = secondsIn[greater_unit] \/ secondsIn[unit];\n }\n\n var curUnits = (diff \/ secondsIn[unit]);\n var oldUnits = (old_diff \/ secondsIn[unit]);\n\n if (floor) {\n if (curUnits > 0) {\n curUnits = Math.floor(curUnits);\n } else {\n curUnits = Math.ceil(curUnits);\n }\n if (oldUnits > 0) {\n oldUnits = Math.floor(oldUnits);\n } else {\n oldUnits = Math.ceil(oldUnits);\n }\n }\n\n if (unit !== \"Hours\") {\n curUnits = curUnits % maxUnits;\n oldUnits = oldUnits % maxUnits;\n }\n\n raw_time[unit] = curUnits;\n time[unit] = Math.abs(curUnits);\n raw_old_time[unit] = oldUnits;\n old_time[unit] = Math.abs(oldUnits);\n pct[unit] = Math.abs(curUnits) \/ maxUnits;\n old_pct[unit] = Math.abs(oldUnits) \/ maxUnits;\n\n greater_unit = unit;\n }\n\n return {\n raw_time: raw_time,\n raw_old_time: raw_old_time,\n time: time,\n old_time: old_time,\n pct: pct,\n old_pct: old_pct\n };\n }\n\n var TC_Instance_List = {};\n function updateUsedWindow() {\n if (typeof useWindow.TC_Instance_List !== \"undefined\") {\n TC_Instance_List = useWindow.TC_Instance_List;\n }\n else {\n useWindow.TC_Instance_List = TC_Instance_List;\n }\n initializeAnimationFrameHandler(useWindow);\n };\n\n function initializeAnimationFrameHandler(w) {\n var vendors = ['webkit', 'moz'];\n for (var x = 0; x < vendors.length && !w.requestAnimationFrame; ++x) {\n w.requestAnimationFrame = w[vendors[x] + 'RequestAnimationFrame'];\n w.cancelAnimationFrame = w[vendors[x] + 'CancelAnimationFrame'];\n }\n\n if (!w.requestAnimationFrame || !w.cancelAnimationFrame) {\n w.requestAnimationFrame = function(callback, element, instance) {\n if (typeof instance === \"undefined\") {\n instance = {data: {last_frame: 0}};\n }\n var currTime = new Date().getTime();\n var timeToCall = Math.max(0, 16 - (currTime - instance.data.last_frame));\n var id = w.setTimeout(function() {\n callback(currTime + timeToCall);\n }, timeToCall);\n instance.data.last_frame = currTime + timeToCall;\n return id;\n };\n w.cancelAnimationFrame = function(id) {\n clearTimeout(id);\n };\n }\n }\n\n var TC_Instance = function(element, options) {\n this.element = element;\n this.container;\n this.listeners = null;\n this.data = {\n paused: false,\n last_frame: 0,\n animation_frame: null,\n interval_fallback: null,\n timer: false,\n total_duration: null,\n prev_time: null,\n drawn_units: [],\n text_elements: {\n Days: null,\n Hours: null,\n Minutes: null,\n Seconds: null\n },\n attributes: {\n canvas: null,\n context: null,\n item_size: null,\n line_width: null,\n radius: null,\n outer_radius: null\n },\n state: {\n fading: {\n Days: false,\n Hours: false,\n Minutes: false,\n Seconds: false\n }\n }\n };\n\n this.config = null;\n this.setOptions(options);\n this.initialize();\n };\n\n TC_Instance.prototype.clearListeners = function() {\n this.listeners = { all: [], visible: [] };\n };\n\n TC_Instance.prototype.addTime = function(seconds_to_add) {\n if (this.data.attributes.ref_date instanceof Date) {\n var d = this.data.attributes.ref_date;\n d.setSeconds(d.getSeconds() + seconds_to_add);\n }\n else if (!isNaN(this.data.attributes.ref_date)) {\n this.data.attributes.ref_date += (seconds_to_add * 1000);\n }\n };\n\n TC_Instance.prototype.initialize = function(clear_listeners) {\n \/\/ Initialize drawn units.\n this.data.drawn_units = [];\n for (var i = 0; i < Object.keys(this.config.time).length; i++) {\n var unit = Object.keys(this.config.time)[i];\n if (this.config.time[unit].show) {\n this.data.drawn_units.push(unit);\n }\n }\n\n \/\/ Avoid stacking.\n $(this.element).children('div.time_circles').remove();\n\n if (typeof clear_listeners === \"undefined\") {\n clear_listeners = true;\n }\n if (clear_listeners || this.listeners === null) {\n this.clearListeners();\n }\n this.container = $(\"
\");\n this.container.addClass('time_circles');\n this.container.appendTo(this.element);\n\n \/\/ Determine the needed width and height of TimeCircles.\n var height = this.element.offsetHeight;\n var width = this.element.offsetWidth;\n if (height === 0) {\n height = $(this.element).height();\n }\n if (width === 0) {\n width = $(this.element).width();\n }\n\n if (height === 0 && width > 0) {\n height = width \/ this.data.drawn_units.length;\n }\n else if (width === 0 && height > 0) {\n width = height * this.data.drawn_units.length;\n }\n\n \/\/ Create our canvas and set it to the appropriate size.\n var canvasElement = document.createElement('canvas');\n canvasElement.width = width;\n canvasElement.height = height;\n\n \/\/ Add canvas elements.\n this.data.attributes.canvas = $(canvasElement);\n this.data.attributes.canvas.appendTo(this.container);\n\n \/\/ Check if the browser has browser support.\n var canvasSupported = isCanvasSupported();\n \/\/ If the browser doesn't have browser support, check if explorer canvas is loaded.\n \/\/ (A javascript library that adds canvas support to browsers that don't have it).\n if (!canvasSupported && typeof G_vmlCanvasManager !== \"undefined\") {\n G_vmlCanvasManager.initElement(canvasElement);\n limited_mode = true;\n canvasSupported = true;\n }\n if (canvasSupported) {\n this.data.attributes.context = canvasElement.getContext('2d');\n }\n\n this.data.attributes.item_size = Math.min(width \/ this.data.drawn_units.length, height);\n this.data.attributes.line_width = this.data.attributes.item_size * this.config.fg_width;\n this.data.attributes.radius = ((this.data.attributes.item_size * 0.8) - this.data.attributes.line_width) \/ 2;\n this.data.attributes.outer_radius = this.data.attributes.radius + 0.5 * Math.max(this.data.attributes.line_width, this.data.attributes.line_width * this.config.bg_width);\n\n \/\/ Prepare Time Elements.\n var i = 0;\n for (var key in this.data.text_elements) {\n if (!this.config.time[key].show) {\n continue;\n }\n\n var textElement = $(\"
\");\n textElement.addClass('textDiv_' + key);\n textElement.css(\"top\", Math.round(0.35 * this.data.attributes.item_size));\n textElement.css(\"left\", Math.round(i++ * this.data.attributes.item_size));\n textElement.css(\"width\", this.data.attributes.item_size);\n textElement.appendTo(this.container);\n\n var headerElement = $(\"

\");\n headerElement.text(this.config.time[key].text); \/\/ Options.\n headerElement.css(\"font-size\", Math.round(this.config.text_size * this.data.attributes.item_size));\n headerElement.appendTo(textElement);\n\n var numberElement = $(\"\");\n numberElement.css(\"font-size\", Math.round(this.config.number_size * this.data.attributes.item_size));\n numberElement.appendTo(textElement);\n\n this.data.text_elements[key] = numberElement;\n }\n\n this.start();\n if (!this.config.start) {\n this.data.paused = true;\n }\n\n \/\/ Set up interval fallback.\n var _this = this;\n this.data.interval_fallback = useWindow.setInterval(function() {\n _this.update.call(_this, true);\n }, 100);\n };\n\n TC_Instance.prototype.update = function(nodraw) {\n if (typeof nodraw === \"undefined\") {\n nodraw = false;\n }\n else if (nodraw && this.data.paused) {\n return;\n }\n\n if (limited_mode) {\n \/\/ Per unit clearing doesn't work in IE8 using explorer canvas, so do it in one time. The downside is that radial fade cant be used.\n this.data.attributes.context.clearRect(0, 0, this.data.attributes.canvas[0].width, this.data.attributes.canvas[0].hright);\n }\n var diff, old_diff;\n\n var prevDate = this.data.prev_time;\n var curDate = new Date();\n this.data.prev_time = curDate;\n\n if (prevDate === null) {\n prevDate = curDate;\n }\n\n \/\/ If not counting past zero, and time < 0, then simply draw the zero point once, and call stop.\n if (!this.config.count_past_zero) {\n if (curDate > this.data.attributes.ref_date) {\n for (var i = 0; i < this.data.drawn_units.length; i++) {\n var key = this.data.drawn_units[i];\n\n \/\/ Set the text value.\n this.data.text_elements[key].text(\"0\");\n var x = (i * this.data.attributes.item_size) + (this.data.attributes.item_size \/ 2);\n var y = this.data.attributes.item_size \/ 2;\n var color = this.config.time[key].color;\n this.drawArc(x, y, color, 0);\n }\n this.stop();\n return;\n }\n }\n\n \/\/ Compare current time with reference.\n diff = (this.data.attributes.ref_date - curDate) \/ 1000;\n old_diff = (this.data.attributes.ref_date - prevDate) \/ 1000;\n\n var floor = this.config.animation !== \"smooth\";\n\n var visible_times = parse_times(diff, old_diff, this.data.total_duration, this.data.drawn_units, floor);\n var all_times = parse_times(diff, old_diff, secondsIn[\"Years\"], allUnits, floor);\n\n var i = 0;\n var j = 0;\n var lastKey = null;\n\n var cur_shown = this.data.drawn_units.slice();\n for (var i in allUnits) {\n var key = allUnits[i];\n\n \/\/ Notify (all) listeners.\n if (Math.floor(all_times.raw_time[key]) !== Math.floor(all_times.raw_old_time[key])) {\n this.notifyListeners(key, Math.floor(all_times.time[key]), Math.floor(diff), \"all\");\n }\n\n if (cur_shown.indexOf(key) < 0) {\n continue;\n }\n\n \/\/ Notify (visible) listeners.\n if (Math.floor(visible_times.raw_time[key]) !== Math.floor(visible_times.raw_old_time[key])) {\n this.notifyListeners(key, Math.floor(visible_times.time[key]), Math.floor(diff), \"visible\");\n }\n\n if (!nodraw) {\n \/\/ Set the text value.\n this.data.text_elements[key].text(Math.floor(Math.abs(visible_times.time[key])));\n\n var x = (j * this.data.attributes.item_size) + (this.data.attributes.item_size \/ 2);\n var y = this.data.attributes.item_size \/ 2;\n var color = this.config.time[key].color;\n\n if (this.config.animation === \"smooth\") {\n if (lastKey !== null && !limited_mode) {\n if (Math.floor(visible_times.time[lastKey]) > Math.floor(visible_times.old_time[lastKey])) {\n this.radialFade(x, y, color, 1, key);\n this.data.state.fading[key] = true;\n }\n else if (Math.floor(visible_times.time[lastKey]) < Math.floor(visible_times.old_time[lastKey])) {\n this.radialFade(x, y, color, 0, key);\n this.data.state.fading[key] = true;\n }\n }\n if (!this.data.state.fading[key]) {\n this.drawArc(x, y, color, visible_times.pct[key]);\n }\n }\n else {\n this.animateArc(x, y, color, visible_times.pct[key], visible_times.old_pct[key], (new Date()).getTime() + tick_duration);\n }\n }\n lastKey = key;\n j++;\n }\n\n \/\/ Dont request another update if we should be paused.\n if (this.data.paused || nodraw) {\n return;\n }\n\n \/\/ We need this for our next frame either way.\n var _this = this;\n var update = function() {\n _this.update.call(_this);\n };\n\n \/\/ Either call next update immediately, or in a second.\n if (this.config.animation === \"smooth\") {\n \/\/ Smooth animation, Queue up the next frame.\n this.data.animation_frame = useWindow.requestAnimationFrame(update, _this.element, _this);\n }\n else {\n \/\/ Tick animation, Don't queue until very slightly after the next second happens.\n var delay = (diff % 1) * 1000;\n if (delay < 0) {\n delay = 1000 + delay;\n }\n delay += 50;\n\n _this.data.animation_frame = useWindow.setTimeout(function() {\n _this.data.animation_frame = useWindow.requestAnimationFrame(update, _this.element, _this);\n }, delay);\n }\n };\n\n TC_Instance.prototype.animateArc = function(x, y, color, target_pct, cur_pct, animation_end) {\n if (this.data.attributes.context === null) {\n return;\n }\n\n var diff = cur_pct - target_pct;\n if (Math.abs(diff) > 0.5) {\n if (target_pct === 0) {\n this.radialFade(x, y, color, 1);\n }\n else {\n this.radialFade(x, y, color, 0);\n }\n }\n else {\n var progress = (tick_duration - (animation_end - (new Date()).getTime())) \/ tick_duration;\n if (progress > 1) {\n progress = 1;\n }\n\n var pct = (cur_pct * (1 - progress)) + (target_pct * progress);\n this.drawArc(x, y, color, pct);\n\n if (progress >= 1) {\n return;\n }\n var _this = this;\n useWindow.requestAnimationFrame(function() {\n _this.animateArc(x, y, color, target_pct, cur_pct, animation_end);\n }, this.element);\n }\n };\n\n TC_Instance.prototype.drawArc = function(x, y, color, pct) {\n if (this.data.attributes.context === null) {\n return;\n }\n\n var clear_radius = Math.max(this.data.attributes.outer_radius, this.data.attributes.item_size \/ 2);\n if (!limited_mode) {\n this.data.attributes.context.clearRect(\n x - clear_radius,\n y - clear_radius,\n clear_radius * 2,\n clear_radius * 2\n );\n }\n\n if (this.config.use_background) {\n this.data.attributes.context.beginPath();\n this.data.attributes.context.arc(x, y, this.data.attributes.radius, 0, 2 * Math.PI, false);\n this.data.attributes.context.lineWidth = this.data.attributes.line_width * this.config.bg_width;\n\n \/\/ Line color.\n this.data.attributes.context.strokeStyle = this.config.circle_bg_color;\n this.data.attributes.context.stroke();\n }\n\n \/\/ Direction.\n var startAngle, endAngle, counterClockwise;\n var defaultOffset = (-0.5 * Math.PI);\n var fullCircle = 2 * Math.PI;\n startAngle = defaultOffset + (this.config.start_angle \/ 360 * fullCircle);\n var offset = (2 * pct * Math.PI);\n\n if (this.config.direction === \"Both\") {\n counterClockwise = false;\n startAngle -= (offset \/ 2);\n endAngle = startAngle + offset;\n }\n else {\n if (this.config.direction === \"Clockwise\") {\n counterClockwise = false;\n endAngle = startAngle + offset;\n }\n else {\n counterClockwise = true;\n endAngle = startAngle - offset;\n }\n }\n\n this.data.attributes.context.beginPath();\n this.data.attributes.context.arc(x, y, this.data.attributes.radius, startAngle, endAngle, counterClockwise);\n this.data.attributes.context.lineWidth = this.data.attributes.line_width;\n\n \/\/ Line color.\n this.data.attributes.context.strokeStyle = color;\n this.data.attributes.context.stroke();\n };\n\n TC_Instance.prototype.radialFade = function(x, y, color, from, key) {\n \/\/ TODO: Make fade_time option.\n var rgb = hexToRgb(color);\n var _this = this; \/\/ We have a few inner scopes here that will need access to our instance.\n\n var step = 0.2 * ((from === 1) ? -1 : 1);\n var i;\n for (i = 0; from <= 1 && from >= 0; i++) {\n \/\/ Create inner scope so our variables are not changed by the time the Timeout triggers.\n (function() {\n var delay = 50 * i;\n var rgba = \"rgba(\" + rgb.r + \", \" + rgb.g + \", \" + rgb.b + \", \" + (Math.round(from * 10) \/ 10) + \")\";\n useWindow.setTimeout(function() {\n _this.drawArc(x, y, rgba, 1);\n }, delay);\n }());\n from += step;\n }\n if (typeof key !== undefined) {\n useWindow.setTimeout(function() {\n _this.data.state.fading[key] = false;\n }, 50 * i);\n }\n };\n\n TC_Instance.prototype.timeLeft = function() {\n if (this.data.paused && typeof this.data.timer === \"number\") {\n return this.data.timer;\n }\n var now = new Date();\n return ((this.data.attributes.ref_date - now) \/ 1000);\n };\n\n TC_Instance.prototype.start = function() {\n useWindow.cancelAnimationFrame(this.data.animation_frame);\n useWindow.clearTimeout(this.data.animation_frame);\n\n \/\/ Check if a date was passed in html attribute or jquery data.\n var attr_data_date = $(this.element).data('date');\n if (typeof attr_data_date === \"undefined\") {\n attr_data_date = $(this.element).attr('data-date');\n }\n if (typeof attr_data_date === \"string\") {\n this.data.attributes.ref_date = parse_date(attr_data_date);\n }\n \/\/ Check if this is an unpause of a timer.\n else if (typeof this.data.timer === \"number\") {\n if (this.data.paused) {\n this.data.attributes.ref_date = (new Date()).getTime() + (this.data.timer * 1000);\n }\n }\n else {\n \/\/ Try to get data-timer.\n var attr_data_timer = $(this.element).data('timer');\n if (typeof attr_data_timer === \"undefined\") {\n attr_data_timer = $(this.element).attr('data-timer');\n }\n if (typeof attr_data_timer === \"string\") {\n attr_data_timer = parseFloat(attr_data_timer);\n }\n if (typeof attr_data_timer === \"number\") {\n this.data.timer = attr_data_timer;\n this.data.attributes.ref_date = (new Date()).getTime() + (attr_data_timer * 1000);\n }\n else {\n \/\/ Data-timer and data-date were both not set.\n \/\/ Use config date.\n this.data.attributes.ref_date = this.config.ref_date;\n }\n }\n\n \/\/ Start running.\n this.data.paused = false;\n this.update.call(this);\n };\n\n TC_Instance.prototype.restart = function() {\n this.data.timer = false;\n this.start();\n };\n\n TC_Instance.prototype.stop = function() {\n if (typeof this.data.timer === \"number\") {\n this.data.timer = this.timeLeft(this);\n }\n \/\/ Stop running.\n this.data.paused = true;\n useWindow.cancelAnimationFrame(this.data.animation_frame);\n };\n\n TC_Instance.prototype.destroy = function() {\n this.clearListeners();\n this.stop();\n useWindow.clearInterval(this.data.interval_fallback);\n this.data.interval_fallback = null;\n\n this.container.remove();\n $(this.element).removeAttr('data-tc-id');\n $(this.element).removeData('tc-id');\n };\n\n TC_Instance.prototype.setOptions = function(options) {\n if (this.config === null) {\n this.default_options.ref_date = new Date();\n this.config = $.extend(true, {}, this.default_options);\n }\n $.extend(true, this.config, options);\n\n \/\/ Use window.top if use_top_frame is true.\n if (this.config.use_top_frame) {\n useWindow = window.top;\n }\n else {\n useWindow = window;\n }\n updateUsedWindow();\n\n this.data.total_duration = this.config.total_duration;\n if (typeof this.data.total_duration === \"string\") {\n if (typeof secondsIn[this.data.total_duration] !== \"undefined\") {\n \/\/ If set to Years, Months, Days, Hours or Minutes, fetch the secondsIn value for that.\n this.data.total_duration = secondsIn[this.data.total_duration];\n }\n else if (this.data.total_duration === \"Auto\") {\n \/\/ If set to auto, total_duration is the size of 1 unit, of the unit type bigger than the largest shown.\n for (var i = 0; i < Object.keys(this.config.time).length; i++) {\n var unit = Object.keys(this.config.time)[i];\n if (this.config.time[unit].show) {\n this.data.total_duration = secondsIn[nextUnits[unit]];\n break;\n }\n }\n }\n else {\n \/\/ If it's a string, but neither of the above, user screwed up.\n this.data.total_duration = secondsIn[\"Years\"];\n notification.exception({\n debuginfo: '',\n msg: \"Valid values for TimeCircles config.total_duration are either numeric, or (string) Years, Months, Days, Hours, Minutes, Auto\"\n });\n }\n }\n };\n\n TC_Instance.prototype.addListener = function(f, context, type) {\n if (typeof f !== \"function\") {\n return;\n }\n if (typeof type === \"undefined\") {\n type = \"visible\";\n }\n this.listeners[type].push({func: f, scope: context});\n };\n\n TC_Instance.prototype.notifyListeners = function(unit, value, total, type) {\n for (var i = 0; i < this.listeners[type].length; i++) {\n var listener = this.listeners[type][i];\n listener.func.apply(listener.scope, [unit, value, total]);\n }\n };\n\n TC_Instance.prototype.default_options = {\n ref_date: new Date(),\n start: true,\n animation: \"smooth\",\n count_past_zero: true,\n circle_bg_color: \"#60686F\",\n use_background: true,\n fg_width: 0.1,\n bg_width: 1.2,\n text_size: 0.07,\n number_size: 0.28,\n total_duration: \"Auto\",\n direction: \"Clockwise\",\n use_top_frame: false,\n start_angle: 0,\n time: {\n Days: {\n show: true,\n text: \"Days\",\n color: \"#FC6\"\n },\n Hours: {\n show: true,\n text: \"Hours\",\n color: \"#9CF\"\n },\n Minutes: {\n show: true,\n text: \"Minutes\",\n color: \"#BFB\"\n },\n Seconds: {\n show: true,\n text: \"Seconds\",\n color: \"#F99\"\n }\n }\n };\n\n \/\/ Time circle class.\n var TC_Class = function(elements, options) {\n this.elements = elements;\n this.options = options;\n this.foreach();\n };\n\n TC_Class.prototype.getInstance = function(element) {\n var instance;\n\n var cur_id = $(element).data(\"tc-id\");\n if (typeof cur_id === \"undefined\") {\n cur_id = guid();\n $(element).attr(\"data-tc-id\", cur_id);\n }\n if (typeof TC_Instance_List[cur_id] === \"undefined\") {\n var options = this.options;\n var element_options = $(element).data('options');\n if (typeof element_options === \"string\") {\n element_options = JSON.parse(element_options);\n }\n if (typeof element_options === \"object\") {\n options = $.extend(true, {}, this.options, element_options);\n }\n instance = new TC_Instance(element, options);\n TC_Instance_List[cur_id] = instance;\n }\n else {\n instance = TC_Instance_List[cur_id];\n if (typeof this.options !== \"undefined\") {\n instance.setOptions(this.options);\n }\n }\n return instance;\n };\n\n TC_Class.prototype.addTime = function(seconds_to_add) {\n this.foreach(function(instance) {\n instance.addTime(seconds_to_add);\n });\n };\n\n TC_Class.prototype.foreach = function(callback) {\n var _this = this;\n this.elements.each(function() {\n var instance = _this.getInstance(this);\n if (typeof callback === \"function\") {\n callback(instance);\n }\n });\n return this;\n };\n\n TC_Class.prototype.start = function() {\n this.foreach(function(instance) {\n instance.start();\n });\n return this;\n };\n\n TC_Class.prototype.stop = function() {\n this.foreach(function(instance) {\n instance.stop();\n });\n return this;\n };\n\n TC_Class.prototype.restart = function() {\n this.foreach(function(instance) {\n instance.restart();\n });\n return this;\n };\n\n TC_Class.prototype.rebuild = function() {\n this.foreach(function(instance) {\n instance.initialize(false);\n });\n return this;\n };\n\n TC_Class.prototype.getTime = function() {\n return this.getInstance(this.elements[0]).timeLeft();\n };\n\n TC_Class.prototype.addListener = function(f, type) {\n if (typeof type === \"undefined\") {\n type = \"visible\";\n }\n var _this = this;\n this.foreach(function(instance) {\n instance.addListener(f, _this.elements, type);\n });\n return this;\n };\n\n TC_Class.prototype.destroy = function() {\n this.foreach(function(instance) {\n instance.destroy();\n });\n return this;\n };\n\n TC_Class.prototype.end = function() {\n return this.elements;\n };\n\n $.fn.TimeCircles = function(options) {\n return new TC_Class(this, options);\n };\n }));\n"],"names":["factory","$","notification","hasOwnProperty","hasDontEnumBug","dontEnums","dontEnumsLength","useWindow","window","Object","keys","prototype","toString","propertyIsEnumerable","length","obj","TypeError","prop","i","result","call","push","limited_mode","location","hash","allUnits","nextUnits","Seconds","Minutes","Hours","Days","secondsIn","Months","Years","s4","Math","floor","random","substring","parse_times","diff","old_diff","total_duration","units","raw_time","raw_old_time","time","pct","old_pct","old_time","greater_unit","maxUnits","unit","curUnits","oldUnits","ceil","abs","Array","indexOf","elt","len","this","from","Number","arguments","TC_Instance_List","updateUsedWindow","w","vendors","x","requestAnimationFrame","cancelAnimationFrame","callback","element","instance","data","last_frame","currTime","Date","getTime","timeToCall","max","id","setTimeout","clearTimeout","initializeAnimationFrameHandler","TC_Instance","options","container","listeners","paused","animation_frame","interval_fallback","timer","prev_time","drawn_units","text_elements","attributes","canvas","context","item_size","line_width","radius","outer_radius","state","fading","config","setOptions","initialize","clearListeners","all","visible","addTime","seconds_to_add","ref_date","d","setSeconds","getSeconds","isNaN","clear_listeners","show","children","remove","addClass","appendTo","height","offsetHeight","width","offsetWidth","canvasElement","document","createElement","elem","canvasSupported","getContext","key","G_vmlCanvasManager","initElement","min","fg_width","bg_width","textElement","css","round","headerElement","text","text_size","numberElement","number_size","start","_this","setInterval","update","nodraw","clearRect","hright","prevDate","curDate","count_past_zero","y","color","drawArc","stop","animation","visible_times","all_times","j","lastKey","cur_shown","slice","notifyListeners","radialFade","animateArc","delay","target_pct","cur_pct","animation_end","progress","startAngle","endAngle","counterClockwise","clear_radius","use_background","beginPath","arc","PI","lineWidth","strokeStyle","circle_bg_color","stroke","defaultOffset","fullCircle","start_angle","offset","direction","rgb","hex","rgba","test","exec","r","parseInt","g","b","a","replace","m","hexToRgb","step","undefined","timeLeft","now","attr_data_date","attr","str","match","parts","split","date","parse","parse_date","attr_data_timer","parseFloat","restart","destroy","clearInterval","removeAttr","removeData","default_options","extend","use_top_frame","top","exception","debuginfo","msg","addListener","f","type","func","scope","value","total","listener","apply","TC_Class","elements","foreach","getInstance","cur_id","element_options","JSON","each","rebuild","end","fn","TimeCircles","define","amd","exports","require","jQuery"],"mappings":"AAiBE,IAASA,QAAAA,QAWR,SAASC,EAAGC,kBAOEC,eACIC,eACAC,UASAC,gBAhBZC,UAAYC,OAGXC,OAAOC,OACRD,OAAOC,MACCP,eAAiBM,OAAOE,UAAUR,eAC9BC,gBAAmB,CAACQ,SAAU,MAAOC,qBAAqB,YAU1DP,iBATAD,UAAY,CACR,WACA,iBACA,UACA,iBACA,gBACA,uBACA,gBAEwBS,OAE7B,SAASC,QACO,iBAARA,MAAoC,mBAARA,KAA8B,OAARA,WACnD,IAAIC,UAAU,wCAGPC,KAAMC,EAAnBC,OAAS,OAERF,QAAQF,IACLZ,eAAeiB,KAAKL,IAAKE,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