fckxhtmlentities.js
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:7k
源码类别:

OA系统

开发平台:

C#

  1. /*
  2.  * FCKeditor - The text editor for internet
  3.  * Copyright (C) 2003-2006 Frederico Caldeira Knabben
  4.  * 
  5.  * Licensed under the terms of the GNU Lesser General Public License:
  6.  *  http://www.opensource.org/licenses/lgpl-license.php
  7.  * 
  8.  * For further information visit:
  9.  *  http://www.fckeditor.net/
  10.  * 
  11.  * "Support Open Source software. What about a donation today?"
  12.  * 
  13.  * File Name: fckxhtmlentities.js
  14.  *  This file define the HTML entities handled by the editor.
  15.  * 
  16.  * File Authors:
  17.  *  Frederico Caldeira Knabben (fredck@fckeditor.net)
  18.  */
  19. var FCKXHtmlEntities = new Object() ;
  20. FCKXHtmlEntities.Initialize = function()
  21. {
  22. if ( FCKXHtmlEntities.Entities )
  23. return ;
  24. var sChars = '' ;
  25. if ( FCKConfig.ProcessHTMLEntities )
  26. {
  27. FCKXHtmlEntities.Entities = {
  28. // Latin-1 Entities
  29. ' ':'nbsp',
  30. '¡':'iexcl',
  31. '¢':'cent',
  32. '£':'pound',
  33. '¤':'curren',
  34. '¥':'yen',
  35. '¦':'brvbar',
  36. '§':'sect',
  37. '¨':'uml',
  38. '©':'copy',
  39. 'ª':'ordf',
  40. '«':'laquo',
  41. '¬':'not',
  42. '­':'shy',
  43. '®':'reg',
  44. '¯':'macr',
  45. '°':'deg',
  46. '±':'plusmn',
  47. '²':'sup2',
  48. '³':'sup3',
  49. '´':'acute',
  50. 'µ':'micro',
  51. '¶':'para',
  52. '·':'middot',
  53. '¸':'cedil',
  54. '¹':'sup1',
  55. 'º':'ordm',
  56. '»':'raquo',
  57. '¼':'frac14',
  58. '½':'frac12',
  59. '¾':'frac34',
  60. '¿':'iquest',
  61. '×':'times',
  62. '÷':'divide',
  63. // Symbols
  64. 'ƒ':'fnof',
  65. '•':'bull',
  66. '…':'hellip',
  67. '′':'prime',
  68. '″':'Prime',
  69. '‾':'oline',
  70. '⁄':'frasl',
  71. '℘':'weierp',
  72. 'ℑ':'image',
  73. 'ℜ':'real',
  74. '™':'trade',
  75. 'ℵ':'alefsym',
  76. '←':'larr',
  77. '↑':'uarr',
  78. '→':'rarr',
  79. '↓':'darr',
  80. '↔':'harr',
  81. '↵':'crarr',
  82. '⇐':'lArr',
  83. '⇑':'uArr',
  84. '⇒':'rArr',
  85. '⇓':'dArr',
  86. '⇔':'hArr',
  87. '∀':'forall',
  88. '∂':'part',
  89. '∃':'exist',
  90. '∅':'empty',
  91. '∇':'nabla',
  92. '∈':'isin',
  93. '∉':'notin',
  94. '∋':'ni',
  95. '∏':'prod',
  96. '∑':'sum',
  97. '−':'minus',
  98. '∗':'lowast',
  99. '√':'radic',
  100. '∝':'prop',
  101. '∞':'infin',
  102. '∠':'ang',
  103. '∧':'and',
  104. '∨':'or',
  105. '∩':'cap',
  106. '∪':'cup',
  107. '∫':'int',
  108. '∴':'there4',
  109. '∼':'sim',
  110. '≅':'cong',
  111. '≈':'asymp',
  112. '≠':'ne',
  113. '≡':'equiv',
  114. '≤':'le',
  115. '≥':'ge',
  116. '⊂':'sub',
  117. '⊃':'sup',
  118. '⊄':'nsub',
  119. '⊆':'sube',
  120. '⊇':'supe',
  121. '⊕':'oplus',
  122. '⊗':'otimes',
  123. '⊥':'perp',
  124. '⋅':'sdot',
  125. '◊':'loz',
  126. '♠':'spades',
  127. '♣':'clubs',
  128. '♥':'hearts',
  129. '♦':'diams',
  130. // Other Special Characters 
  131. '"':'quot',
  132. // '&':'amp', // This entity is automatically handled by the XHTML parser.
  133. // '<':'lt', // This entity is automatically handled by the XHTML parser.
  134. // '>':'gt', // This entity is automatically handled by the XHTML parser.
  135. 'ˆ':'circ',
  136. '˜':'tilde',
  137. ' ':'ensp',
  138. ' ':'emsp',
  139. ' ':'thinsp',
  140. '‌':'zwnj',
  141. '‍':'zwj',
  142. '‎':'lrm',
  143. '‏':'rlm',
  144. '–':'ndash',
  145. '—':'mdash',
  146. '‘':'lsquo',
  147. '’':'rsquo',
  148. '‚':'sbquo',
  149. '“':'ldquo',
  150. '”':'rdquo',
  151. '„':'bdquo',
  152. '†':'dagger',
  153. '‡':'Dagger',
  154. '‰':'permil',
  155. '‹':'lsaquo',
  156. '›':'rsaquo',
  157. '€':'euro'
  158. } ;
  159. // Process Base Entities.
  160. for ( var e in FCKXHtmlEntities.Entities )
  161. sChars += e ;
  162. // Include Latin Letters Entities.
  163. if ( FCKConfig.IncludeLatinEntities )
  164. {
  165. var oEntities = {
  166. 'À':'Agrave',
  167. 'Á':'Aacute',
  168. 'Â':'Acirc',
  169. 'Ã':'Atilde',
  170. 'Ä':'Auml',
  171. 'Å':'Aring',
  172. 'Æ':'AElig',
  173. 'Ç':'Ccedil',
  174. 'È':'Egrave',
  175. 'É':'Eacute',
  176. 'Ê':'Ecirc',
  177. 'Ë':'Euml',
  178. 'Ì':'Igrave',
  179. 'Í':'Iacute',
  180. 'Î':'Icirc',
  181. 'Ï':'Iuml',
  182. 'Ð':'ETH',
  183. 'Ñ':'Ntilde',
  184. 'Ò':'Ograve',
  185. 'Ó':'Oacute',
  186. 'Ô':'Ocirc',
  187. 'Õ':'Otilde',
  188. 'Ö':'Ouml',
  189. 'Ø':'Oslash',
  190. 'Ù':'Ugrave',
  191. 'Ú':'Uacute',
  192. 'Û':'Ucirc',
  193. 'Ü':'Uuml',
  194. 'Ý':'Yacute',
  195. 'Þ':'THORN',
  196. 'ß':'szlig',
  197. 'à':'agrave',
  198. 'á':'aacute',
  199. 'â':'acirc',
  200. 'ã':'atilde',
  201. 'ä':'auml',
  202. 'å':'aring',
  203. 'æ':'aelig',
  204. 'ç':'ccedil',
  205. 'è':'egrave',
  206. 'é':'eacute',
  207. 'ê':'ecirc',
  208. 'ë':'euml',
  209. 'ì':'igrave',
  210. 'í':'iacute',
  211. 'î':'icirc',
  212. 'ï':'iuml',
  213. 'ð':'eth',
  214. 'ñ':'ntilde',
  215. 'ò':'ograve',
  216. 'ó':'oacute',
  217. 'ô':'ocirc',
  218. 'õ':'otilde',
  219. 'ö':'ouml',
  220. 'ø':'oslash',
  221. 'ù':'ugrave',
  222. 'ú':'uacute',
  223. 'û':'ucirc',
  224. 'ü':'uuml',
  225. 'ý':'yacute',
  226. 'þ':'thorn',
  227. 'ÿ':'yuml',
  228. 'Œ':'OElig',
  229. 'œ':'oelig',
  230. 'Š':'Scaron',
  231. 'š':'scaron',
  232. 'Ÿ':'Yuml'
  233. } ; 
  234. for ( var e in oEntities )
  235. {
  236. FCKXHtmlEntities.Entities[ e ] = oEntities[ e ] ;
  237. sChars += e ;
  238. }
  239. oEntities = null ;
  240. }
  241. // Include Greek Letters Entities.
  242. if ( FCKConfig.IncludeGreekEntities )
  243. {
  244. var oEntities = {
  245. 'Α':'Alpha',
  246. 'Β':'Beta',
  247. 'Γ':'Gamma',
  248. 'Δ':'Delta',
  249. 'Ε':'Epsilon',
  250. 'Ζ':'Zeta',
  251. 'Η':'Eta',
  252. 'Θ':'Theta',
  253. 'Ι':'Iota',
  254. 'Κ':'Kappa',
  255. 'Λ':'Lambda',
  256. 'Μ':'Mu',
  257. 'Ν':'Nu',
  258. 'Ξ':'Xi',
  259. 'Ο':'Omicron',
  260. 'Π':'Pi',
  261. 'Ρ':'Rho',
  262. 'Σ':'Sigma',
  263. 'Τ':'Tau',
  264. 'Υ':'Upsilon',
  265. 'Φ':'Phi',
  266. 'Χ':'Chi',
  267. 'Ψ':'Psi',
  268. 'Ω':'Omega',
  269. 'α':'alpha',
  270. 'β':'beta',
  271. 'γ':'gamma',
  272. 'δ':'delta',
  273. 'ε':'epsilon',
  274. 'ζ':'zeta',
  275. 'η':'eta',
  276. 'θ':'theta',
  277. 'ι':'iota',
  278. 'κ':'kappa',
  279. 'λ':'lambda',
  280. 'μ':'mu',
  281. 'ν':'nu',
  282. 'ξ':'xi',
  283. 'ο':'omicron',
  284. 'π':'pi',
  285. 'ρ':'rho',
  286. 'ς':'sigmaf',
  287. 'σ':'sigma',
  288. 'τ':'tau',
  289. 'υ':'upsilon',
  290. 'φ':'phi',
  291. 'χ':'chi',
  292. 'ψ':'psi',
  293. 'ω':'omega'
  294. } ;
  295. for ( var e in oEntities )
  296. {
  297. FCKXHtmlEntities.Entities[ e ] = oEntities[ e ] ;
  298. sChars += e ;
  299. }
  300. oEntities = null ;
  301. }
  302. }
  303. else
  304. {
  305. FCKXHtmlEntities.Entities = {} ;
  306. // Even if we are not processing the entities, we must render the &nbsp;
  307. // correctly. As we don't want HTML entities, let's use its numeric
  308. // representation (&#160).
  309. sChars = ' ' ;
  310. }
  311. // Create the Regex used to find entities in the text.
  312. var sRegexPattern = '[' + sChars + ']' ;
  313. if ( FCKConfig.ProcessNumericEntities )
  314. sRegexPattern = '[^ -~]|' + sRegexPattern ;
  315. var sAdditional = FCKConfig.AdditionalNumericEntities ;
  316. if ( sAdditional || sAdditional.length > 0 )
  317. sRegexPattern += '|' + FCKConfig.AdditionalNumericEntities ;
  318. FCKXHtmlEntities.EntitiesRegex = new RegExp( sRegexPattern, 'g' ) ;
  319. }