-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
84 lines (80 loc) · 1.66 KB
/
index.js
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
"use strict"
var X = [
{
name: 'banana',
alt_text: 'banana',
emoji_unicode: '1F34C',
emoji: '🍌'
},
{
name: 'eggplant',
alt_text: 'eggplant',
emoji_unicode: '1F346',
emoji: '🍆'
},
{
name: 'man in suit levitating',
alt_text: 'man in suit levitating',
emoji_unicode: '1F574',
emoji: '🕴'
},
{
name: 'person dancing',
alt_text: 'person dancing',
emoji_unicode: '1F483',
emoji: '💃'
},
{
name: 'person dancing',
alt_text: 'person dancing',
emoji_unicode: '1F57A',
emoji: '🕺'
},
{
name: 'pants',
alt_text: 'pants',
emoji_unicode: '1F456',
emoji: '👖'
},
{
name: 'moon',
alt_text: 'moon',
emoji_unicode: '1F31D',
emoji: '🌝'
},
{
name: 'rainbows',
alt_text: 'rainbows',
emoji_unicode: '1F308',
emoji: '🌈'
},
{
name: 'bread',
alt_text: 'bread',
emoji_unicode: '1F35E',
emoji: '🍞'
},
{
name: 'baguette',
alt_text: 'baguette',
emoji_unicode: '1F956',
emoji: '🥖'
},
];
(function () {
var pickX = function () {
var pick = Math.floor((Math.random() * (X.length)));
return X[pick];
}
if (typeof window !== 'undefined') {
// replace all DOM nodes with class='made-with-x' with X
var containers = window.document && window.document.getElementsByClassName('made-with-x');
Array.prototype.forEach.call(containers, function(container) {
container.innerHTML = '&#x' + pickX().emoji_unicode;
});
}
if (typeof module !== 'undefined' && module.exports) {
// export a default function for randomly picking an X
module.exports = pickX;
}
}())