-
Notifications
You must be signed in to change notification settings - Fork 2
/
transliterate-kn.html
136 lines (121 loc) · 4.86 KB
/
transliterate-kn.html
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
<!DOCTYPE HTML>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>Kannada transliteration</title>
<style type="text/css">
div { width:49%; border: 0px solid green; }
div.devanagaridiv, div.htmldiv, div.iastdiv, div.IASTdiv, div.ipadiv { float:right; clear:right;}
textarea { font-family: "Kedage", sans-serif;}
div.harvardkyotodiv,div.itransdiv,div.velthuisdiv { float:left; clear:left;}
textarea {
width: 90%;
height: 6em;
}
div.formatlist {
display: none;
}
</style>
</head>
<body>
<p>Note: see <a href="http://en.wikipedia.org/wiki/Help:Multilingual_support_(Indic)">
these instructions</a> for ways to input Indic scripts directly (without transliteration), or see <a href="http://www.google.com/transliterate/indic">Google Indic transliteration</a> for another way to input Kannada.</p>
<div class="entryarea">
If you enable Javascript, you can convert between the following transliteration schemes:
<ul>
<li title="devanagari">Kannada</li>
<li title="harvardkyoto"><a href="http://en.wikipedia.org/wiki/Devanagari_transliteration#Transliteration_Comparison">Harvard-Kyoto</a></li>
<li title="itrans"><a href="http://en.wikipedia.org/wiki/Devanagari_transliteration#Transliteration_Comparison">ITRANS</a></li>
<li title="iast"><a href="http://en.wikipedia.org/wiki/Devanagari_transliteration#Transliteration_Comparison">IAST</a>, lowercase</li>
<li title="IAST">IAST, uppercase</li>
<li title="velthuis"><a href="http://en.wikipedia.org/wiki/Devanagari_transliteration#Transliteration_Comparison">Velthuis</a> (for <a href="http://sanskrit.inria.fr/">INRIA</a>, etc.)</li>
<li title="html">HTML numeric character references</li>
<li title="ipa">IPA (approximate, incomplete, experimental!)</li>
</ul>
</div>
<script type="text/javascript" charset=UTF-8 src="json2.js"></script>
<script type="text/javascript" charset=UTF-8 src="convert-data-kn.js"></script>
<script type="text/javascript" charset=UTF-8 src="convert-in.js"></script>
<script>
var ta = [];
function makeentryarea() {
var myolddiv = document.getElementsByClassName("entryarea")[0];
var taposs = myolddiv.getElementsByTagName("ul")[0].getElementsByTagName("li");
for(var i=0; i<taposs.length; ++i) {
ta.push(taposs[i]);
}
/*This is part of the document; *really* ought to be done server-side*/
while(myolddiv.hasChildNodes()) myolddiv.removeChild(myolddiv.firstChild);
document.body.removeChild(myolddiv);
document.open();
for(var i=0; i<ta.length; ++i) {
/*
var mynewdiv = document.createElement('div'); mynewdiv.setAttribute('class', ta[i].getAttribute("title")+'div');
var mytmppar = document.createElement('p'); mytmppar.appendChild(document.createTextNode(ta[i].innerHTML));
mynewdiv.appendChild(mytmppar);
var mytarea = document.createElement('textarea'); mytarea.setAttribute('id', ta[i].getAttribute("title"));
mynewdiv.appendChild(mytarea);
myolddiv.appendChild(mynewdiv);
*/
var tareahtml = '<textarea spellcheck="false" id="' + ta[i].getAttribute("title") + '"';
if(ta[i].getAttribute("title") === 'devanagari') { tareahtml += ' lang="kn"'; }
tareahtml += '></textarea>';
document.writeln('<div class="'+ta[i].getAttribute("title")+'div"> <p>' + ta[i].innerHTML + '<br/>' + tareahtml + '</div>');
}
document.close();
}
makeentryarea();
/*
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(suffix) {
var startPos = this.length - suffix.length;
if (startPos < 0) {
return false;
}
return (this.lastIndexOf(suffix, startPos) == startPos);
};
}
//Reorder divs so that left/right works
var rightdivs = { devanagaridiv:'', htmldiv:'', IASTdiv:'', iastdiv:'' };
var leftdivs = { harvardkyotodiv:'', ITRANSdiv:'', velthuisdiv:''};
var alldivs = document.getElementsByTagName("div");
for(var i=0; i< alldivs.length; ++i) {
if (alldivs[i].getAttribute("class").endsWith("div")) {
alert("Found " + alldivs[i].getAttribute("class"));
}
}
*/
</script>
<script>
function fixall(tarea) {
var u = INtranslit[tarea.id+"2u"](tarea.value);
//document.writeln(tarea.value + "becomes " + u);
for(var i=0; i<ta.length; ++i) {
var t = ta[i].getAttribute("title");
if(t != tarea.id) {
document.getElementById(t).value = INtranslit["u2"+t](u);
}
}
}
function prepareTareas() {
var areas = document.getElementsByTagName('textarea');
for(var i=0; i<areas.length; ++i) {
areas[i].onkeyup=function() { return fixall(this); }
}
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
//addLoadEvent(makeentryarea);
addLoadEvent(prepareTareas);
</script>
</body>