forked from pazguille/github-card
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
57 lines (49 loc) · 2.07 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
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, minimal-ui">
<meta name="apple-mobile-web-app-capable" content="yes">
<title><github-card>: a web component to show a profile-card for your github account.</title>
<link rel="stylesheet" href="assets/normalize.css">
<link rel="stylesheet" href="assets/styles.css">
</head>
<body>
<script type="module">
import "./src/github-card.js";
</script>
<header>
<h1><github-card></h1>
<h2>a web component to show a profile-card for your github account</h2>
</header>
<output id="cards">
<github-card user="rejas"></github-card>
</output>
<form id="create-card">
<input id="username" type="text" placeholder="Enter a Github username">
<button>Show</button>
</form>
<footer>
<a href="https://github.com/rejas/github-webcomponents" id="github-ribbon"><img width="149" height="149" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
based on code by <a href="http://pazguille.me/">Guille Paz</a>
<iframe id="github-button" src="http://ghbtns.com/github-btn.html?user=rejas&repo=github-webcomponents&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="152" height="30"></iframe>
</footer>
<script>
window.onload = function() {
var inp = document.querySelector('#username'),
frm = document.querySelector('#create-card'),
output = document.querySelector('#cards');
frm.addEventListener('submit', function(eve) {
var user = inp.value,
github;
eve.preventDefault();
if (user === '') { return false; }
github = document.createElement('github-card');
github.setAttribute('user', user);
output.innerHTML = '';
output.appendChild(github);
}, true);
};
</script>
</body>
</html>