From 2ac74dc3448e4c799351ed60241848e286239836 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Fri, 6 Mar 2020 21:01:40 -0500 Subject: ui cleanup --- public/face.css | 10 +++++++++- public/face.js | 22 ++++++++++++++++++++ public/index.html | 60 ++++++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 75 insertions(+), 17 deletions(-) (limited to 'public') diff --git a/public/face.css b/public/face.css index d0e2913..8ef6e85 100644 --- a/public/face.css +++ b/public/face.css @@ -4,6 +4,10 @@ body { font-family: arial, verdana, helvetica, sans-serif; } +#help-toggle { + color: #ddd; +} + #text { width: 50%; margin: 20px auto 20px auto; @@ -17,7 +21,7 @@ body { width: 6em; } -#controls { +.controls { zoom: 200%; } @@ -26,3 +30,7 @@ body { margin: 10px auto 10px auto; zoom: 800%; } + +.hidden { + display: none; +} diff --git a/public/face.js b/public/face.js index cb10e0b..1e8e2ad 100644 --- a/public/face.js +++ b/public/face.js @@ -3,7 +3,11 @@ jQuery(function($) { // default base price var BASE_PRICE = 55.73; + + // current price (fetched below from current.json) var CURRENT = 0; + + // path to JSON data var DATA_URL = './current.json'; /** @@ -218,6 +222,21 @@ jQuery(function($) { return false; }); + // set base price + $('#base').text(BASE_PRICE); + + $('#help-toggle').click(function() { + // toggle help visibility + $('#help').toggleClass('hidden'); + + // update text + var text = $('#help').hasClass('hidden') ? 'Show Help' : 'Hide Help'; + $(this).text(text); + + // stop event + return false; + }); + // fetch current price as percent and populate #rate $.ajax({ method: 'GET', @@ -226,7 +245,10 @@ jQuery(function($) { }).fail(function(r) { alert("Couldn't fetch current data."); }).done(function(r) { + // cache current price CURRENT = to_percent(r.ask); + + // update field $('#rate').val(CURRENT); }); }); diff --git a/public/index.html b/public/index.html index 90bcd48..eefcf1b 100644 --- a/public/index.html +++ b/public/index.html @@ -11,24 +11,60 @@

Alonzo Mood Calculator

- Enter the change in the change in the stock price for the day as - a percentage in the field below. For example, if the stock - price is down 1%, then enter -1. + Calculate Alonzo's mood with pinpoint accuracy by leveraging the + latest synergy of advanced technology and cross-platform + initiatives.

-

-
+

+ +

+ Show Help +

+ +

+ + @@ -36,7 +72,7 @@ @@ -44,18 +80,10 @@ - -

-- cgit v1.2.3