Skip to content

Commit

Permalink
Fix coderot
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Oct 18, 2013
1 parent 6d5fb3d commit 0231eb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<title>Project it Yourself!</title>
<link href='reset.css' rel='stylesheet' type='text/css' />
<link href='site.css' rel='stylesheet' type='text/css' />
<script src='d3.v3.js'></script>
</head>
<body>
<div class='wrapper'>
Expand Down
20 changes: 8 additions & 12 deletions site.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,14 @@ if (window.location.hash) {
head.appendChild(script);
document.getElementById('fx').value =
document.getElementById('fy').value = '... loading preset ...';
script.onload = function() {
document.getElementById('fx').value =
fx.toString()
.replace('function fx(x, y) {', '')
.replace(/\}/, '');
document.getElementById('fy').value =
fy.toString()
.replace('function fy(x, y) {', '')
.replace(/\}/, '');
load_and_draw();
};
script.src = 'https://raw.github.com/gist/' + id;
d3.json('https://api.github.com/gists/' + id)
.on('load', function(d) {
d3.select('#fx')
.node().value = (d.files['x.js'] || {}).content;
d3.select('#fy')
.node().value = (d.files['y.js'] || {}).content;
load_and_draw();
}).get();
}
}

Expand Down

0 comments on commit 0231eb4

Please sign in to comment.