PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/editors/tiny_mce_3_4_3_1/themes/advanced/js/charmap.js

#
JavaScript | 355 lines | 318 code | 19 blank | 18 comment | 9 complexity | 45fb124d08a1556ead4e1a845f79b2a6 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. /**
  2. * charmap.js
  3. *
  4. * Copyright 2009, Moxiecode Systems AB
  5. * Released under LGPL License.
  6. *
  7. * License: http://tinymce.moxiecode.com/license
  8. * Contributing: http://tinymce.moxiecode.com/contributing
  9. */
  10. tinyMCEPopup.requireLangPack();
  11. var charmap = [
  12. [' ', ' ', true, 'no-break space'],
  13. ['&', '&', true, 'ampersand'],
  14. ['"', '"', true, 'quotation mark'],
  15. // finance
  16. ['¢', '¢', true, 'cent sign'],
  17. ['€', '€', true, 'euro sign'],
  18. ['£', '£', true, 'pound sign'],
  19. ['¥', '¥', true, 'yen sign'],
  20. // signs
  21. ['©', '©', true, 'copyright sign'],
  22. ['®', '®', true, 'registered sign'],
  23. ['™', '™', true, 'trade mark sign'],
  24. ['‰', '‰', true, 'per mille sign'],
  25. ['µ', 'µ', true, 'micro sign'],
  26. ['·', '·', true, 'middle dot'],
  27. ['•', '•', true, 'bullet'],
  28. ['…', '…', true, 'three dot leader'],
  29. ['′', '′', true, 'minutes / feet'],
  30. ['″', '″', true, 'seconds / inches'],
  31. ['§', '§', true, 'section sign'],
  32. ['¶', '¶', true, 'paragraph sign'],
  33. ['ß', 'ß', true, 'sharp s / ess-zed'],
  34. // quotations
  35. ['‹', '‹', true, 'single left-pointing angle quotation mark'],
  36. ['›', '›', true, 'single right-pointing angle quotation mark'],
  37. ['«', '«', true, 'left pointing guillemet'],
  38. ['»', '»', true, 'right pointing guillemet'],
  39. ['‘', '‘', true, 'left single quotation mark'],
  40. ['’', '’', true, 'right single quotation mark'],
  41. ['“', '“', true, 'left double quotation mark'],
  42. ['”', '”', true, 'right double quotation mark'],
  43. ['‚', '‚', true, 'single low-9 quotation mark'],
  44. ['„', '„', true, 'double low-9 quotation mark'],
  45. ['<', '<', true, 'less-than sign'],
  46. ['>', '>', true, 'greater-than sign'],
  47. ['≤', '≤', true, 'less-than or equal to'],
  48. ['≥', '≥', true, 'greater-than or equal to'],
  49. ['–', '–', true, 'en dash'],
  50. ['—', '—', true, 'em dash'],
  51. ['¯', '¯', true, 'macron'],
  52. ['‾', '‾', true, 'overline'],
  53. ['¤', '¤', true, 'currency sign'],
  54. ['¦', '¦', true, 'broken bar'],
  55. ['¨', '¨', true, 'diaeresis'],
  56. ['¡', '¡', true, 'inverted exclamation mark'],
  57. ['¿', '¿', true, 'turned question mark'],
  58. ['ˆ', 'ˆ', true, 'circumflex accent'],
  59. ['˜', '˜', true, 'small tilde'],
  60. ['°', '°', true, 'degree sign'],
  61. ['−', '−', true, 'minus sign'],
  62. ['±', '±', true, 'plus-minus sign'],
  63. ['÷', '÷', true, 'division sign'],
  64. ['⁄', '⁄', true, 'fraction slash'],
  65. ['×', '×', true, 'multiplication sign'],
  66. ['¹', '¹', true, 'superscript one'],
  67. ['²', '²', true, 'superscript two'],
  68. ['³', '³', true, 'superscript three'],
  69. ['¼', '¼', true, 'fraction one quarter'],
  70. ['½', '½', true, 'fraction one half'],
  71. ['¾', '¾', true, 'fraction three quarters'],
  72. // math / logical
  73. ['ƒ', 'ƒ', true, 'function / florin'],
  74. ['∫', '∫', true, 'integral'],
  75. ['∑', '∑', true, 'n-ary sumation'],
  76. ['∞', '∞', true, 'infinity'],
  77. ['√', '√', true, 'square root'],
  78. ['∼', '∼', false,'similar to'],
  79. ['≅', '≅', false,'approximately equal to'],
  80. ['≈', '≈', true, 'almost equal to'],
  81. ['≠', '≠', true, 'not equal to'],
  82. ['≡', '≡', true, 'identical to'],
  83. ['∈', '∈', false,'element of'],
  84. ['∉', '∉', false,'not an element of'],
  85. ['∋', '∋', false,'contains as member'],
  86. ['∏', '∏', true, 'n-ary product'],
  87. ['∧', '∧', false,'logical and'],
  88. ['∨', '∨', false,'logical or'],
  89. ['¬', '¬', true, 'not sign'],
  90. ['∩', '∩', true, 'intersection'],
  91. ['∪', '∪', false,'union'],
  92. ['∂', '∂', true, 'partial differential'],
  93. ['∀', '∀', false,'for all'],
  94. ['∃', '∃', false,'there exists'],
  95. ['∅', '∅', false,'diameter'],
  96. ['∇', '∇', false,'backward difference'],
  97. ['∗', '∗', false,'asterisk operator'],
  98. ['∝', '∝', false,'proportional to'],
  99. ['∠', '∠', false,'angle'],
  100. // undefined
  101. ['´', '´', true, 'acute accent'],
  102. ['¸', '¸', true, 'cedilla'],
  103. ['ª', 'ª', true, 'feminine ordinal indicator'],
  104. ['º', 'º', true, 'masculine ordinal indicator'],
  105. ['†', '†', true, 'dagger'],
  106. ['‡', '‡', true, 'double dagger'],
  107. // alphabetical special chars
  108. ['À', 'À', true, 'A - grave'],
  109. ['Á', 'Á', true, 'A - acute'],
  110. ['Â', 'Â', true, 'A - circumflex'],
  111. ['Ã', 'Ã', true, 'A - tilde'],
  112. ['Ä', 'Ä', true, 'A - diaeresis'],
  113. ['Å', 'Å', true, 'A - ring above'],
  114. ['Æ', 'Æ', true, 'ligature AE'],
  115. ['Ç', 'Ç', true, 'C - cedilla'],
  116. ['È', 'È', true, 'E - grave'],
  117. ['É', 'É', true, 'E - acute'],
  118. ['Ê', 'Ê', true, 'E - circumflex'],
  119. ['Ë', 'Ë', true, 'E - diaeresis'],
  120. ['Ì', 'Ì', true, 'I - grave'],
  121. ['Í', 'Í', true, 'I - acute'],
  122. ['Î', 'Î', true, 'I - circumflex'],
  123. ['Ï', 'Ï', true, 'I - diaeresis'],
  124. ['Ð', 'Ð', true, 'ETH'],
  125. ['Ñ', 'Ñ', true, 'N - tilde'],
  126. ['Ò', 'Ò', true, 'O - grave'],
  127. ['Ó', 'Ó', true, 'O - acute'],
  128. ['Ô', 'Ô', true, 'O - circumflex'],
  129. ['Õ', 'Õ', true, 'O - tilde'],
  130. ['Ö', 'Ö', true, 'O - diaeresis'],
  131. ['Ø', 'Ø', true, 'O - slash'],
  132. ['Œ', 'Œ', true, 'ligature OE'],
  133. ['Š', 'Š', true, 'S - caron'],
  134. ['Ù', 'Ù', true, 'U - grave'],
  135. ['Ú', 'Ú', true, 'U - acute'],
  136. ['Û', 'Û', true, 'U - circumflex'],
  137. ['Ü', 'Ü', true, 'U - diaeresis'],
  138. ['Ý', 'Ý', true, 'Y - acute'],
  139. ['Ÿ', 'Ÿ', true, 'Y - diaeresis'],
  140. ['Þ', 'Þ', true, 'THORN'],
  141. ['à', 'à', true, 'a - grave'],
  142. ['á', 'á', true, 'a - acute'],
  143. ['â', 'â', true, 'a - circumflex'],
  144. ['ã', 'ã', true, 'a - tilde'],
  145. ['ä', 'ä', true, 'a - diaeresis'],
  146. ['å', 'å', true, 'a - ring above'],
  147. ['æ', 'æ', true, 'ligature ae'],
  148. ['ç', 'ç', true, 'c - cedilla'],
  149. ['è', 'è', true, 'e - grave'],
  150. ['é', 'é', true, 'e - acute'],
  151. ['ê', 'ê', true, 'e - circumflex'],
  152. ['ë', 'ë', true, 'e - diaeresis'],
  153. ['ì', 'ì', true, 'i - grave'],
  154. ['í', 'í', true, 'i - acute'],
  155. ['î', 'î', true, 'i - circumflex'],
  156. ['ï', 'ï', true, 'i - diaeresis'],
  157. ['ð', 'ð', true, 'eth'],
  158. ['ñ', 'ñ', true, 'n - tilde'],
  159. ['ò', 'ò', true, 'o - grave'],
  160. ['ó', 'ó', true, 'o - acute'],
  161. ['ô', 'ô', true, 'o - circumflex'],
  162. ['õ', 'õ', true, 'o - tilde'],
  163. ['ö', 'ö', true, 'o - diaeresis'],
  164. ['ø', 'ø', true, 'o slash'],
  165. ['œ', 'œ', true, 'ligature oe'],
  166. ['š', 'š', true, 's - caron'],
  167. ['ù', 'ù', true, 'u - grave'],
  168. ['ú', 'ú', true, 'u - acute'],
  169. ['û', 'û', true, 'u - circumflex'],
  170. ['ü', 'ü', true, 'u - diaeresis'],
  171. ['ý', 'ý', true, 'y - acute'],
  172. ['þ', 'þ', true, 'thorn'],
  173. ['ÿ', 'ÿ', true, 'y - diaeresis'],
  174. ['Α', 'Α', true, 'Alpha'],
  175. ['Β', 'Β', true, 'Beta'],
  176. ['Γ', 'Γ', true, 'Gamma'],
  177. ['Δ', 'Δ', true, 'Delta'],
  178. ['Ε', 'Ε', true, 'Epsilon'],
  179. ['Ζ', 'Ζ', true, 'Zeta'],
  180. ['Η', 'Η', true, 'Eta'],
  181. ['Θ', 'Θ', true, 'Theta'],
  182. ['Ι', 'Ι', true, 'Iota'],
  183. ['Κ', 'Κ', true, 'Kappa'],
  184. ['Λ', 'Λ', true, 'Lambda'],
  185. ['Μ', 'Μ', true, 'Mu'],
  186. ['Ν', 'Ν', true, 'Nu'],
  187. ['Ξ', 'Ξ', true, 'Xi'],
  188. ['Ο', 'Ο', true, 'Omicron'],
  189. ['Π', 'Π', true, 'Pi'],
  190. ['Ρ', 'Ρ', true, 'Rho'],
  191. ['Σ', 'Σ', true, 'Sigma'],
  192. ['Τ', 'Τ', true, 'Tau'],
  193. ['Υ', 'Υ', true, 'Upsilon'],
  194. ['Φ', 'Φ', true, 'Phi'],
  195. ['Χ', 'Χ', true, 'Chi'],
  196. ['Ψ', 'Ψ', true, 'Psi'],
  197. ['Ω', 'Ω', true, 'Omega'],
  198. ['α', 'α', true, 'alpha'],
  199. ['β', 'β', true, 'beta'],
  200. ['γ', 'γ', true, 'gamma'],
  201. ['δ', 'δ', true, 'delta'],
  202. ['ε', 'ε', true, 'epsilon'],
  203. ['ζ', 'ζ', true, 'zeta'],
  204. ['η', 'η', true, 'eta'],
  205. ['θ', 'θ', true, 'theta'],
  206. ['ι', 'ι', true, 'iota'],
  207. ['κ', 'κ', true, 'kappa'],
  208. ['λ', 'λ', true, 'lambda'],
  209. ['μ', 'μ', true, 'mu'],
  210. ['ν', 'ν', true, 'nu'],
  211. ['ξ', 'ξ', true, 'xi'],
  212. ['ο', 'ο', true, 'omicron'],
  213. ['π', 'π', true, 'pi'],
  214. ['ρ', 'ρ', true, 'rho'],
  215. ['ς', 'ς', true, 'final sigma'],
  216. ['σ', 'σ', true, 'sigma'],
  217. ['τ', 'τ', true, 'tau'],
  218. ['υ', 'υ', true, 'upsilon'],
  219. ['φ', 'φ', true, 'phi'],
  220. ['χ', 'χ', true, 'chi'],
  221. ['ψ', 'ψ', true, 'psi'],
  222. ['ω', 'ω', true, 'omega'],
  223. // symbols
  224. ['ℵ', 'ℵ', false,'alef symbol'],
  225. ['ϖ', 'ϖ', false,'pi symbol'],
  226. ['ℜ', 'ℜ', false,'real part symbol'],
  227. ['ϑ','ϑ', false,'theta symbol'],
  228. ['ϒ', 'ϒ', false,'upsilon - hook symbol'],
  229. ['℘', '℘', false,'Weierstrass p'],
  230. ['ℑ', 'ℑ', false,'imaginary part'],
  231. // arrows
  232. ['←', '←', true, 'leftwards arrow'],
  233. ['↑', '↑', true, 'upwards arrow'],
  234. ['→', '→', true, 'rightwards arrow'],
  235. ['↓', '↓', true, 'downwards arrow'],
  236. ['↔', '↔', true, 'left right arrow'],
  237. ['↵', '↵', false,'carriage return'],
  238. ['⇐', '⇐', false,'leftwards double arrow'],
  239. ['⇑', '⇑', false,'upwards double arrow'],
  240. ['⇒', '⇒', false,'rightwards double arrow'],
  241. ['⇓', '⇓', false,'downwards double arrow'],
  242. ['⇔', '⇔', false,'left right double arrow'],
  243. ['∴', '∴', false,'therefore'],
  244. ['⊂', '⊂', false,'subset of'],
  245. ['⊃', '⊃', false,'superset of'],
  246. ['⊄', '⊄', false,'not a subset of'],
  247. ['⊆', '⊆', false,'subset of or equal to'],
  248. ['⊇', '⊇', false,'superset of or equal to'],
  249. ['⊕', '⊕', false,'circled plus'],
  250. ['⊗', '⊗', false,'circled times'],
  251. ['⊥', '⊥', false,'perpendicular'],
  252. ['⋅', '⋅', false,'dot operator'],
  253. ['⌈', '⌈', false,'left ceiling'],
  254. ['⌉', '⌉', false,'right ceiling'],
  255. ['⌊', '⌊', false,'left floor'],
  256. ['⌋', '⌋', false,'right floor'],
  257. ['⟨', '〈', false,'left-pointing angle bracket'],
  258. ['⟩', '〉', false,'right-pointing angle bracket'],
  259. ['◊', '◊', true, 'lozenge'],
  260. ['♠', '♠', true, 'black spade suit'],
  261. ['♣', '♣', true, 'black club suit'],
  262. ['♥', '♥', true, 'black heart suit'],
  263. ['♦', '♦', true, 'black diamond suit'],
  264. [' ', ' ', false,'en space'],
  265. [' ', ' ', false,'em space'],
  266. [' ', ' ', false,'thin space'],
  267. ['‌', '‌', false,'zero width non-joiner'],
  268. ['‍', '‍', false,'zero width joiner'],
  269. ['‎', '‎', false,'left-to-right mark'],
  270. ['‏', '‏', false,'right-to-left mark'],
  271. ['­', '­', false,'soft hyphen']
  272. ];
  273. tinyMCEPopup.onInit.add(function() {
  274. tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
  275. addKeyboardNavigation();
  276. });
  277. function addKeyboardNavigation(){
  278. var tableElm, cells, settings;
  279. cells = tinyMCEPopup.dom.select(".charmaplink", "charmapgroup");
  280. settings ={
  281. root: "charmapgroup",
  282. items: cells
  283. };
  284. tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);
  285. }
  286. function renderCharMapHTML() {
  287. var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
  288. var html = '<div id="charmapgroup" aria-labelledby="charmap_label" tabindex="0" role="listbox">'+
  289. '<table role="presentation" border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) +
  290. '"><tr height="' + tdHeight + '">';
  291. var cols=-1;
  292. for (i=0; i<charmap.length; i++) {
  293. var previewCharFn;
  294. if (charmap[i][2]==true) {
  295. cols++;
  296. previewCharFn = 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');';
  297. html += ''
  298. + '<td class="charmap">'
  299. + '<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] + '">'
  300. + charmap[i][1]
  301. + '</a></td>';
  302. if ((cols+1) % charsPerRow == 0)
  303. html += '</tr><tr height="' + tdHeight + '">';
  304. }
  305. }
  306. if (cols % charsPerRow > 0) {
  307. var padd = charsPerRow - (cols % charsPerRow);
  308. for (var i=0; i<padd-1; i++)
  309. html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap">&nbsp;</td>';
  310. }
  311. html += '</tr></table></div>';
  312. html = html.replace(/<tr height="20"><\/tr>/g, '');
  313. return html;
  314. }
  315. function insertChar(chr) {
  316. tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';');
  317. // Refocus in window
  318. if (tinyMCEPopup.isWindow)
  319. window.focus();
  320. tinyMCEPopup.editor.focus();
  321. tinyMCEPopup.close();
  322. }
  323. function previewChar(codeA, codeB, codeN) {
  324. var elmA = document.getElementById('codeA');
  325. var elmB = document.getElementById('codeB');
  326. var elmV = document.getElementById('codeV');
  327. var elmN = document.getElementById('codeN');
  328. if (codeA=='#160;') {
  329. elmV.innerHTML = '__';
  330. } else {
  331. elmV.innerHTML = '&' + codeA;
  332. }
  333. elmB.innerHTML = '&amp;' + codeA;
  334. elmA.innerHTML = '&amp;' + codeB;
  335. elmN.innerHTML = codeN;
  336. }