Permalink
Browse files

RC, displays total backers, list, etc

  • Loading branch information...
1 parent 80088cd commit 6efb4efc7ccf713891a4a4ff98e76a90fc606dbf @uberscientist committed Aug 6, 2013
Showing with 49 additions and 209 deletions.
  1. +0 −200 index.html
  2. +7 −5 public/index.html
  3. +42 −4 public/js/donate.js
View
@@ -1,200 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Bitstarter - Amateur EMG Research</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
- <link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css" media="screen">
- <link rel="stylesheet" type="text/css" href="/css/style.css">
-
- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css">
-
- <link href="http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic" rel="stylesheet" type="text/css">
- <link href="http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,300,400,600,700,800"
- rel="stylesheet" type="text/css">
- </head>
-
- <body>
-
- <div class="navbar navbar-inverse navbar-fixed-top">
- <div class="container">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
-
- <a class="navbar-brand" href="#">MindsForge</a>
- <div class="nav-collapse collapse">
- <ul class="nav navbar-nav">
- <li class="active"><a href="#">Home</a></li>
- <li><a href="#about">About</a></li>
- <li><a href="#contact">Contact</a></li>
- </ul>
- </div>
- </div>
- </div>
-
- <!-- We use row-fluid inside containers to achieve a resizable layout. -->
- <!-- blogs.endjin.com/2013/04/tips-for-implementing-responsive-designs-using-bootstrap/ -->
- <!-- http://stackoverflow.com/a/12270322 -->
- <div class="container">
- <!-- Font and paired font of .heading/.subheading and body from Google Fonts -->
- <!-- www.google.com/fonts/specimen/Ubuntu -->
- <!-- www.google.com/fonts/specimen/Ubuntu#pairings -->
- <div class="row-fluid heading">
- <div class="span12">
- <h1>Science:</h1>
- </div>
- </div>
- <div class="row-fluid subheading">
- <div class="span12">
- <!-- Special typography from Bootstrap for lead paragraph. -->
- <!-- http://twitter.github.io/bootstrap/base-css.html#typography -->
- <p class="lead">How can EMG technology be used to help people with Parkinsons?</p>
- </div>
- </div>
- <div class="row-fluid pitch">
- <div class="span5 offset1 video">
- <img class="img-polaroid" src="http://placehold.it/480x300">
- </div>
-
- <!-- We define a new 'actions' div to contain statistics, order, and share buttons.-->
- <div class="span5 actions">
- <div class="span8 offset2">
- <div class="statistics">
- <div class="span4">
- <!-- linediv-l and linediv-r give dividing lines that look
- different in horizontal and vertical layouts, illustrating
- media queries. -->
- <div class="linediv-l">
- <h3>0</h3> <p>backers</p>
- </div>
- </div>
- <div class="span4">
- <div class="linediv-c">
- <h3>$0</h3> <p>of $1,000</p>
- </div>
- </div>
- <div class="span4">
- <div class="linediv-r">
- <h3>30</h3> <p>days left</p>
- </div>
- </div>
- </div>
- </div>
- <div class="span10 offset1">
- <!-- Bootstrap progress bar -->
- <!-- http://twitter.github.io/bootstrap/components.html#progress -->
- <div class="thermometer progress active">
- <div class="bar bar-success" style="width: 60%;"></div>
- <div class="bar bar-warning" style="width: 40%;"></div>
- </div>
- </div>
- <div class="span6 offset3 order">
- <!-- Standard Bootstrap button. -->
- <!-- http://twitter.github.io/bootstrap/base-css.html#buttons -->
- <button class="btn btn-success btn-large">Donate</button>
- </div>
- <div class="span8 offset2 social">
- <!-- Social buttons are not included in default Bootstrap. -->
- <!-- See: http://noizwaves.github.io/bootstrap-social-buttons -->
- <button class="btn btn-twitter"><i class="icon-twitter"></i> | Twitter</button>
- <button class="btn btn-facebook"><i class="icon-facebook"></i> | Facebook</button>
- </div>
- </div>
- </div>
-
- <!-- Beyond this part the marketing copy begins. -->
- <!-- https://developer.mozilla.org/en-US/docs/Web/CSS/text-align -->
- <!-- http://twitter.github.io/bootstrap/base-css.html#images -->
- <!-- http://placehold.it -->
- <div class="row-fluid section1">
- <div class="span5 offset1 asset">
- <img class="img-polaroid" src="http://placehold.it/480x300">
- </div>
- <div class="span5 copy">
- <p>My dad was diagnosed with Parkinsons disease in 2008. I have been living with him since 2011
- and have been able to observe first hand the effects of this degenerative neurological disease.
- Inspired by the <a href="http://parkinsonsvoice.org/science.php">Parkinsons Voice Initiative</a>
- and my own participating in the recent <a href="https://www.coursera.org/course/ml">course on machine learning</a>, I believe there is potential
- to gain valuable insights into certain aspects of the disease using data from a simple EMG device
- and applying machine learning algorithms to the collected data.</p>
- </div>
- </div>
-
- <div class="row-fluid section2">
- <div class="span5 offset1 copy copy-right">
- <p>I am most hopeful to finding a better way of objectively measuring the well known "on" and "off"
- periods that people with Parkinsons experience in their daily lives, and how those on and off episodes
- are influenced by medication, foods, exercise and other environmental factors. Creating a dosage
- schedule is difficult due to the varience in the speed of metabolization of L-Dopa and dopamine.
- I would like to find that it would be plausible to create a wrist band that would measure EMG and then
- alert the patient to medicate with L-Dopa at the appropriate times.</p>
- </div>
- <div class="span5 asset">
- <img class="img-polaroid" src="http://placehold.it/480x300">
- </div>
- </div>
-
- <!-- For the FAQ, we introduce a little bit of JS, using the accordion. -->
- <!-- This brings in jquery.js and bootstrap.js as dependencies. -->
- <!-- http://twitter.github.io/bootstrap/javascript.html#collapse -->
- <div class="row-fluid faq">
- <div class="span10 offset1">
- <h3>FAQ</h3>
- <div class="accordion" id="accordion2">
- <div class="accordion-group">
- <div class="accordion-heading">
- <a class="accordion-toggle" data-toggle="collapse"
- data-parent="#accordion2" href="#collapseOne">
- What does EMG stand for?
- </a>
- </div>
- <div id="collapseOne" class="accordion-body collapse">
- <div class="accordion-inner">
- EMG stands for <a href="https://en.wikipedia.org/wiki/Electromyography">Electromyography</a>
- , or measuring the electrical activity of skeletal muscles.
- </div>
- </div>
- </div>
- <div class="accordion-group">
- <div class="accordion-heading">
- <a class="accordion-toggle" data-toggle="collapse"
- data-parent="#accordion2" href="#collapseTwo">
- What qualifys you to undertake this project?
- </a>
- </div>
- <div id="collapseTwo" class="accordion-body collapse">
- <div class="accordion-inner">
- My most used screenname is uberscientist. I also have experience building and designing
- electronics at a basic level. I can read schematics, have designed a TMS machine with a
- SPICE simulator and attempted to build that (ran out of funds, I need HV low ESR capacitors!
- ... that will be the next bitstarter). And I live with someone who is probably willing to
- let me take measurements as I go through the development process! What more could I say?
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- Not crucial, but we put this under a CC By-SA 3.0 license. -->
- <!-- http://creativecommons.org/licenses/ -->
- <div class="row-fluid footer">
- <div class="span12">
- <p>
- This work is licensed under the
- <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC By-SA 3.0</a>
- </p>
- </div>
- </div>
- </div>
-
- <!-- SCRIPTS -->
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
- <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/js/bootstrap.min.js"></script>
-
- </body>
-</html>
View
@@ -98,10 +98,10 @@
<!-- Button trigger modal -->
- <h3 id="backers-count">1</h3>
+ <h3 id="backers-count"></h3>
<p><a data-toggle="modal" href="#donation-rank-modal" id="backers-link" href="#">backers</a></p>
- <h3>&#3647;<span id="total-btc">0.5</span></h3>
- <h3>&#0321;<span id="total-ltc">0.0</span></h3>
+ <h3>&#3647;<span id="total-btc"></span></h3>
+ <h3>&#0321;<span id="total-ltc"></span></h3>
</div>
<!-- Bootstrap progress bar
@@ -205,12 +205,14 @@ <h4 class="modal-title">Backers</h4>
</div>
<div class="modal-body">
- <div id="#btc-donators" class="col-lg-6">
+ <div class="col-lg-6">
<h5>Bitcoin donations:</h5>
+ <div id="btc-donators"></div>
</div>
- <div id="#ltc-donators"class="col-lg-6">
+ <div class="col-lg-6">
<h5>Litecoin donations:</h5>
+ <div id="ltc-donators"></div>
</div>
<div class="clearfix"></div>
View
@@ -1,3 +1,13 @@
+// Yoinked out of sugar.js
+var escapeHTML = function(string) {
+ return string.replace(/&/g, '&amp;' )
+ .replace(/</g, '&lt;' )
+ .replace(/>/g, '&gt;' )
+ .replace(/"/g, '&quot;')
+ .replace(/'/g, '&apos;')
+ .replace(/\//g, '&#x2f;');
+}
+
$.ready = function() {
var displayAddress = function(coin_type) {
@@ -27,15 +37,40 @@ $.ready = function() {
}
var displayDonations = function() {
+ $.get('/donate-api/donations', function(donations) {
+ var btc = donations[0];
+ var ltc = donations[1];
+
+ var ltc_list = "<ul>"
+ var btc_list = "<ul>"
+
+ for(var i = 0; i < btc.length; i+=2) {
+ var name = escapeHTML(btc[i]);
+ var amount = btc[i+1];
+ btc_list += "<li>" + name + " : " + "&#3647;" + amount + "</li>";
+ }
+ btc_list += "</ul>";
+
+ for(var i = 0; i < ltc.length; i+=2) {
+ var name = escapeHTML(ltc[i]);
+ var amount = ltc[i+1];
+ ltc_list += "<li>" + name + " : " + "&#3647;" + amount + "</li>";
+ }
+ ltc_list += "</ul>";
+ $('#btc-donators').html(btc_list);
+ $('#ltc-donators').html(ltc_list);
+ });
}
var getTotals = function() {
$.get('/donate-api/totals', function(totals) {
- console.log(totals);
- $('#total-btc').html(totals[0]);
- $('#total-ltc').html(totals[1]);
- }
+ $('#total-btc').html(totals[0] || '0.0');
+ $('#total-ltc').html(totals[1] || '0.0');
+
+ var donator_count = totals[2] + totals[3];
+ $('#backers-count').html(donator_count);
+ });
}
// Donation request
@@ -46,4 +81,7 @@ $.ready = function() {
// Display the backer ranks when clicked
$('#backers-link').click(displayDonations);
+
+ // Display totals for btc/ltc when page loads
+ getTotals();
};

0 comments on commit 6efb4ef

Please sign in to comment.