-
Notifications
You must be signed in to change notification settings - Fork 96
/
index.html
executable file
·122 lines (101 loc) · 3.73 KB
/
index.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
<html>
<head>
<title>Zawgyi to Unicode</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="rabbit.js"></script>
<link rel="stylesheet" href="style.css"/>
<link rel="stylesheet" href='http://mmwebfonts.comquas.com/fonts/?font=notosan' />
<link rel="stylesheet" href='http://mmwebfonts.comquas.com/fonts/?font=zawgyi' />
<script type="text/javascript">
function clearText() {
document.getElementById("unicode").value = "";
document.getElementById("zawgyi").value = ""
}
</script>
</head>
<body>
<div id="container">
<header>
<img src="rabbit_100.png">
<h2>Rabbit</h2>
</header>
<br/>
<div id="textContainer">
<section id="Unicode">
<h3>Unicode</h3>
<textarea id="unicode" onfocus="handleOnFocus(this)" onblur="handleOnBlur()">သီဟိုဠ်မှ ဉာဏ်ကြီးရှင်သည် အာယုဝဍ္ဎနဆေးညွှန်းစာကို ဇလွန်ဈေးဘေး ဗာဒံပင်ထက် အဓိဋ္ဌာန်လျက် ဂဃနဏဖတ်ခဲ့သည်။</textarea>
</section>
<section id="Zawgyi">
<h3>Zawgyi</h3>
<textarea id="zawgyi" onfocus="handleOnFocus(this)" onblur="handleOnBlur()">သီဟိုဠ္မွ ဉာဏ္ႀကီးရွင္သည္ အာယုဝၯနေဆးၫႊန္းစာကို ဇလြန္ေဈးေဘး ဗာဒံပင္ထက္ အဓိ႒ာန္လ်က္ ဂဃနဏဖတ္ခဲ့သည္။</textarea>
</section>
</div>
<div id="textContainer">
<section id="buttons">
<input type="button" value="Clear Text" onclick="clearText()">
<input type="button" value="Copy Zawgyi" onclick="copyZawgyi()">
<input type="button" value="Copy Unicode" onclick="copyUnicode()">
</section>
</div>
<footer>
Found a bug ? Please , open <a href="https://github.com/Rabbit-Converter/Rabbit/issues/new">new issue</a>.
</footer>
</div>
<script>
var textFieldInFocus;
function handleOnFocus(form_element)
{
textFieldInFocus = form_element;
}
function handleOnBlur()
{
textFieldInFocus = null;
}
var unicode = document.getElementById("unicode");
var zawgyi = document.getElementById("zawgyi");
onchangeHandler(unicode,zawgyi,"uni2zg");
onchangeHandler(zawgyi,unicode,"zg2uni");
function converter(textField,tochangeField,toconv) {
if(tochangeField != textFieldInFocus) {
if(toconv == "uni2zg") {
tochangeField.value = Rabbit.uni2zg(textField.value);
}
else {
tochangeField.value = Rabbit.zg2uni(textField.value);
}
}
}
function onchangeHandler(textField,tochangeField,toconv) {
if (textField.addEventListener) {
textField.addEventListener('input', function() {
converter(textField,tochangeField,toconv);
}, false);
} else if (textField.attachEvent) {
textField.attachEvent('onpropertychange', function() {
// IE
converter(textField,tochangeField,toconv);
});
}
}
function copyZawgyi() {
/* Get the text field */
var copyText = document.getElementById("zawgyi");
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
/* Copy the text inside the text field */
document.execCommand("copy");
}
function copyUnicode() {
/* Get the text field */
var copyText = document.getElementById("unicode");
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
/* Copy the text inside the text field */
document.execCommand("copy");
}
</script>
</body>
</html>