Transaltor / tables.html
Aichatbot12321's picture
Upload 27 files
84e1dd3 verified
Raw History Blame Contribute Delete
15.8 kB
<!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} &nbsp;×&nbsp; ${i} &nbsp;=&nbsp; <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>