/
index.html
47 lines (46 loc) · 1.54 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<html>
<head>
<link rel="stylesheet" href="normalize.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1 class="heading">Fetch, Git.</h1>
</header>
<main>
<section id="input">
<form class="pure-form">
<input type='text' class="pure-input-rounded" id='profile_name' placeholder="Enter the github profile you want to fetch" />
<button type="submit" class="button-secondary pure-button" </button><a href="#" id='fetch_github_profile'>Search</a>
</section>
<section id='profiles'>
</section>
</main>
<template id="profileTemplate">
<article>
<header>
<img src="{{avatar_url}}" />
<h1>{{name}}</h1>
<h2>{{login}}</h2>
</header>
<p>
<strong id='followers'>{{followers}} Followers</strong>
<strong id='repos'>{{public_repos}} Public Repos</strong>
</p>
</article>
</template>
<script type="text/javascript" src='jquery.js'></script>
<script type="text/javascript" src='handlebars.js'></script>
<script type="text/javascript">
$('#fetch_github_profile').on('click', function(){
var profile_name = $('#profile_name').val();
var source = $('#profileTemplate').html();
var template = Handlebars.compile(source);
$.get('https://api.github.com/users/' + profile_name + '?client_id=37af7ad49e2fbe652ed8&client_secret=302527e94db51b65a7c0e91e697a8162a449e87d', function(gitHubProfile) {
$('#profiles').append(template(gitHubProfile));
});
});
</script>
</body>
</html>