From 6fd5d4ecb99944364ccf663124ebf77c9cfe6fa8 Mon Sep 17 00:00:00 2001 From: Jamie Perkins Date: Thu, 24 Aug 2017 12:36:37 -0600 Subject: [PATCH] fixed separator check bug (removed separator check) --- countUp.js | 12 +++--------- dist/countUp.js | 12 +++--------- dist/countUp.min.js | 2 +- index.html | 4 ---- package.json | 42 +++++++++++++++++++++--------------------- 5 files changed, 28 insertions(+), 44 deletions(-) diff --git a/countUp.js b/countUp.js index 32e8822..c71e973 100644 --- a/countUp.js +++ b/countUp.js @@ -15,7 +15,7 @@ var CountUp = function(target, startVal, endVal, decimals, duration, options) { var self = this; - self.version = function () { return '1.9.0'; }; + self.version = function () { return '1.9.1'; }; // default options self.options = { @@ -117,14 +117,8 @@ var CountUp = function(target, startVal, endVal, decimals, duration, options) { self.duration = Number(duration) * 1000 || 2000; self.countDown = (self.startVal > self.endVal); self.frameVal = self.startVal; - if (isNaN(self.options.separator)) { - self.initialized = true; - return true; - } - else { - self.error = '[CountUp] separator cannot be a number: '+self.options.separator; - return false; - } + self.initialized = true; + return true; } else { self.error = '[CountUp] startVal ('+startVal+') or endVal ('+endVal+') is not a number'; diff --git a/dist/countUp.js b/dist/countUp.js index cc1412d..1b34862 100644 --- a/dist/countUp.js +++ b/dist/countUp.js @@ -26,7 +26,7 @@ var CountUp = function(target, startVal, endVal, decimals, duration, options) { var self = this; - self.version = function () { return '1.9.0'; }; + self.version = function () { return '1.9.1'; }; // default options self.options = { @@ -128,14 +128,8 @@ var CountUp = function(target, startVal, endVal, decimals, duration, options) { self.duration = Number(duration) * 1000 || 2000; self.countDown = (self.startVal > self.endVal); self.frameVal = self.startVal; - if (isNaN(self.options.separator)) { - self.initialized = true; - return true; - } - else { - self.error = '[CountUp] separator cannot be a number: '+self.options.separator; - return false; - } + self.initialized = true; + return true; } else { self.error = '[CountUp] startVal ('+startVal+') or endVal ('+endVal+') is not a number'; diff --git a/dist/countUp.min.js b/dist/countUp.min.js index 41e4792..2078290 100644 --- a/dist/countUp.min.js +++ b/dist/countUp.min.js @@ -1 +1 @@ -!function(a,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):a.CountUp=e()}(this,function(a,e,n){var t=function(a,e,n,t,i,r){function o(a){a=a.toFixed(l.decimals),a+="";var e,n,t,i;if(e=a.split("."),n=e[0],t=e.length>1?l.options.decimal+e[1]:"",i=/(\d+)(\d{3})/,l.options.useGrouping)for(;i.test(n);)n=n.replace(i,"$1"+l.options.separator+"$2");return l.options.numerals.length&&(n=n.replace(/[0-9]/g,function(a){return l.options.numerals[+a]}),t=t.replace(/[0-9]/g,function(a){return l.options.numerals[+a]})),l.options.prefix+n+t+l.options.suffix}function s(a,e,n,t){return n*(-Math.pow(2,-10*a/t)+1)*1024/1023+e}function u(a){return"number"==typeof a&&!isNaN(a)}var l=this;if(l.version=function(){return"1.9.0"},l.options={useEasing:!0,useGrouping:!0,separator:",",decimal:".",easingFn:s,formattingFn:o,prefix:"",suffix:"",numerals:[]},r&&"object"==typeof r)for(var m in l.options)r.hasOwnProperty(m)&&null!==r[m]&&(l.options[m]=r[m]);""===l.options.separator&&(l.options.useGrouping=!1);for(var d=0,c=["webkit","moz","ms","o"],p=0;pl.endVal,l.frameVal=l.startVal,isNaN(l.options.separator)?(l.initialized=!0,!0):(l.error="[CountUp] separator cannot be a number: "+l.options.separator,!1)):(l.error="[CountUp] startVal ("+e+") or endVal ("+n+") is not a number",!1)):(l.error="[CountUp] target is null or undefined",!1))},l.printValue=function(a){var e=l.options.formattingFn(a);"INPUT"===l.d.tagName?this.d.value=e:"text"===l.d.tagName||"tspan"===l.d.tagName?this.d.textContent=e:this.d.innerHTML=e},l.count=function(a){l.startTime||(l.startTime=a),l.timestamp=a;var e=a-l.startTime;l.remaining=l.duration-e,l.options.useEasing?l.countDown?l.frameVal=l.startVal-l.options.easingFn(e,0,l.startVal-l.endVal,l.duration):l.frameVal=l.options.easingFn(e,l.startVal,l.endVal-l.startVal,l.duration):l.countDown?l.frameVal=l.startVal-(l.startVal-l.endVal)*(e/l.duration):l.frameVal=l.startVal+(l.endVal-l.startVal)*(e/l.duration),l.countDown?l.frameVal=l.frameVall.endVal?l.endVal:l.frameVal,l.frameVal=Math.round(l.frameVal*l.dec)/l.dec,l.printValue(l.frameVal),el.endVal,l.rAF=requestAnimationFrame(l.count))}},l.initialize()&&l.printValue(l.startVal)};return t}); \ No newline at end of file +!function(a,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):a.CountUp=e()}(this,function(a,e,n){var t=function(a,e,n,t,i,r){function o(a){a=a.toFixed(s.decimals),a+="";var e,n,t,i;if(e=a.split("."),n=e[0],t=e.length>1?s.options.decimal+e[1]:"",i=/(\d+)(\d{3})/,s.options.useGrouping)for(;i.test(n);)n=n.replace(i,"$1"+s.options.separator+"$2");return s.options.numerals.length&&(n=n.replace(/[0-9]/g,function(a){return s.options.numerals[+a]}),t=t.replace(/[0-9]/g,function(a){return s.options.numerals[+a]})),s.options.prefix+n+t+s.options.suffix}function u(a,e,n,t){return n*(-Math.pow(2,-10*a/t)+1)*1024/1023+e}function l(a){return"number"==typeof a&&!isNaN(a)}var s=this;if(s.version=function(){return"1.9.1"},s.options={useEasing:!0,useGrouping:!0,separator:",",decimal:".",easingFn:u,formattingFn:o,prefix:"",suffix:"",numerals:[]},r&&"object"==typeof r)for(var m in s.options)r.hasOwnProperty(m)&&null!==r[m]&&(s.options[m]=r[m]);""===s.options.separator&&(s.options.useGrouping=!1);for(var d=0,c=["webkit","moz","ms","o"],f=0;fs.endVal,s.frameVal=s.startVal,s.initialized=!0,!0):(s.error="[CountUp] startVal ("+e+") or endVal ("+n+") is not a number",!1)):(s.error="[CountUp] target is null or undefined",!1))},s.printValue=function(a){var e=s.options.formattingFn(a);"INPUT"===s.d.tagName?this.d.value=e:"text"===s.d.tagName||"tspan"===s.d.tagName?this.d.textContent=e:this.d.innerHTML=e},s.count=function(a){s.startTime||(s.startTime=a),s.timestamp=a;var e=a-s.startTime;s.remaining=s.duration-e,s.options.useEasing?s.countDown?s.frameVal=s.startVal-s.options.easingFn(e,0,s.startVal-s.endVal,s.duration):s.frameVal=s.options.easingFn(e,s.startVal,s.endVal-s.startVal,s.duration):s.countDown?s.frameVal=s.startVal-(s.startVal-s.endVal)*(e/s.duration):s.frameVal=s.startVal+(s.endVal-s.startVal)*(e/s.duration),s.countDown?s.frameVal=s.frameVals.endVal?s.endVal:s.frameVal,s.frameVal=Math.round(s.frameVal*s.dec)/s.dec,s.printValue(s.frameVal),es.endVal,s.rAF=requestAnimationFrame(s.count))}},s.initialize()&&s.printValue(s.startVal)};return t}); \ No newline at end of file diff --git a/index.html b/index.html index fe67224..6087431 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,6 @@ CountUp.js - @@ -301,7 +300,6 @@

Custom:

updateCodeVisualizer(); } function toggleEasing(checkbox) { - useEasing = checkbox.checked easingFnsDropdown.disabled = !useEasing if (useEasing) { @@ -311,9 +309,7 @@

Custom:

updateCodeVisualizer(); } function toggleGrouping(checkbox) { - useGrouping = checkbox.checked; - document.getElementById('separator').disabled = !useGrouping updateCodeVisualizer(); } function methodToCallOnComplete() { diff --git a/package.json b/package.json index 7e820c4..10612a0 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,23 @@ { - "name": "countup.js", - "description": "Animates a numerical value by counting to it", - "version": "1.9.0", - "license": "MIT", - "main": "./dist/countUp.min.js", - "repository": { - "type": "git", - "url": "git+https://github.com/inorganik/countUp.js.git" - }, - "dependencies": {}, - "devDependencies": { - "del": "~0.1.3", - "gulp": "~3.8.10", - "gulp-rename": "~1.2.0", - "gulp-uglify": "^1.4.2", - "gulp-wrap-umd": "~0.2.1" - }, - "scripts": { - "build": "gulp", - "clean": "gulp clean" - } + "name": "countup.js", + "description": "Animates a numerical value by counting to it", + "version": "1.9.1", + "license": "MIT", + "main": "./dist/countUp.min.js", + "repository": { + "type": "git", + "url": "git+https://github.com/inorganik/countUp.js.git" + }, + "dependencies": {}, + "devDependencies": { + "del": "~0.1.3", + "gulp": "~3.8.10", + "gulp-rename": "~1.2.0", + "gulp-uglify": "^1.4.2", + "gulp-wrap-umd": "~0.2.1" + }, + "scripts": { + "build": "gulp", + "clean": "gulp clean" + } }