Skip to content

Instantly share code, notes, and snippets.

@zyphlar
Created December 22, 2019 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zyphlar/c5205a8d8e93f360ba521df90d6e6e5f to your computer and use it in GitHub Desktop.
Save zyphlar/c5205a8d8e93f360ba521df90d6e6e5f to your computer and use it in GitHub Desktop.
dynamic fundraising thermometer from google docs / spreadsheet
<!doctype>
<html>
<head>
<script type="text/javascript">
var sheetPublicWebUrl = "https://docs.google.com/spreadsheets/d/e/2PACX-1vSbdn0eDQHBJuC3X8C4Lrmgwsomj5c4K-5x8ROhCkylVNeA5dtCq59wavQcgzmGt8qplXgUBHq-NZEj/pub?gid=0&single=true&range=b1&output=csv"
var req = new XMLHttpRequest();
req.open('GET', sheetPublicWebUrl, true);
req.onload = function() {
result = req.responseText;
cur = Number(result.replace(/[^0-9\.-]+/g,""))
document.getElementById("thermometer").innerHTML =
'<img src="https://www.abcfundraising.com/thermometer-generator?max=8500&cur='+cur+'&symbol=%24&color=green" />';
};
req.send(null);
</script>
</head>
<body>
<div id="thermometer"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment