-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3104dda
commit aedd95e
Showing
3 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
const answers = [ | ||
"Are you sure?", | ||
"Are you really sure??", | ||
"Are you really realy sure???", | ||
"Think again?", | ||
"Don't believe in second chances?", | ||
"Why are you being so cold?", | ||
"Maybe we can talk about it?", | ||
"I am not going to ask again!", | ||
"Ok now this is hurting my feelings!", | ||
"You are now just being mean!", | ||
"Why are you doing this to me?", | ||
"Please give me a chance!", | ||
"I am begging you to stop!", | ||
"Ok, Lets just start over.." | ||
] | ||
|
||
const no_button = document.getElementById('no-button'); | ||
const yes_button = document.getElementById('yes-button'); | ||
let i = 0; | ||
let size = 50; | ||
let clicks = 0; | ||
|
||
no_button.addEventListener('click', () => { | ||
// Change banner source | ||
let banner = document.getElementById('banner'); | ||
if (clicks === 0) banner.src = "images/no.gif"; | ||
clicks++; | ||
// increase button height and width gradually to 250px | ||
const sizes = [40, 50, 30, 35, 45] | ||
const random = Math.floor(Math.random() * sizes.length); | ||
size += sizes[random] | ||
yes_button.style.height = `${size}px`; | ||
yes_button.style.width = `${size}px`; | ||
let total = answers.length; | ||
// change button text | ||
if (i < total - 1) { | ||
no_button.innerHTML = answers[i]; | ||
i++; | ||
} else if (i === total - 1) { | ||
alert(answers[i]); | ||
i = 0; | ||
no_button.innerHTML = "No"; | ||
yes_button.style.height = "50px"; | ||
yes_button.style.width = "50px"; | ||
size = 50; | ||
} | ||
}); | ||
|
||
yes_button.addEventListener('click', () => { | ||
// change banner gif path | ||
let banner = document.getElementById('banner'); | ||
banner.src = "images/yes.gif"; | ||
// hide buttons div | ||
let buttons = document.getElementsByClassName('buttons')[0]; | ||
buttons.style.display = "none"; | ||
// show message div | ||
let message = document.getElementsByClassName('message')[0]; | ||
message.style.display = "block"; | ||
}); |