[1257] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
| 2 | <!-- |
---|
| 3 | * FCKeditor - The text editor for internet |
---|
| 4 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben |
---|
| 5 | * |
---|
| 6 | * Licensed under the terms of the GNU Lesser General Public License: |
---|
| 7 | * http://www.opensource.org/licenses/lgpl-license.php |
---|
| 8 | * |
---|
| 9 | * For further information visit: |
---|
| 10 | * http://www.fckeditor.net/ |
---|
| 11 | * |
---|
| 12 | * "Support Open Source software. What about a donation today?" |
---|
| 13 | * |
---|
| 14 | * File Name: fck_find.html |
---|
| 15 | * "Find" dialog window. |
---|
| 16 | * |
---|
| 17 | * File Authors: |
---|
| 18 | * Frederico Caldeira Knabben (fredck@fckeditor.net) |
---|
| 19 | --> |
---|
| 20 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
| 21 | <head> |
---|
| 22 | <title></title> |
---|
| 23 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
| 24 | <meta content="noindex, nofollow" name="robots" /> |
---|
| 25 | <script type="text/javascript"> |
---|
| 26 | |
---|
| 27 | var oEditor = window.parent.InnerDialogLoaded() ; |
---|
| 28 | |
---|
| 29 | function OnLoad() |
---|
| 30 | { |
---|
| 31 | // Whole word is available on IE only. |
---|
| 32 | if ( oEditor.FCKBrowserInfo.IsIE ) |
---|
| 33 | document.getElementById('divWord').style.display = '' ; |
---|
| 34 | |
---|
| 35 | // First of all, translate the dialog box texts. |
---|
| 36 | oEditor.FCKLanguageManager.TranslatePage( document ) ; |
---|
| 37 | |
---|
| 38 | window.parent.SetAutoSize( true ) ; |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | function btnStat(frm) |
---|
| 42 | { |
---|
| 43 | document.getElementById('btnFind').disabled = |
---|
| 44 | ( document.getElementById('txtFind').value.length == 0 ) ; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | function ReplaceTextNodes( parentNode, regex, replaceValue, replaceAll ) |
---|
| 48 | { |
---|
| 49 | for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) |
---|
| 50 | { |
---|
| 51 | var oNode = parentNode.childNodes[i] ; |
---|
| 52 | if ( oNode.nodeType == 3 ) |
---|
| 53 | { |
---|
| 54 | var sReplaced = oNode.nodeValue.replace( regex, replaceValue ) ; |
---|
| 55 | if ( oNode.nodeValue != sReplaced ) |
---|
| 56 | { |
---|
| 57 | oNode.nodeValue = sReplaced ; |
---|
| 58 | if ( ! replaceAll ) |
---|
| 59 | return true ; |
---|
| 60 | } |
---|
| 61 | } |
---|
| 62 | else |
---|
| 63 | { |
---|
| 64 | if ( ReplaceTextNodes( oNode, regex, replaceValue ) ) |
---|
| 65 | return true ; |
---|
| 66 | } |
---|
| 67 | } |
---|
| 68 | return false ; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | function GetRegexExpr() |
---|
| 72 | { |
---|
| 73 | if ( document.getElementById('chkWord').checked ) |
---|
| 74 | var sExpr = '\\b' + document.getElementById('txtFind').value + '\\b' ; |
---|
| 75 | else |
---|
| 76 | var sExpr = document.getElementById('txtFind').value ; |
---|
| 77 | |
---|
| 78 | return sExpr ; |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | function GetCase() |
---|
| 82 | { |
---|
| 83 | return ( document.getElementById('chkCase').checked ? '' : 'i' ) ; |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | function Ok() |
---|
| 87 | { |
---|
| 88 | if ( document.getElementById('txtFind').value.length == 0 ) |
---|
| 89 | return ; |
---|
| 90 | |
---|
| 91 | if ( oEditor.FCKBrowserInfo.IsIE ) |
---|
| 92 | FindIE() ; |
---|
| 93 | else |
---|
| 94 | FindGecko() ; |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | var oRange ; |
---|
| 98 | |
---|
| 99 | if ( oEditor.FCKBrowserInfo.IsIE ) |
---|
| 100 | oRange = oEditor.FCK.EditorDocument.body.createTextRange() ; |
---|
| 101 | |
---|
| 102 | function FindIE() |
---|
| 103 | { |
---|
| 104 | var iFlags = 0 ; |
---|
| 105 | |
---|
| 106 | if ( chkCase.checked ) |
---|
| 107 | iFlags = iFlags | 4 ; |
---|
| 108 | |
---|
| 109 | if ( chkWord.checked ) |
---|
| 110 | iFlags = iFlags | 2 ; |
---|
| 111 | |
---|
| 112 | var bFound = oRange.findText( document.getElementById('txtFind').value, 1, iFlags ) ; |
---|
| 113 | |
---|
| 114 | if ( bFound ) |
---|
| 115 | { |
---|
| 116 | oRange.scrollIntoView() ; |
---|
| 117 | oRange.select() ; |
---|
| 118 | oRange.collapse(false) ; |
---|
| 119 | oLastRangeFound = oRange ; |
---|
| 120 | } |
---|
| 121 | else |
---|
| 122 | { |
---|
| 123 | oRange = oEditor.FCK.EditorDocument.body.createTextRange() ; |
---|
| 124 | alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ; |
---|
| 125 | } |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | function FindGecko() |
---|
| 129 | { |
---|
| 130 | var bCase = document.getElementById('chkCase').checked ; |
---|
| 131 | var bWord = document.getElementById('chkWord').checked ; |
---|
| 132 | |
---|
| 133 | // window.find( searchString, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog ) ; |
---|
| 134 | if ( !oEditor.FCK.EditorWindow.find( document.getElementById('txtFind').value, bCase, false, false, bWord, false, false ) ) |
---|
| 135 | alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ; |
---|
| 136 | } |
---|
| 137 | </script> |
---|
| 138 | </head> |
---|
| 139 | <body onload="OnLoad()" style="overflow: hidden"> |
---|
| 140 | <table cellspacing="3" cellpadding="2" width="100%" border="0"> |
---|
| 141 | <tr> |
---|
| 142 | <td nowrap="nowrap"> |
---|
| 143 | <label for="txtFind" fcklang="DlgReplaceFindLbl"> |
---|
| 144 | Find what:</label> |
---|
| 145 | </td> |
---|
| 146 | <td width="100%"> |
---|
| 147 | <input id="txtFind" style="width: 100%" tabindex="1" type="text" /> |
---|
| 148 | </td> |
---|
| 149 | <td> |
---|
| 150 | <input id="btnFind" style="padding-right: 5px; padding-left: 5px" onclick="Ok();" |
---|
| 151 | type="button" value="Find" fcklang="DlgFindFindBtn" /> |
---|
| 152 | </td> |
---|
| 153 | </tr> |
---|
| 154 | <tr> |
---|
| 155 | <td valign="bottom" colspan="3"> |
---|
| 156 | <input id="chkCase" tabindex="3" type="checkbox" /><label for="chkCase" fcklang="DlgReplaceCaseChk">Match |
---|
| 157 | case</label> |
---|
| 158 | <br /> |
---|
| 159 | <div id="divWord" style="display: none"> |
---|
| 160 | <input id="chkWord" tabindex="4" type="checkbox" /><label for="chkWord" fcklang="DlgReplaceWordChk">Match |
---|
| 161 | whole word</label> |
---|
| 162 | </div> |
---|
| 163 | </td> |
---|
| 164 | </tr> |
---|
| 165 | </table> |
---|
| 166 | </body> |
---|
| 167 | </html> |
---|