summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/util.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/js/util.js b/js/util.js
index dcc978f..dde3427 100644
--- a/js/util.js
+++ b/js/util.js
@@ -1,10 +1,13 @@
if (window.$) {
$.fn.int = function(){ return parseInt($(this).val(),10) }
$.fn.float = function(){ return parseFloat($(this).val()) }
+ $.fn.string = function(){ return trim($(this).val()) }
$.fn.enable = function() { return $(this).attr("disabled",null) }
$.fn.disable = function() { return $(this).attr("disabled","disabled") }
}
+function trim(s){ return s.replace(/^\s+/,"").replace(/\s+$/,"") }
+
var E = Math.E
var PI = Math.PI
function clamp(n,a,b){ return n<a?a:n<b?n:b }