[ Index ] |
|
Code source de FCKeditor 2.4 |
1 /* 2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 3 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 4 * 5 * == BEGIN LICENSE == 6 * 7 * Licensed under the terms of any of the following licenses at your 8 * choice: 9 * 10 * - GNU General Public License Version 2 or later (the "GPL") 11 * http://www.gnu.org/licenses/gpl.html 12 * 13 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 14 * http://www.gnu.org/licenses/lgpl.html 15 * 16 * - Mozilla Public License Version 1.1 or later (the "MPL") 17 * http://www.mozilla.org/MPL/MPL-1.1.html 18 * 19 * == END LICENSE == 20 * 21 * File Name: fckregexlib.js 22 * These are some Regular Expresions used by the editor. 23 * 24 * File Authors: 25 * Frederico Caldeira Knabben (www.fckeditor.net) 26 * Alfonso Martinez de Lizarrondo - Uritec (alfonso at uritec dot net) 27 */ 28 29 var FCKRegexLib = 30 { 31 // This is the Regular expression used by the SetHTML method for the "'" entity. 32 AposEntity : /'/gi , 33 34 // Used by the Styles combo to identify styles that can't be applied to text. 35 ObjectElements : /^(?:IMG|TABLE|TR|TD|TH|INPUT|SELECT|TEXTAREA|HR|OBJECT|A|UL|OL|LI)$/i , 36 37 // List all named commands (commands that can be interpreted by the browser "execCommand" method. 38 NamedCommands : /^(?:Cut|Copy|Paste|Print|SelectAll|RemoveFormat|Unlink|Undo|Redo|Bold|Italic|Underline|StrikeThrough|Subscript|Superscript|JustifyLeft|JustifyCenter|JustifyRight|JustifyFull|Outdent|Indent|InsertOrderedList|InsertUnorderedList|InsertHorizontalRule)$/i , 39 40 BodyContents : /([\s\S]*\<body[^\>]*\>)([\s\S]*)(\<\/body\>[\s\S]*)/i , 41 42 // Temporary text used to solve some browser specific limitations. 43 ToReplace : /___fcktoreplace:([\w]+)/ig , 44 45 // Get the META http-equiv attribute from the tag. 46 MetaHttpEquiv : /http-equiv\s*=\s*["']?([^"' ]+)/i , 47 48 HasBaseTag : /<base /i , 49 50 HtmlOpener : /<html\s?[^>]*>/i , 51 HeadOpener : /<head\s?[^>]*>/i , 52 HeadCloser : /<\/head\s*>/i , 53 54 // Temporary classes (Tables without border, Anchors with content) used in IE 55 FCK_Class : /(\s*FCK__[A-Za-z]*\s*)/ , 56 57 // Validate element names (it must be in lowercase). 58 ElementName : /(^[a-z_:][\w.\-:]*\w$)|(^[a-z_]$)/ , 59 60 // Used in conjuction with the FCKConfig.ForceSimpleAmpersand configuration option. 61 ForceSimpleAmpersand : /___FCKAmp___/g , 62 63 // Get the closing parts of the tags with no closing tags, like <br/>... gets the "/>" part. 64 SpaceNoClose : /\/>/g , 65 66 EmptyParagraph : /^<(p|div)>\s*<\/\1>$/i , 67 68 TagBody : /></ , 69 70 StrongOpener : /<STRONG([ \>])/gi , 71 StrongCloser : /<\/STRONG>/gi , 72 EmOpener : /<EM([ \>])/gi , 73 EmCloser : /<\/EM>/gi , 74 //AbbrOpener : /<ABBR([ \>])/gi , 75 //AbbrCloser : /<\/ABBR>/gi , 76 77 GeckoEntitiesMarker : /#\?-\:/g , 78 79 // We look for the "src" and href attribute with the " or ' or whithout one of 80 // them. We have to do all in one, otherwhise we will have problems with URLs 81 // like "thumbnail.php?src=someimage.jpg" (SF-BUG 1554141). 82 ProtectUrlsImg : /(?:(<img(?=\s).*?\ssrc=)("|')(.*?)\2)|(?:(<img\s.*?src=)([^"'][^ >]+))/gi , 83 ProtectUrlsA : /(?:(<a(?=\s).*?\shref=)("|')(.*?)\2)|(?:(<a\s.*?href=)([^"'][^ >]+))/gi , 84 85 Html4DocType : /HTML 4\.0 Transitional/i , 86 DocTypeTag : /<!DOCTYPE[^>]*>/i , 87 88 // These regex are used to save the original event attributes in the HTML. 89 TagsWithEvent : /<[^\>]+ on\w+[\s\r\n]*=[\s\r\n]*?('|")[\s\S]+?\>/g , 90 EventAttributes : /\s(on\w+)[\s\r\n]*=[\s\r\n]*?('|")([\s\S]*?)\2/g, 91 ProtectedEvents : /\s\w+_fckprotectedatt="([^"]+)"/g, 92 93 StyleProperties : /\S+\s*:/g 94 } ; 95 96 // Test have shown that check for the existence of a key in an object is the 97 // most efficient list entry check (10x faster that regex). Example: 98 // if ( FCKListsLib.<ListName>[key] != null ) 99 var FCKListsLib = 100 { 101 // We are not handling <ins> and <del> as block elements, for now. 102 BlockElements : { address:1,blockquote:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,noscript:1,ol:1,p:1,pre:1,script:1,table:1,ul:1 }, 103 104 // Block elements that may be filled with if empty. 105 NonEmptyBlockElements : { p:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,address:1,pre:1,ol:1,ul:1,li:1,td:1,th:1 }, 106 107 // Elements that may be considered the "Block boundary" in an element path. 108 PathBlockElements : { address:1,blockquote:1,div:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,ol:1,ul:1,li:1,dt:1,de:1 }, 109 110 // Inline elements which MUST have child nodes. 111 InlineChildReqElements : { abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strong:1,sub:1,sup:1,tt:1,'var':1 }, 112 113 // Elements marked as empty "Empty" in the XHTML DTD. 114 EmptyElements : { base:1,meta:1,link:1,hr:1,br:1,param:1,img:1,area:1,input:1 } 115 } ;
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:28:05 2007 | par Balluche grâce à PHPXref 0.7 |