diff --git a/_includes/globals_js_data.html b/_includes/globals_js_data.html new file mode 100644 index 0000000..4f32784 --- /dev/null +++ b/_includes/globals_js_data.html @@ -0,0 +1,5 @@ + diff --git a/_layouts/default.html b/_layouts/default.html index 0ff9e89..3ef5113 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -34,22 +34,7 @@ - + {% include globals_js_data.html %} diff --git a/_layouts/post.html b/_layouts/post.html index ed61744..7698893 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -74,17 +74,7 @@ - + {% include globals_js_data.html %} diff --git a/src/js/globals.js b/src/js/globals.js new file mode 100644 index 0000000..f5d02ea --- /dev/null +++ b/src/js/globals.js @@ -0,0 +1,12 @@ +/** + * Created by cwilliams on 5/4/17. + */ +function formatNumber (num) { + return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,") +} + +function formatCurrency (num,decimal) { + var _decimal; + _decimal = typeof decimal !== "undefined" ? decimal : 2; + return parseFloat(num).toFixed(_decimal).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,") +}