-
Notifications
You must be signed in to change notification settings - Fork 1
/
keyboard.html
180 lines (160 loc) · 5.58 KB
/
keyboard.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
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
<!DOCTYPE html>
<!-- saved from url=(0052)https://x20web.corp.google.com/~shuchen/vk/demo.html -->
<html>
<head>
<title>Osage keyboard input</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="/css/blueprint/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="/css/blueprint/print.css" type="text/css" media="print">
<!--[if lt IE 8]>
<link rel="stylesheet" href="/css/blueprint/ie.css" type="text/css" media="screen, projection">
<![endif]-->
<script src="/js/vk-debug.js"></script>
<link rel="stylesheet" type="text/css" href="/css/fonts.css">
<link rel="stylesheet" type="text/css" href="/css/keyboard.css">
<style>
.vk-cap {font-family: Nelagoney, Osage, Arial; font-size:18px;}
.vk-button {font-family: Nelagoney, Osage, Arial;}
.input {font-size:18px;}
.textarea {font-size:24px;}
.textarea {font-family: Pawhuska, Osage, Arial;}
</style>
<script src="/js/text_utils.js"></script>
<script>
var diff_list = [];
var controller, visible = true;
function onPageLoaded() {
var outputArea = 't1';
var input = document.getElementById(outputArea);
controller = new i18n.input.keyboard.Keyboard();
controller.loadLayout('osa_traditional');
controller.loadLayout('osa');
controller.reposition(input, 2, 0, [1, 0, 0, 0]);
controller.register(input);
controller.addEventListener('kc', function() { visible = false; });
input.focus();
var selector = document.getElementById('selectKeyboard');
onLayoutSelected(selector, controller, outputArea);
onFontSelected(document.getElementById('selectFont'), 't1');
}
function onLayoutSelected(selector, this_controller, outputId) {
var layoutCode = selector.value;
if (this_controller) {
this_controller.activateLayout(layoutCode);
} else { // The global.
controller.activateLayout(layoutCode);
}
document.getElementById(outputId).focus();
var vkbox = document.getElementById('kbd');
var field = document.getElementById(outputId);
if (layoutCode == "osa_traditional") {
field.style.fontFamily = "Osage";
if (vkbox) {
vkbox.style.fontFamily = "Osage";
}
} else if (layoutCode == "osa") {
if (vkbox) {
vkbox.style.fontFamily = "Pawhuska";
}
onFontSelected('selectFont', 't1');
}
}
function toggle() {
if (controller) {
controller.setVisible(visible = !visible);
}
}
function clearText() {
var field = document.getElementById('t1');
field.value = '';
field = document.getElementById('codepoints');
field.value = '';
document.getElementById('t1').focus();
}
function showCodePoints() {
var src_field = document.getElementById('t1');
var code_text = uplus(src_field.value, " ");
var dest_field = document.getElementById('codepoints');
dest_field.value = code_text;
document.getElementById('t1').focus();
}
function onFontSelected(selected, area) {
var output_text = document.getElementById(area);
var fontFam = selected.value + ", Osage, Arial";
output_text.style.fontFamily = fontFam;
setKeyCapsFont(fontFam);
}
function setKeyCapsFont(newFontFamily) {
var keycaps = document.getElementsByClassName("vk-cap");
for (var i = 0; i < keycaps.length; i++ ) {
keycaps[i].style.fontFamily = newFontFamily;
}
}
</script>
<script>window["_GOOG_TRANS_EXT_VER"] = "1";</script>
</head>
<body onload="onPageLoaded()">
<div class="container">
<div class="span-1">
</div>
<div class="span-16">
<select onchange="onLayoutSelected(this, null, 't1')" id="selectKeyboard">
<option value="osa">Osage Unicode</option>
<option value="osa_traditional">Osage Traditional</option>
</select>
<input type="button" value="Clear text" onclick="clearText()">
Select font: <select onchange="onFontSelected(this, 't1');" id="selectFont">
{% for font in fontFamilies %}
<option value="{{font}}">{{font}}</option>
{% endfor %}
</select>
<br />
<textarea id="t1" dir="ltr" class="unicodeOsageText oldOsageText" style="width:600px;height:300px;" rows="10"></textarea>
<br />
<input type="button" value="Code points" onclick="showCodePoints()">
</div>
<div class="span-4 last">
{% if user_nickname %}
<h4>Welcome {{user_nickname}}</h4>
{% if user_logout %}
<a href={{user_logout}}>Logout</a>
{% endif %}
{% else %}
{% if user_login_url %}
<a href={{user_login_url}}>Log in</a>
{% endif %}
{% endif %}
<h3>Useful links</h3>
<ul>
<li>
<a href="/">Osage Main</a>
</li>
<li>
<a href="/keyboard/">Osage keyboard</a>
</li>
<li>
<a href="/downloads/">Download Osage Nation fonts</a>
</li>
<li>
<a href="/words/">Review Osage phrases</a>
</li>
<li>
<a href="/words/getPhrases/">View database</a>
<br />
<br />
</li>
<li>
<a href="http://www.unicode.org/charts/PDF/U104B0.pdf">Unicode Osage</a>
</li>
<li>
<a href="http://std.dkuug.dk/jtc1/sc2/wg2/docs/n4619.pdf">Osage Unicode proposal</a>
</li>
</ul>
</div>
<div class="span-18 last">
<textarea id="codepoints" class="default-font" style="width:600px;" rows="10"></textarea>
<br>
</div>
</div>
</body></html>