diff options
Diffstat (limited to 'js')
| -rw-r--r-- | js/util.js | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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 } |
