Last active
September 30, 2017 22:15
-
-
Save ianpark/7393858800ebe370876f54a697085f12 to your computer and use it in GitHub Desktop.
This file contains 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
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> | |
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script> | |
<div id="my_space"></div> | |
<script> | |
var user_info = null; | |
function get_user(user_id, callback) { | |
console.log('Send getAccounts request'); | |
steem.api.getAccounts([user_id], function(err, response){ | |
if (err) { | |
console.log('Error!'); | |
} else { | |
console.log('Done!'); | |
user_info = JSON.parse(response[0].json_metadata).profile; | |
user_info.id = user_id; | |
} | |
if (callback) { | |
callback(); | |
} | |
}); | |
} | |
function show_as_text() { | |
if (user_info) { | |
$('#my_space').append(JSON.stringify(user_info)); | |
} | |
} | |
function show_nicely() { | |
if (user_info) { | |
$('#my_space') | |
.append( | |
$('<img/>', {src: user_info.profile_image, class: 'img-circle', width:120}) | |
).append( | |
$('<h1/>').text(user_info.id) | |
).append( | |
$('<h3/>').text(user_info.name) | |
).append( | |
$('<h4/>').text(user_info.location) | |
).append( | |
$('<p/>').text(user_info.about) | |
); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment