LennyHood commited on
Commit
2a87169
·
verified ·
1 Parent(s): 817e974

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +336 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Test
3
- emoji: 👁
4
- colorFrom: yellow
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: test
3
+ emoji: 🐳
4
+ colorFrom: gray
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,336 @@
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>Dribbble Style Calculator</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
11
+
12
+ body {
13
+ font-family: 'Inter', sans-serif;
14
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
15
+ }
16
+
17
+ .calculator {
18
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25),
19
+ inset 0 -8px 16px rgba(0, 0, 0, 0.1);
20
+ border-radius: 2rem;
21
+ backdrop-filter: blur(8px);
22
+ background: rgba(255, 255, 255, 0.7);
23
+ border: 1px solid rgba(255, 255, 255, 0.3);
24
+ }
25
+
26
+ .display {
27
+ text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
28
+ letter-spacing: -0.05em;
29
+ }
30
+
31
+ .btn {
32
+ transition: all 0.2s ease;
33
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
34
+ border: 1px solid rgba(255, 255, 255, 0.3);
35
+ }
36
+
37
+ .btn:active {
38
+ transform: translateY(2px);
39
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
40
+ }
41
+
42
+ .btn-operator {
43
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
44
+ color: white;
45
+ }
46
+
47
+ .btn-operator:hover {
48
+ background: linear-gradient(135deg, #5a6fd1 0%, #6a4199 100%);
49
+ }
50
+
51
+ .btn-equals {
52
+ background: linear-gradient(135deg, #f83600 0%, #f9d423 100%);
53
+ color: white;
54
+ }
55
+
56
+ .btn-equals:hover {
57
+ background: linear-gradient(135deg, #e03000 0%, #e9c41d 100%);
58
+ }
59
+
60
+ .btn-number {
61
+ background: rgba(255, 255, 255, 0.8);
62
+ }
63
+
64
+ .btn-number:hover {
65
+ background: rgba(255, 255, 255, 1);
66
+ }
67
+
68
+ .btn-function {
69
+ background: rgba(237, 242, 247, 0.8);
70
+ }
71
+
72
+ .btn-function:hover {
73
+ background: rgba(237, 242, 247, 1);
74
+ }
75
+
76
+ .history-item {
77
+ transition: all 0.2s ease;
78
+ }
79
+
80
+ .history-item:hover {
81
+ background: rgba(0, 0, 0, 0.05);
82
+ }
83
+
84
+ .glass-effect {
85
+ backdrop-filter: blur(16px);
86
+ background: rgba(255, 255, 255, 0.4);
87
+ border: 1px solid rgba(255, 255, 255, 0.2);
88
+ }
89
+ </style>
90
+ </head>
91
+ <body class="min-h-screen flex items-center justify-center p-4">
92
+ <div class="calculator w-full max-w-md p-6 glass-effect">
93
+ <!-- Display Area -->
94
+ <div class="display mb-6 p-4 rounded-xl bg-white bg-opacity-50">
95
+ <div class="text-right text-gray-500 text-sm h-6 overflow-x-auto whitespace-nowrap" id="history">
96
+ <!-- History will appear here -->
97
+ </div>
98
+ <div class="text-right text-4xl font-bold text-gray-800 h-12 overflow-x-auto whitespace-nowrap" id="result">
99
+ 0
100
+ </div>
101
+ </div>
102
+
103
+ <!-- Button Grid -->
104
+ <div class="grid grid-cols-4 gap-3">
105
+ <!-- Row 1 -->
106
+ <button class="btn btn-function rounded-xl p-4 text-gray-700 font-medium" onclick="clearAll()">
107
+ <i class="fas fa-undo-alt"></i>
108
+ </button>
109
+ <button class="btn btn-function rounded-xl p-4 text-gray-700 font-medium" onclick="backspace()">
110
+ <i class="fas fa-backspace"></i>
111
+ </button>
112
+ <button class="btn btn-function rounded-xl p-4 text-gray-700 font-medium" onclick="toggleHistory()">
113
+ <i class="fas fa-history"></i>
114
+ </button>
115
+ <button class="btn btn-operator rounded-xl p-4 font-medium" onclick="appendOperator('/')">
116
+ ÷
117
+ </button>
118
+
119
+ <!-- Row 2 -->
120
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('7')">
121
+ 7
122
+ </button>
123
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('8')">
124
+ 8
125
+ </button>
126
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('9')">
127
+ 9
128
+ </button>
129
+ <button class="btn btn-operator rounded-xl p-4 font-medium" onclick="appendOperator('*')">
130
+ ×
131
+ </button>
132
+
133
+ <!-- Row 3 -->
134
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('4')">
135
+ 4
136
+ </button>
137
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('5')">
138
+ 5
139
+ </button>
140
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('6')">
141
+ 6
142
+ </button>
143
+ <button class="btn btn-operator rounded-xl p-4 font-medium" onclick="appendOperator('-')">
144
+
145
+ </button>
146
+
147
+ <!-- Row 4 -->
148
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('1')">
149
+ 1
150
+ </button>
151
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('2')">
152
+ 2
153
+ </button>
154
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('3')">
155
+ 3
156
+ </button>
157
+ <button class="btn btn-operator rounded-xl p-4 font-medium" onclick="appendOperator('+')">
158
+ +
159
+ </button>
160
+
161
+ <!-- Row 5 -->
162
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('0')">
163
+ 0
164
+ </button>
165
+ <button class="btn btn-number rounded-xl p-4 text-gray-700 font-medium" onclick="appendNumber('.')">
166
+ .
167
+ </button>
168
+ <button class="btn btn-function rounded-xl p-4 text-gray-700 font-medium" onclick="toggleSign()">
169
+ ±
170
+ </button>
171
+ <button class="btn btn-equals rounded-xl p-4 font-medium" onclick="calculate()">
172
+ =
173
+ </button>
174
+ </div>
175
+
176
+ <!-- History Panel -->
177
+ <div id="historyPanel" class="hidden mt-6 max-h-48 overflow-y-auto rounded-xl glass-effect p-4">
178
+ <div class="flex justify-between items-center mb-2">
179
+ <h3 class="font-bold text-gray-700">Calculation History</h3>
180
+ <button onclick="clearHistory()" class="text-red-500 hover:text-red-700">
181
+ <i class="fas fa-trash"></i>
182
+ </button>
183
+ </div>
184
+ <div id="historyList" class="space-y-2">
185
+ <!-- History items will appear here -->
186
+ </div>
187
+ </div>
188
+ </div>
189
+
190
+ <script>
191
+ let currentInput = '0';
192
+ let previousInput = '';
193
+ let operation = null;
194
+ let resetInput = false;
195
+ let calculationHistory = [];
196
+
197
+ const resultElement = document.getElementById('result');
198
+ const historyElement = document.getElementById('history');
199
+ const historyPanel = document.getElementById('historyPanel');
200
+ const historyList = document.getElementById('historyList');
201
+
202
+ function updateDisplay() {
203
+ resultElement.textContent = currentInput;
204
+ }
205
+
206
+ function appendNumber(number) {
207
+ if (currentInput === '0' || resetInput) {
208
+ currentInput = number;
209
+ resetInput = false;
210
+ } else {
211
+ currentInput += number;
212
+ }
213
+ updateDisplay();
214
+ }
215
+
216
+ function appendOperator(op) {
217
+ if (operation !== null) calculate();
218
+ previousInput = currentInput;
219
+ operation = op;
220
+ resetInput = true;
221
+ historyElement.textContent = `${previousInput} ${operation}`;
222
+ }
223
+
224
+ function calculate() {
225
+ let computation;
226
+ const prev = parseFloat(previousInput);
227
+ const current = parseFloat(currentInput);
228
+
229
+ if (isNaN(prev) || isNaN(current)) return;
230
+
231
+ switch (operation) {
232
+ case '+':
233
+ computation = prev + current;
234
+ break;
235
+ case '-':
236
+ computation = prev - current;
237
+ break;
238
+ case '*':
239
+ computation = prev * current;
240
+ break;
241
+ case '/':
242
+ computation = prev / current;
243
+ break;
244
+ default:
245
+ return;
246
+ }
247
+
248
+ // Add to history
249
+ const historyEntry = `${previousInput} ${operation} ${currentInput} = ${computation}`;
250
+ calculationHistory.unshift(historyEntry);
251
+ updateHistory();
252
+
253
+ currentInput = computation.toString();
254
+ operation = null;
255
+ resetInput = true;
256
+ historyElement.textContent = '';
257
+ updateDisplay();
258
+ }
259
+
260
+ function clearAll() {
261
+ currentInput = '0';
262
+ previousInput = '';
263
+ operation = null;
264
+ updateDisplay();
265
+ historyElement.textContent = '';
266
+ }
267
+
268
+ function backspace() {
269
+ if (currentInput.length === 1) {
270
+ currentInput = '0';
271
+ } else {
272
+ currentInput = currentInput.slice(0, -1);
273
+ }
274
+ updateDisplay();
275
+ }
276
+
277
+ function toggleSign() {
278
+ currentInput = (parseFloat(currentInput) * -1).toString();
279
+ updateDisplay();
280
+ }
281
+
282
+ function updateHistory() {
283
+ historyList.innerHTML = '';
284
+ calculationHistory.slice(0, 5).forEach(item => {
285
+ const historyItem = document.createElement('div');
286
+ historyItem.textContent = item;
287
+ historyItem.className = 'history-item p-2 rounded hover:bg-gray-100 cursor-pointer text-sm';
288
+ historyItem.onclick = () => {
289
+ // When clicking a history item, use the result
290
+ const parts = item.split(' = ');
291
+ if (parts.length === 2) {
292
+ currentInput = parts[1];
293
+ updateDisplay();
294
+ }
295
+ };
296
+ historyList.appendChild(historyItem);
297
+ });
298
+ }
299
+
300
+ function toggleHistory() {
301
+ historyPanel.classList.toggle('hidden');
302
+ }
303
+
304
+ function clearHistory() {
305
+ calculationHistory = [];
306
+ updateHistory();
307
+ }
308
+
309
+ // Keyboard support
310
+ document.addEventListener('keydown', (e) => {
311
+ if (/[0-9]/.test(e.key)) {
312
+ appendNumber(e.key);
313
+ } else if (e.key === '.') {
314
+ appendNumber('.');
315
+ } else if (e.key === '+') {
316
+ appendOperator('+');
317
+ } else if (e.key === '-') {
318
+ appendOperator('-');
319
+ } else if (e.key === '*') {
320
+ appendOperator('*');
321
+ } else if (e.key === '/') {
322
+ appendOperator('/');
323
+ } else if (e.key === 'Enter' || e.key === '=') {
324
+ calculate();
325
+ } else if (e.key === 'Escape') {
326
+ clearAll();
327
+ } else if (e.key === 'Backspace') {
328
+ backspace();
329
+ }
330
+ });
331
+
332
+ // Initialize display
333
+ updateDisplay();
334
+ </script>
335
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=LennyHood/test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
336
+ </html>