-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.js
47 lines (42 loc) · 1.33 KB
/
settings.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
changename.addEventListener("click", () => {
let newName = prompt('What is your new name?')
if (newName != "") {
farmerName = newName
localStorage.setItem('name',farmerName)
welcome.innerHTML = `Welcome to your farm, Peasant ${farmerName}!`
} else {
alert("Please input something.")
}
})
deleteData.addEventListener("click", function deleteThingy() {
let wantToDelete = confirm("WARNING! You are now about to delete all your data associated with this game. Click OK to continue, and if you didn't mean to do this, click Cancel.")
if (wantToDelete == true) {
alert("Your data was successfully cleared.")
localStorage.clear()
window.location = window.location
} else {
alert("Your data was not cleared.")
}
})
mansave.addEventListener("click", function manualSave() {
dialog("Your data has been saved")
localStorage.setItem("playerdata", JSON.stringify(playerdata))
})
usefert.addEventListener("change", function checkfert() {
if (playerdata.fertile > 0 && usefert.value == "true") {
dialog("Fertilizer activated!")
hasFertile = true
} else {
dialog("Fertilizer deactivated!")
hasFertile = false
}
})
choosing.addEventListener("change", () => {
for (let each of rices) {
if (each.type != choosing.value) {
each.using = false
} else {
each.using = true
}
}
})