97 lines
No EOL
3.5 KiB
HTML
97 lines
No EOL
3.5 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
|
|
<head profile="http://gmpg.org/xfn/11">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
<title>Chinese Switcher</title>
|
|
<style type="text/css">
|
|
body {
|
|
margin: 0 auto;
|
|
width: 900px;
|
|
}
|
|
|
|
.general {
|
|
margin-top: 20px;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="wrapper" class="general">
|
|
<form action="convert.php" method="post" id="form1">
|
|
<label for="data">Original Text: </label><br/>
|
|
<textarea name="data" id="data" rows="20" cols="100"></textarea><br/>
|
|
<label for="variant">Convert to: </label>
|
|
<select id="variant" name="variant">
|
|
<!--
|
|
<option value="zh-hans">简体中文 (zh-hans)</option>
|
|
<option value="zh-hant">繁體中文 (zh-hant)</option>
|
|
-->
|
|
<option value="zh-cn">大陆简体 (zh-cn)</option>
|
|
<!--
|
|
<option value="zh-hk">港澳繁體 (zh-hk)</option>
|
|
<option value="zh-mo">澳門繁體 (zh-mo)</option>
|
|
<option value="zh-sg">马新简体 (zh-sg)</option>
|
|
<option value="zh-my">马来西亚简体 (zh-my)</option>
|
|
-->
|
|
<option value="zh-tw">台灣正體 (zh-tw)</option>
|
|
</select><br/>
|
|
<input type="hidden" name="dochineseconversion" value="1"/>
|
|
<input type="submit" id="s" name="submit" value="Submit (Ctrl + Enter)" class="general"/>
|
|
</form>
|
|
<div id="error" class="general"></div>
|
|
<div id="return" style="display: none" class="general">
|
|
<label for="response">Converted Text: </label><br/>
|
|
<textarea id="response" rows="20" cols="100"></textarea><br/>
|
|
</div>
|
|
<br/>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* <![CDATA[ */
|
|
document.forms[0].onsubmit = function () {
|
|
if (XMLHttpRequest) {
|
|
var ajax = new XMLHttpRequest();
|
|
} else {
|
|
var ajax = new ActiveXObject("Microsoft.XMLHTTP");
|
|
}
|
|
ajax.onreadystatechange = function () {
|
|
if (ajax.readyState == 4) {
|
|
if (ajax.status == 200) {
|
|
document.getElementById("response").value = ajax.responseText;
|
|
document.getElementById("return").style.display = "block";
|
|
document.getElementById("error").innerHTML = "";
|
|
} else {
|
|
document.getElementById("error").innerHTML = "Error, please try again.";
|
|
}
|
|
}
|
|
}
|
|
var t = 'dochineseconversion=1&variant=' +
|
|
(document.getElementById("variant").options[document.getElementById("variant").selectedIndex].value || document.getElementById("variant").options[document.getElementById("variant").selectedIndex].text) +
|
|
'&data=' + encodeURIComponent(document.getElementById("data").value);
|
|
document.getElementById("error").innerHTML = "Loading...";
|
|
ajax.open("POST", 'convert.php', true);
|
|
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
ajax.send(t);
|
|
return false;
|
|
}
|
|
|
|
var isCtrl = false;
|
|
document.onkeydown = function (e) {
|
|
if (typeof (e) == "undefined") e = window.event || window.Event;
|
|
if ((e.which || e.keyCode) == 17) isCtrl = true;
|
|
}
|
|
document.onkeyup = function (e) {
|
|
if (typeof (e) == "undefined") e = window.event || window.Event;
|
|
if (isCtrl &&
|
|
((e.which || e.keyCode) == 13 || (e.which || e.keyCode) == 10)
|
|
) {
|
|
if (typeof (e.preventDefault) != "undefined") e.preventDefault();
|
|
document.getElementById("s").click();
|
|
isCtrl = false;
|
|
return false;
|
|
}
|
|
isCtrl = false;
|
|
}
|
|
/* ]]> */
|
|
</script>
|
|
</body>
|
|
</html> |