Skip to content

Commit

Permalink
Get number from github file
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKohler committed Nov 19, 2019
1 parent c1ac5b4 commit 8c329e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -25,7 +25,7 @@ <h1>Get the respect you deserve</h1>

<section class="row">
<section class="goals">
<h1><span id="number">0</span> of 5000 new accounts</h1>
<h1><span id="number">?</span> of 5000 new accounts</h1>
<span class="thermometer"></span>
</section>

Expand Down
21 changes: 12 additions & 9 deletions main.js
@@ -1,23 +1,26 @@
'use strict';

console.log('foo');

const GOAL = 5000;
const MAX_HEIGHT = 153;
const MIN_HEIGHT = 11;
const MAX_TOP = 142;
const MIN_TOP = 0;
const RATIO = MAX_TOP/GOAL;

let current = 800; // TODO: actually get it...
getValue();

if (current > GOAL) {
current = GOAL;
}
async function getValue() {
const response = await fetch('https://raw.githubusercontent.com/mozilla/firefox-accounts-campaign/master/number');
let current = await response.json();

const values = calculateValues(current);
setNewValues(values);
setTitle(current);
if (current > GOAL) {
current = GOAL;
}

const values = calculateValues(current);
setNewValues(values);
setTitle(current);
}

function setTitle(current) {
const numberElement = document.querySelector('#number');
Expand Down

0 comments on commit 8c329e3

Please sign in to comment.