forked from walletgeneratornet/WalletGenerator.net
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdoge.js
77 lines (61 loc) · 1.76 KB
/
doge.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
(function (window) {
var muchIndex = 0;
var wowLength = 0;
var manyWords = null;
var suchInterval = null;
var muchPlay = false;
var wowElement = document.createElement('div');
var suchColors = [
'#FF0000',
'#00FF00',
'#0000FF',
];
function veryRandom(val) {
return Math.floor((Math.random() * val));
}
function placeWord(word) {
var muchWidth = window.innerWidth - 200; //Very random offset
var manyHeight = window.innerHeight - 26; //Such fontsize based offset
wowElement.textContent = word;
wowElement.style.left = veryRandom(muchWidth) + 'px';
wowElement.style.top = veryRandom(manyHeight) + 'px';
wowElement.style.color = suchColors[veryRandom(suchColors.length)];
}
function muchWords() {
muchPlay = true;
suchInterval = setInterval(function () {
if(muchIndex === wowLength - 1) {
muchIndex = 0;
} else {
muchIndex++;
}
placeWord(manyWords[muchIndex]);
}, 6000);
}
var Doge = function (words) {
if (typeof(words) !== 'object' || words.length === undefined) {
return console.error('Wow. Words is not array. Much Error.');
}
if (words.length < 1) {
return console.error('Much dumb. Very fail. No words in array. Wow');
}
wowLength = words.length;
manyWords = words;
wowElement.className = 'dogeTag';
wowElement.style.position = 'fixed';
wowElement.style.fontSize = '26px';
wowElement.style.fontFamily = '"Comic Sans MS"';
wowElement.style.zIndex = 10000001;
document.body.appendChild(wowElement);
muchWords();
};
Doge.prototype.stop = function () {
if (muchPlay) {
muchPlay = false;
clearInterval(suchInterval);
}
if(wowElement != null)
wowElement.parentNode.removeChild(wowElement);
};
window.Doge = Doge;
}(window));