From 9d9ecb07298086be469c31d737ba828bbabd3f3c Mon Sep 17 00:00:00 2001 From: Win Parker Date: Fri, 9 Aug 2024 17:18:20 +0700 Subject: [PATCH] moved to local assets --- assets/.DS_Store | Bin 10244 -> 10244 bytes assets/css/odometer-theme-default.css | 98 ++++ assets/js/jquery-3.7.1.min.js | 2 + assets/js/odometer.js | 632 ++++++++++++++++++++++++++ index.html | 7 +- 5 files changed, 736 insertions(+), 3 deletions(-) create mode 100644 assets/css/odometer-theme-default.css create mode 100644 assets/js/jquery-3.7.1.min.js create mode 100644 assets/js/odometer.js diff --git a/assets/.DS_Store b/assets/.DS_Store index e2bd42d932e5e186050399d3d2b6f7dd05cba3cc..0c68bf1b8d5e02bd374d6ffc29ac883d916de087 100644 GIT binary patch delta 96 zcmZn(XbIS0F3z}n@&buM9_i|8LlZL{1zjUklgV=hWEp!W?-r0}?A!cFT!dpYyMh5b ZUWGz^3=9mc3~3Dc40#MC48=L=h5(U`8%h8G delta 95 zcmZn(XbIS0F3z}X@+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",le.option=!!xe.lastChild;var ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n",""]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="
",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0'; + + DIGIT_HTML = '8' + RIBBON_HTML + ''; + + FORMAT_MARK_HTML = ''; + + DIGIT_FORMAT = '(,ddd).dd'; + + FORMAT_PARSER = /^\(?([^)]*)\)?(?:(.)(d+))?$/; + + FRAMERATE = 30; + + DURATION = 2000; + + COUNT_FRAMERATE = 20; + + FRAMES_PER_VALUE = 2; + + DIGIT_SPEEDBOOST = .5; + + MS_PER_FRAME = 1000 / FRAMERATE; + + COUNT_MS_PER_FRAME = 1000 / COUNT_FRAMERATE; + + TRANSITION_END_EVENTS = 'transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd'; + + transitionCheckStyles = document.createElement('div').style; + + TRANSITION_SUPPORT = (transitionCheckStyles.transition != null) || (transitionCheckStyles.webkitTransition != null) || (transitionCheckStyles.mozTransition != null) || (transitionCheckStyles.oTransition != null); + + requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; + + MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; + + createFromHTML = function(html) { + var el; + el = document.createElement('div'); + el.innerHTML = html; + return el.children[0]; + }; + + removeClass = function(el, name) { + return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' '); + }; + + addClass = function(el, name) { + removeClass(el, name); + return el.className += " " + name; + }; + + trigger = function(el, name) { + var evt; + if (document.createEvent != null) { + evt = document.createEvent('HTMLEvents'); + evt.initEvent(name, true, true); + return el.dispatchEvent(evt); + } + }; + + now = function() { + var _ref, _ref1; + return (_ref = (_ref1 = window.performance) != null ? typeof _ref1.now === "function" ? _ref1.now() : void 0 : void 0) != null ? _ref : +(new Date); + }; + + round = function(val, precision) { + if (precision == null) { + precision = 0; + } + if (!precision) { + return Math.round(val); + } + val *= Math.pow(10, precision); + val += 0.5; + val = Math.floor(val); + return val /= Math.pow(10, precision); + }; + + truncate = function(val) { + if (val < 0) { + return Math.ceil(val); + } else { + return Math.floor(val); + } + }; + + fractionalPart = function(val) { + return val - round(val); + }; + + _jQueryWrapped = false; + + (wrapJQuery = function() { + var property, _i, _len, _ref, _results; + if (_jQueryWrapped) { + return; + } + if (window.jQuery != null) { + _jQueryWrapped = true; + _ref = ['html', 'text']; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + property = _ref[_i]; + _results.push((function(property) { + var old; + old = window.jQuery.fn[property]; + return window.jQuery.fn[property] = function(val) { + var _ref1; + if ((val == null) || (((_ref1 = this[0]) != null ? _ref1.odometer : void 0) == null)) { + return old.apply(this, arguments); + } + return this[0].odometer.update(val); + }; + })(property)); + } + return _results; + } + })(); + + setTimeout(wrapJQuery, 0); + + Odometer = (function() { + function Odometer(options) { + var e, k, property, v, _base, _i, _len, _ref, _ref1, _ref2, + _this = this; + this.options = options; + this.el = this.options.el; + if (this.el.odometer != null) { + return this.el.odometer; + } + this.el.odometer = this; + _ref = Odometer.options; + for (k in _ref) { + v = _ref[k]; + if (this.options[k] == null) { + this.options[k] = v; + } + } + if ((_base = this.options).duration == null) { + _base.duration = DURATION; + } + this.MAX_VALUES = ((this.options.duration / MS_PER_FRAME) / FRAMES_PER_VALUE) | 0; + this.resetFormat(); + this.value = this.cleanValue((_ref1 = this.options.value) != null ? _ref1 : ''); + this.renderInside(); + this.render(); + try { + _ref2 = ['innerHTML', 'innerText', 'textContent']; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + property = _ref2[_i]; + if (this.el[property] != null) { + (function(property) { + return Object.defineProperty(_this.el, property, { + get: function() { + var _ref3; + if (property === 'innerHTML') { + return _this.inside.outerHTML; + } else { + return (_ref3 = _this.inside.innerText) != null ? _ref3 : _this.inside.textContent; + } + }, + set: function(val) { + return _this.update(val); + } + }); + })(property); + } + } + } catch (_error) { + e = _error; + this.watchForMutations(); + } + this; + } + + Odometer.prototype.renderInside = function() { + this.inside = document.createElement('div'); + this.inside.className = 'odometer-inside'; + this.el.innerHTML = ''; + return this.el.appendChild(this.inside); + }; + + Odometer.prototype.watchForMutations = function() { + var e, + _this = this; + if (MutationObserver == null) { + return; + } + try { + if (this.observer == null) { + this.observer = new MutationObserver(function(mutations) { + var newVal; + newVal = _this.el.innerText; + _this.renderInside(); + _this.render(_this.value); + return _this.update(newVal); + }); + } + this.watchMutations = true; + return this.startWatchingMutations(); + } catch (_error) { + e = _error; + } + }; + + Odometer.prototype.startWatchingMutations = function() { + if (this.watchMutations) { + return this.observer.observe(this.el, { + childList: true + }); + } + }; + + Odometer.prototype.stopWatchingMutations = function() { + var _ref; + return (_ref = this.observer) != null ? _ref.disconnect() : void 0; + }; + + Odometer.prototype.cleanValue = function(val) { + var _ref; + if (typeof val === 'string') { + val = val.replace((_ref = this.format.radix) != null ? _ref : '.', ''); + val = val.replace(/[.,]/g, ''); + val = val.replace('', '.'); + val = parseFloat(val, 10) || 0; + } + return round(val, this.format.precision); + }; + + Odometer.prototype.bindTransitionEnd = function() { + var event, renderEnqueued, _i, _len, _ref, _results, + _this = this; + if (this.transitionEndBound) { + return; + } + this.transitionEndBound = true; + renderEnqueued = false; + _ref = TRANSITION_END_EVENTS.split(' '); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + event = _ref[_i]; + _results.push(this.el.addEventListener(event, function() { + if (renderEnqueued) { + return true; + } + renderEnqueued = true; + setTimeout(function() { + _this.render(); + renderEnqueued = false; + return trigger(_this.el, 'odometerdone'); + }, 0); + return true; + }, false)); + } + return _results; + }; + + Odometer.prototype.resetFormat = function() { + var format, fractional, parsed, precision, radix, repeating, _ref, _ref1; + format = (_ref = this.options.format) != null ? _ref : DIGIT_FORMAT; + format || (format = 'd'); + parsed = FORMAT_PARSER.exec(format); + if (!parsed) { + throw new Error("Odometer: Unparsable digit format"); + } + _ref1 = parsed.slice(1, 4), repeating = _ref1[0], radix = _ref1[1], fractional = _ref1[2]; + precision = (fractional != null ? fractional.length : void 0) || 0; + return this.format = { + repeating: repeating, + radix: radix, + precision: precision + }; + }; + + Odometer.prototype.render = function(value) { + var classes, cls, digit, match, newClasses, theme, wholePart, _i, _j, _len, _len1, _ref; + if (value == null) { + value = this.value; + } + this.stopWatchingMutations(); + this.resetFormat(); + this.inside.innerHTML = ''; + theme = this.options.theme; + classes = this.el.className.split(' '); + newClasses = []; + for (_i = 0, _len = classes.length; _i < _len; _i++) { + cls = classes[_i]; + if (!cls.length) { + continue; + } + if (match = /^odometer-theme-(.+)$/.exec(cls)) { + theme = match[1]; + continue; + } + if (/^odometer(-|$)/.test(cls)) { + continue; + } + newClasses.push(cls); + } + newClasses.push('odometer'); + if (!TRANSITION_SUPPORT) { + newClasses.push('odometer-no-transitions'); + } + if (theme) { + newClasses.push("odometer-theme-" + theme); + } else { + newClasses.push("odometer-auto-theme"); + } + this.el.className = newClasses.join(' '); + this.ribbons = {}; + this.digits = []; + wholePart = !this.format.precision || !fractionalPart(value) || false; + _ref = value.toString().split('').reverse(); + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { + digit = _ref[_j]; + if (digit === '.') { + wholePart = true; + } + this.addDigit(digit, wholePart); + } + return this.startWatchingMutations(); + }; + + Odometer.prototype.update = function(newValue) { + var diff, + _this = this; + newValue = this.cleanValue(newValue); + if (!(diff = newValue - this.value)) { + return; + } + removeClass(this.el, 'odometer-animating-up odometer-animating-down odometer-animating'); + if (diff > 0) { + addClass(this.el, 'odometer-animating-up'); + } else { + addClass(this.el, 'odometer-animating-down'); + } + this.stopWatchingMutations(); + this.animate(newValue); + this.startWatchingMutations(); + setTimeout(function() { + _this.el.offsetHeight; + return addClass(_this.el, 'odometer-animating'); + }, 0); + return this.value = newValue; + }; + + Odometer.prototype.renderDigit = function() { + return createFromHTML(DIGIT_HTML); + }; + + Odometer.prototype.insertDigit = function(digit, before) { + if (before != null) { + return this.inside.insertBefore(digit, before); + } else if (!this.inside.children.length) { + return this.inside.appendChild(digit); + } else { + return this.inside.insertBefore(digit, this.inside.children[0]); + } + }; + + Odometer.prototype.addSpacer = function(chr, before, extraClasses) { + var spacer; + spacer = createFromHTML(FORMAT_MARK_HTML); + spacer.innerHTML = chr; + if (extraClasses) { + addClass(spacer, extraClasses); + } + return this.insertDigit(spacer, before); + }; + + Odometer.prototype.addDigit = function(value, repeating) { + var chr, digit, resetted, _ref; + if (repeating == null) { + repeating = true; + } + if (value === '-') { + return this.addSpacer(value, null, 'odometer-negation-mark'); + } + if (value === '.') { + return this.addSpacer((_ref = this.format.radix) != null ? _ref : '.', null, 'odometer-radix-mark'); + } + if (repeating) { + resetted = false; + while (true) { + if (!this.format.repeating.length) { + if (resetted) { + throw new Error("Bad odometer format without digits"); + } + this.resetFormat(); + resetted = true; + } + chr = this.format.repeating[this.format.repeating.length - 1]; + this.format.repeating = this.format.repeating.substring(0, this.format.repeating.length - 1); + if (chr === 'd') { + break; + } + this.addSpacer(chr); + } + } + digit = this.renderDigit(); + digit.querySelector('.odometer-value').innerHTML = value; + this.digits.push(digit); + return this.insertDigit(digit); + }; + + Odometer.prototype.animate = function(newValue) { + if (!TRANSITION_SUPPORT || this.options.animation === 'count') { + return this.animateCount(newValue); + } else { + return this.animateSlide(newValue); + } + }; + + Odometer.prototype.animateCount = function(newValue) { + var cur, diff, last, start, tick, + _this = this; + if (!(diff = +newValue - this.value)) { + return; + } + start = last = now(); + cur = this.value; + return (tick = function() { + var delta, dist, fraction; + if ((now() - start) > _this.options.duration) { + _this.value = newValue; + _this.render(); + trigger(_this.el, 'odometerdone'); + return; + } + delta = now() - last; + if (delta > COUNT_MS_PER_FRAME) { + last = now(); + fraction = delta / _this.options.duration; + dist = diff * fraction; + cur += dist; + _this.render(Math.round(cur)); + } + if (requestAnimationFrame != null) { + return requestAnimationFrame(tick); + } else { + return setTimeout(tick, COUNT_MS_PER_FRAME); + } + })(); + }; + + Odometer.prototype.getDigitCount = function() { + var i, max, value, values, _i, _len; + values = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + for (i = _i = 0, _len = values.length; _i < _len; i = ++_i) { + value = values[i]; + values[i] = Math.abs(value); + } + max = Math.max.apply(Math, values); + return Math.ceil(Math.log(max + 1) / Math.log(10)); + }; + + Odometer.prototype.getFractionalDigitCount = function() { + var i, parser, parts, value, values, _i, _len; + values = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + parser = /^\-?\d*\.(\d*?)0*$/; + for (i = _i = 0, _len = values.length; _i < _len; i = ++_i) { + value = values[i]; + values[i] = value.toString(); + parts = parser.exec(values[i]); + if (parts == null) { + values[i] = 0; + } else { + values[i] = parts[1].length; + } + } + return Math.max.apply(Math, values); + }; + + Odometer.prototype.resetDigits = function() { + this.digits = []; + this.ribbons = []; + this.inside.innerHTML = ''; + return this.resetFormat(); + }; + + Odometer.prototype.animateSlide = function(newValue) { + var boosted, cur, diff, digitCount, digits, dist, end, fractionalCount, frame, frames, i, incr, j, mark, numEl, oldValue, start, _base, _i, _j, _k, _l, _len, _len1, _len2, _m, _ref, _results; + oldValue = this.value; + fractionalCount = this.getFractionalDigitCount(oldValue, newValue); + if (fractionalCount) { + newValue = newValue * Math.pow(10, fractionalCount); + oldValue = oldValue * Math.pow(10, fractionalCount); + } + if (!(diff = newValue - oldValue)) { + return; + } + this.bindTransitionEnd(); + digitCount = this.getDigitCount(oldValue, newValue); + digits = []; + boosted = 0; + for (i = _i = 0; 0 <= digitCount ? _i < digitCount : _i > digitCount; i = 0 <= digitCount ? ++_i : --_i) { + start = truncate(oldValue / Math.pow(10, digitCount - i - 1)); + end = truncate(newValue / Math.pow(10, digitCount - i - 1)); + dist = end - start; + if (Math.abs(dist) > this.MAX_VALUES) { + frames = []; + incr = dist / (this.MAX_VALUES + this.MAX_VALUES * boosted * DIGIT_SPEEDBOOST); + cur = start; + while ((dist > 0 && cur < end) || (dist < 0 && cur > end)) { + frames.push(Math.round(cur)); + cur += incr; + } + if (frames[frames.length - 1] !== end) { + frames.push(end); + } + boosted++; + } else { + frames = (function() { + _results = []; + for (var _j = start; start <= end ? _j <= end : _j >= end; start <= end ? _j++ : _j--){ _results.push(_j); } + return _results; + }).apply(this); + } + for (i = _k = 0, _len = frames.length; _k < _len; i = ++_k) { + frame = frames[i]; + frames[i] = Math.abs(frame % 10); + } + digits.push(frames); + } + this.resetDigits(); + _ref = digits.reverse(); + for (i = _l = 0, _len1 = _ref.length; _l < _len1; i = ++_l) { + frames = _ref[i]; + if (!this.digits[i]) { + this.addDigit(' ', i >= fractionalCount); + } + if ((_base = this.ribbons)[i] == null) { + _base[i] = this.digits[i].querySelector('.odometer-ribbon-inner'); + } + this.ribbons[i].innerHTML = ''; + if (diff < 0) { + frames = frames.reverse(); + } + for (j = _m = 0, _len2 = frames.length; _m < _len2; j = ++_m) { + frame = frames[j]; + numEl = document.createElement('div'); + numEl.className = 'odometer-value'; + numEl.innerHTML = frame; + this.ribbons[i].appendChild(numEl); + if (j === frames.length - 1) { + addClass(numEl, 'odometer-last-value'); + } + if (j === 0) { + addClass(numEl, 'odometer-first-value'); + } + } + } + if (start < 0) { + this.addDigit('-'); + } + mark = this.inside.querySelector('.odometer-radix-mark'); + if (mark != null) { + mark.parent.removeChild(mark); + } + if (fractionalCount) { + return this.addSpacer(this.format.radix, this.digits[fractionalCount - 1], 'odometer-radix-mark'); + } + }; + + return Odometer; + + })(); + + Odometer.options = (_ref = window.odometerOptions) != null ? _ref : {}; + + setTimeout(function() { + var k, v, _base, _ref1, _results; + if (window.odometerOptions) { + _ref1 = window.odometerOptions; + _results = []; + for (k in _ref1) { + v = _ref1[k]; + _results.push((_base = Odometer.options)[k] != null ? (_base = Odometer.options)[k] : _base[k] = v); + } + return _results; + } + }, 0); + + Odometer.init = function() { + var el, elements, _i, _len, _ref1, _results; + if (document.querySelectorAll == null) { + return; + } + elements = document.querySelectorAll(Odometer.options.selector || '.odometer'); + _results = []; + for (_i = 0, _len = elements.length; _i < _len; _i++) { + el = elements[_i]; + _results.push(el.odometer = new Odometer({ + el: el, + value: (_ref1 = el.innerText) != null ? _ref1 : el.textContent + })); + } + return _results; + }; + + if ((((_ref1 = document.documentElement) != null ? _ref1.doScroll : void 0) != null) && (document.createEventObject != null)) { + _old = document.onreadystatechange; + document.onreadystatechange = function() { + if (document.readyState === 'complete' && Odometer.options.auto !== false) { + Odometer.init(); + } + return _old != null ? _old.apply(this, arguments) : void 0; + }; + } else { + document.addEventListener('DOMContentLoaded', function() { + if (Odometer.options.auto !== false) { + return Odometer.init(); + } + }, false); + } + + if (typeof define === 'function' && define.amd) { + define(['jquery'], function() { + return Odometer; + }); + } else if (typeof exports === !'undefined') { + module.exports = Odometer; + } else { + window.Odometer = Odometer; + } + +}).call(this); diff --git a/index.html b/index.html index 864fdd8..9f098d6 100644 --- a/index.html +++ b/index.html @@ -7,9 +7,10 @@ - - - + + + +