openfree commited on
Commit
34f3376
·
verified ·
1 Parent(s): 4fe9678

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +215 -19
index.html CHANGED
@@ -1,19 +1,215 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Prime Number Finder by MOUSE(VIDraft-mouse.hf.space)</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ body {
15
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
16
+ background: #1a1a1a;
17
+ color: #fff;
18
+ min-height: 100vh;
19
+ padding: 2rem;
20
+ }
21
+
22
+ .container {
23
+ max-width: 1200px;
24
+ margin: 0 auto;
25
+ }
26
+
27
+ .controls {
28
+ background: #2a2a2a;
29
+ padding: 1.5rem;
30
+ border-radius: 10px;
31
+ margin-bottom: 2rem;
32
+ }
33
+
34
+ .range-container {
35
+ margin-bottom: 1rem;
36
+ }
37
+
38
+ .range-slider {
39
+ width: 100%;
40
+ height: 10px;
41
+ -webkit-appearance: none;
42
+ background: #3a3a3a;
43
+ border-radius: 5px;
44
+ outline: none;
45
+ }
46
+
47
+ .range-slider::-webkit-slider-thumb {
48
+ -webkit-appearance: none;
49
+ width: 20px;
50
+ height: 20px;
51
+ background: #6a5acd;
52
+ border-radius: 50%;
53
+ cursor: pointer;
54
+ transition: background 0.3s;
55
+ }
56
+
57
+ .range-slider::-webkit-slider-thumb:hover {
58
+ background: #8a7aed;
59
+ }
60
+
61
+ .btn {
62
+ padding: 0.8rem 1.5rem;
63
+ background: #6a5acd;
64
+ border: none;
65
+ border-radius: 5px;
66
+ color: white;
67
+ font-size: 1rem;
68
+ cursor: pointer;
69
+ transition: background 0.3s;
70
+ }
71
+
72
+ .btn:hover {
73
+ background: #8a7aed;
74
+ }
75
+
76
+ .grid {
77
+ display: grid;
78
+ grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
79
+ gap: 5px;
80
+ margin-top: 2rem;
81
+ }
82
+
83
+ .number {
84
+ aspect-ratio: 1;
85
+ display: flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ background: #2a2a2a;
89
+ border-radius: 5px;
90
+ font-size: 0.9rem;
91
+ transition: all 0.3s;
92
+ }
93
+
94
+ .prime {
95
+ animation: highlight 0.5s ease-out;
96
+ }
97
+
98
+ @keyframes highlight {
99
+ 0% {
100
+ transform: scale(1);
101
+ }
102
+ 50% {
103
+ transform: scale(1.1);
104
+ }
105
+ 100% {
106
+ transform: scale(1);
107
+ }
108
+ }
109
+
110
+ .stats {
111
+ margin-top: 2rem;
112
+ padding: 1rem;
113
+ background: #2a2a2a;
114
+ border-radius: 10px;
115
+ }
116
+
117
+ .progress-bar {
118
+ width: 100%;
119
+ height: 10px;
120
+ background: #3a3a3a;
121
+ border-radius: 5px;
122
+ overflow: hidden;
123
+ margin-top: 1rem;
124
+ }
125
+
126
+ .progress {
127
+ width: 0%;
128
+ height: 100%;
129
+ background: linear-gradient(90deg, #6a5acd, #8a7aed);
130
+ transition: width 0.3s;
131
+ }
132
+ </style>
133
+ </head>
134
+ <body>
135
+ <div class="container">
136
+ <div class="controls">
137
+ <div class="range-container">
138
+ <input type="range" min="1" max="999999" value="100" class="range-slider" id="range">
139
+ <div>Range: <span id="rangeValue">100</span></div>
140
+ </div>
141
+ <button class="btn" id="findPrimes">Find Primes</button>
142
+ </div>
143
+
144
+ <div class="progress-bar">
145
+ <div class="progress" id="progress"></div>
146
+ </div>
147
+
148
+ <div class="stats" id="stats">
149
+ Primes found: 0
150
+ </div>
151
+
152
+ <div class="grid" id="grid"></div>
153
+ </div>
154
+
155
+ <script>
156
+ const range = document.getElementById('range');
157
+ const rangeValue = document.getElementById('rangeValue');
158
+ const findPrimesBtn = document.getElementById('findPrimes');
159
+ const grid = document.getElementById('grid');
160
+ const progress = document.getElementById('progress');
161
+ const stats = document.getElementById('stats');
162
+
163
+ range.addEventListener('input', () => {
164
+ rangeValue.textContent = range.value;
165
+ });
166
+
167
+ function isPrime(num) {
168
+ if (num < 2) return false;
169
+ for (let i = 2; i <= Math.sqrt(num); i++) {
170
+ if (num % i === 0) return false;
171
+ }
172
+ return true;
173
+ }
174
+
175
+ function getRandomColor() {
176
+ const hue = Math.random() * 360;
177
+ return `hsl(${hue}, 70%, 60%)`;
178
+ }
179
+
180
+ async function findPrimes() {
181
+ const maxNum = parseInt(range.value);
182
+ grid.innerHTML = '';
183
+ let primeCount = 0;
184
+
185
+ for (let i = 1; i <= maxNum; i++) {
186
+ const div = document.createElement('div');
187
+ div.className = 'number';
188
+ div.textContent = i;
189
+
190
+ if (isPrime(i)) {
191
+ primeCount++;
192
+ div.style.backgroundColor = getRandomColor();
193
+ div.classList.add('prime');
194
+ }
195
+
196
+ grid.appendChild(div);
197
+
198
+ // Update progress
199
+ const progressValue = (i / maxNum) * 100;
200
+ progress.style.width = `${progressValue}%`;
201
+
202
+ // Update stats
203
+ stats.textContent = `Primes found: ${primeCount}`;
204
+
205
+ // Add small delay for visual effect and prevent browser freeze
206
+ if (i % 100 === 0) {
207
+ await new Promise(resolve => setTimeout(resolve, 0));
208
+ }
209
+ }
210
+ }
211
+
212
+ findPrimesBtn.addEventListener('click', findPrimes);
213
+ </script>
214
+ </body>
215
+ </html>