-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
140 lines (124 loc) · 4.55 KB
/
index.html
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
}
#container {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 50px;
}
#content, #gameContent {
width: 300px;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
}
#options, #gameOptions {
margin-top: 20px;
display: flex;
justify-content: space-between;
}
#centerButton, #clickCounter, #modeTitle {
margin-top: 20px;
font-size: 24px;
}
#gamePage, #titlePage {
display: none;
}
</style>
</head>
<body>
<div id="container">
<div id="titlePage">
<div id="content">
<h1 id="title">The Clicker Game</h1>
<div id="options">
<button onclick="changeOption(-1)">Previous</button>
<button id="centerButton" onclick="goToGamePage()">Game</button>
<button onclick="changeOption(1)">Next</button>
</div>
<div id="clickCounter">0/5</div>
<div id="modeTitle"></div>
</div>
</div>
<div id="gamePage">
<div id="gameContent">
<h1 id="gameTitle"></h1>
<p>Click the button below to meet the required clicks:</p>
<button onclick="checkClicks()">Click Me</button>
<br>
<button onclick="goToTitlePage()">Back</button>
<div id="clickCounter">0/5</div>
<div id="modeTitle"></div>
</div>
</div>
</div>
<script>
let currentOption = 0;
const options = [
{ text: "100 clicks (Weekly)", clicksRequired: 100, resetInterval: "weekly" },
{ text: "1,000 clicks (Weekly)", clicksRequired: 1000, resetInterval: "weekly" },
{ text: "10,000 clicks (Monthly)", clicksRequired: 10000, resetInterval: "monthly" },
{ text: "100,000 clicks (Monthly)", clicksRequired: 100000, resetInterval: "monthly" },
{ text: "1,000,000 clicks (Monthly)", clicksRequired: 1000000, resetInterval: "monthly" },
{ text: "10,000,000 clicks (Monthly)", clicksRequired: 10000000, resetInterval: "monthly" },
{ text: "100,000,000 clicks (Yearly)", clicksRequired: 100000000, resetInterval: "yearly" },
{ text: "1,000,000,000 clicks (Yearly)", clicksRequired: 1000000000, resetInterval: "yearly" }
// Add more options as needed
];
let clickCount = 0;
let currentMode;
function updateContent() {
const { text, clicksRequired, resetInterval } = options[currentOption];
document.getElementById('title').innerText = text;
document.getElementById('modeTitle').innerText = `Mode: ${clicksRequired} clicks (${resetInterval} reset)`;
}
function changeOption(direction) {
currentOption = (currentOption + direction + options.length) % options.length;
updateContent();
}
function goToGamePage() {
currentMode = options[currentOption];
document.getElementById('titlePage').style.display = 'none';
document.getElementById('gamePage').style.display = 'block';
document.getElementById('gameTitle').innerText = currentMode.text;
resetClickCounter();
}
function goToTitlePage() {
document.getElementById('titlePage').style.display = 'block';
document.getElementById('gamePage').style.display = 'none';
resetClickCounter();
}
function updateClickCounter() {
document.getElementById('clickCounter').innerText = `${clickCount}/${currentMode.clicksRequired}`;
}
function resetClickCounter() {
clickCount = 0;
updateClickCounter();
}
function checkClicks() {
clickCount++;
updateClickCounter();
if (clickCount >= currentMode.clicksRequired) {
alert(`You met the required clicks for ${currentMode.text}!`); // You can customize this logic as needed
resetClickCounter();
}
}
document.addEventListener('keydown', (event) => {
if (event.key === 'ArrowLeft') {
changeOption(-1);
} else if (event.key === 'ArrowRight') {
changeOption(1);
}
});
// For mobile swipe detection, you can use a library like Hammer.js or implement your own logic.
</script>
</body>
</html>