Initial commit
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
const { createApp } = Vue;
|
||||
|
||||
const fontsMap = {
|
||||
ambili: "FML-TTambili",
|
||||
charaka: "FML-TTRevathi",
|
||||
haritha: "haritha",
|
||||
indulekha: "FML-TTindulekha",
|
||||
karthika: "FML-TTkarthika",
|
||||
manorama: "manorama",
|
||||
matweb: "matweb",
|
||||
nandini: "FML-TTnandini",
|
||||
panchari: "panchari",
|
||||
revathi: "FML-TTrevathi",
|
||||
uma: "FML-TTkaumudi",
|
||||
};
|
||||
|
||||
createApp({
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
text: `ചെണ്ടമേളം
|
||||
കുഞ്ചൻ നമ്പ്യാർ
|
||||
മഞ്ഞൾ പ്രസാദം
|
||||
തിങ്കളാഴ്ച
|
||||
`,
|
||||
font: "karthika",
|
||||
},
|
||||
allFonts: Object.keys(fontsMap),
|
||||
asciiTxt: "",
|
||||
asciiFont: "",
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
async onSubmit() {
|
||||
const res = await fetch("/api/a2u", {
|
||||
method: "post",
|
||||
body: JSON.stringify(this.form),
|
||||
headers: {
|
||||
"Content-type": "application/json",
|
||||
},
|
||||
});
|
||||
const data = await res.json();
|
||||
this.asciiTxt = data.ascii;
|
||||
this.asciiFont = fontsMap[this.form.font];
|
||||
},
|
||||
correctOldChillu(e) {
|
||||
return (e = e
|
||||
.replace("ൺ", "ണ്")
|
||||
.replace("ൻ", "ന്")
|
||||
.replace("ർ", "ര്")
|
||||
.replace("ൽ", "ല്")
|
||||
.replace("ൾ", "ള്")
|
||||
.replace("ോ", "ോ")
|
||||
.replace("ൊ", "ൊ"));
|
||||
},
|
||||
correctNewChillu(e) {
|
||||
return (e = e
|
||||
.replaceAll("ണ്", "ൺ")
|
||||
.replaceAll("ന്", "ൻ")
|
||||
.replaceAll("ര്", "ർ")
|
||||
.replaceAll("ല്", "ൽ")
|
||||
.replaceAll("ള്", "ൾ")
|
||||
.replaceAll("ോ", "ോ")
|
||||
.replaceAll("ൊ", "ൊ")
|
||||
.replaceAll("൦", "0")
|
||||
.replaceAll("൧", "1")
|
||||
.replaceAll("൨", "2")
|
||||
.replaceAll("൩", "3")
|
||||
.replaceAll("൪", "4")
|
||||
.replaceAll("൫", "5")
|
||||
.replaceAll("൬", "6")
|
||||
.replaceAll("൭", "7")
|
||||
.replaceAll("൮", "8")
|
||||
.replaceAll("൯", "9"));
|
||||
},
|
||||
},
|
||||
}).mount("#app");
|
||||
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>Ascii to unicode converter</title>
|
||||
<link rel="stylesheet" href="https://unpkg.com/mvp.css@1.12/mvp.css" />
|
||||
<style type="text/css" media="screen">
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main id="app">
|
||||
<hr />
|
||||
|
||||
<form accept-charset="utf-8" v-on:submit.prevent="onSubmit">
|
||||
<select v-model="form.font">
|
||||
<option v-for="font in allFonts" :value="font">{{font}}</option>
|
||||
</select>
|
||||
<textarea v-model="form.text" rows="4">
|
||||
</textarea>
|
||||
<button type="submit">Submit</button>
|
||||
<textarea rows="8" :style="{'font-family': asciiFont}" v-model="asciiTxt" ></textarea>
|
||||
</form>
|
||||
</main>
|
||||
|
||||
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
|
||||
<script src="./app.js" charset="utf-8"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user