diff options
| -rw-r--r-- | public/js/calculator.coffee | 20 | ||||
| -rw-r--r-- | public/js/calculator.js | 21 | ||||
| -rw-r--r-- | public/js/report.coffee | 4 | ||||
| -rw-r--r-- | public/js/report.js | 4 |
4 files changed, 32 insertions, 17 deletions
diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee index 69b24642..e6cc813e 100644 --- a/public/js/calculator.coffee +++ b/public/js/calculator.coffee @@ -142,16 +142,24 @@ updateTotal = -> $('#total').html(total.toString()) - $('#qr').html('') # size = $('#calculator').width() * 0.7 size = 300 $('#qr').css('height', size) - new QRCode('qr', - text: "bitcoin:#{g.user.address}?amount=#{g.amount_requested.toString()}" - width: size - height: size - ) + + time = 0 + if g.timeout + time = 1500 + + clearTimeout(g.timeout) + g.timeout = setTimeout(-> + $('#qr').html('') + new QRCode('qr', + text: "bitcoin:#{g.user.address}?amount=#{g.amount_requested.toString()}" + width: size + height: size + ) + , time) listen = -> g.attempts++ diff --git a/public/js/calculator.js b/public/js/calculator.js index d8eb7217..fe3ce42c 100644 --- a/public/js/calculator.js +++ b/public/js/calculator.js @@ -128,7 +128,7 @@ }; updateTotal = function() { - var precision, size, subtotal, total; + var precision, size, subtotal, time, total; precision = 9 - multiplier().toString().length; subtotal = parseFloat(g.amount * g.tip).toFixed(2); total = (subtotal * multiplier() / g.exchange).toFixed(precision); @@ -147,14 +147,21 @@ $('.commission').html("+" + (Math.abs(g.user.commission)) + "%"); } $('#total').html(total.toString()); - $('#qr').html(''); size = 300; $('#qr').css('height', size); - return new QRCode('qr', { - text: "bitcoin:" + g.user.address + "?amount=" + (g.amount_requested.toString()), - width: size, - height: size - }); + time = 0; + if (g.timeout) { + time = 1500; + } + clearTimeout(g.timeout); + return g.timeout = setTimeout(function() { + $('#qr').html(''); + return new QRCode('qr', { + text: "bitcoin:" + g.user.address + "?amount=" + (g.amount_requested.toString()), + width: size, + height: size + }); + }, time); }; listen = function() { diff --git a/public/js/report.coffee b/public/js/report.coffee index 0478a197..57da46c4 100644 --- a/public/js/report.coffee +++ b/public/js/report.coffee @@ -15,8 +15,8 @@ $(-> $('#from_date').datepicker(onClose: filterDates) $('#to_date').datepicker(onClose: filterDates) - $('#from').click(-> $('#from_date').datepicker('show')) - $('#to').click(-> $('#to_date').datepicker('show')) + $('#from').click(-> $('#from_date').datepicker('show').blur()) + $('#to').click(-> $('#to_date').datepicker('show').blur()) $.getJSON('transactions.json', (data) -> g.transactions = data.transactions diff --git a/public/js/report.js b/public/js/report.js index 3a29d788..51d091cf 100644 --- a/public/js/report.js +++ b/public/js/report.js @@ -21,10 +21,10 @@ onClose: filterDates }); $('#from').click(function() { - return $('#from_date').datepicker('show'); + return $('#from_date').datepicker('show').blur(); }); $('#to').click(function() { - return $('#to_date').datepicker('show'); + return $('#to_date').datepicker('show').blur(); }); return $.getJSON('transactions.json', function(data) { g.transactions = data.transactions; |
