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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>Code Builder</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: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 17 |
+
min-height: 100vh;
|
| 18 |
+
display: flex;
|
| 19 |
+
justify-content: center;
|
| 20 |
+
align-items: center;
|
| 21 |
+
padding: 20px;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
.container {
|
| 25 |
+
background: white;
|
| 26 |
+
border-radius: 15px;
|
| 27 |
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
| 28 |
+
width: 100%;
|
| 29 |
+
max-width: 900px;
|
| 30 |
+
overflow: hidden;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.header {
|
| 34 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 35 |
+
color: white;
|
| 36 |
+
padding: 25px;
|
| 37 |
+
text-align: center;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
.header h1 {
|
| 41 |
+
font-size: 28px;
|
| 42 |
+
margin-bottom: 8px;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.header p {
|
| 46 |
+
font-size: 14px;
|
| 47 |
+
opacity: 0.9;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.content {
|
| 51 |
+
padding: 30px;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.input-group {
|
| 55 |
+
margin-bottom: 20px;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.input-group label {
|
| 59 |
+
display: block;
|
| 60 |
+
margin-bottom: 8px;
|
| 61 |
+
font-weight: 600;
|
| 62 |
+
color: #333;
|
| 63 |
+
font-size: 14px;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.filename-container {
|
| 67 |
+
display: flex;
|
| 68 |
+
gap: 10px;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
.filename-container input {
|
| 72 |
+
flex: 1;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
input[type="text"] {
|
| 76 |
+
width: 100%;
|
| 77 |
+
padding: 12px;
|
| 78 |
+
border: 2px solid #e0e0e0;
|
| 79 |
+
border-radius: 8px;
|
| 80 |
+
font-size: 14px;
|
| 81 |
+
transition: all 0.3s;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
input[type="text"]:focus {
|
| 85 |
+
outline: none;
|
| 86 |
+
border-color: #667eea;
|
| 87 |
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.code-editor {
|
| 91 |
+
width: 100%;
|
| 92 |
+
min-height: 350px;
|
| 93 |
+
padding: 15px;
|
| 94 |
+
border: 2px solid #e0e0e0;
|
| 95 |
+
border-radius: 8px;
|
| 96 |
+
font-family: 'Courier New', Courier, monospace;
|
| 97 |
+
font-size: 14px;
|
| 98 |
+
resize: vertical;
|
| 99 |
+
transition: all 0.3s;
|
| 100 |
+
background: #f8f9fa;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.code-editor:focus {
|
| 104 |
+
outline: none;
|
| 105 |
+
border-color: #667eea;
|
| 106 |
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
| 107 |
+
background: white;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.button-group {
|
| 111 |
+
display: flex;
|
| 112 |
+
gap: 10px;
|
| 113 |
+
margin-top: 20px;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
button {
|
| 117 |
+
flex: 1;
|
| 118 |
+
padding: 14px 24px;
|
| 119 |
+
border: none;
|
| 120 |
+
border-radius: 8px;
|
| 121 |
+
font-size: 15px;
|
| 122 |
+
font-weight: 600;
|
| 123 |
+
cursor: pointer;
|
| 124 |
+
transition: all 0.3s;
|
| 125 |
+
text-transform: uppercase;
|
| 126 |
+
letter-spacing: 0.5px;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.btn-save {
|
| 130 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 131 |
+
color: white;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
.btn-save:hover {
|
| 135 |
+
transform: translateY(-2px);
|
| 136 |
+
box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
.btn-clear {
|
| 140 |
+
background: #e0e0e0;
|
| 141 |
+
color: #333;
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
.btn-clear:hover {
|
| 145 |
+
background: #d0d0d0;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
.stats {
|
| 149 |
+
display: flex;
|
| 150 |
+
gap: 20px;
|
| 151 |
+
margin-top: 20px;
|
| 152 |
+
padding: 15px;
|
| 153 |
+
background: #f8f9fa;
|
| 154 |
+
border-radius: 8px;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
.stat-item {
|
| 158 |
+
flex: 1;
|
| 159 |
+
text-align: center;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
.stat-label {
|
| 163 |
+
font-size: 12px;
|
| 164 |
+
color: #666;
|
| 165 |
+
margin-bottom: 5px;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
.stat-value {
|
| 169 |
+
font-size: 18px;
|
| 170 |
+
font-weight: 700;
|
| 171 |
+
color: #667eea;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
.notification {
|
| 175 |
+
position: fixed;
|
| 176 |
+
top: 20px;
|
| 177 |
+
right: 20px;
|
| 178 |
+
padding: 15px 25px;
|
| 179 |
+
background: #4caf50;
|
| 180 |
+
color: white;
|
| 181 |
+
border-radius: 8px;
|
| 182 |
+
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
|
| 183 |
+
transform: translateX(400px);
|
| 184 |
+
transition: transform 0.3s;
|
| 185 |
+
z-index: 1000;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
.notification.show {
|
| 189 |
+
transform: translateX(0);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
.examples {
|
| 193 |
+
margin-top: 15px;
|
| 194 |
+
padding: 12px;
|
| 195 |
+
background: #e8eaf6;
|
| 196 |
+
border-radius: 8px;
|
| 197 |
+
font-size: 12px;
|
| 198 |
+
color: #555;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
.examples strong {
|
| 202 |
+
color: #667eea;
|
| 203 |
+
}
|
| 204 |
+
</style>
|
| 205 |
+
</head>
|
| 206 |
+
<body>
|
| 207 |
+
<div class="container">
|
| 208 |
+
<div class="header">
|
| 209 |
+
<h1>💻 Code Builder</h1>
|
| 210 |
+
<p>Write, paste, and save your code with any extension</p>
|
| 211 |
+
</div>
|
| 212 |
+
|
| 213 |
+
<div class="content">
|
| 214 |
+
<div class="input-group">
|
| 215 |
+
<label for="filename">Filename with Extension</label>
|
| 216 |
+
<div class="filename-container">
|
| 217 |
+
<input type="text" id="filename" placeholder="e.g., app.py, index.html, script.js, styles.css" value="app.py">
|
| 218 |
+
</div>
|
| 219 |
+
<div class="examples">
|
| 220 |
+
<strong>Examples:</strong> app.py, index.html, script.js, styles.css, data.json, README.md, config.yaml, main.cpp
|
| 221 |
+
</div>
|
| 222 |
+
</div>
|
| 223 |
+
|
| 224 |
+
<div class="input-group">
|
| 225 |
+
<label for="code">Your Code</label>
|
| 226 |
+
<textarea id="code" class="code-editor" placeholder="Paste or write your code here..."></textarea>
|
| 227 |
+
</div>
|
| 228 |
+
|
| 229 |
+
<div class="stats">
|
| 230 |
+
<div class="stat-item">
|
| 231 |
+
<div class="stat-label">Lines</div>
|
| 232 |
+
<div class="stat-value" id="lineCount">0</div>
|
| 233 |
+
</div>
|
| 234 |
+
<div class="stat-item">
|
| 235 |
+
<div class="stat-label">Characters</div>
|
| 236 |
+
<div class="stat-value" id="charCount">0</div>
|
| 237 |
+
</div>
|
| 238 |
+
<div class="stat-item">
|
| 239 |
+
<div class="stat-label">Words</div>
|
| 240 |
+
<div class="stat-value" id="wordCount">0</div>
|
| 241 |
+
</div>
|
| 242 |
+
</div>
|
| 243 |
+
|
| 244 |
+
<div class="button-group">
|
| 245 |
+
<button class="btn-save" onclick="saveCode()">💾 Save File</button>
|
| 246 |
+
<button class="btn-clear" onclick="clearAll()">🗑️ Clear All</button>
|
| 247 |
+
</div>
|
| 248 |
+
</div>
|
| 249 |
+
</div>
|
| 250 |
+
|
| 251 |
+
<div class="notification" id="notification"></div>
|
| 252 |
+
|
| 253 |
+
<script>
|
| 254 |
+
const codeEditor = document.getElementById('code');
|
| 255 |
+
const filenameInput = document.getElementById('filename');
|
| 256 |
+
const lineCount = document.getElementById('lineCount');
|
| 257 |
+
const charCount = document.getElementById('charCount');
|
| 258 |
+
const wordCount = document.getElementById('wordCount');
|
| 259 |
+
|
| 260 |
+
// Update statistics
|
| 261 |
+
codeEditor.addEventListener('input', updateStats);
|
| 262 |
+
|
| 263 |
+
function updateStats() {
|
| 264 |
+
const text = codeEditor.value;
|
| 265 |
+
const lines = text.split('\n').length;
|
| 266 |
+
const chars = text.length;
|
| 267 |
+
const words = text.trim() === '' ? 0 : text.trim().split(/\s+/).length;
|
| 268 |
+
|
| 269 |
+
lineCount.textContent = lines;
|
| 270 |
+
charCount.textContent = chars;
|
| 271 |
+
wordCount.textContent = words;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
function saveCode() {
|
| 275 |
+
const code = codeEditor.value;
|
| 276 |
+
const filename = filenameInput.value.trim();
|
| 277 |
+
|
| 278 |
+
if (!filename) {
|
| 279 |
+
showNotification('Please enter a filename!', 'error');
|
| 280 |
+
return;
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
if (!code) {
|
| 284 |
+
showNotification('Please enter some code to save!', 'error');
|
| 285 |
+
return;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
// Create blob and download
|
| 289 |
+
const blob = new Blob([code], { type: 'text/plain' });
|
| 290 |
+
const url = URL.createObjectURL(blob);
|
| 291 |
+
const a = document.createElement('a');
|
| 292 |
+
a.href = url;
|
| 293 |
+
a.download = filename;
|
| 294 |
+
document.body.appendChild(a);
|
| 295 |
+
a.click();
|
| 296 |
+
document.body.removeChild(a);
|
| 297 |
+
URL.revokeObjectURL(url);
|
| 298 |
+
|
| 299 |
+
showNotification(`File "${filename}" saved successfully!`, 'success');
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
function clearAll() {
|
| 303 |
+
if (codeEditor.value && !confirm('Are you sure you want to clear all code?')) {
|
| 304 |
+
return;
|
| 305 |
+
}
|
| 306 |
+
codeEditor.value = '';
|
| 307 |
+
updateStats();
|
| 308 |
+
showNotification('Editor cleared!', 'success');
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
function showNotification(message, type) {
|
| 312 |
+
const notification = document.getElementById('notification');
|
| 313 |
+
notification.textContent = message;
|
| 314 |
+
notification.style.background = type === 'error' ? '#f44336' : '#4caf50';
|
| 315 |
+
notification.classList.add('show');
|
| 316 |
+
|
| 317 |
+
setTimeout(() => {
|
| 318 |
+
notification.classList.remove('show');
|
| 319 |
+
}, 3000);
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
// Initialize stats
|
| 323 |
+
updateStats();
|
| 324 |
+
</script>
|
| 325 |
+
</body>
|
| 326 |
+
</html>
|