summaryrefslogtreecommitdiff
path: root/views/js/frontend.js
diff options
context:
space:
mode:
Diffstat (limited to 'views/js/frontend.js')
-rw-r--r--views/js/frontend.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/views/js/frontend.js b/views/js/frontend.js
index b364265..98b9799 100644
--- a/views/js/frontend.js
+++ b/views/js/frontend.js
@@ -208,4 +208,20 @@
}
};
- \ No newline at end of file
+
+ wpsg_round = function(value, exp) {
+
+ if (typeof exp === 'undefined' || +exp === 0) return Math.round(value);
+
+ value = +value;
+ exp = +exp;
+
+ if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) return NaN;
+
+ value = value.toString().split('e');
+ value = Math.round(+(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp)));
+
+ value = value.toString().split('e');
+ return +(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp));
+
+ } \ No newline at end of file