-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwords.html
60 lines (59 loc) · 1.63 KB
/
words.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
<html>
<head>
<style>
body {
font-size: 6rem;
}
.words {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
}
.words>* {
margin: 1.5rem;
}
</style>
<script src="words.js"></script>
<script src="fonts.js"></script>
<script src="lib.js"></script>
<script>
function shuffle(a) {
var j, x, i;
for (i = a.length - 1; i > 0; i--) {
j = Math.floor(Math.random() * (i + 1));
x = a[i];
a[i] = a[j];
a[j] = x;
}
return a;
}
(function() {
let len = window.fonts.length;
let font = window.fonts[Math.floor(len * Math.random())];
let head = document.querySelector('head');
head.appendChild($el('link', {
href: 'https://fonts.googleapis.com/css2?family=' + escape(font) + '&display=swap',
rel: 'stylesheet'
}));
head.appendChild($el('style', {
innerHTML: 'body{font-family:"' + font + '";}'
}));
})();
addEventListener('load', (e) => {
let el = $('.words');
let words = window.words.slice(0, qs.getI('n', 10));
shuffle(words);
for (let word of words) {
el.appendChild($el('div', {
className: 'word',
innerText: word,
}));
}
});
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-174588210-1"></script>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','UA-174588210-1');</script>
</head>
<body><div class="words"></div></body>
</html>