From 561ab2d01e059da44c0e5b34f5527fe946a1448c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 8 Aug 2014 07:11:56 -0700 Subject: Use connect-assets for js and css --- public/css/calculator.css | 108 -------------------- public/css/calculator.less | 10 +- public/css/index.css | 49 --------- public/css/signin.css | 20 ---- public/js/calculator.coffee | 17 ++-- public/js/calculator.js | 237 -------------------------------------------- public/js/deposit.coffee | 86 ---------------- public/js/deposit.js | 102 ------------------- public/js/index.js | 51 ---------- public/js/register.coffee | 2 +- public/js/register.js | 6 -- public/js/report.coffee | 7 +- public/js/report.js | 80 --------------- public/js/setup.coffee | 12 +-- public/js/setup.js | 81 --------------- public/js/signin.coffee | 2 + public/js/signin.js | 9 -- public/js/socket.io.js | 3 - public/js/sweep.js | 14 --- 19 files changed, 25 insertions(+), 871 deletions(-) delete mode 100644 public/css/calculator.css delete mode 100644 public/css/index.css delete mode 100644 public/css/signin.css delete mode 100644 public/js/calculator.js delete mode 100644 public/js/deposit.coffee delete mode 100644 public/js/deposit.js delete mode 100644 public/js/index.js delete mode 100644 public/js/register.js delete mode 100644 public/js/report.js delete mode 100644 public/js/setup.js delete mode 100644 public/js/signin.js delete mode 100644 public/js/socket.io.js delete mode 100644 public/js/sweep.js (limited to 'public') diff --git a/public/css/calculator.css b/public/css/calculator.css deleted file mode 100644 index 89cc758e..00000000 --- a/public/css/calculator.css +++ /dev/null @@ -1,108 +0,0 @@ -@import "bootstrap.min.css"; -@import "bootstrap-responsive.min.css"; -@import "jquery-ui.min.css"; -@import "jquery-ui.theme.min.css"; -body { - text-align: center; -} -body { - line-height: 100%; -} -h1 { - margin-top: 0; -} -div.container-fluid { - max-width: 480px; - margin-left: auto; - margin-right: auto; - text-align: left; - padding-bottom: 50px; -} -.navbar-toggle { - background-color: #428bca; - width: 100%; - position: absolute; - top: 0px; - height: 30px; - margin: 0; - float: none; - z-index: 1; -} -.navbar-toggle .glyphicon { - margin-top: -5px; - padding-left: 10px; -} -.navbar { - margin: 0; -} -.navbar-collapse.in { - overflow-y: visible; -} -.nav { - margin-top: 30px; -} -.nav li a { - padding: 10px 0 10px 10px; -} -#connection { - display: none; -} -.form-group label { - font-weight: normal; - font-size: 14px; - display: block; -} -.form-group p, -.form-group span, -.form-group .form-control { - font-size: 18px; -} -.form-group span, -.form-group label { - color: #999; -} -.form-group .form-control { - height: auto; - padding: 3px; - display: inline-block; -} -div#calculator #exchange, -div#calculator #amount { - width: 5em; -} -div#calculator span.btn { - font-size: 16px; - width: 100%; -} -div#calculator strong#total { - font-size: 30px; -} -div#calculator p#address { - padding-top: 10px; -} -div#calculator #title { - display: none; -} -div#calculator #logo { - display: none; - padding: 10px 0; - margin-bottom: 10px; - max-height: 250px; -} -div#calculator #error { - margin-top: 10px; -} -td#total { - font-weight: bold; - text-align: right; -} -#main-logo { - background-image: url('../img/coinos_logo.png'); - width: 300px; - height: 80px; - margin-top: 10px; -} -.svg #main-logo { - background-image: url('../img/coinos_logo.svg') !important; - background-size: 300px 80px; -} diff --git a/public/css/calculator.less b/public/css/calculator.less index da7b7fab..61349041 100644 --- a/public/css/calculator.less +++ b/public/css/calculator.less @@ -1,10 +1,8 @@ -@import "bootstrap.min.css"; -@import "bootstrap-responsive.min.css"; -@import "jquery-ui.min.css"; -@import "jquery-ui.theme.min.css"; +//= require css/bootstrap.min +//= require css/bootstrap-responsive.min +//= require css/jquery-ui.min +//= require css/jquery-ui.theme.min -body { text-align: center; } -body { line-height: 100%; } h1 { margin-top: 0; } div.container-fluid { diff --git a/public/css/index.css b/public/css/index.css deleted file mode 100644 index 8a3cd940..00000000 --- a/public/css/index.css +++ /dev/null @@ -1,49 +0,0 @@ -@import "bootstrap.min.css"; -@import "bootstrap-responsive.min.css"; -@import "font-awesome.css"; -.hero-unit { - background: url(/img/vancouver.jpg); - background-size: 100% 100%; -} -.hero-unit p { - background: rgba(255, 255, 255, 0.5); -} -.navbar-inverse, -.navbar-inverse .navbar-link, -.navbar-inverse .brand, -.navbar-inverse .nav > li > a { - color: #eee; -} -footer { - background: black; - color: #ddd; - padding: 10px 0px 2px 5px; - margin: 0; - text-align: right; -} -#ask, -#bid { - color: white; -} -div.directory { - width: 500px; - float: left; - border: 1px dashed #ccc; - padding: 10px; - margin: 10px; -} -div.directory img { - height: 180px; - float: left; - padding-right: 10px; -} -div.directory p { - font-size: 13px; -} -div.directory h2 a { - text-decoration: none; - color: #000; -} -div.row-fluid td.first { - text-align: right; -} diff --git a/public/css/signin.css b/public/css/signin.css deleted file mode 100644 index 2f3291ff..00000000 --- a/public/css/signin.css +++ /dev/null @@ -1,20 +0,0 @@ -#main-logo { - margin-bottom: 15px; -} -.form-signin { - margin-bottom: 10px; -} -.form-signin .form-control { - height: auto; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - padding: 10px; - font-size: 16px; -} -.notice { - border: 1px solid gray; - background: #eee; - padding: 10px; - margin-bottom: 15px; -} diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee index 7b42bab5..e8cfdd48 100644 --- a/public/js/calculator.coffee +++ b/public/js/calculator.coffee @@ -1,12 +1,11 @@ -#= require jquery-1.8.2.min.js -#= require moment.min.js -#= require qrcode.js -#= require bootstrap.min.js -#= require 2.5.3-crypto-sha256.js -#= require jsbn.js -#= require jsbn2.js -#= require check_address.js -#= require socket.io.js +#= require js/jquery-1.8.2.min.js +#= require js/moment.min.js +#= require js/qrcode.js +#= require js/bootstrap.min.js +#= require js/2.5.3-crypto-sha256.js +#= require js/jsbn.js +#= require js/jsbn2.js +#= require js/check_address.js EXCHANGE_FAIL = "Error fetching exchange rate" SOCKET_FAIL = "Error connecting to payment server" diff --git a/public/js/calculator.js b/public/js/calculator.js deleted file mode 100644 index 71aa22da..00000000 --- a/public/js/calculator.js +++ /dev/null @@ -1,237 +0,0 @@ -(function() { - var ADDRESS_FAIL, EXCHANGE_FAIL, SOCKET_FAIL, activateTip, clear, fail, fetchExchangeRate, finalize, g, get, setup, setupSocket, tip, updateTotal; - - EXCHANGE_FAIL = "Error fetching exchange rate"; - - SOCKET_FAIL = "Error connecting to payment server"; - - ADDRESS_FAIL = "Invalid address"; - - tip = 1; - - g = typeof exports !== "undefined" && exports !== null ? exports : this; - - $(function() { - g.user = $('#user').val(); - g.title = get('title'); - g.address = get('address'); - g.symbol = get('symbol'); - g.currency = get('currency'); - g.commission = parseFloat(get('commission')); - g.logo = get('logo'); - g.errors = []; - g.receivable = 0; - if (g.user) { - $.ajax({ - url: g.user + '.json', - dataType: 'json', - success: function(data) { - if (data != null) { - g.title = data.title; - g.address = data.address; - g.currency = data.currency; - g.symbol = data.symbol; - g.commission = data.commission; - g.logo = data.logo; - } - return setup(); - } - }); - } else { - setup(); - } - $('#tip button').click(function() { - var value; - value = $(this).html().slice(0, -1); - $(this).siblings().css('font-weight', 'normal').removeClass('active'); - $(this).css('font-weight', 'bold'); - tip = 1 + (parseFloat(value) / 100); - return updateTotal(); - }); - $('#tip button').first().click(); - $('#amount').keyup(updateTotal); - return $('#amount').focus(function() { - $('#received').hide(); - $('#payment').fadeIn('slow'); - $(this).val(''); - return updateTotal(); - }); - }); - - activateTip = function(p) {}; - - setup = function() { - var address; - g.address || (g.address = ''); - g.commission || (g.commission = 0); - g.symbol || (g.symbol = 'quadrigacx'); - if (g.title) { - $('#title').html(g.title).show(); - } - if (g.logo) { - $('#logo').attr('src', g.logo).show(); - } else if (!g.title) { - $('#logo').attr('src', 'img/bitcoin.png').show(); - } - $('#logo').click(function() { - return $(location).attr("href", "/" + g.user + "/edit"); - }); - address = g.address; - if ((g.user != null) && g.user) { - address = "" + address + " "; - } - if (check_address(g.address)) { - $('#address').html(address); - } else { - fail(ADDRESS_FAIL); - } - $('#symbol').html(g.symbol + " bid"); - $('#currency').html(g.currency); - $('#received').hide(); - setupSocket(); - return fetchExchangeRate(); - }; - - fetchExchangeRate = function() { - $.ajax({ - url: "ticker?currency=" + g.currency + "&symbol=" + g.symbol + "&type=bid", - success: function(exchange) { - if (exchange != null) { - clear(EXCHANGE_FAIL); - } else { - fail(EXCHANGE_FAIL); - return; - } - if (!g.setupComplete) { - finalize(); - } - g.exchange = exchange - exchange * g.commission * 0.01; - $('#exchange').val(g.exchange.toFixed(2)); - return updateTotal(); - }, - error: function() { - return fail(EXCHANGE_FAIL); - } - }); - return setTimeout(fetchExchangeRate, 900000); - }; - - finalize = function() { - $('#amount').focus(); - return g.setupComplete = true; - }; - - setupSocket = function() { - setTimeout(setupSocket, 10000); - if (!(g.websocket && g.websocket.readyState === 1)) { - g.websocket = new WebSocket("wss://ws.blockchain.info/inv"); - g.websocket.onopen = function() { - $('#connection').fadeIn().removeClass('glyphicon-exclamation-sign').addClass('glyphicon-signal'); - return g.websocket.send('{"op":"addr_sub", "addr":"' + g.address + '"}'); - }; - g.websocket.onerror = function() { - $('#connection').addClass('glyphicon-exclamation-sign').removeClass('glyphicon-signal'); - g.websocket = null; - return fail(SOCKET_FAIL); - }; - g.websocket.onclose = function() { - $('#connection').addClass('glyphicon-exclamation-sign').removeClass('glyphicon-signal'); - g.websocket = null; - return fail(SOCKET_FAIL); - }; - return g.websocket.onmessage = function(e) { - var from_address, received, results; - results = eval('(' + e.data + ')'); - from_address = ''; - received = 0; - $.each(results.x.out, function(i, v) { - if (v.addr === g.address) { - return received += v.value / 100000000; - } - }); - $.each(results.x.inputs, function(i, v) { - from_address = v.prev_out.addr; - if (v.prev_out.addr === g.address) { - return input -= v.prev_out.value / 100000000; - } - }); - if (g.receivable <= received) { - $('#amount').blur(); - $('#payment').hide(); - $('#received').fadeIn('slow'); - $('#chaching')[0].play(); - } - if (g.user) { - return $.post("/" + g.user + "/transactions", { - address: from_address, - date: moment().format("YYYY-MM-DD HH:mm:ss"), - received: received, - exchange: g.exchange - }); - } - }; - } - }; - - updateTotal = function() { - var amount, total; - amount = parseFloat($('#amount').val() * tip); - total = (amount * 1000 / g.exchange).toFixed(5); - g.receivable = (amount / g.exchange).toFixed(8); - if (!$.isNumeric(total)) { - total = ''; - } - $('#total').html(total.toString()); - $('#qr').html(''); - return new QRCode('qr', "bitcoin:" + g.address + "?amount=" + (g.receivable.toString())); - }; - - fail = function(msg) { - g.errors.push(msg); - g.errors = g.errors.uniq(); - $('#calculator').hide(); - return $('#error').show().html(g.errors.toString()); - }; - - clear = function(msg) { - var i; - i = g.errors.indexOf(msg); - if (i >= 0) { - g.errors.splice(i, 1); - } - if (g.errors.length > 0) { - return $('#error').show().html(g.errors.toString()); - } else { - $('#error').hide(); - return $('#calculator').fadeIn('slow'); - } - }; - - get = function(name) { - var regex, regexS, results; - name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); - regexS = "[\\?&]" + name + "=([^&#]*)"; - regex = new RegExp(regexS); - results = regex.exec(window.location.search); - if (results === null) { - return ""; - } else { - return decodeURIComponent(results[1].replace(/\+/g, " ")); - } - }; - - Array.prototype.uniq = function() { - var key, output, value, _i, _ref, _results; - output = {}; - for (key = _i = 0, _ref = this.length; 0 <= _ref ? _i < _ref : _i > _ref; key = 0 <= _ref ? ++_i : --_i) { - output[this[key]] = this[key]; - } - _results = []; - for (key in output) { - value = output[key]; - _results.push(value); - } - return _results; - }; - -}).call(this); diff --git a/public/js/deposit.coffee b/public/js/deposit.coffee deleted file mode 100644 index 331d7975..00000000 --- a/public/js/deposit.coffee +++ /dev/null @@ -1,86 +0,0 @@ -#= require jquery-1.8.2.min.js -#= require moment.min.js -#= require qr.js -#= require bootstrap.min.js -#= require 2.5.3-crypto-sha256.js -#= require jsbn.js -#= require jsbn2.js -#= require check_address.js - -EXCHANGE_FAIL = "Error fetching exchange rate" -SOCKET_FAIL = "Error connecting to payment server" -ADDRESS_FAIL = "Invalid address" - -g = exports ? this - -$(-> - g.address or= '1VAnbtCAnYccECnjaMCPnWwt81EHCVgNr' - setupSocket() - setupQR() - displayQR('bitcoin:' + g.address) -) - -setupSocket = -> - g.address = "1VAnbtCAnYccECnjaMCPnWwt81EHCVgNr" - setTimeout(setupSocket, 10000) - - unless g.websocket and g.websocket.readyState is 1 - g.websocket = new WebSocket("ws://api.blockchain.info:8335/inv") - - g.websocket.onopen = -> - g.websocket.send('{"op":"addr_sub", "addr":"' + g.address + '"}') - - g.websocket.onerror = g.websocket.onclose = -> - fail(SOCKET_FAIL) - - g.websocket.onmessage = (e) -> - results = eval('(' + e.data + ')') - from_address = '' - total = 0 - received = 0 - - $.each(results.x.out, (i, v) -> - if (v.addr == g.address) - received += v.value - ) - - $.each(results.x.inputs, (i, v) -> - from_address = v.prev_out.addr - if (v.prev_out.addr == g.address) - input -= v.prev_out.value - ) - - $.get("/issue/#{received}", (data) -> - $('#received').text(data) - ) - -fail = (msg) -> - g.errors.push(msg) - g.errors = g.errors.uniq() - $('#calculator').hide() - $('#error').show().html(g.errors.toString()) - -clear = (msg) -> - i = g.errors.indexOf(msg) - g.errors.splice(i, 1) if i >= 0 - if (g.errors.length > 0) - $('#error').show().html(g.errors.toString()) - else - $('#error').hide() - $('#calculator').fadeIn('slow') - -get = (name) -> - name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]") - regexS = "[\\?&]" + name + "=([^&#]*)" - regex = new RegExp(regexS) - results = regex.exec(window.location.search) - - if (results == null) - return "" - else - return decodeURIComponent(results[1].replace(/\+/g, " ")) - -Array::uniq = -> - output = {} - output[@[key]] = @[key] for key in [0...@length] - value for key, value of output diff --git a/public/js/deposit.js b/public/js/deposit.js deleted file mode 100644 index 3bb5bf23..00000000 --- a/public/js/deposit.js +++ /dev/null @@ -1,102 +0,0 @@ -(function() { - var ADDRESS_FAIL, EXCHANGE_FAIL, SOCKET_FAIL, clear, fail, g, get, setupSocket; - - EXCHANGE_FAIL = "Error fetching exchange rate"; - - SOCKET_FAIL = "Error connecting to payment server"; - - ADDRESS_FAIL = "Invalid address"; - - g = typeof exports !== "undefined" && exports !== null ? exports : this; - - $(function() { - g.address || (g.address = '1VAnbtCAnYccECnjaMCPnWwt81EHCVgNr'); - setupSocket(); - setupQR(); - return displayQR('bitcoin:' + g.address); - }); - - setupSocket = function() { - g.address = "1VAnbtCAnYccECnjaMCPnWwt81EHCVgNr"; - setTimeout(setupSocket, 10000); - if (!(g.websocket && g.websocket.readyState === 1)) { - g.websocket = new WebSocket("ws://api.blockchain.info:8335/inv"); - g.websocket.onopen = function() { - return g.websocket.send('{"op":"addr_sub", "addr":"' + g.address + '"}'); - }; - g.websocket.onerror = g.websocket.onclose = function() { - return fail(SOCKET_FAIL); - }; - return g.websocket.onmessage = function(e) { - var from_address, received, results, total; - results = eval('(' + e.data + ')'); - from_address = ''; - total = 0; - received = 0; - $.each(results.x.out, function(i, v) { - if (v.addr === g.address) { - return received += v.value; - } - }); - $.each(results.x.inputs, function(i, v) { - from_address = v.prev_out.addr; - if (v.prev_out.addr === g.address) { - return input -= v.prev_out.value; - } - }); - return $.get("/issue/" + received, function(data) { - return $('#received').text(data); - }); - }; - } - }; - - fail = function(msg) { - g.errors.push(msg); - g.errors = g.errors.uniq(); - $('#calculator').hide(); - return $('#error').show().html(g.errors.toString()); - }; - - clear = function(msg) { - var i; - i = g.errors.indexOf(msg); - if (i >= 0) { - g.errors.splice(i, 1); - } - if (g.errors.length > 0) { - return $('#error').show().html(g.errors.toString()); - } else { - $('#error').hide(); - return $('#calculator').fadeIn('slow'); - } - }; - - get = function(name) { - var regex, regexS, results; - name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); - regexS = "[\\?&]" + name + "=([^&#]*)"; - regex = new RegExp(regexS); - results = regex.exec(window.location.search); - if (results === null) { - return ""; - } else { - return decodeURIComponent(results[1].replace(/\+/g, " ")); - } - }; - - Array.prototype.uniq = function() { - var key, output, value, _i, _ref, _results; - output = {}; - for (key = _i = 0, _ref = this.length; 0 <= _ref ? _i < _ref : _i > _ref; key = 0 <= _ref ? ++_i : --_i) { - output[this[key]] = this[key]; - } - _results = []; - for (key in output) { - value = output[key]; - _results.push(value); - } - return _results; - }; - -}).call(this); diff --git a/public/js/index.js b/public/js/index.js deleted file mode 100644 index 7b799c1e..00000000 --- a/public/js/index.js +++ /dev/null @@ -1,51 +0,0 @@ -(function() { - var fetchExchangeRate, g; - - g = typeof exports !== "undefined" && exports !== null ? exports : this; - - $(function() { - fetchExchangeRate('ask'); - fetchExchangeRate('bid'); - $('#username').blur(function() { - return $.get("/" + ($(this).val()) + "/exists", { - username: $(this).val() - }, function(data) { - if (data === "true") { - $('#username').prev().css('color', 'red').html('Username (taken)'); - return g.preventSubmit = true; - } else { - $('#username').prev().css('color', 'black').html('Username'); - return g.preventSubmit = false; - } - }); - }); - return $('#signup').submit(function() { - if (g.preventSubmit) { - return false; - } - return true; - }); - }); - - fetchExchangeRate = function(type) { - var commission; - commission = 0.015; - if (type === 'bid') { - commission *= -1; - } - return $.ajax({ - url: "/ticker?symbol=virtexCAD&type=" + type + "&amount=100", - success: function(exchange) { - if (exchange == null) { - exchange = '??'; - } - exchange = exchange - exchange * commission; - return $("#" + type).html(exchange.toFixed(2)); - }, - error: function() { - return $("#" + type).html('??'); - } - }); - }; - -}).call(this); diff --git a/public/js/register.coffee b/public/js/register.coffee index ff775539..57c399e5 100644 --- a/public/js/register.coffee +++ b/public/js/register.coffee @@ -1,4 +1,4 @@ -#= require jquery-1.8.2.min.js +#= require js/jquery-1.8.2.min.js $(-> $('#username').focus() diff --git a/public/js/register.js b/public/js/register.js deleted file mode 100644 index b75cc305..00000000 --- a/public/js/register.js +++ /dev/null @@ -1,6 +0,0 @@ -(function() { - $(function() { - return $('#username').focus(); - }); - -}).call(this); diff --git a/public/js/report.coffee b/public/js/report.coffee index 37c5276d..6c0583a8 100644 --- a/public/js/report.coffee +++ b/public/js/report.coffee @@ -1,6 +1,7 @@ -#= require jquery-1.8.2.min.js -#= require jquery-ui-1.9.0.custom.min.js -#= require moment.min.js +#= require ../js/jquery-1.8.2.min.js +#= require ../js/jquery-ui.min.js +#= require ../js/bootstrap.min.js +#= require ../js/moment.min.js g = exports ? this diff --git a/public/js/report.js b/public/js/report.js deleted file mode 100644 index 69794ad5..00000000 --- a/public/js/report.js +++ /dev/null @@ -1,80 +0,0 @@ -(function() { - var display, filterDates, g; - - g = typeof exports !== "undefined" && exports !== null ? exports : this; - - $(function() { - var from, to; - from = moment().subtract('days', 7); - to = moment(); - $('#from').html(from.format("MMMM Do, YYYY")); - $('#to').html(to.format("MMMM Do, YYYY")); - $('#from_date').val(from.format("MM/DD/YYYY")); - $('#to_date').val(to.format("MM/DD/YYYY")); - $('#from_date').datepicker({ - onClose: filterDates - }); - $('#to_date').datepicker({ - onClose: filterDates - }); - $('#from').click(function() { - return $('#from_date').datepicker('show'); - }); - $('#to').click(function() { - return $('#to_date').datepicker('show'); - }); - return $.getJSON('transactions.json', function(data) { - g.transactions = data.transactions; - display(g.transactions); - return filterDates(); - }); - }); - - filterDates = function() { - var transactions; - $('#from').html(moment($('#from_date').datepicker('getDate')).format("MMMM Do, YYYY")); - $('#to').html(moment($('#to_date').datepicker('getDate')).format("MMMM Do, YYYY")); - transactions = $.grep(g.transactions, function(e, i) { - var amount, d, from, to; - if (!e) { - return false; - } - from = moment($('#from_date').val(), "MM/DD/YYYY"); - to = moment($('#to_date').val(), "MM/DD/YYYY"); - d = moment(e.date); - amount = parseFloat(e.exchange) * parseFloat(e.received); - return !isNaN(parseFloat(amount)) && isFinite(amount) && ((from == null) || d.diff(from) >= 0) && ((to == null) || d.diff(to) <= 0); - }); - return display(transactions); - }; - - display = function(transactions) { - var btc, cad; - $('.alert').remove(); - $('.report tbody tr').remove(); - $('.report').show(); - if (transactions.length === 0) { - $('.report').before("

No transactions were found for the specified time period

"); - $('.report').hide(); - } - $.each(transactions, function() { - var amount, exchange, received; - exchange = parseFloat(this.exchange); - received = parseFloat(this.received); - amount = received * exchange; - received *= 1000; - return $('.report tbody').append("\n " + (moment(this.date, 'YYYY-MM-DD h:mm:ss').format('MMM D h:mma')) + "\n " + (exchange.toFixed(2)) + "\n " + (received.toFixed(5)) + "\n " + (amount.toFixed(2)) + "\n"); - }); - btc = 0; - $('table.report tbody td:nth-child(3)').each(function() { - return btc += parseFloat($(this).html()); - }); - $('#btc').html(btc.toFixed(5)); - cad = 0; - $('table.report tbody td:nth-child(4)').each(function() { - return cad += parseFloat($(this).html()); - }); - return $('#cad').html(cad.toFixed(2)); - }; - -}).call(this); diff --git a/public/js/setup.coffee b/public/js/setup.coffee index 4e1c6b8f..08356b5b 100644 --- a/public/js/setup.coffee +++ b/public/js/setup.coffee @@ -1,9 +1,9 @@ -#= require jquery-1.8.2.min.js -#= require jqiery-ui.min.js -#= require 2.5.3-crypto-sha256.js -#= require jsbn.js -#= require jsbn2.js -#= require check_address.js +#= require ../js/jquery-1.8.2.min.js +#= require ../js/jquery-ui.min.js +#= require ../js/2.5.3-crypto-sha256.js +#= require ../js/jsbn.js +#= require ../js/jsbn2.js +#= require ../js/check_address.js g = exports ? this g.proceed = false diff --git a/public/js/setup.js b/public/js/setup.js deleted file mode 100644 index 9552e715..00000000 --- a/public/js/setup.js +++ /dev/null @@ -1,81 +0,0 @@ -(function() { - var g; - - g = typeof exports !== "undefined" && exports !== null ? exports : this; - - g.proceed = false; - - $(function() { - $('#title').focus(); - return $.getJSON("/js/rates.json", function(data) { - var currencies, user; - currencies = Object.keys(data); - currencies = currencies.sort(); - currencies.pop(); - $.each(currencies, function(i, v) { - return $('#currency').append(""); - }); - $("#currency option[value='CAD']").attr('selected', 'selected'); - user = $('#username').val(); - $('#currency').change(function() { - var symbol, symbols; - $('#symbol option').remove(); - symbol = $(this).val(); - if (!symbol) { - return; - } - symbols = Object.keys(data[symbol]); - $.each(symbols, function(i, v) { - return $('#symbol').append(""); - }); - switch ($(this).val()) { - case 'CAD': - return $("#symbol option[value='quadrigacx']").attr('selected', 'selected'); - case 'USD': - return $("#symbol option[value='bitstamp']").attr('selected', 'selected'); - } - }).change(); - $('#title').blur(function() { - if ($(this).val() === '') { - return $(this).parent().addClass('has-error'); - } else { - return $(this).parent().removeClass('has-error'); - } - }); - $('#address').blur(function() { - if (check_address($(this).val())) { - return $(this).parent().removeClass('has-error'); - } else { - return $(this).parent().addClass('has-error'); - } - }); - $('#confirm').blur(function() { - $('#confirm_error').remove(); - if ($('#password').val() !== $('#confirm').val()) { - $('#password, #confirm').parent().addClass('has-error'); - return $('#confirm').parent().after('
Passwords don\'t match
'); - } else { - return $('#password, #confirm').parent().removeClass('has-error'); - } - }); - $('#setup').submit(function() { - $('.form-control').blur(); - if ($('.has-error').length > 0) { - $('.has-error').effect('shake', 500); - return false; - } - }); - if (user) { - $('#setup').attr('action', "/" + user).attr('method', 'post'); - return $.getJSON("/" + user + ".json", function(data) { - $('#title').val(data.title); - $('#logo').val(data.logo); - $('#address').val(data.address); - $("#symbol option[value='" + data.symbol + "']").attr('selected', 'selected'); - return $('#commission').val(data.commission); - }); - } - }); - }); - -}).call(this); diff --git a/public/js/signin.coffee b/public/js/signin.coffee index df7dbb39..842b7b92 100644 --- a/public/js/signin.coffee +++ b/public/js/signin.coffee @@ -1,3 +1,5 @@ +#= require js/jquery-1.8.2.min.js + $(-> $('#register').click(-> window.location.href = '/register' diff --git a/public/js/signin.js b/public/js/signin.js deleted file mode 100644 index 3383de15..00000000 --- a/public/js/signin.js +++ /dev/null @@ -1,9 +0,0 @@ -(function() { - $(function() { - return $('#register').click(function() { - window.location.href = '/register'; - return $(this).preventDefault(); - }); - }); - -}).call(this); diff --git a/public/js/socket.io.js b/public/js/socket.io.js deleted file mode 100644 index d5fe104d..00000000 --- a/public/js/socket.io.js +++ /dev/null @@ -1,3 +0,0 @@ -!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.io=e():"undefined"!=typeof global?global.io=e():"undefined"!=typeof self&&(self.io=e())}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0&&!this.encoding){var pack=this.packetBuffer.shift();this.packet(pack)}};Manager.prototype.cleanup=function(){var sub;while(sub=this.subs.shift())sub.destroy();this.packetBuffer=[];this.encoding=false;this.decoder.destroy()};Manager.prototype.close=Manager.prototype.disconnect=function(){this.skipReconnect=true;this.engine.close()};Manager.prototype.onclose=function(reason){debug("close");this.cleanup();this.readyState="closed";this.emit("close",reason);if(this._reconnection&&!this.skipReconnect){this.reconnect()}};Manager.prototype.reconnect=function(){if(this.reconnecting)return this;var self=this;this.attempts++;if(this.attempts>this._reconnectionAttempts){debug("reconnect failed");this.emitAll("reconnect_failed");this.reconnecting=false}else{var delay=this.attempts*this.reconnectionDelay();delay=Math.min(delay,this.reconnectionDelayMax());debug("will wait %dms before reconnect attempt",delay);this.reconnecting=true;var timer=setTimeout(function(){debug("attempting reconnect");self.emitAll("reconnect_attempt",self.attempts);self.emitAll("reconnecting",self.attempts);self.open(function(err){if(err){debug("reconnect attempt error");self.reconnecting=false;self.reconnect();self.emitAll("reconnect_error",err.data)}else{debug("reconnect success");self.onreconnect()}})},delay);this.subs.push({destroy:function(){clearTimeout(timer)}})}};Manager.prototype.onreconnect=function(){var attempt=this.attempts;this.attempts=0;this.reconnecting=false;this.emitAll("reconnect",attempt)}},{"./on":4,"./socket":5,"./url":6,"component-bind":7,"component-emitter":8,debug:9,"engine.io-client":11,"object-component":37,"socket.io-parser":40}],4:[function(require,module,exports){module.exports=on;function on(obj,ev,fn){obj.on(ev,fn);return{destroy:function(){obj.removeListener(ev,fn)}}}},{}],5:[function(require,module,exports){var parser=require("socket.io-parser");var Emitter=require("component-emitter");var toArray=require("to-array");var on=require("./on");var bind=require("component-bind");var debug=require("debug")("socket.io-client:socket");var hasBin=require("has-binary-data");var indexOf=require("indexof");module.exports=exports=Socket;var events={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1};var emit=Emitter.prototype.emit;function Socket(io,nsp){this.io=io;this.nsp=nsp;this.json=this;this.ids=0;this.acks={};this.open();this.receiveBuffer=[];this.sendBuffer=[];this.connected=false;this.disconnected=true;this.subEvents()}Emitter(Socket.prototype);Socket.prototype.subEvents=function(){var io=this.io;this.subs=[on(io,"open",bind(this,"onopen")),on(io,"packet",bind(this,"onpacket")),on(io,"close",bind(this,"onclose"))]};Socket.prototype.open=Socket.prototype.connect=function(){if(this.connected)return this;this.io.open();if("open"==this.io.readyState)this.onopen();return this};Socket.prototype.send=function(){var args=toArray(arguments);args.unshift("message");this.emit.apply(this,args);return this};Socket.prototype.emit=function(ev){if(events.hasOwnProperty(ev)){emit.apply(this,arguments);return this}var args=toArray(arguments);var parserType=parser.EVENT;if(hasBin(args)){parserType=parser.BINARY_EVENT}var packet={type:parserType,data:args};if("function"==typeof args[args.length-1]){debug("emitting packet with ack id %d",this.ids);this.acks[this.ids]=args.pop();packet.id=this.ids++}if(this.connected){this.packet(packet)}else{this.sendBuffer.push(packet)}return this};Socket.prototype.packet=function(packet){packet.nsp=this.nsp;this.io.packet(packet)};Socket.prototype.onopen=function(){debug("transport is open - connecting");if("/"!=this.nsp){this.packet({type:parser.CONNECT})}};Socket.prototype.onclose=function(reason){debug("close (%s)",reason);this.connected=false;this.disconnected=true;this.emit("disconnect",reason)};Socket.prototype.onpacket=function(packet){if(packet.nsp!=this.nsp)return;switch(packet.type){case parser.CONNECT:this.onconnect();break;case parser.EVENT:this.onevent(packet);break;case parser.BINARY_EVENT:this.onevent(packet);break;case parser.ACK:this.onack(packet);break;case parser.BINARY_ACK:this.onack(packet);break;case parser.DISCONNECT:this.ondisconnect();break;case parser.ERROR:this.emit("error",packet.data);break}};Socket.prototype.onevent=function(packet){var args=packet.data||[];debug("emitting event %j",args);if(null!=packet.id){debug("attaching ack callback to event");args.push(this.ack(packet.id))}if(this.connected){emit.apply(this,args)}else{this.receiveBuffer.push(args)}};Socket.prototype.ack=function(id){var self=this;var sent=false;return function(){if(sent)return;sent=true;var args=toArray(arguments);debug("sending ack %j",args);var type=hasBin(args)?parser.BINARY_ACK:parser.ACK;self.packet({type:type,id:id,data:args})}};Socket.prototype.onack=function(packet){debug("calling ack %s with %j",packet.id,packet.data);var fn=this.acks[packet.id];fn.apply(this,packet.data);delete this.acks[packet.id]};Socket.prototype.onconnect=function(){this.connected=true;this.disconnected=false;this.emit("connect");this.emitBuffered()};Socket.prototype.emitBuffered=function(){var i;for(i=0;i=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"};debug.enabled=function(name){for(var i=0,len=debug.skips.length;i';iframe=document.createElement(html)}catch(e){iframe=document.createElement("iframe");iframe.name=self.iframeId;iframe.src="javascript:0"}iframe.id=self.iframeId;self.form.appendChild(iframe);self.iframe=iframe}initIframe();data=data.replace(rEscapedNewline,"\\\n");this.area.value=data.replace(rNewline,"\\n");try{this.form.submit()}catch(e){}if(this.iframe.attachEvent){this.iframe.onreadystatechange=function(){if(self.iframe.readyState=="complete"){complete()}}}else{this.iframe.onload=complete}}},{"./polling":18,"component-inherit":21}],17:[function(require,module,exports){var global=typeof self!=="undefined"?self:typeof window!=="undefined"?window:{};var XMLHttpRequest=require("xmlhttprequest");var Polling=require("./polling");var Emitter=require("component-emitter");var inherit=require("component-inherit");var debug=require("debug")("engine.io-client:polling-xhr");module.exports=XHR;module.exports.Request=Request;function empty(){}function XHR(opts){Polling.call(this,opts);if(global.location){var isSSL="https:"==location.protocol;var port=location.port;if(!port){port=isSSL?443:80}this.xd=opts.hostname!=global.location.hostname||port!=opts.port}}inherit(XHR,Polling);XHR.prototype.supportsBinary=true;XHR.prototype.request=function(opts){opts=opts||{};opts.uri=this.uri();opts.xd=this.xd;opts.agent=this.agent||false;opts.supportsBinary=this.supportsBinary;return new Request(opts)};XHR.prototype.doWrite=function(data,fn){var isBinary=typeof data!=="string"&&data!==undefined;var req=this.request({method:"POST",data:data,isBinary:isBinary});var self=this;req.on("success",fn);req.on("error",function(err){self.onError("xhr post error",err)});this.sendXhr=req};XHR.prototype.doPoll=function(){debug("xhr poll");var req=this.request();var self=this;req.on("data",function(data){self.onData(data)});req.on("error",function(err){self.onError("xhr poll error",err)});this.pollXhr=req};function Request(opts){this.method=opts.method||"GET";this.uri=opts.uri;this.xd=!!opts.xd;this.async=false!==opts.async;this.data=undefined!=opts.data?opts.data:null;this.agent=opts.agent;this.create(opts.isBinary,opts.supportsBinary)}Emitter(Request.prototype);Request.prototype.create=function(isBinary,supportsBinary){var xhr=this.xhr=new XMLHttpRequest({agent:this.agent,xdomain:this.xd});var self=this;try{debug("xhr open %s: %s",this.method,this.uri);xhr.open(this.method,this.uri,this.async);if(supportsBinary){xhr.responseType="arraybuffer"}if("POST"==this.method){try{if(isBinary){xhr.setRequestHeader("Content-type","application/octet-stream")}else{xhr.setRequestHeader("Content-type","text/plain;charset=UTF-8")}}catch(e){}}if("withCredentials"in xhr){xhr.withCredentials=true}xhr.onreadystatechange=function(){var data;try{if(4!=xhr.readyState)return;if(200==xhr.status||1223==xhr.status){var contentType=xhr.getResponseHeader("Content-Type");if(contentType==="application/octet-stream"){data=xhr.response}else{if(!supportsBinary){data=xhr.responseText}else{data="ok"}}}else{setTimeout(function(){self.onError(xhr.status)},0)}}catch(e){self.onError(e)}if(null!=data){self.onData(data)}};debug("xhr data %s",this.data);xhr.send(this.data)}catch(e){setTimeout(function(){self.onError(e)},0);return}if(global.document){this.index=Request.requestsCount++;Request.requests[this.index]=this}};Request.prototype.onSuccess=function(){this.emit("success");this.cleanup()};Request.prototype.onData=function(data){this.emit("data",data);this.onSuccess()};Request.prototype.onError=function(err){this.emit("error",err);this.cleanup()};Request.prototype.cleanup=function(){if("undefined"==typeof this.xhr||null===this.xhr){return}this.xhr.onreadystatechange=empty;try{this.xhr.abort()}catch(e){}if(global.document){delete Request.requests[this.index]}this.xhr=null};Request.prototype.abort=function(){this.cleanup()};if(global.document){Request.requestsCount=0;Request.requests={};if(global.attachEvent){global.attachEvent("onunload",unloadHandler)}else if(global.addEventListener){global.addEventListener("beforeunload",unloadHandler)}}function unloadHandler(){for(var i in Request.requests){if(Request.requests.hasOwnProperty(i)){Request.requests[i].abort()}}}},{"./polling":18,"component-emitter":8,"component-inherit":21,debug:9,xmlhttprequest:20}],18:[function(require,module,exports){var Transport=require("../transport");var parseqs=require("parseqs");var parser=require("engine.io-parser");var inherit=require("component-inherit");var debug=require("debug")("engine.io-client:polling");module.exports=Polling;var hasXHR2=function(){var XMLHttpRequest=require("xmlhttprequest");var xhr=new XMLHttpRequest({agent:this.agent,xdomain:false});return null!=xhr.responseType}();function Polling(opts){var forceBase64=opts&&opts.forceBase64;if(!hasXHR2||forceBase64){this.supportsBinary=false}Transport.call(this,opts)}inherit(Polling,Transport);Polling.prototype.name="polling";Polling.prototype.doOpen=function(){this.poll()};Polling.prototype.pause=function(onPause){var pending=0;var self=this;this.readyState="pausing";function pause(){debug("paused");self.readyState="paused";onPause()}if(this.polling||!this.writable){var total=0;if(this.polling){debug("we are currently polling - waiting to pause");total++;this.once("pollComplete",function(){debug("pre-pause polling complete");--total||pause()})}if(!this.writable){debug("we are currently writing - waiting to pause");total++;this.once("drain",function(){debug("pre-pause writing complete");--total||pause()})}}else{pause()}};Polling.prototype.poll=function(){debug("polling");this.polling=true;this.doPoll();this.emit("poll")};Polling.prototype.onData=function(data){var self=this;debug("polling got data %s",data);var callback=function(packet,index,total){if("opening"==self.readyState){self.onOpen()}if("close"==packet.type){self.onClose();return false}self.onPacket(packet)};parser.decodePayload(data,this.socket.binaryType,callback);if("closed"!=this.readyState){this.polling=false;this.emit("pollComplete");if("open"==this.readyState){this.poll()}else{debug('ignoring poll - transport state "%s"',this.readyState)}}};Polling.prototype.doClose=function(){var self=this;function close(){debug("writing close packet");self.write([{type:"close"}])}if("open"==this.readyState){debug("transport open - closing");close()}else{debug("transport not open - deferring close");this.once("open",close)}};Polling.prototype.write=function(packets){var self=this;this.writable=false;var callbackfn=function(){self.writable=true;self.emit("drain")};var self=this;parser.encodePayload(packets,this.supportsBinary,function(data){self.doWrite(data,callbackfn)})};Polling.prototype.uri=function(){var query=this.query||{};var schema=this.secure?"https":"http";var port="";if(false!==this.timestampRequests){query[this.timestampParam]=+new Date+"-"+Transport.timestamps++}if(!this.supportsBinary&&!query.sid){query.b64=1}query=parseqs.encode(query);if(this.port&&("https"==schema&&this.port!=443||"http"==schema&&this.port!=80)){port=":"+this.port}if(query.length){query="?"+query}return schema+"://"+this.hostname+port+this.path+query}},{"../transport":14,"component-inherit":21,debug:9,"engine.io-parser":22,parseqs:30,xmlhttprequest:20}],19:[function(require,module,exports){var Transport=require("../transport");var parser=require("engine.io-parser");var parseqs=require("parseqs");var inherit=require("component-inherit");var debug=require("debug")("engine.io-client:websocket");var WebSocket=require("ws");module.exports=WS;function WS(opts){var forceBase64=opts&&opts.forceBase64;if(forceBase64){this.supportsBinary=false}Transport.call(this,opts)}inherit(WS,Transport);WS.prototype.name="websocket";WS.prototype.supportsBinary=true;WS.prototype.doOpen=function(){if(!this.check()){return}var self=this;var uri=this.uri();var protocols=void 0;var opts={agent:this.agent};this.ws=new WebSocket(uri,protocols,opts);if(this.ws.binaryType===undefined){this.supportsBinary=false}this.ws.binaryType="arraybuffer";this.addEventListeners()};WS.prototype.addEventListeners=function(){var self=this;this.ws.onopen=function(){self.onOpen()};this.ws.onclose=function(){self.onClose()};this.ws.onmessage=function(ev){self.onData(ev.data)};this.ws.onerror=function(e){self.onError("websocket error",e)}};if("undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)){WS.prototype.onData=function(data){var self=this;setTimeout(function(){Transport.prototype.onData.call(self,data)},0)}}WS.prototype.write=function(packets){var self=this;this.writable=false;for(var i=0,l=packets.length;i1){return{type:packetslist[type],data:data.substring(1)}}else{return{type:packetslist[type]}}}var asArray=new Uint8Array(data);var type=asArray[0];var rest=sliceBuffer(data,1);if(Blob&&binaryType==="blob"){rest=new Blob([rest])}return{type:packetslist[type],data:rest}};exports.decodeBase64Packet=function(msg,binaryType){var type=packetslist[msg.charAt(0)];if(!global.ArrayBuffer){return{type:type,data:{base64:true,data:msg.substr(1)}}}var data=base64encoder.decode(msg.substr(1));if(binaryType==="blob"&&Blob){data=new Blob([data])}return{type:type,data:data}};exports.encodePayload=function(packets,supportsBinary,callback){if(typeof supportsBinary=="function"){callback=supportsBinary;supportsBinary=null}if(supportsBinary){if(Blob&&!isAndroid){return exports.encodePayloadAsBlob(packets,callback)}return exports.encodePayloadAsArrayBuffer(packets,callback)}if(!packets.length){return callback("0:")}function setLengthHeader(message){return message.length+":"+message}function encodeOne(packet,doneCallback){exports.encodePacket(packet,supportsBinary,function(message){doneCallback(null,setLengthHeader(message))})}map(packets,encodeOne,function(err,results){return callback(results.join(""))})};function map(ary,each,done){var result=new Array(ary.length);var next=after(ary.length,done);var eachWithIndex=function(i,el,cb){each(el,function(error,msg){result[i]=msg;cb(error,result)})};for(var i=0;i0){var tailArray=new Uint8Array(bufferTail);var isString=tailArray[0]===0;var msgLength="";for(var i=1;;i++){if(tailArray[i]==255)break;msgLength+=tailArray[i]}bufferTail=sliceBuffer(bufferTail,2+msgLength.length);msgLength=parseInt(msgLength);var msg=sliceBuffer(bufferTail,0,msgLength);if(isString){try{msg=String.fromCharCode.apply(null,new Uint8Array(msg))}catch(e){var typed=new Uint8Array(msg);msg="";for(var i=0;ibytes){end=bytes}if(start>=bytes||start>=end||bytes===0){return new ArrayBuffer(0)}var abv=new Uint8Array(arraybuffer);var result=new Uint8Array(end-start);for(var i=start,ii=0;i>2];base64+=chars[(bytes[i]&3)<<4|bytes[i+1]>>4];base64+=chars[(bytes[i+1]&15)<<2|bytes[i+2]>>6];base64+=chars[bytes[i+2]&63]}if(len%3===2){base64=base64.substring(0,base64.length-1)+"="}else if(len%3===1){base64=base64.substring(0,base64.length-2)+"=="}return base64};exports.decode=function(base64){var bufferLength=base64.length*.75,len=base64.length,i,p=0,encoded1,encoded2,encoded3,encoded4;if(base64[base64.length-1]==="="){bufferLength--;if(base64[base64.length-2]==="="){bufferLength--}}var arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer);for(i=0;i>4;bytes[p++]=(encoded2&15)<<4|encoded3>>2;bytes[p++]=(encoded3&3)<<6|encoded4&63}return arraybuffer}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],27:[function(require,module,exports){var global=typeof self!=="undefined"?self:typeof window!=="undefined"?window:{};var BlobBuilder=global.BlobBuilder||global.WebKitBlobBuilder||global.MSBlobBuilder||global.MozBlobBuilder;var blobSupported=function(){try{var b=new Blob(["hi"]);return b.size==2}catch(e){return false}}();var blobBuilderSupported=BlobBuilder&&BlobBuilder.prototype.append&&BlobBuilder.prototype.getBlob;function BlobBuilderConstructor(ary,options){options=options||{};var bb=new BlobBuilder;for(var i=0;i=55296&&value<=56319&&counter65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value)}return output}function createByte(codePoint,shift){return stringFromCharCode(codePoint>>shift&63|128)}function encodeCodePoint(codePoint){if((codePoint&4294967168)==0){return stringFromCharCode(codePoint)}var symbol="";if((codePoint&4294965248)==0){symbol=stringFromCharCode(codePoint>>6&31|192)}else if((codePoint&4294901760)==0){symbol=stringFromCharCode(codePoint>>12&15|224);symbol+=createByte(codePoint,6)}else if((codePoint&4292870144)==0){symbol=stringFromCharCode(codePoint>>18&7|240);symbol+=createByte(codePoint,12);symbol+=createByte(codePoint,6)}symbol+=stringFromCharCode(codePoint&63|128);return symbol}function utf8encode(string){var codePoints=ucs2decode(string);var length=codePoints.length;var index=-1;var codePoint;var byteString="";while(++index=byteCount){throw Error("Invalid byte index")}var continuationByte=byteArray[byteIndex]&255;byteIndex++;if((continuationByte&192)==128){return continuationByte&63}throw Error("Invalid continuation byte")}function decodeSymbol(){var byte1;var byte2;var byte3;var byte4;var codePoint;if(byteIndex>byteCount){throw Error("Invalid byte index")}if(byteIndex==byteCount){return false}byte1=byteArray[byteIndex]&255;byteIndex++;if((byte1&128)==0){return byte1}if((byte1&224)==192){var byte2=readContinuationByte();codePoint=(byte1&31)<<6|byte2;if(codePoint>=128){return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&240)==224){byte2=readContinuationByte();byte3=readContinuationByte();codePoint=(byte1&15)<<12|byte2<<6|byte3;if(codePoint>=2048){return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&248)==240){byte2=readContinuationByte();byte3=readContinuationByte();byte4=readContinuationByte();codePoint=(byte1&15)<<18|byte2<<12|byte3<<6|byte4;if(codePoint>=65536&&codePoint<=1114111){return codePoint}}throw Error("Invalid UTF-8 detected")}var byteArray;var byteCount;var byteIndex;function utf8decode(byteString){byteArray=ucs2decode(byteString);byteCount=byteArray.length;byteIndex=0;var codePoints=[];var tmp;while((tmp=decodeSymbol())!==false){codePoints.push(tmp)}return ucs2encode(codePoints)}var utf8={version:"2.0.0",encode:utf8encode,decode:utf8decode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return utf8})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=utf8}else{var object={};var hasOwnProperty=object.hasOwnProperty;for(var key in utf8){hasOwnProperty.call(utf8,key)&&(freeExports[key]=utf8[key])}}}else{root.utf8=utf8}})(this)},{}],29:[function(require,module,exports){var global=typeof self!=="undefined"?self:typeof window!=="undefined"?window:{};var rvalidchars=/^[\],:{}\s]*$/;var rvalidescape=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;var rvalidtokens=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;var rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g;var rtrimLeft=/^\s+/;var rtrimRight=/\s+$/;module.exports=function parsejson(data){if("string"!=typeof data||!data){return null}data=data.replace(rtrimLeft,"").replace(rtrimRight,"");if(global.JSON&&JSON.parse){return JSON.parse(data)}if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidtokens,"]").replace(rvalidbraces,""))){return new Function("return "+data)()}}},{}],30:[function(require,module,exports){exports.encode=function(obj){var str="";for(var i in obj){if(obj.hasOwnProperty(i)){if(str.length)str+="&";str+=encodeURIComponent(i)+"="+encodeURIComponent(obj[i])}}return str};exports.decode=function(qs){var qry={};var pairs=qs.split("&");for(var i=0,l=pairs.length;i1)))/4)-floor((year-1901+month)/100)+floor((year-1601+month)/400)}}if(!(isProperty={}.hasOwnProperty)){isProperty=function(property){var members={},constructor;if((members.__proto__=null,members.__proto__={toString:1},members).toString!=getClass){isProperty=function(property){var original=this.__proto__,result=property in(this.__proto__=null,this);this.__proto__=original;return result}}else{constructor=members.constructor;isProperty=function(property){var parent=(this.constructor||constructor).prototype;return property in this&&!(property in parent&&this[property]===parent[property])}}members=null;return isProperty.call(this,property)}}var PrimitiveTypes={"boolean":1,number:1,string:1,undefined:1};var isHostType=function(object,property){var type=typeof object[property];return type=="object"?!!object[property]:!PrimitiveTypes[type]};forEach=function(object,callback){var size=0,Properties,members,property;(Properties=function(){this.valueOf=0}).prototype.valueOf=0;members=new Properties;for(property in members){if(isProperty.call(members,property)){size++}}Properties=members=null;if(!size){members=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,length;var hasProperty=!isFunction&&typeof object.constructor!="function"&&isHostType(object,"hasOwnProperty")?object.hasOwnProperty:isProperty;for(property in object){if(!(isFunction&&property=="prototype")&&hasProperty.call(object,property)){callback(property)}}for(length=members.length;property=members[--length];hasProperty.call(object,property)&&callback(property));}}else if(size==2){forEach=function(object,callback){var members={},isFunction=getClass.call(object)==functionClass,property;for(property in object){if(!(isFunction&&property=="prototype")&&!isProperty.call(members,property)&&(members[property]=1)&&isProperty.call(object,property)){callback(property)}}}}else{forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,isConstructor;for(property in object){if(!(isFunction&&property=="prototype")&&isProperty.call(object,property)&&!(isConstructor=property==="constructor")){callback(property)}}if(isConstructor||isProperty.call(object,property="constructor")){callback(property)}}}return forEach(object,callback)};if(!has("json-stringify")){var Escapes={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var leadingZeroes="000000";var toPaddedString=function(width,value){return(leadingZeroes+(value||0)).slice(-width)};var unicodePrefix="\\u00";var quote=function(value){var result='"',index=0,length=value.length,isLarge=length>10&&charIndexBuggy,symbols;if(isLarge){symbols=value.split("")}for(;index-1/0&&value<1/0){if(getDay){date=floor(value/864e5);for(year=floor(date/365.2425)+1970-1;getDay(year+1,0)<=date;year++);for(month=floor((date-getDay(year,0))/30.42);getDay(year,month+1)<=date;month++);date=1+date-getDay(year,month);time=(value%864e5+864e5)%864e5;hours=floor(time/36e5)%24;minutes=floor(time/6e4)%60;seconds=floor(time/1e3)%60;milliseconds=time%1e3}else{year=value.getUTCFullYear();month=value.getUTCMonth();date=value.getUTCDate();hours=value.getUTCHours();minutes=value.getUTCMinutes();seconds=value.getUTCSeconds();milliseconds=value.getUTCMilliseconds()}value=(year<=0||year>=1e4?(year<0?"-":"+")+toPaddedString(6,year<0?-year:year):toPaddedString(4,year))+"-"+toPaddedString(2,month+1)+"-"+toPaddedString(2,date)+"T"+toPaddedString(2,hours)+":"+toPaddedString(2,minutes)+":"+toPaddedString(2,seconds)+"."+toPaddedString(3,milliseconds)+"Z"}else{value=null}}else if(typeof value.toJSON=="function"&&(className!=numberClass&&className!=stringClass&&className!=arrayClass||isProperty.call(value,"toJSON"))){value=value.toJSON(property)}}if(callback){value=callback.call(object,property,value)}if(value===null){return"null"}className=getClass.call(value);if(className==booleanClass){return""+value}else if(className==numberClass){return value>-1/0&&value<1/0?""+value:"null"}else if(className==stringClass){return quote(""+value)}if(typeof value=="object"){for(length=stack.length;length--;){if(stack[length]===value){throw TypeError()}}stack.push(value);results=[];prefix=indentation;indentation+=whitespace;if(className==arrayClass){for(index=0,length=value.length;index0){for(whitespace="",width>10&&(width=10);whitespace.length=48&&charCode<=57||charCode>=97&&charCode<=102||charCode>=65&&charCode<=70)){abort()}}value+=fromCharCode("0x"+source.slice(begin,Index));break;default:abort()}}else{if(charCode==34){break}charCode=source.charCodeAt(Index);begin=Index;while(charCode>=32&&charCode!=92&&charCode!=34){charCode=source.charCodeAt(++Index)}value+=source.slice(begin,Index)}}if(source.charCodeAt(Index)==34){Index++;return value}abort();default:begin=Index;if(charCode==45){isSigned=true;charCode=source.charCodeAt(++Index)}if(charCode>=48&&charCode<=57){if(charCode==48&&(charCode=source.charCodeAt(Index+1),charCode>=48&&charCode<=57)){abort()}isSigned=false;for(;Index=48&&charCode<=57);Index++);if(source.charCodeAt(Index)==46){position=++Index;for(;position=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}charCode=source.charCodeAt(Index);if(charCode==101||charCode==69){charCode=source.charCodeAt(++Index);if(charCode==43||charCode==45){Index++}for(position=Index;position=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}return+source.slice(begin,Index)}if(isSigned){abort()}if(source.slice(Index,Index+4)=="true"){Index+=4;return true}else if(source.slice(Index,Index+5)=="false"){Index+=5;return false}else if(source.slice(Index,Index+4)=="null"){Index+=4;return null}abort()}}return"$"};var get=function(value){var results,hasMembers;if(value=="$"){abort()}if(typeof value=="string"){if((charIndexBuggy?value.charAt(0):value[0])=="@"){return value.slice(1)}if(value=="["){results=[];for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="]"){break}if(hasMembers){if(value==","){value=lex();if(value=="]"){abort()}}else{abort()}}if(value==","){abort()}results.push(get(value))}return results}else if(value=="{"){results={};for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="}"){break}if(hasMembers){if(value==","){value=lex();if(value=="}"){abort()}}else{abort()}}if(value==","||typeof value!="string"||(charIndexBuggy?value.charAt(0):value[0])!="@"||lex()!=":"){abort()}results[value.slice(1)]=get(lex())}return results}abort()}return value};var update=function(source,property,callback){var element=walk(source,property,callback);if(element===undef){delete source[property]}else{source[property]=element}};var walk=function(source,property,callback){var value=source[property],length;if(typeof value=="object"&&value){if(getClass.call(value)==arrayClass){for(length=value.length;length--;){update(value,length,callback)}}else{forEach(value,function(property){update(value,property,callback)})}}return callback.call(source,property,value)};JSON3.parse=function(source,callback){var result,value;Index=0;Source=""+source;result=get(lex());if(lex()!="$"){abort()}Index=Source=null;return callback&&getClass.call(callback)==functionClass?walk((value={},value[""]=result,value),"",callback):result}}}if(isLoader){define(function(){return JSON3})}})(this)},{}],43:[function(require,module,exports){module.exports=toArray;function toArray(list,index){var array=[];index=index||0;for(var i=index||0;i