-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
209 lines (167 loc) · 4.61 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-8NNGHFBY58"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-8NNGHFBY58');
</script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Lora" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=PT+Sans+Narrow" rel="stylesheet">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://kit.fontawesome.com/57a8a8c892.js" crossorigin="anonymous"></script>
<title>GitHub Contributions | Adam Thomas</title>
<style>
body {
margin: 0;
padding: 0;
height: 100%;
font-family: 'Lora', serif;
color: #fff;
background-color: #000;
}
#step-1 {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
#step-1-box {
text-align: center;
width: 100%;
}
input, textarea {
font-size: 18px;
border: 1px solid #30363d !important;
background-color: #0d1117;
color: #fff;
max-width: 600px;
width: 100%;
margin: auto;
}
input {
font-size: 24px;
max-width: 400px;
text-align: center;
}
#codeadam {
position: fixed;
bottom: 0;
right: 0;
font-size: 24px;
padding: 15px;
z-index: 10000;
font-family: Arial, Helvetica, sans-serif;
}
iframe {
width: 100%;
max-width: 800px;
height: 160px;
border: none;
}
a:link,
a:hover,
a:visited,
a:active {
text-decoration: none;
font-size: 24px;
}
textarea:focus,
input:focus,
*:focus {
outline: none;
}
iframe {
background:none transparent !important;
}
</style>
</head>
<body>
<div id="codeadam">
<a href="/"><i class="fas fa-bars"></i></a>
<a href="https://github.com/codeadamca/github-contributions"><i class="fab fa-github"></i></a>
<a href="https://codeadam.ca"><img src="https://codeadam.ca/images/code-block-white.png" width="30"></a>
</div>
<div id="step-1">
<div id="step-1-box">
<a href="https://github.com/codeadamca"><img src="images/github.jpg" width="150" alt="GitHub Logo"></a>
<div class="w3-padding-32">
<input class="w3-input"
type="text"
value="codeadamca"
id="username"
autocomplete="off"
autocapitalize="off"
spellcheck="false">
</div>
<iframe width="800"
height="160"
frameborder="0"
allowtransparency
id="iframe"></iframe>
<div class="w3-padding-32">
<textarea class="w3-input"
id="embed"
rows="4"
autocomplete="off"
autocapitalize="off"
spellcheck="false"></textarea>
</div>
<div class="">
<a href="#" id="copy"><i class="fas fa-copy"></i></a>
</div>
</div>
</div>
<script>
// Create references to each DOM element needed
const iframeRef = document.getElementById('iframe');
const usernameRef = document.getElementById('username');
const embedRef = document.getElementById('embed');
const copyRef = document.getElementById('copy');
// Define a variable to set the delay required
const delay = 2000;
// Define a timer to track when typing stops
let timer;
// Track when useer stops typing
usernameRef.addEventListener('keyup', () => {
clearTimeout(timer);
timer = setTimeout(setUsername, delay)
});
// Use the provided username to display github contributions
function setUsername()
{
if(usernameRef.value == "")
{
iframeRef.src = 'https://pages.codeadam.ca/github-contributions/blank';
}
else
{
iframeRef.src = 'https://pages.codeadam.ca/github-contributions/' + usernameRef.value;
}
embedRef.value = '<iframe src=\"https://pages.codeadam.ca/github-contributions/' +
usernameRef.value +
'" width="800" height="190" frameborder="0" allowtransparency id="iframe"></iframe>';
}
window.addEventListener('load', () => {
setUsername();
});
copyRef.addEventListener('click', (event) => {
embedRef.contenteditable = true;
embedRef.focus();
document.execCommand('selectAll');
document.execCommand("copy");
embedRef.contenteditable = false;
copyRef.focus();
event.preventDefault();
});
</script>
</body>
</html>