2
* The contents of this file are subject to the Netscape Public
3
* License Version 1.1 (the "License"); you may not use this file
4
* except in compliance with the License. You may obtain a copy of
5
* the License at http://www.mozilla.org/NPL/
7
* Software distributed under the License is distributed on an "AS
8
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9
* implied. See the License for the specific language governing
10
* rights and limitations under the License.
12
* The Original Code is Mozilla Communicator client code, released
15
* The Initial Developer of the Original Code is Netscape
16
* Communications Corporation. Portions created by Netscape are
17
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
21
* Baki Bon <bakibon@yahoo.com> (original author)
22
* Charles Manske (cmanske@netscape.com)
23
* Neil Rashbrook (neil@parkwaycc.co.uk)
26
//------------------------------------------------------------------
27
// From Unicode 3.0 Page 54. 3.11 Conjoining Jamo Behavior
35
var NCount = VCount * TCount;
38
// dialog initialization code
41
if (!GetCurrentEditor())
49
// Dialog is non-modal:
50
// Change button text: "Ok" to "Insert"; "Cancel" to "Close"
51
var insertButton = document.documentElement.getButton("accept");
54
insertButton.setAttribute("label", GetString("Insert"));
55
insertButton.setAttribute("accesskey", GetString("InsertAccessKey"));
58
var cancelButton = document.getElementById("insertCharsDlg").getButton("cancel");
60
cancelButton.setAttribute("label", GetString("Close"));
62
// Set a variable on the opener window so we
63
// can track ownership of close this window with it
64
window.opener.InsertCharWindow = window;
65
window.sizeToContent();
72
// Insert the character
74
GetCurrentEditor().insertText(LatinM.label);
77
// Set persistent attributes to save
78
// which category, letter, and character modifier was used
79
CategoryGroup.setAttribute("category", category);
80
CategoryGroup.setAttribute("letter_index", indexL);
81
CategoryGroup.setAttribute("char_index", indexM);
83
// Don't close the dialog
87
// Don't allow inserting in HTML Source Mode
91
if ("gEditorDisplayMode" in window.opener)
92
enable = !window.opener.IsInHTMLSourceMode();
94
SetElementEnabled(document.documentElement.getButton("accept"), enable);
99
window.opener.InsertCharWindow = null;
100
SaveWindowLocation();
104
//------------------------------------------------------------------
119
var initialize = true;
121
function StartupLatin()
124
LatinL = document.getElementById("LatinL");
125
LatinM = document.getElementById("LatinM");
126
LatinL_Label = document.getElementById("LatinL_Label");
127
LatinM_Label = document.getElementById("LatinM_Label");
129
var Symbol = document.getElementById("Symbol");
130
var AccentUpper = document.getElementById("AccentUpper");
131
var AccentLower = document.getElementById("AccentLower");
132
var Upper = document.getElementById("Upper");
133
var Lower = document.getElementById("Lower");
134
CategoryGroup = document.getElementById("CatGrp");
136
// Initialize which radio button is set from persistent attribute...
137
var category = CategoryGroup.getAttribute("category");
139
// ...as well as indexes into the letter and character lists
140
var index = Number(CategoryGroup.getAttribute("letter_index"));
141
if (index && index >= 0)
143
index = Number(CategoryGroup.getAttribute("char_index"));
144
if (index && index >= 0)
150
case "AccentUpper": // Uppercase Diacritical
151
CategoryGroup.selectedItem = AccentUpper;
154
case "AccentLower": // Lowercase Diacritical
155
CategoryGroup.selectedItem = AccentLower;
158
case "Upper": // Uppercase w/o Diacritical
159
CategoryGroup.selectedItem = Upper;
162
case "Lower": // Lowercase w/o Diacritical
163
CategoryGroup.selectedItem = Lower;
168
CategoryGroup.selectedItem = Symbol;
173
ChangeCategory(category);
177
function ChangeCategory(newCategory)
179
if (category != newCategory || initialize)
181
category = newCategory;
182
// Note: Must do L before M to set LatinL.selectedIndex
189
function SelectLatinLetter()
191
if(LatinL.selectedIndex != indexL )
193
indexL = LatinL.selectedIndex;
199
function SelectLatinModifier()
201
if(LatinM.selectedIndex != indexM )
203
indexM = LatinM.selectedIndex;
207
function DisableLatinL(disable)
210
LatinL_Label.setAttribute("disabled", "true");
211
LatinL.setAttribute("disabled", "true");
213
LatinL_Label.removeAttribute("disabled");
214
LatinL.removeAttribute("disabled");
218
function UpdateLatinL()
220
LatinL.removeAllItems();
221
if (category == "AccentUpper" || category == "AccentLower")
223
DisableLatinL(false);
225
var alphabet = category == "AccentUpper" ? "ABCDEFGHIJKLMNOPRSTUVWXYZ" : "abcdefghijklmnoprstuvwxyz";
226
for (var letter = 0; letter < alphabet.length; letter++)
227
LatinL.appendItem(alphabet.charAt(letter));
229
LatinL.selectedIndex = indexL;
233
// Other categories don't hinge on a "letter"
235
// Note: don't change the indexL so it can be used next time
239
function UpdateLatinM()
241
LatinM.removeAllItems();
245
case "AccentUpper": // Uppercase Diacritical
246
accent = upper[indexL];
247
for(i=0; i < accent.length; i++)
248
LatinM.appendItem(accent.charAt(i));
250
if(indexM_AU < accent.length)
253
indexM = accent.length - 1;
257
case "AccentLower": // Lowercase Diacritical
258
accent = lower[indexL];
259
for(i=0; i < accent.length; i++)
260
LatinM.appendItem(accent.charAt(i));
262
if(indexM_AL < accent.length)
265
indexM = lower[indexL].length - 1;
269
case "Upper": // Uppercase w/o Diacritical
270
for(i=0; i < otherupper.length; i++)
271
LatinM.appendItem(otherupper.charAt(i));
273
if(indexM_U < otherupper.length)
276
indexM = otherupper.length - 1;
280
case "Lower": // Lowercase w/o Diacritical
281
for(i=0; i < otherlower.length; i++)
282
LatinM.appendItem(otherlower.charAt(i));
284
if(indexM_L < otherlower.length)
287
indexM = otherlower.length - 1;
291
case "Symbol": // Symbol
292
for(i=0; i < symbol.length; i++)
293
LatinM.appendItem(symbol.charAt(i));
295
if(indexM_S < symbol.length)
298
indexM = symbol.length - 1;
302
LatinM.selectedIndex = indexM;
305
function UpdateCharacter()
307
indexM = LatinM.selectedIndex;
311
case "AccentUpper": // Uppercase Diacritical
314
case "AccentLower": // Lowercase Diacritical
317
case "Upper": // Uppercase w/o Diacritical
320
case "Lower": // Lowercase w/o Diacritical
327
//dump("Letter Index="+indexL+", Character Index="+indexM+", Character = "+LatinM.label+"\n");
332
"\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u0100\u0102\u0104\u01cd\u01de\u01de\u01e0\u01fa\u0200\u0202\u0226\u1e00\u1ea0\u1ea2\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6",
334
"\u0181\u0182\u0184\u1e02\u1e04\u1e06",
336
"\u00c7\u0106\u0108\u010a\u010c\u0187\u1e08",
338
"\u010e\u0110\u0189\u018a\u1e0a\u1e0c\u1e0e\u1e10\u1e12",
340
"\u00C8\u00C9\u00CA\u00CB\u0112\u0114\u0116\u0118\u011A\u0204\u0206\u0228\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6",
344
"\u011c\u011E\u0120\u0122\u01e4\u01e6\u01f4\u1e20",
346
"\u0124\u0126\u021e\u1e22\u1e24\u1e26\u1e28\u1e2a",
348
"\u00CC\u00CD\u00CE\u00CF\u0128\u012a\u012C\u012e\u0130\u0208\u020a\u1e2c\u1e2e\u1ec8\u1eca",
352
"\u0136\u0198\u01e8\u1e30\u1e32\u1e34",
354
"\u0139\u013B\u013D\u013F\u0141\u1e36\u1e38\u1e3a\u1e3c",
356
"\u1e3e\u1e40\u1e42",
358
"\u00D1\u0143\u0145\u0147\u014A\u01F8\u1e44\u1e46\u1e48\u1e4a",
360
"\u00D2\u00D3\u00D4\u00D5\u00D6\u014C\u014E\u0150\u01ea\u01ec\u020c\u020e\u022A\u022C\u022E\u0230\u1e4c\u1e4e\u1e50\u1e52\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede\u1ee0\u1ee2",
365
"\u0154\u0156\u0158\u0210\u0212\u1e58\u1e5a\u1e5c\u1e5e",
367
"\u015A\u015C\u015E\u0160\u0218\u1e60\u1e62\u1e64\u1e66\u1e68",
369
"\u0162\u0164\u0166\u021A\u1e6a\u1e6c\u1e6e\u1e70",
371
"\u00D9\u00DA\u00DB\u00DC\u0168\u016A\u016C\u016E\u0170\u0172\u0214\u0216\u1e72\u1e74\u1e76\u1e78\u1e7a\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0",
375
"\u0174\u1e80\u1e82\u1e84\u1e86\u1e88",
379
"\u00DD\u0176\u0178\u0232\u1e8e\u1ef2\u1ef4\u1ef6\u1ef8",
381
"\u0179\u017B\u017D\u0224\u1e90\u1e92\u1e94"
386
"\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u0101\u0103\u0105\u01ce\u01df\u01e1\u01fb\u0201\u0203\u0227\u1e01\u1e9a\u1ea1\u1ea3\u1ea5\u1ea7\u1ea9\u1eab\u1ead\u1eaf\u1eb1\u1eb3\u1eb5\u1eb7",
388
"\u0180\u0183\u0185\u1e03\u1e05\u1e07",
390
"\u00e7\u0107\u0109\u010b\u010d\u0188\u1e09",
392
"\u010f\u0111\u1e0b\u1e0d\u1e0f\u1e11\u1e13",
394
"\u00e8\u00e9\u00ea\u00eb\u0113\u0115\u0117\u0119\u011b\u0205\u0207\u0229\u1e15\u1e17\u1e19\u1e1b\u1e1d\u1eb9\u1ebb\u1ebd\u1ebf\u1ec1\u1ec3\u1ec5\u1ec7",
398
"\u011d\u011f\u0121\u0123\u01e5\u01e7\u01f5\u1e21",
400
"\u0125\u0127\u021f\u1e23\u1e25\u1e27\u1e29\u1e2b\u1e96",
402
"\u00ec\u00ed\u00ee\u00ef\u0129\u012b\u012d\u012f\u0131\u01d0\u0209\u020b\u1e2d\u1e2f\u1ec9\u1ecb",
406
"\u0137\u0138\u01e9\u1e31\u1e33\u1e35",
408
"\u013a\u013c\u013e\u0140\u0142\u1e37\u1e39\u1e3b\u1e3d",
410
"\u1e3f\u1e41\u1e43",
412
"\u00f1\u0144\u0146\u0148\u0149\u014b\u01f9\u1e45\u1e47\u1e49\u1e4b",
414
"\u00f2\u00f3\u00f4\u00f5\u00f6\u014d\u014f\u0151\u01d2\u01eb\u01ed\u020d\u020e\u022b\u22d\u022f\u0231\u1e4d\u1e4f\u1e51\u1e53\u1ecd\u1ecf\u1ed1\u1ed3\u1ed5\u1ed7\u1ed9\u1edb\u1edd\u1edf\u1ee1\u1ee3",
419
"\u0155\u0157\u0159\u0211\u0213\u1e59\u1e5b\u1e5d\u1e5f",
421
"\u015b\u015d\u015f\u0161\u0219\u1e61\u1e63\u1e65\u1e67\u1e69",
423
"\u0162\u0163\u0165\u0167\u021b\u1e6b\u1e6d\u1e6f\u1e71\u1e97",
425
"\u00f9\u00fa\u00fb\u00fc\u0169\u016b\u016d\u016f\u0171\u0173\u01d4\u01d6\u01d8\u01da\u01dc\u0215\u0217\u1e73\u1e75\u1e77\u1e79\u1e7b\u1ee5\u1ee7\u1ee9\u1eeb\u1eed\u1eef\u1ef1",
429
"\u0175\u1e81\u1e83\u1e85\u1e87\u1e89\u1e98",
433
"\u00fd\u00ff\u0177\u0233\u1e8f\u1e99\u1ef3\u1ef5\u1ef7\u1ef9",
435
"\u017a\u017c\u017e\u0225\u1e91\u1e93\u1e95"
439
const symbol = "\u00a1\u00a2\u00a3\u00a4\u00a5\u20ac\u00a6\u00a7\u00a8\u00a9\u2122\u00aa\u00ab\u00ac\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00d7\u00f7";
441
const otherupper = "\u00c6\u00d0\u00d8\u00de\u0132\u0152\u0186\u01c4\u01c5\u01c7\u01c8\u01ca\u01cb\u01F1\u01f2";
443
const otherlower = "\u00e6\u00f0\u00f8\u00fe\u00df\u0133\u0153\u01c6\u01c9\u01cc\u01f3";