Spaces:
Running
Running
File size: 15,836 Bytes
df9973f 5497ff3 df9973f 84e1dd3 df9973f 84e1dd3 df9973f 84e1dd3 df9973f 84e1dd3 df9973f 84e1dd3 df9973f 84e1dd3 df9973f 5497ff3 | 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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Math Tables Engine</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;800&display=swap" rel="stylesheet">
<style>
:root {
--app-bg: #f8fafc;
--primary: #3b82f6;
--primary-glow: rgba(59, 130, 246, 0.3);
--bg-surface: #ffffff;
--border-light: #e2e8f0;
--text-main: #1e293b;
--text-muted: #64748b;
}
body {
background: var(--app-bg);
font-family: 'Poppins', sans-serif;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
color: var(--text-main);
}
/* 📱 TOP NAVIGATION */
.topbar {
position: fixed;
top: 0;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 20px;
background: var(--bg-surface);
border-bottom: 1px solid var(--border-light);
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
z-index: 500;
box-sizing: border-box;
}
.action-btn {
background: var(--bg-surface);
border: 2px solid var(--border-light);
color: var(--text-main);
padding: 10px 20px;
border-radius: 12px;
font-size: 14px;
font-weight: bold;
cursor: pointer;
transition: 0.2s;
}
.action-btn:hover {
background: var(--primary);
color: white;
border-color: var(--primary);
box-shadow: 0 4px 10px var(--primary-glow);
}
/* 🎛️ CONTROLS SECTION */
.controls-container {
margin-top: 100px;
background: var(--bg-surface);
padding: 25px;
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0,0,0,0.05);
border: 1px solid var(--border-light);
text-align: center;
width: 90%;
max-width: 400px;
box-sizing: border-box;
}
.number-input {
width: 100%;
padding: 15px;
font-size: 24px;
font-weight: 800;
text-align: center;
border: 2px solid var(--primary);
border-radius: 15px;
color: var(--primary);
outline: none;
margin-bottom: 15px;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
/* 📋 TABLE DISPLAY */
.table-display {
width: 90%;
max-width: 400px;
margin-top: 20px;
display: flex;
flex-direction: column;
gap: 10px;
margin-bottom: 20px;
}
.table-row {
background: var(--bg-surface);
padding: 15px;
border-radius: 12px;
border: 1px solid var(--border-light);
font-size: 20px;
font-weight: 800;
color: var(--text-main);
text-align: center;
letter-spacing: 2px;
box-shadow: 0 2px 8px rgba(0,0,0,0.02);
animation: slideUp 0.3s ease forwards;
}
@keyframes slideUp {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.load-more-btn {
background: #10b981;
color: white;
border: none;
width: 90%;
max-width: 400px;
padding: 16px;
border-radius: 15px;
font-size: 16px;
font-weight: 800;
cursor: pointer;
margin-bottom: 50px;
box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
transition: 0.2s;
}
.load-more-btn:hover { transform: scale(1.02); }
/* 🎤 MODAL FOR VOICE SELECTION */
.modal-overlay {
display: none;
position: fixed;
inset: 0;
background: rgba(0,0,0,0.8);
z-index: 99999;
justify-content: center;
align-items: center;
backdrop-filter: blur(5px);
}
.modal-box {
background: var(--bg-surface);
width: 90%;
max-width: 350px;
padding: 30px;
border-radius: 24px;
text-align: center;
position: relative;
animation: popUp 0.3s ease;
}
@keyframes popUp { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.speak-stop-btn {
display: none;
background: #ef4444 !important;
color: white !important;
border-color: #ef4444 !important;
box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
}
</style>
</head>
<body>
<style>
/* === UNIVERSAL SIDEBAR (injected — this page had no navigation drawer before) === */
#globalMenuBtn { position: fixed; top: 14px; left: 14px; z-index: 999997; width: 42px; height: 42px; border-radius: 50%; border: none; background: var(--primary, #8b5cf6); color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
#overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999998; display: none; opacity: 0; transition: 0.3s; }
#overlay.active { display: block; opacity: 1; }
.sidebar { position: fixed; top: 0; left: -300px; width: 280px; height: 100%; background: var(--bg-surface, #ffffff); z-index: 999999; transition: left 0.3s ease; box-shadow: 4px 0 25px rgba(0,0,0,0.3); padding: 20px 14px; box-sizing: border-box; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.sidebar.active { left: 0; }
.sidebar button { display: block; width: 100%; text-align: left; padding: 12px 14px; border-radius: 10px; border: none; background: transparent; color: var(--text-main, #1e293b); font-size: 14.5px; font-weight: 600; cursor: pointer; }
.sidebar button:hover { background: var(--border-light, rgba(139,92,246,0.1)); }
.sidebar-close-btn { color: #ef4444 !important; font-weight: 800 !important; margin-bottom: 10px; border: 1px solid rgba(239,68,68,0.3) !important; }
</style>
<button id="globalMenuBtn" onclick="toggleSidebar()">☰</button>
<div class="overlay" id="overlay" onclick="toggleSidebar()"></div>
<div class="sidebar" id="sidebar" style="overflow-y:auto;">
<button class="sidebar-close-btn" onclick="toggleSidebar()">✖ Close Menu</button>
<button onclick="window.location.href='index.html'">🏠 Dashboard</button>
<button onclick="window.location.href='lens.html'">✨ Lens Studio</button>
<button onclick="window.location.href='books.html'">📚 Book Deep Study</button>
<button onclick="window.location.href='maths.html'">🧮 Math Solver</button>
<button onclick="window.location.href='search.html'">🔎 Deep Search</button>
<button onclick="window.location.href='downloader.html'">📥 Video Downloader</button>
<button onclick="window.location.href='board.html'">📋 Whiteboard</button>
<button onclick="window.location.href='clone.html'">📑 Website Cloner</button>
<button onclick="window.location.href='runhtml.html'">🌐 Write HTML</button>
<button onclick="window.location.href='youtube.html'">▶️ YouTube Search</button>
<button onclick="window.location.href='managequiz.html'">⚙️ Manage Quiz</button>
<button onclick="window.location.href='tutor.html'">👨🏫 AI Tutor</button>
<button onclick="window.location.href='quiz.html'">📝 Take a Quiz!</button>
<button onclick="window.location.href='book_quiz.html'">📝 Take a Book Quiz!</button>
<button onclick="window.location.href='tables.html'" style="border-left: 4px solid var(--primary); color: var(--primary); background: var(--border-light);">🔢 Maths Table</button>
<button onclick="window.location.href='coding.html'">💻 AI Coding</button>
<button onclick="window.location.href='chess.html'">♟️ Chess AI</button>
<button onclick="window.location.href='translator.html'">🎙️ Text Translator</button>
<button onclick="window.location.href='image.html'">🖼️ Image Translator</button>
<button onclick="window.location.href='create.html'">🎨 Image Creator</button>
<button onclick="window.location.href='qa.html'">📚 Document Q&A</button>
<button onclick="window.location.href='history.html'">🕒 History & Downloads</button>
<button onclick="window.location.href='storage.html'">📂 Storage</button>
<button onclick="window.location.href='hub.html'">🛰️ HF Command Center</button>
<button onclick="window.location.href='live.html'">🗣️ Gemini Live</button>
</div>
<script>
function toggleSidebar() { const s = document.getElementById("sidebar"), o = document.getElementById("overlay"); const a = !s.classList.contains("active"); s.classList.toggle("active", a); o.classList.toggle("active", a); }
</script>
<div class="topbar">
<button onclick="window.location.href='index.html'" style="background:transparent; border:none; font-size:24px; cursor:pointer;">⬅️</button>
<div style="font-size: 18px; font-weight: 800; color: var(--primary);">🧮 Math Tables</div>
<button id="mainSpeakBtn" class="action-btn" onclick="openSpeakModal()">🔊 Speak</button>
<button id="stopSpeakBtn" class="action-btn speak-stop-btn" onclick="stopSpeaking()">🛑 Stop</button>
</div>
<div class="controls-container">
<div style="font-size: 14px; font-weight: 800; margin-bottom: 10px; color: var(--text-muted);">ENTER MULTIPLICATION TABLE</div>
<input type="number" id="tableInput" class="number-input" value="1" min="1" max="100" oninput="generateTable()">
</div>
<div id="tableContainer" class="table-display"></div>
<button class="load-more-btn" onclick="loadMore()">⏬ Load 10 More</button>
<div id="voiceModal" class="modal-overlay" onclick="closeSpeakModal(event)">
<div class="modal-box" onclick="event.stopPropagation()">
<button onclick="closeSpeakModal(null, true)" style="position:absolute; top:15px; right:15px; background:#f1f5f9; border:none; width:30px; height:30px; border-radius:50%; font-weight:bold; cursor:pointer;">✕</button>
<div style="font-size: 40px; margin-bottom: 10px;">🗣️</div>
<h3 style="margin-top: 0; color: var(--text-main); font-weight: 800;">Choose Language</h3>
<div style="display: flex; flex-direction: column; gap: 12px; margin-top: 20px;">
<button class="action-btn" style="background: var(--primary); color: white;" onclick="startSpeaking('en')">🗣️ English (1 Wanja 1)</button>
<button class="action-btn" style="background: #10b981; color: white; border-color: #10b981;" onclick="startSpeaking('hi')">🗣️ Hindi (1 एकम 1)</button>
</div>
</div>
</div>
<script>
let currentTable = 1;
let currentMax = 10;
let isSpeaking = false;
let ttsQueue = [];
// This stops Chrome from deleting the audio mid-sentence
window.activeTableUtterance = null;
window.onload = () => { generateTable(); };
function generateTable() {
let inputVal = document.getElementById('tableInput').value;
currentTable = parseInt(inputVal) || 1;
currentMax = 10;
renderRows();
stopSpeaking();
}
function loadMore() {
currentMax += 10;
renderRows();
}
function renderRows() {
const container = document.getElementById('tableContainer');
container.innerHTML = '';
for(let i = 1; i <= currentMax; i++) {
container.insertAdjacentHTML('beforeend', `
<div class="table-row">
${currentTable} × ${i} = <span style="color:var(--primary);">${currentTable * i}</span>
</div>
`);
}
}
function openSpeakModal() {
document.getElementById('voiceModal').style.display = 'flex';
}
function closeSpeakModal(e, force = false) {
if (force || e.target === document.getElementById('voiceModal')) {
document.getElementById('voiceModal').style.display = 'none';
}
}
function startSpeaking(lang) {
closeSpeakModal(null, true);
window.speechSynthesis.cancel();
isSpeaking = false;
ttsQueue = [];
// Combined the number and 'ja' together so the TTS engine reads it as a single sound
for(let i = 1; i <= currentMax; i++) {
let res = currentTable * i;
let text = "";
if (lang === 'en') {
// This forces "1ja 1" instead of "one ja 1"
text = `${currentTable} ${i}ja ${res}`;
} else {
// Hindi phonetic mapping
let hiSuffix = ["", "एकम", "दूनी", "तिया", "चौके", "पंचे", "छक", "सत्ते", "अट्ठे", "निमा", "दहाम"];
let suffix = i <= 10 ? hiSuffix[i] : `गुना ${i}`;
text = `${currentTable} ${suffix} ${res}`;
}
ttsQueue.push({ text: text, lang: lang === 'en' ? 'en-IN' : 'hi-IN' });
}
isSpeaking = true;
document.getElementById('mainSpeakBtn').style.display = 'none';
document.getElementById('stopSpeakBtn').style.display = 'block';
setTimeout(playNextInChain, 100);
}
function playNextInChain() {
if (!isSpeaking || ttsQueue.length === 0) {
stopSpeaking();
return;
}
let nextItem = ttsQueue.shift();
window.activeTableUtterance = new SpeechSynthesisUtterance(nextItem.text);
window.activeTableUtterance.lang = nextItem.lang;
window.activeTableUtterance.rate = 0.85;
window.activeTableUtterance.onend = () => {
if (isSpeaking) {
setTimeout(playNextInChain, 50);
}
};
window.activeTableUtterance.onerror = () => {
if (isSpeaking) setTimeout(playNextInChain, 50);
};
window.speechSynthesis.speak(window.activeTableUtterance);
}
function stopSpeaking() {
isSpeaking = false;
window.speechSynthesis.cancel();
ttsQueue = [];
window.activeTableUtterance = null;
document.getElementById('mainSpeakBtn').style.display = 'block';
document.getElementById('stopSpeakBtn').style.display = 'none';
}
</script>
</body>
</html> |