-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
235 lines (211 loc) · 5.53 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Your new Nickname</title>
<link rel="shortcut icon" href="//campudus.github.io/namegen/favicon.ico" />
<link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:200" rel="stylesheet"
type="text/css">
<link href="//fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet"
type="text/css">
<script src="js/namegen.js"></script>
<script src="js/example.js"></script>
<style type="text/css">
html,body {
margin: 0;
min-height: 100%;
}
body {
/* Old browsers */
background: #000000;
/* FF3.6+ */
background: -moz-radial-gradient(center, ellipse cover, #303030 0%, #000000 99%);
/* Chrome,Safari4+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%,
color-stop(0%, #303030), color-stop(99%, #000000));
/* Chrome10+,Safari5.1+ */
background: -webkit-radial-gradient(center, ellipse cover, #303030 0%, #000000 99%);
/* Opera 12+ */
background: -o-radial-gradient(center, ellipse cover, #303030 0%, #000000 99%);
/* IE10+ */
background: -ms-radial-gradient(center, ellipse cover, #303030 0%, #000000 99%);
/* W3C */
background: radial-gradient(ellipse at center, #303030 0%, #000000 99%);
/* IE6-9 fallback on horizontal gradient */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#303030',
endColorstr='#000000', GradientType=1);
font-family: "Montserrat", Arial, Helvetica, sans-serif;
font-size: 13px;
line-height: 1.4;
color: #fff;
}
.logo {
position: absolute;
bottom: 10px;
right: 10px;
}
.lang {
position: absolute;
bottom: 10px;
left: 10px;
}
.langBtn {
background-color: transparent;
border: 0;
border-radius: 9px;
height: 22px;
width: 32px;
height: 22px;
}
#lang_en {
background-position: center center;
background-repeat: no-repeat;
background-image: url('img/lang_en.png');
}
#lang_de {
background-position: center center;
background-repeat: no-repeat;
background-image: url('img/lang_de.png');
}
.activeLang {
/* Old browsers */
background: #fff;
}
#generated {
position: absolute;
top: 50%;
left: 50%;
width: 650px;
margin-top: -80px;
margin-left: -325px;
}
#generated .name {
height: 60px;
width: 400px;
padding: 0px 20px;
line-height: 60px;
font-size: 32px;
color: #000000;
background-color: #fff;
font-weight: bold;
float: left;
text-align: center;
vertical-align: center;
}
#generated .another {
border: 0;
background-color: #d40055;
color: #ffffff;
width: 200px;
height: 60px;
line-height: 60px;
margin-left: 10px;
font-size: 24px;
padding: 0;
float: left;
padding-right: 25px;
padding-left: 25px;
text-transform: uppercase;
font-family: "Montserrat";
text-align: center;
}
#generated .another:hover,#generated .another:focus,#generated .another:active
{
background-color: #a3d2e7;
}
#generated .callme {
font-size: 60px;
font-family: "Source Sans Pro", sans-serif;
font-weight: normal;
text-transform: uppercase;
color: #ffffff;
line-height: 1;
margin-bottom: 40px;
text-align: center;
color: #ffffff;
}
</style>
</head>
<body>
<div class="logo">
<img alt="Campudus" src="img/campudus-white.png" width="200" height="41" />
</div>
<a href="https://github.com/campudus/namegen"><img
style="position: absolute; top: 0; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<div id="generated">
<div class="callme" id="callme">Nenn mich</div>
<div class="name" id="name">...</div>
<button class="another" id="anotherBtn">... oder ?</button>
</div>
<div class="lang">
<button id="lang_en" class="langBtn"></button>
<button id="lang_de" class="langBtn activeLang"></button>
</div>
<script type="text/javascript">
var qs = (function(args) {
if (args == "") {
return {};
}
var params = {};
for ( var i = 0; i < args.length; ++i) {
var keyValue = args[i].split('=');
if (keyValue.length != 2) {
continue;
}
params[keyValue[0]] = decodeURIComponent(keyValue[1].replace(/\+/g, " "));
}
return params;
})(window.location.search.substr(1).split('&'));
var lang = qs['lang'] || 'de';
var texts = {
'de' : {
title : 'Dein neuer Nickname',
callme : 'Nenn mich',
another : '... anders!'
},
'en' : {
title : 'Your new nickname',
callme : 'Call me',
another : '... no!'
}
}
var callme = document.getElementById('callme');
var nameElem = document.getElementById('name');
var anotherBtn = document.getElementById('anotherBtn');
var langSwitchEn = document.getElementById('lang_en');
var langSwitchDe = document.getElementById('lang_de');
function replaceWithNewName() {
nameElem.innerHTML = nameGen[lang]();
}
function setLang(l) {
lang = l;
if (l === 'en') {
langSwitchEn.className = 'langBtn activeLang';
langSwitchDe.className = 'langBtn';
} else {
langSwitchEn.className = 'langBtn';
langSwitchDe.className = 'langBtn activeLang';
}
initLang();
}
function initLang() {
document.title = texts[lang].title;
callme.innerHTML = texts[lang].callme;
anotherBtn.innerHTML = texts[lang].another;
replaceWithNewName();
}
anotherBtn.addEventListener('click', function(e) {
replaceWithNewName();
});
langSwitchEn.addEventListener('click', function(e) {
setLang('en');
});
langSwitchDe.addEventListener('click', function(e) {
setLang('de');
});
setLang(lang);
</script>
</body>
</html>