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