diff options
| author | Adam Soltys <[email protected]> | 2017-01-15 18:24:09 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2017-01-15 18:24:09 -0800 |
| commit | 7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e (patch) | |
| tree | 91bb1d1b8fe6ad77a48f0e429d9bfd35834c78d9 /static/js/index.js | |
| parent | 0ae266bf88f9f79c7e99b272688126898303daa4 (diff) | |
| download | coinos-server-7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e.tar.gz coinos-server-7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e.zip | |
Initial Vueification
Diffstat (limited to 'static/js/index.js')
| -rw-r--r-- | static/js/index.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/static/js/index.js b/static/js/index.js new file mode 100644 index 00000000..b1a7167c --- /dev/null +++ b/static/js/index.js @@ -0,0 +1,56 @@ +;(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0](function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){ +(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); + + +},{}]},{},[1]) +;
\ No newline at end of file |
