aboutsummaryrefslogtreecommitdiffstats
path: root/tinymce/jscripts/tiny_mce/themes/advanced/js/charmap.js
blob: 8c5aea1721f56c80391a174cbc1c719ef9d124a1 (plain) (blame)
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
/**
 * charmap.js
 *
 * Copyright 2009, Moxiecode Systems AB
 * Released under LGPL License.
 *
 * License: http://tinymce.moxiecode.com/license
 * Contributing: http://tinymce.moxiecode.com/contributing
 */

tinyMCEPopup.requireLangPack();

var charmap = [
	[' ',    ' ',  true, 'no-break space'],
	['&',     '&',   true, 'ampersand'],
	['"',    '"',   true, 'quotation mark'],
// finance
	['¢',    '¢',  true, 'cent sign'],
	['€',    '€', true, 'euro sign'],
	['£',   '£',  true, 'pound sign'],
	['¥',     '¥',  true, 'yen sign'],
// signs
	['©',    '©',  true, 'copyright sign'],
	['®',     '®',  true, 'registered sign'],
	['™',   '™', true, 'trade mark sign'],
	['‰',  '‰', true, 'per mille sign'],
	['µ',   'µ',  true, 'micro sign'],
	['·',  '·',  true, 'middle dot'],
	['•',    '•', true, 'bullet'],
	['…',  '…', true, 'three dot leader'],
	['′',   '′', true, 'minutes / feet'],
	['″',   '″', true, 'seconds / inches'],
	['§',    '§',  true, 'section sign'],
	['¶',    '¶',  true, 'paragraph sign'],
	['ß',   'ß',  true, 'sharp s / ess-zed'],
// quotations
	['‹',  '‹', true, 'single left-pointing angle quotation mark'],
	['›',  '›', true, 'single right-pointing angle quotation mark'],
	['«',   '«',  true, 'left pointing guillemet'],
	['»',   '»',  true, 'right pointing guillemet'],
	['‘',   '‘', true, 'left single quotation mark'],
	['’',   '’', true, 'right single quotation mark'],
	['“',   '“', true, 'left double quotation mark'],
	['”',   '”', true, 'right double quotation mark'],
	['‚',   '‚', true, 'single low-9 quotation mark'],
	['„',   '„', true, 'double low-9 quotation mark'],
	['<',      '<',   true, 'less-than sign'],
	['>',      '>',   true, 'greater-than sign'],
	['≤',      '≤', true, 'less-than or equal to'],
	['≥',      '≥', true, 'greater-than or equal to'],
	['–',   '–', true, 'en dash'],
	['—',   '—', true, 'em dash'],
	['¯',    '¯',  true, 'macron'],
	['‾',   '‾', true, 'overline'],
	['¤',  '¤',  true, 'currency sign'],
	['¦',  '¦',  true, 'broken bar'],
	['¨',     '¨',  true, 'diaeresis'],
	['¡',   '¡',  true, 'inverted exclamation mark'],
	['¿',  '¿',  true, 'turned question mark'],
	['ˆ',    'ˆ',  true, 'circumflex accent'],
	['˜',   '˜',  true, 'small tilde'],
	['°',     '°',  true, 'degree sign'],
	['−',   '−', true, 'minus sign'],
	['±',  '±',  true, 'plus-minus sign'],
	['÷',  '÷',  true, 'division sign'],
	['⁄',   '⁄', true, 'fraction slash'],
	['×',   '×',  true, 'multiplication sign'],
	['¹',    '¹',  true, 'superscript one'],
	['²',    '²',  true, 'superscript two'],
	['³',    '³',  true, 'superscript three'],
	['¼',  '¼',  true, 'fraction one quarter'],
	['½',  '½',  true, 'fraction one half'],
	['¾',  '¾',  true, 'fraction three quarters'],
// math / logical
	['ƒ',    'ƒ',  true, 'function / florin'],
	['∫',     '∫', true, 'integral'],
	['∑',     '∑', true, 'n-ary sumation'],
	['∞',   '∞', true, 'infinity'],
	['√',   '√', true, 'square root'],
	['∼',     '∼', false,'similar to'],
	['≅',    '≅', false,'approximately equal to'],
	['≈',   '≈', true, 'almost equal to'],
	['≠',      '≠', true, 'not equal to'],
	['≡',   '≡', true, 'identical to'],
	['∈',    '∈', false,'element of'],
	['∉',   '∉', false,'not an element of'],
	['∋',      '∋', false,'contains as member'],
	['∏',    '∏', true, 'n-ary product'],
	['∧',     '∧', false,'logical and'],
	['∨',      '∨', false,'logical or'],
	['¬',     '¬',  true, 'not sign'],
	['∩',     '∩', true, 'intersection'],
	['∪',     '∪', false,'union'],
	['∂',    '∂', true, 'partial differential'],
	['∀',  '∀', false,'for all'],
	['∃',   '∃', false,'there exists'],
	['∅',   '∅', false,'diameter'],
	['∇',   '∇', false,'backward difference'],
	['∗',  '∗', false,'asterisk operator'],
	['∝',    '∝', false,'proportional to'],
	['∠',     '∠', false,'angle'],
// undefined
	['´',   '´',  true, 'acute accent'],
	['¸',   '¸',  true, 'cedilla'],
	['ª',    'ª',  true, 'feminine ordinal indicator'],
	['º',    'º',  true, 'masculine ordinal indicator'],
	['†',  '†', true, 'dagger'],
	['‡',  '‡', true, 'double dagger'],
// alphabetical special chars
	['À',  'À',  true, 'A - grave'],
	['Á',  'Á',  true, 'A - acute'],
	['Â',   'Â',  true, 'A - circumflex'],
	['Ã',  'Ã',  true, 'A - tilde'],
	['Ä',    'Ä',  true, 'A - diaeresis'],
	['Å',   'Å',  true, 'A - ring above'],
	['Æ',   'Æ',  true, 'ligature AE'],
	['Ç',  'Ç',  true, 'C - cedilla'],
	['È',  'È',  true, 'E - grave'],
	['É',  'É',  true, 'E - acute'],
	['Ê',   'Ê',  true, 'E - circumflex'],
	['Ë',    'Ë',  true, 'E - diaeresis'],
	['Ì',  'Ì',  true, 'I - grave'],
	['Í',  'Í',  true, 'I - acute'],
	['Î',   'Î',  true, 'I - circumflex'],
	['Ï',    'Ï',  true, 'I - diaeresis'],
	['Ð',     'Ð',  true, 'ETH'],
	['Ñ',  'Ñ',  true, 'N - tilde'],
	['Ò',  'Ò',  true, 'O - grave'],
	['Ó',  'Ó',  true, 'O - acute'],
	['Ô',   'Ô',  true, 'O - circumflex'],
	['Õ',  'Õ',  true, 'O - tilde'],
	['Ö',    'Ö',  true, 'O - diaeresis'],
	['Ø',  'Ø',  true, 'O - slash'],
	['Œ',   'Œ',  true, 'ligature OE'],
	['Š',  'Š',  true, 'S - caron'],
	['Ù',  'Ù',  true, 'U - grave'],
	['Ú',  'Ú',  true, 'U - acute'],
	['Û',   'Û',  true, 'U - circumflex'],
	['Ü',    'Ü',  true, 'U - diaeresis'],
	['Ý',  'Ý',  true, 'Y - acute'],
	['Ÿ',    'Ÿ',  true, 'Y - diaeresis'],
	['Þ',   'Þ',  true, 'THORN'],
	['à',  'à',  true, 'a - grave'],
	['á',  'á',  true, 'a - acute'],
	['â',   'â',  true, 'a - circumflex'],
	['ã',  'ã',  true, 'a - tilde'],
	['ä',    'ä',  true, 'a - diaeresis'],
	['å',   'å',  true, 'a - ring above'],
	['æ',   'æ',  true, 'ligature ae'],
	['ç',  'ç',  true, 'c - cedilla'],
	['è',  'è',  true, 'e - grave'],
	['é',  'é',  true, 'e - acute'],
	['ê',   'ê',  true, 'e - circumflex'],
	['ë',    'ë',  true, 'e - diaeresis'],
	['ì',  'ì',  true, 'i - grave'],
	['í',  'í',  true, 'i - acute'],
	['î',   'î',  true, 'i - circumflex'],
	['ï',    'ï',  true, 'i - diaeresis'],
	['ð',     'ð',  true, 'eth'],
	['ñ',  'ñ',  true, 'n - tilde'],
	['ò',  'ò',  true, 'o - grave'],
	['ó',  'ó',  true, 'o - acute'],
	['ô',   'ô',  true, 'o - circumflex'],
	['õ',  'õ',  true, 'o - tilde'],
	['ö',    'ö',  true, 'o - diaeresis'],
	['ø',  'ø',  true, 'o slash'],
	['œ',   'œ',  true, 'ligature oe'],
	['š',  'š',  true, 's - caron'],
	['ù',  'ù',  true, 'u - grave'],
	['ú',  'ú',  true, 'u - acute'],
	['û',   'û',  true, 'u - circumflex'],
	['ü',    'ü',  true, 'u - diaeresis'],
	['ý',  'ý',  true, 'y - acute'],
	['þ',   'þ',  true, 'thorn'],
	['ÿ',    'ÿ',  true, 'y - diaeresis'],
    ['Α',   'Α',  true, 'Alpha'],
	['Β',    'Β',  true, 'Beta'],
	['Γ',   'Γ',  true, 'Gamma'],
	['Δ',   'Δ',  true, 'Delta'],
	['Ε', 'Ε',  true, 'Epsilon'],
	['Ζ',    'Ζ',  true, 'Zeta'],
	['Η',     'Η',  true, 'Eta'],
	['Θ',   'Θ',  true, 'Theta'],
	['Ι',    'Ι',  true, 'Iota'],
	['Κ',   'Κ',  true, 'Kappa'],
	['Λ',  'Λ',  true, 'Lambda'],
	['Μ',      'Μ',  true, 'Mu'],
	['Ν',      'Ν',  true, 'Nu'],
	['Ξ',      'Ξ',  true, 'Xi'],
	['Ο', 'Ο',  true, 'Omicron'],
	['Π',      'Π',  true, 'Pi'],
	['Ρ',     'Ρ',  true, 'Rho'],
	['Σ',   'Σ',  true, 'Sigma'],
	['Τ',     'Τ',  true, 'Tau'],
	['Υ', 'Υ',  true, 'Upsilon'],
	['Φ',     'Φ',  true, 'Phi'],
	['Χ',     'Χ',  true, 'Chi'],
	['Ψ',     'Ψ',  true, 'Psi'],
	['Ω',   'Ω',  true, 'Omega'],
	['α',   'α',  true, 'alpha'],
	['β',    'β',  true, 'beta'],
	['γ',   'γ',  true, 'gamma'],
	['δ',   'δ',  true, 'delta'],
	['ε', 'ε',  true, 'epsilon'],
	['ζ',    'ζ',  true, 'zeta'],
	['η',     'η',  true, 'eta'],
	['θ',   'θ',  true, 'theta'],
	['ι',    'ι',  true, 'iota'],
	['κ',   'κ',  true, 'kappa'],
	['λ',  'λ',  true, 'lambda'],
	['μ',      'μ',  true, 'mu'],
	['ν',      'ν',  true, 'nu'],
	['ξ',      'ξ',  true, 'xi'],
	['ο', 'ο',  true, 'omicron'],
	['π',      'π',  true, 'pi'],
	['ρ',     'ρ',  true, 'rho'],
	['ς',  'ς',  true, 'final sigma'],
	['σ',   'σ',  true, 'sigma'],
	['τ',     'τ',  true, 'tau'],
	['υ', 'υ',  true, 'upsilon'],
	['φ',     'φ',  true, 'phi'],
	['χ',     'χ',  true, 'chi'],
	['ψ',     'ψ',  true, 'psi'],
	['ω',   'ω',  true, 'omega'],
// symbols
	['ℵ', 'ℵ', false,'alef symbol'],
	['ϖ',     'ϖ',  false,'pi symbol'],
	['ℜ',    'ℜ', false,'real part symbol'],
	['ϑ','ϑ',  false,'theta symbol'],
	['ϒ',   'ϒ',  false,'upsilon - hook symbol'],
	['℘',  '℘', false,'Weierstrass p'],
	['ℑ',   'ℑ', false,'imaginary part'],
// arrows
	['←',    '←', true, 'leftwards arrow'],
	['↑',    '↑', true, 'upwards arrow'],
	['→',    '→', true, 'rightwards arrow'],
	['↓',    '↓', true, 'downwards arrow'],
	['↔',    '↔', true, 'left right arrow'],
	['↵',   '↵', false,'carriage return'],
	['⇐',    '⇐', false,'leftwards double arrow'],
	['⇑',    '⇑', false,'upwards double arrow'],
	['⇒',    '⇒', false,'rightwards double arrow'],
	['⇓',    '⇓', false,'downwards double arrow'],
	['⇔',    '⇔', false,'left right double arrow'],
	['∴',  '∴', false,'therefore'],
	['⊂',     '⊂', false,'subset of'],
	['⊃',     '⊃', false,'superset of'],
	['⊄',    '⊄', false,'not a subset of'],
	['⊆',    '⊆', false,'subset of or equal to'],
	['⊇',    '⊇', false,'superset of or equal to'],
	['⊕',   '⊕', false,'circled plus'],
	['⊗',  '⊗', false,'circled times'],
	['⊥',    '⊥', false,'perpendicular'],
	['⋅',    '⋅', false,'dot operator'],
	['⌈',   '⌈', false,'left ceiling'],
	['⌉',   '⌉', false,'right ceiling'],
	['⌊',  '⌊', false,'left floor'],
	['⌋',  '⌋', false,'right floor'],
	['⟨',    '〈', false,'left-pointing angle bracket'],
	['⟩',    '〉', false,'right-pointing angle bracket'],
	['◊',     '◊', true,'lozenge'],
	['♠',  '♠', false,'black spade suit'],
	['♣',   '♣', true, 'black club suit'],
	['♥',  '♥', true, 'black heart suit'],
	['♦',   '♦', true, 'black diamond suit'],
	[' ',    ' ', false,'en space'],
	[' ',    ' ', false,'em space'],
	[' ',  ' ', false,'thin space'],
	['‌',    '‌', false,'zero width non-joiner'],
	['‍',     '‍', false,'zero width joiner'],
	['‎',     '‎', false,'left-to-right mark'],
	['‏',     '‏', false,'right-to-left mark'],
	['­',     '­',  false,'soft hyphen']
];

tinyMCEPopup.onInit.add(function() {
	tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
});

function renderCharMapHTML() {
	var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
	var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">';
	var cols=-1;

	for (i=0; i<charmap.length; i++) {
		if (charmap[i][2]==true) {
			cols++;
			html += ''
				+ '<td class="charmap">'
				+ '<a onmouseover="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
				+ charmap[i][1]
				+ '</a></td>';
			if ((cols+1) % charsPerRow == 0)
				html += '</tr><tr height="' + tdHeight + '">';
		}
	 }

	if (cols % charsPerRow > 0) {
		var padd = charsPerRow - (cols % charsPerRow);
		for (var i=0; i<padd-1; i++)
			html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap">&nbsp;</td>';
	}

	html += '</tr></table>';

	return html;
}

function insertChar(chr) {
	tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';');

	// Refocus in window
	if (tinyMCEPopup.isWindow)
		window.focus();

	tinyMCEPopup.editor.focus();
	tinyMCEPopup.close();
}

function previewChar(codeA, codeB, codeN) {
	var elmA = document.getElementById('codeA');
	var elmB = document.getElementById('codeB');
	var elmV = document.getElementById('codeV');
	var elmN = document.getElementById('codeN');

	if (codeA=='#160;') {
		elmV.innerHTML = '__';
	} else {
		elmV.innerHTML = '&' + codeA;
	}

	elmB.innerHTML = '&amp;' + codeA;
	elmA.innerHTML = '&amp;' + codeB;
	elmN.innerHTML = codeN;
}