mirror of
https://github.com/friendica/friendica
synced 2024-11-14 21:02:55 +00:00
363 lines
15 KiB
JavaScript
363 lines
15 KiB
JavaScript
/**
|
|
* 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'],
|
|
['♠', '♠', true, '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());
|
|
addKeyboardNavigation();
|
|
});
|
|
|
|
function addKeyboardNavigation(){
|
|
var tableElm, cells, settings;
|
|
|
|
cells = tinyMCEPopup.dom.select("a.charmaplink", "charmapgroup");
|
|
|
|
settings ={
|
|
root: "charmapgroup",
|
|
items: cells
|
|
};
|
|
cells[0].tabindex=0;
|
|
tinyMCEPopup.dom.addClass(cells[0], "mceFocus");
|
|
if (tinymce.isGecko) {
|
|
cells[0].focus();
|
|
} else {
|
|
setTimeout(function(){
|
|
cells[0].focus();
|
|
}, 100);
|
|
}
|
|
tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);
|
|
}
|
|
|
|
function renderCharMapHTML() {
|
|
var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
|
|
var html = '<div id="charmapgroup" aria-labelledby="charmap_label" tabindex="0" role="listbox">'+
|
|
'<table role="presentation" border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) +
|
|
'"><tr height="' + tdHeight + '">';
|
|
var cols=-1;
|
|
|
|
for (i=0; i<charmap.length; i++) {
|
|
var previewCharFn;
|
|
|
|
if (charmap[i][2]==true) {
|
|
cols++;
|
|
previewCharFn = 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');';
|
|
html += ''
|
|
+ '<td class="charmap">'
|
|
+ '<a class="charmaplink" role="button" onmouseover="'+previewCharFn+'" onfocus="'+previewCharFn+'" 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] + ' '+ tinyMCEPopup.editor.translate("advanced_dlg.charmap_usage")+'">'
|
|
+ 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"> </td>';
|
|
}
|
|
|
|
html += '</tr></table></div>';
|
|
html = html.replace(/<tr height="20"><\/tr>/g, '');
|
|
|
|
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 = '&' + codeA;
|
|
elmA.innerHTML = '&' + codeB;
|
|
elmN.innerHTML = codeN;
|
|
}
|