Changeset 1541 for FCKeditor/trunk/editor/dialog/fck_replace.html
- Timestamp:
- 2008-02-18 04:14:39 (2 years ago)
- Files:
-
- 1 modified
-
FCKeditor/trunk/editor/dialog/fck_replace.html (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/trunk/editor/dialog/fck_replace.html
r1521 r1541 98 98 function btnStat() 99 99 { 100 document.getElementById('btnReplace').disabled =101 document.getElementById('btnReplaceAll').disabled =102 document.getElementById('btnFind').disabled =103 ( document.getElementById(idMap["FindText"]).value.length == 0 ) ;100 GetE('btnReplace').disabled = 101 GetE('btnReplaceAll').disabled = 102 GetE('btnFind').disabled = 103 ( GetE(idMap["FindText"]).value.length == 0 ) ; 104 104 } 105 105 … … 111 111 function GetSearchString() 112 112 { 113 return document.getElementById(idMap['FindText']).value ;113 return GetE(idMap['FindText']).value ; 114 114 } 115 115 116 116 function GetReplaceString() 117 117 { 118 return document.getElementById("txtReplace").value ;118 return GetE("txtReplace").value ; 119 119 } 120 120 121 121 function GetCheckCase() 122 122 { 123 return !! ( document.getElementById(idMap['CheckCase']).checked ) ;123 return !! ( GetE(idMap['CheckCase']).checked ) ; 124 124 } 125 125 126 126 function GetMatchWord() 127 127 { 128 return !! ( document.getElementById(idMap['CheckWord']).checked ) ;128 return !! ( GetE(idMap['CheckWord']).checked ) ; 129 129 } 130 130 … … 227 227 // Knuth-Morris-Pratt Algorithm for stream input 228 228 KMP_NOMATCH = 0 ; 229 KMP_ADVANCED = 1 ; 230 KMP_MATCHED = 2 ; 229 KMP_STARTED = 1 ; 230 KMP_ADVANCED = 2 ; 231 KMP_MATCHED = 3 ; 231 232 function KmpMatch( pattern, ignoreCase ) 232 233 { … … 263 264 return KMP_MATCHED; 264 265 } 265 return KMP_ADVANCED;266 return this._State > 1 ? KMP_ADVANCED : KMP_STARTED ; 266 267 } 267 268 else if ( this._State == 0 ) … … 307 308 matchState = matcher.FeedCharacter(data) ; 308 309 310 // No possible match of any useful substring in the pattern for the currently scanned character. 311 // So delete any positional information. 309 312 if ( matchState == KMP_NOMATCH ) 310 313 matchBookmark = null ; 311 else if ( matchState == KMP_ADVANCED && matchBookmark == null ) 314 // The currently scanned character is a possible start, so mark down the starting position. 315 else if ( matchState == KMP_STARTED ) 312 316 matchBookmark = { Start : cursor.concat( [] ) } ; 317 // Found a complete match! Mark down the ending position as well. 313 318 else if ( matchState == KMP_MATCHED ) 314 319 { 320 // It is possible to get a KMP_MATCHED without KMP_STARTED when the match pattern is only 1 character. 321 // So need to check and mark down the starting position as well. 315 322 if ( matchBookmark == null ) 316 323 matchBookmark = { Start : cursor.concat( [] ) } ; 324 317 325 matchBookmark.End = cursor.concat( [] ) ; 318 326 matchBookmark.End[ matchBookmark.End.length - 1 ]++; 319 327 320 328 // Wait, do we have to match a whole word? 329 // If yes, carry out additional checks on what we've got. 321 330 if ( GetMatchWord() ) 322 331 {