-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
533 lines (473 loc) · 25.5 KB
/
Copy pathindex.html
File metadata and controls
533 lines (473 loc) · 25.5 KB
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Malayalam Converter | Developed by Saheer Mk</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Malayalam:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.malayalam-font {
font-family: 'Noto Sans Malayalam', sans-serif;
line-height: 1.6;
}
/* Custom Scrollbar */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
background: #cbd5e1;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #94a3b8;
}
.tab-btn {
position: relative;
}
.tab-active {
color: #2563eb;
background-color: #eff6ff;
}
.tab-active::after {
content: '';
position: absolute;
bottom: -2px;
left: 0;
width: 100%;
height: 2px;
background-color: #2563eb;
}
.tab-inactive {
color: #64748b;
}
.tab-inactive:hover {
color: #334155;
background-color: #f1f5f9;
}
.keyboard-key {
transition: all 0.1s active;
}
.keyboard-key:active {
transform: scale(0.95);
background-color: #dbeafe;
}
</style>
</head>
<body class="min-h-screen flex flex-col text-slate-800">
<!-- Navigation / Header -->
<nav class="bg-white shadow-sm border-b border-gray-200 sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex items-center gap-3">
<div class="bg-blue-600 text-white p-2 rounded-lg">
<i class="fas fa-language text-xl"></i>
</div>
<div>
<h1 class="text-lg font-bold text-gray-900 leading-tight">Malayalam ToolKit</h1>
<p class="text-[10px] text-blue-600 font-medium uppercase tracking-wider">By Saheer Mk</p>
</div>
</div>
<!-- Desktop Menu -->
<div class="hidden md:flex items-center space-x-1">
<button onclick="switchTab('converter')" id="nav-converter" class="px-4 py-2 text-sm font-medium rounded-md text-blue-600 bg-blue-50 transition">
<i class="fas fa-sync-alt mr-2"></i>Converter
</button>
<button onclick="switchTab('tools')" id="nav-tools" class="px-4 py-2 text-sm font-medium rounded-md text-gray-600 hover:bg-gray-50 transition">
<i class="fas fa-tools mr-2"></i>Tools
</button>
<button onclick="switchTab('guide')" id="nav-guide" class="px-4 py-2 text-sm font-medium rounded-md text-gray-600 hover:bg-gray-50 transition">
<i class="fas fa-book mr-2"></i>Guide
</button>
</div>
<!-- Mobile Menu Button -->
<div class="md:hidden flex items-center">
<button onclick="toggleMobileMenu()" class="text-gray-500 hover:text-gray-700 p-2">
<i class="fas fa-bars text-xl"></i>
</button>
</div>
</div>
</div>
<!-- Mobile Menu Dropdown -->
<div id="mobile-menu" class="hidden md:hidden bg-white border-b border-gray-200">
<div class="px-2 pt-2 pb-3 space-y-1">
<button onclick="switchTab('converter')" class="block w-full text-left px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 hover:text-blue-600">Converter</button>
<button onclick="switchTab('tools')" class="block w-full text-left px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 hover:text-blue-600">Tools & Analytics</button>
<button onclick="switchTab('guide')" class="block w-full text-left px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 hover:text-blue-600">User Guide</button>
</div>
</div>
</nav>
<!-- Main Content -->
<main class="flex-grow container mx-auto px-4 py-6 max-w-6xl">
<!-- CONVERTER SECTION -->
<div id="converter-section" class="space-y-4">
<!-- Toolbar -->
<div class="flex flex-wrap items-center justify-between gap-3 bg-white p-3 rounded-lg border border-gray-200 shadow-sm">
<div class="flex items-center gap-2">
<button onclick="toggleKeyboard()" class="text-sm bg-indigo-50 text-indigo-700 border border-indigo-100 px-3 py-1.5 rounded-md hover:bg-indigo-100 transition flex items-center gap-2">
<i class="fas fa-keyboard"></i> <span class="hidden sm:inline">On-Screen Keyboard</span>
</button>
<span class="text-xs text-gray-400">|</span>
<button onclick="increaseFontSize()" class="text-gray-500 hover:text-gray-700 p-1.5" title="Increase Size"><i class="fas fa-search-plus"></i></button>
<button onclick="decreaseFontSize()" class="text-gray-500 hover:text-gray-700 p-1.5" title="Decrease Size"><i class="fas fa-search-minus"></i></button>
</div>
<div class="flex items-center gap-2">
<button onclick="downloadText()" class="text-sm bg-gray-50 text-gray-700 border border-gray-200 px-3 py-1.5 rounded-md hover:bg-gray-100 transition" title="Save as .txt">
<i class="fas fa-download"></i>
</button>
<button onclick="clearAll()" class="text-sm bg-red-50 text-red-600 border border-red-100 px-3 py-1.5 rounded-md hover:bg-red-100 transition flex items-center gap-2">
<i class="fas fa-trash-alt"></i> <span class="hidden sm:inline">Clear</span>
</button>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<!-- INPUT: Unicode / Manglish -->
<div class="flex flex-col h-[500px] bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden relative">
<div class="bg-gray-50 px-4 py-2.5 border-b border-gray-200 flex justify-between items-center">
<div class="flex items-center gap-2">
<span class="w-6 h-6 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center text-xs font-bold">1</span>
<span class="text-sm font-semibold text-gray-700">Type Manglish / Malayalam</span>
</div>
<span class="text-xs text-gray-400" id="char-count">0 chars</span>
</div>
<textarea
id="input-text"
class="flex-grow w-full p-5 text-lg malayalam-font outline-none resize-none border-none placeholder-gray-400 focus:bg-blue-50/10 transition"
placeholder="Type here... (e.g., 'namaskaram')"
oninput="handleInput(this.value)"></textarea>
<!-- Virtual Keyboard Overlay -->
<div id="virtual-keyboard" class="hidden absolute bottom-0 left-0 right-0 bg-white border-t border-gray-200 p-1 shadow-[0_-8px_30px_rgba(0,0,0,0.12)] z-10">
<div class="flex justify-between items-center px-2 py-1 mb-1 border-b border-gray-100">
<span class="text-xs text-gray-500 font-medium">Malayalam Keypad</span>
<button onclick="toggleKeyboard()" class="text-gray-400 hover:text-red-500"><i class="fas fa-times"></i></button>
</div>
<div class="grid grid-cols-10 gap-1 p-1 h-48 overflow-y-auto">
<!-- Populated by JS -->
</div>
</div>
</div>
<!-- OUTPUT: ML-TT -->
<div class="flex flex-col h-[500px] bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
<div class="bg-emerald-50 px-4 py-2.5 border-b border-emerald-100 flex justify-between items-center">
<div class="flex items-center gap-2">
<span class="w-6 h-6 rounded-full bg-emerald-100 text-emerald-600 flex items-center justify-center text-xs font-bold">2</span>
<span class="text-sm font-semibold text-emerald-800">ML-TT Output</span>
</div>
<button onclick="copyToClipboard()" class="text-xs bg-emerald-600 text-white px-3 py-1.5 rounded hover:bg-emerald-700 transition shadow-sm flex items-center gap-2">
<i class="fas fa-copy"></i> Copy
</button>
</div>
<div class="flex-grow relative bg-gray-50">
<textarea
id="output-text"
class="w-full h-full p-5 text-lg font-mono text-gray-600 bg-transparent border-none outline-none resize-none"
readonly
placeholder="Converted text appears here..."></textarea>
<!-- Floating info -->
<div class="absolute bottom-4 right-4 text-xs text-gray-400 bg-white/80 backdrop-blur px-2 py-1 rounded border border-gray-200 pointer-events-none">
Ready for Photoshop / capcut
</div>
</div>
</div>
</div>
</div>
<!-- TOOLS SECTION -->
<div id="tools-section" class="hidden space-y-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Analysis Card -->
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-200">
<div class="flex items-center gap-3 mb-4 text-blue-600">
<i class="fas fa-chart-pie text-xl"></i>
<h3 class="font-bold text-gray-800">Text Analysis</h3>
</div>
<div class="space-y-3">
<div class="flex justify-between p-3 bg-gray-50 rounded-lg">
<span class="text-gray-600 text-sm">Characters</span>
<span id="stat-char" class="font-mono font-bold text-gray-800">0</span>
</div>
<div class="flex justify-between p-3 bg-gray-50 rounded-lg">
<span class="text-gray-600 text-sm">Words</span>
<span id="stat-word" class="font-mono font-bold text-gray-800">0</span>
</div>
<div class="flex justify-between p-3 bg-gray-50 rounded-lg">
<span class="text-gray-600 text-sm">Lines</span>
<span id="stat-line" class="font-mono font-bold text-gray-800">0</span>
</div>
</div>
</div>
<!-- Sharing Card -->
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-200">
<div class="flex items-center gap-3 mb-4 text-green-600">
<i class="fas fa-share-alt text-xl"></i>
<h3 class="font-bold text-gray-800">Quick Share</h3>
</div>
<p class="text-sm text-gray-500 mb-4">Share the converted output directly to apps.</p>
<div class="space-y-3">
<button onclick="shareText('whatsapp')" class="w-full py-2 px-4 bg-green-500 hover:bg-green-600 text-white rounded-lg flex items-center justify-center gap-2 transition">
<i class="fab fa-whatsapp"></i> Share on WhatsApp
</button>
<button onclick="shareText('native')" class="w-full py-2 px-4 bg-gray-800 hover:bg-gray-900 text-white rounded-lg flex items-center justify-center gap-2 transition">
<i class="fas fa-share"></i> More Options
</button>
</div>
</div>
<!-- Tip Card -->
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-200 border-l-4 border-l-yellow-400">
<div class="flex items-center gap-3 mb-4 text-yellow-600">
<i class="fas fa-lightbulb text-xl"></i>
<h3 class="font-bold text-gray-800">Did You Know?</h3>
</div>
<p class="text-sm text-gray-600 leading-relaxed">
ML-TT fonts are "ASCII-mapped" fonts. This means they replace English letters with Malayalam shapes. That's why the output looks like gibberish English until you apply the correct font file in your design software.
</p>
</div>
</div>
</div>
<!-- GUIDE SECTION -->
<div id="guide-section" class="hidden">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Instructions -->
<div class="lg:col-span-2 bg-white rounded-xl shadow-sm border border-gray-200 p-6">
<h2 class="text-xl font-bold text-gray-800 mb-4">How to use this tool</h2>
<ol class="space-y-4 text-sm text-gray-600">
<li class="flex gap-3">
<span class="flex-shrink-0 w-6 h-6 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center font-bold text-xs">1</span>
<p>Type Malayalam text in the left box. You can use Manglish (e.g., "ente keralam") or the built-in keyboard.</p>
</li>
<li class="flex gap-3">
<span class="flex-shrink-0 w-6 h-6 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center font-bold text-xs">2</span>
<p>The tool automatically converts it to ML-TT format in the right box.</p>
</li>
<li class="flex gap-3">
<span class="flex-shrink-0 w-6 h-6 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center font-bold text-xs">3</span>
<p>Copy the result and paste it into Photoshop, Premiere Pro, or CorelDraw.</p>
</li>
<li class="flex gap-3">
<span class="flex-shrink-0 w-6 h-6 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center font-bold text-xs">4</span>
<p>Select an ML-TT font (like <b>FML-TT-Karthika</b> or <b>ML-TT-Revathi</b>) in your software to see correct Malayalam.</p>
</li>
</ol>
</div>
<!-- Manglish Cheat Sheet -->
<div class="bg-slate-800 rounded-xl shadow-sm text-white p-6">
<h3 class="font-bold text-lg mb-4 text-slate-200">Manglish Codes</h3>
<div class="grid grid-cols-2 gap-x-4 gap-y-2 text-sm font-mono text-slate-400">
<div class="flex justify-between border-b border-slate-700 pb-1"><span>a</span> <span>അ</span></div>
<div class="flex justify-between border-b border-slate-700 pb-1"><span>aa</span> <span>ആ</span></div>
<div class="flex justify-between border-b border-slate-700 pb-1"><span>i</span> <span>ഇ</span></div>
<div class="flex justify-between border-b border-slate-700 pb-1"><span>ee</span> <span>ഈ</span></div>
<div class="flex justify-between border-b border-slate-700 pb-1"><span>k</span> <span>ക</span></div>
<div class="flex justify-between border-b border-slate-700 pb-1"><span>kh</span> <span>ഖ</span></div>
<div class="flex justify-between border-b border-slate-700 pb-1"><span>ch</span> <span>ച</span></div>
<div class="flex justify-between border-b border-slate-700 pb-1"><span>j</span> <span>ജ</span></div>
<div class="flex justify-between border-b border-slate-700 pb-1"><span>zh</span> <span>ഴ</span></div>
<div class="flex justify-between border-b border-slate-700 pb-1"><span>sh</span> <span>ഷ</span></div>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-white border-t border-gray-200 mt-auto">
<div class="max-w-7xl mx-auto py-6 px-4 text-center">
<p class="text-sm text-gray-500">© 2025 Malayalam ToolKit</p>
<p class="text-sm font-semibold text-gray-700 mt-1">Developed by Saheer Mk</p>
</div>
</footer>
<!-- Notification Toast -->
<div id="toast" class="fixed bottom-5 left-1/2 transform -translate-x-1/2 bg-gray-800 text-white px-6 py-3 rounded-full shadow-lg text-sm font-medium transition-all duration-300 opacity-0 translate-y-10 z-50 flex items-center gap-2">
<i class="fas fa-check-circle text-green-400"></i>
<span id="toast-msg">Action Successful</span>
</div>
<script>
// --- Navigation ---
function switchTab(tabId) {
// Hide all
['converter', 'tools', 'guide'].forEach(t => {
document.getElementById(`${t}-section`).classList.add('hidden');
});
// Remove active state from nav buttons
const navs = document.querySelectorAll('nav button');
navs.forEach(btn => {
if(btn.id.includes('nav-')) {
btn.classList.remove('bg-blue-50', 'text-blue-600');
btn.classList.add('text-gray-600', 'hover:bg-gray-50');
}
});
// Show selected
document.getElementById(`${tabId}-section`).classList.remove('hidden');
// Highlight nav (Desktop)
const activeBtn = document.getElementById(`nav-${tabId}`);
if(activeBtn) {
activeBtn.classList.remove('text-gray-600', 'hover:bg-gray-50');
activeBtn.classList.add('bg-blue-50', 'text-blue-600');
}
// Close mobile menu if open
document.getElementById('mobile-menu').classList.add('hidden');
}
function toggleMobileMenu() {
document.getElementById('mobile-menu').classList.toggle('hidden');
}
// --- Core Functions ---
function showToast(msg) {
const toast = document.getElementById('toast');
document.getElementById('toast-msg').innerText = msg;
toast.classList.remove('opacity-0', 'translate-y-10');
setTimeout(() => {
toast.classList.add('opacity-0', 'translate-y-10');
}, 3000);
}
function copyToClipboard() {
const output = document.getElementById('output-text');
if (!output.value) return showToast('Nothing to copy!');
output.select();
document.execCommand('copy');
showToast('Copied ML-TT code!');
}
function clearAll() {
if(confirm('Clear all content?')) {
document.getElementById('input-text').value = '';
document.getElementById('output-text').value = '';
updateStats('');
showToast('Cleared');
}
}
function downloadText() {
const text = document.getElementById('output-text').value;
if(!text) return showToast('Output is empty');
const blob = new Blob([text], { type: 'text/plain' });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'malayalam-mltt.txt';
a.click();
window.URL.revokeObjectURL(url);
showToast('Downloaded text file');
}
function shareText(type) {
const text = document.getElementById('output-text').value;
if(!text) return showToast('Nothing to share');
if (type === 'whatsapp') {
const url = `https://wa.me/?text=${encodeURIComponent(text)}`;
window.open(url, '_blank');
} else if (type === 'native') {
if (navigator.share) {
navigator.share({
title: 'Converted Malayalam Text',
text: text
}).catch(console.error);
} else {
showToast('Sharing not supported on this device');
}
}
}
// --- Font Resizer ---
let currentFontSize = 18; // px
function increaseFontSize() {
if(currentFontSize < 32) {
currentFontSize += 2;
applyFontSize();
}
}
function decreaseFontSize() {
if(currentFontSize > 12) {
currentFontSize -= 2;
applyFontSize();
}
}
function applyFontSize() {
document.getElementById('input-text').style.fontSize = `${currentFontSize}px`;
document.getElementById('output-text').style.fontSize = `${currentFontSize}px`;
}
// --- Keyboard Generation ---
const malChars = [
'അ','ആ','ഇ','ഈ','ഉ','ഊ','എ','ഏ','ഐ','ഒ','ഓ','ഔ',
'ക','ഖ','ഗ','ഘ','ങ',
'ച','ഛ','ജ','ഝ','ഞ',
'ട','ഠ','ഡ','ഢ','ണ',
'ത','ഥ','ദ','ധ','ന',
'പ','ഫ','ബ','ഭ','മ',
'യ','ര','ല','വ','ശ','ഷ','സ','ഹ',
'ള','ഴ','റ',
'്','ാ','ി','ീ','ു','ൂ','ൃ','െ','േ','ൈ','ൊ','ോ','ൌ'
];
function initKeyboard() {
const kbContainer = document.querySelector('#virtual-keyboard > div:last-child');
malChars.forEach(char => {
const btn = document.createElement('button');
btn.className = 'p-2 bg-gray-50 border border-gray-200 rounded text-lg hover:bg-blue-100 keyboard-key font-bold text-gray-700';
btn.innerText = char;
btn.onclick = (e) => {
e.preventDefault();
insertChar(char);
};
kbContainer.appendChild(btn);
});
}
function toggleKeyboard() {
const kb = document.getElementById('virtual-keyboard');
kb.classList.toggle('hidden');
}
function insertChar(char) {
const input = document.getElementById('input-text');
const start = input.selectionStart;
const end = input.selectionEnd;
const text = input.value;
input.value = text.substring(0, start) + char + text.substring(end);
input.selectionStart = input.selectionEnd = start + char.length;
input.focus();
handleInput(input.value);
}
// --- Logic & Mapping ---
function updateStats(text) {
document.getElementById('char-count').innerText = `${text.length} chars`;
document.getElementById('stat-char').innerText = text.length;
document.getElementById('stat-word').innerText = text.trim() === '' ? 0 : text.trim().split(/\s+/).length;
document.getElementById('stat-line').innerText = text.trim() === '' ? 0 : text.split(/\r\n|\r|\n/).length;
}
const unicodeToMlTT = {
'അ': 'A', 'ആ': 'B', 'ഇ': 'C', 'ഈ': 'D', 'ഉ': 'E', 'ഊ': 'F', 'ഋ': 'G', 'എ': 'H', 'ഏ': 'I', 'ഐ': 'J', 'ഒ': 'K', 'ഓ': 'L', 'ഔ': 'M', 'അം': 'N',
'ക': 'k', 'ഖ': 'K', 'ഗ': 'g', 'ഘ': 'G', 'ങ': '§',
'ച': 'c', 'ഛ': 'C', 'ജ': 'j', 'ഝ': 'J', 'ഞ': 'n\\',
'ട': 't', 'ഠ': 'T', 'ഡ': 'd', 'ഢ': 'D', 'ണ': 'W',
'ത': 'X', 'ഥ': 'Y', 'ദ': 'Z', 'ധ': '[', 'ന': 'm',
'പ': 'p', 'ഫ': 'P', 'ബ': 'b', 'ഭ': 'B', 'മ': 'a',
'യ': 'b', 'ര': 'r', 'ല': 'l', 'വ': 'v', 'ശ': 'S', 'ഷ': 'x', 'സ': 's', 'ഹ': 'h',
'ള': 'ƒ', 'ഴ': 'g', 'റ': 'd',
'ാ': 'O', 'ി': 'w', 'ീ': 'W', 'ു': 'p', 'ൂ': 'q', 'ൃ': 'r',
'െ': 'e', 'േ': 'E', 'ൈ': 's', 'ൊ': 'o', 'ോ': 'O', 'ൌ': 'au',
'്': 'v', ' ': ' '
};
function handleInput(text) {
updateStats(text);
let converted = "";
const chars = Array.from(text);
for (let i = 0; i < chars.length; i++) {
const char = chars[i];
const nextChar = chars[i+1];
// Matra reordering logic for e, E, ai (ML-TT puts them BEFORE the consonant)
if (nextChar === 'െ' || nextChar === 'േ' || nextChar === 'ൈ') {
let matra = unicodeToMlTT[nextChar] || nextChar;
let cons = unicodeToMlTT[char] || char;
converted += (matra + cons);
i++;
} else {
converted += (unicodeToMlTT[char] || char);
}
}
document.getElementById('output-text').value = converted;
}
// Init
initKeyboard();
</script>
</body>
</html>