diff options
| author | Adam Soltys <[email protected]> | 2016-09-17 19:02:51 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2016-09-17 19:03:20 -0700 |
| commit | 898d21a7cc1fe23a48896618e638b63130ac7c8c (patch) | |
| tree | ca105c92cd9046ee021965e254430bb092511fb0 /public/js | |
| parent | 26bf18266266d8a3957875d0b08ecd457d535410 (diff) | |
| download | coinos-server-898d21a7cc1fe23a48896618e638b63130ac7c8c.tar.gz coinos-server-898d21a7cc1fe23a48896618e638b63130ac7c8c.zip | |
Display and sizing adjustments to handle larger numbers and fit better on small screens (fixes #48)
Diffstat (limited to 'public/js')
| -rw-r--r-- | public/js/calculator.coffee | 14 | ||||
| -rw-r--r-- | public/js/calculator.js | 16 |
2 files changed, 19 insertions, 11 deletions
diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee index 1b5f5034..cf1e1d24 100644 --- a/public/js/calculator.coffee +++ b/public/js/calculator.coffee @@ -35,7 +35,7 @@ $(-> updateTotal() return - return if n > 1000 + return if n > 100000 if m is '00' n = 100 * n @@ -57,10 +57,14 @@ $(-> $('.tippad .btn').off('click').click((e) -> e.preventDefault() + text = $(this).html() + if text is 'No Tip' + value = 0 + else + value = text.slice(1, -1) + $(this).addClass('active') - value = $(this).html().slice(0, -1) - $(this).siblings().css('font-weight','normal').removeClass('active') - $(this).css('font-weight','bold') + $(this).siblings().removeClass('active') g.tip = 1 + (parseFloat(value)/100) updateTotal() ) @@ -149,7 +153,7 @@ updateTotal = -> time = 0 if g.timeout - time = 1500 + time = 10 clearTimeout(g.timeout) g.timeout = setTimeout(-> diff --git a/public/js/calculator.js b/public/js/calculator.js index f54e70bd..4dccce40 100644 --- a/public/js/calculator.js +++ b/public/js/calculator.js @@ -44,7 +44,7 @@ updateTotal(); return; } - if (n > 1000) { + if (n > 100000) { return; } if (m === '00') { @@ -61,12 +61,16 @@ return updateTotal(); }); $('.tippad .btn').off('click').click(function(e) { - var value; + var text, value; e.preventDefault(); + text = $(this).html(); + if (text === 'No Tip') { + value = 0; + } else { + value = text.slice(1, -1); + } $(this).addClass('active'); - value = $(this).html().slice(0, -1); - $(this).siblings().css('font-weight', 'normal').removeClass('active'); - $(this).css('font-weight', 'bold'); + $(this).siblings().removeClass('active'); g.tip = 1 + (parseFloat(value) / 100); return updateTotal(); }); @@ -151,7 +155,7 @@ $('#qr').css('height', size); time = 0; if (g.timeout) { - time = 1500; + time = 10; } clearTimeout(g.timeout); return g.timeout = setTimeout(function() { |
