#= require ../js/jquery-1.8.2.min.js #= require ../js/jquery-ui.min.js #= require ../js/jquery.printElement.min.js #= require ../js/check_password.js #= require ../js/bootstrap.min.js #= require ../js/jsbn.js #= require ../js/jsbn2.js #= require ../js/crypto-min.js #= require ../js/2.5.3-crypto-sha256.js #= require ../js/sha512.js #= require ../js/rfc1751.js #= require ../js/bitcoinjs-min-1.0.2.js #= require ../js/bitcoinjs-min.js #= require ../js/modsqrt.js #= require ../js/bip32.js #= require ../js/secure_random.js #= require ../js/qrcode.js #= require ../js/aes.js #= require ../js/key.js g = exports ? this g.proceed = false $(-> $('#encryption-password').pwstrength(showVerdicts: false) $.getJSON("/js/rates.json", (data) -> currencies = Object.keys(data) currencies = currencies.sort() currencies.pop() $.each(currencies, (i, v) -> $('#currency').append("") ) $("#currency option[value='CAD']").attr('selected', 'selected') $('#currency').change(-> $('#symbol option').remove() symbol = $(this).val() return unless symbol symbols = Object.keys(data[symbol]) $.each(symbols, (i, v) -> return if v == 'localbitcoins' $('#symbol').append("") ) switch $(this).val() when 'CAD' $("#symbol option[value='quadrigacx']").attr('selected', 'selected') when 'USD' $("#symbol option[value='bitstamp']").attr('selected', 'selected') ) user = $('#username').val() $.getJSON("/#{user}.json", (data) -> $('#email').val(data.email) $('#title').val(data.title) $('#logo').val(data.logo) $('#pubkey').val(data.pubkey) $('#address').val(data.address) $("#symbol option[value='#{data.symbol}']").attr('selected', 'selected') $('#commission').val(data.commission) $('#unit').val(data.unit) $('#currency').change() $('#setup').fadeIn() $('#title').focus() ) ) units = ['BTC', 'mBTC', 'µBTC', 'bits', 'satoshis'] $.each(units, (i, v) -> $('#unit').append("") ) $('#pubkey').blur(-> if check_address($(this).val()) $(this).parent().removeClass('has-error') else $(this).parent().addClass('has-error') ) $('#generate').click(-> key = new Key() g.pubkey = key.extended_public_key_string() g.privkey = key.extended_private_key_string() $('#modal').modal() $('#privkey_text').html(g.privkey) $('#qr').html('') new QRCode('qr', text: g.privkey, width: 260, height: 260) ) $('#encryption-password').keyup((e) -> return if e.keyCode is 9 or e.keyCode is 16 g.enc_privkey = CryptoJS.AES.encrypt(g.privkey, $(this).val()).toString() g.enc_privkey = g.privkey if $(this).val() == '' $('#privkey_text').html(g.enc_privkey) $('#qr').html('') new QRCode('qr', text: g.enc_privkey, width: 260, height: 260) if $(this).val() $('#status').html('(Encrypted)') else $('#status').html('(Unencrypted)') ) $('#confirm').blur(-> $('#confirm_error').remove() if $('#password').val() != $('#confirm').val() $('#password, #confirm').parent().addClass('has-error') $('#confirm').parent().after('