[ Launch: Tributary Users ] 4550131 by zeffii
[ Launch: An inlet to Tributary ] 4545400 by enjalot
-
-
Save zeffii/4550131 to your computer and use it in GitHub Desktop.
Tributary Users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"description":"Tributary Users","endpoint":"","display":"html","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.7,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"hidepanel":false} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var display = d3.select("#display") | |
.style("overflow", "scroll"); | |
var url = '/api/users'; | |
display.append("input") | |
.attr({ | |
id: "fetch", | |
type: "button", | |
value: "fetch" | |
}) | |
.on("click", function() { | |
d3.json(url, function(err, res) { | |
tributary.data = res; | |
render(); | |
}) | |
}) | |
function render() { | |
if(!tributary.data) return; | |
var users = display.selectAll("div.user") | |
.data(tributary.data) | |
.enter() | |
.append("div") | |
.classed("user", true); | |
users.append("img") | |
.attr({ | |
src: function(d) { return d.avatar_url }, | |
width: 72, | |
height: 72 | |
}) | |
users.append("br") | |
users.append("span") | |
.classed("login", true) | |
.text(function(d) { return d.login }); | |
users.append("br") | |
users.append("span") | |
.classed("name", true) | |
.text(function(d) { return d.name }); | |
}; | |
render(); | |
/* | |
if(!tributary.data || !tributary.data.length) { | |
d3.json(url, function(err, res) { | |
tributary.data = res; | |
render(); | |
}) | |
} | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#fetch { | |
position:relative; | |
margin-top: 20px; | |
right: 40px; | |
font-size:29px; | |
float:right; | |
} | |
.user { | |
float:left; | |
margin-left: 10px; | |
margin-top: 20px; | |
height: 120px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment