Codeblok (voorbeeld.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
var achievement = [];
achievement[1] = "Congratulations! You are now addicted";
achievement[3] = "Illuminati confirmed";
achievement[42] = "Only a zero away!";
achievement[69] = "I see what you did there";
achievement[100] = "What are you doing with your life?";
achievement[123] = "It all makes sense now!";
achievement[124] = "Oh, nah it doesnt";
achievement[420] = "OMG YOU REACHED 420";
achievement[777] = "$Jackpot$";
achievement[1000] = "Bruh, you hacking";
achievement[1500] = "Stop hacking!";
achievement[2000] = "Fuck you hacker";
function checkAch() {
if(achievement[fristiCount].length =! 0) {
appearAch(fristiCount, achievement[fristiCount]);
console.log("success");
} else {
console.log("error");
}
}
function appearAch(amount, desc) {
var achievement = document.createElement("div");
achievement.style.position = "absolute";
achievement.style.cssFloat = "right";
achievement.innerHTML = amount + "Clicks!
" + desc + "
";
achievement.append;
}
Wat doe ik fout?
Console geeft "Success".
Live te bekijken op
http://www.stef.partytoevoeging op 11 september 2015, 22:58:21:Jeuj het werkt!
Codeblok (voorbeeld.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
function achFade() {
$(.achievement).fadeOut(fast);
}
var achievement = [];
achievement[1] = "Congratulations! You are now addicted";
achievement[3] = "Illuminati confirmed";
achievement[42] = "Only a zero away!";
achievement[69] = "I see what you did there";
achievement[100] = "What are you doing with your life?";
achievement[123] = "It all makes sense now!";
achievement[124] = "Oh, nah it doesnt";
achievement[420] = "OMG YOU REACHED 420";
achievement[777] = "$Jackpot$";
achievement[1000] = "Bruh, you hacking";
achievement[1500] = "Stop hacking!";
achievement[2000] = "Fuck you hacker";
function checkAch() {
if(typeof achievement[fristiCount] === string) {
appearAch(fristiCount, achievement[fristiCount]);
console.log(achievement[fristiCount]);
}
}
function appearAch(amount, desc) {
var achievement = document.createElement("div");
//achievement.style.position = "absolute";
achievement.style.cssFloat = "right";
achievement.innerHTML = "
Achievement!
" + amount + " Clicks!
" + desc + "
";
achievement.className = "achievement";
document.body.appendChild(achievement);
setTimeout(achFade(), 3000);
}
Nu alleen nog maken dat het op mobiel werkt, maar dat komt een andere keer wel
