-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
92 lines (79 loc) · 2.4 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<html>
<head>
<title>Gradient Avatar by Varld</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0px;
padding: 0px;
left: 0px;
right: 0px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',
sans-serif;
text-align: center;
}
* {
outline: none;
}
.logo {
position: fixed;
top: 50px;
width: 50px;
height: 50px;
right: 0px;
left: 0px;
margin: 0px auto;
}
h1 {
font-weight: 400;
}
.main {
margin-top: 200px;
}
input {
border: solid #ddd 1px;
padding: 7px 10px;
border-radius: 3px;
}
.avatar {
border-radius: 50000px;
}
.sub {
position: fixed;
bottom: 10px;
left: 0px;
right: 0px;
}
.sub a {
color: black;
}
</style>
</head>
<body>
<a href="https://github.com/varld">
<img class="logo" width="100%" height="100%" src="https://cdn.glitch.com/031487da-1ce3-4f55-9b00-ae47bb04db4f%2FPink%20bordered.svg?v=1569917483389" />
</a>
<div class="main">
<h1>Varld avatar generator</h1>
<img class="avatar" src="https://gradient-avatar.glitch.me/Enter a username"> <br /><br />
<input class="username" placeholder="Enter a username" /><br /><br />
</div>
<div class="sub">
<p>Made by <a href="https://github.com/varld">Varld</a>. <a href="https://github.com/varld/gradient-avatar-service">Source code</a>.</p>
</div>
<script>
document.querySelector('.username').addEventListener('keyup', (ev) => {
document.querySelector('.avatar').setAttribute('src', 'https://gradient-avatar.glitch.me/' + (ev.target.value != '' ? ev.target.value : 'Enter a username'));
if (ev.keyCode == 13) {
const src = document.querySelector('.avatar').getAttribute('src');
window.open(src, '_blank').focus();
}
});
document.querySelector('.avatar').addEventListener('click', (ev) => {
const src = document.querySelector('.avatar').getAttribute('src');
window.open(src, '_blank').focus();
});
</script>
</body>
</html>