fck_find.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <!--
  3. * FCKeditor - The text editor for internet
  4. * Copyright (C) 2003-2005 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>
  21. <head>
  22. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  23. <meta content="noindex, nofollow" name="robots">
  24. <script type="text/javascript">
  25. var oEditor = window.parent.InnerDialogLoaded() ;
  26. function OnLoad()
  27. {
  28. // Whole word is available on IE only.
  29. if ( oEditor.FCKBrowserInfo.IsIE )
  30. document.getElementById('divWord').style.display = '' ;
  31. // First of all, translate the dialog box texts.
  32. oEditor.FCKLanguageManager.TranslatePage( document ) ;
  33. window.parent.SetAutoSize( true ) ;
  34. }
  35. function btnStat(frm)
  36. {
  37. document.getElementById('btnFind').disabled =
  38. ( document.getElementById('txtFind').value.length == 0 ) ;
  39. }
  40. function ReplaceTextNodes( parentNode, regex, replaceValue, replaceAll )
  41. {
  42. for ( var i = 0 ; i < parentNode.childNodes.length ; i++ )
  43. {
  44. var oNode = parentNode.childNodes[i] ;
  45. if ( oNode.nodeType == 3 )
  46. {
  47. var sReplaced = oNode.nodeValue.replace( regex, replaceValue ) ;
  48. if ( oNode.nodeValue != sReplaced )
  49. {
  50. oNode.nodeValue = sReplaced ;
  51. if ( ! replaceAll )
  52. return true ;
  53. }
  54. }
  55. else
  56. {
  57. if ( ReplaceTextNodes( oNode, regex, replaceValue ) )
  58. return true ;
  59. }
  60. }
  61. return false ;
  62. }
  63. function GetRegexExpr()
  64. {
  65. if ( document.getElementById('chkWord').checked )
  66. var sExpr = '\\b' + document.getElementById('txtFind').value + '\\b' ;
  67. else
  68. var sExpr = document.getElementById('txtFind').value ;
  69. return sExpr ;
  70. }
  71. function GetCase()
  72. {
  73. return ( document.getElementById('chkCase').checked ? '' : 'i' ) ;
  74. }
  75. function Ok()
  76. {
  77. if ( document.getElementById('txtFind').value.length == 0 )
  78. return ;
  79. if ( oEditor.FCKBrowserInfo.IsIE )
  80. FindIE() ;
  81. else
  82. FindGecko() ;
  83. }
  84. var oRange ;
  85. if ( oEditor.FCKBrowserInfo.IsIE )
  86. oRange = oEditor.FCK.EditorDocument.body.createTextRange() ;
  87. function FindIE()
  88. {
  89. var iFlags = 0 ;
  90. if ( chkCase.checked )
  91. iFlags = iFlags | 4 ;
  92. if ( chkWord.checked )
  93. iFlags = iFlags | 2 ;
  94. var bFound = oRange.findText( document.getElementById('txtFind').value, 1, iFlags ) ;
  95. if ( bFound )
  96. {
  97. oRange.scrollIntoView() ;
  98. oRange.select() ;
  99. oRange.collapse(false) ;
  100. oLastRangeFound = oRange ;
  101. }
  102. else
  103. {
  104. oRange = oEditor.FCK.EditorDocument.body.createTextRange() ;
  105. alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ;
  106. }
  107. }
  108. function FindGecko()
  109. {
  110. var bCase = document.getElementById('chkCase').checked ;
  111. var bWord = document.getElementById('chkWord').checked ;
  112. // window.find( searchString, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog ) ;
  113. oEditor.FCK.EditorWindow.find( document.getElementById('txtFind').value, bCase, false, false, bWord, false, false ) ;
  114. }
  115. </script>
  116. </head>
  117. <body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
  118. <table cellSpacing="3" cellPadding="2" width="100%" border="0">
  119. <tr>
  120. <td nowrap>
  121. <label for="txtFind" fckLang="DlgReplaceFindLbl">Find what:</label>&nbsp;
  122. </td>
  123. <td width="100%">
  124. <input id="txtFind" style="WIDTH: 100%" tabIndex="1" type="text">
  125. </td>
  126. <td>
  127. <input id="btnFind" style="WIDTH: 100%; PADDING-RIGHT: 5px; PADDING-LEFT: 5px" onclick="Ok();"
  128. type="button" value="Find" fckLang="DlgFindFindBtn">
  129. </td>
  130. </tr>
  131. <tr>
  132. <td valign="bottom" colSpan="3">
  133. &nbsp;<input id="chkCase" tabIndex="3" type="checkbox"><label for="chkCase" fckLang="DlgReplaceCaseChk">Match
  134. case</label>
  135. <br>
  136. <div id="divWord" style="DISPLAY: none">
  137. &nbsp;<input id="chkWord" tabIndex="4" type="checkbox"><label for="chkWord" fckLang="DlgReplaceWordChk">Match
  138. whole word</label>
  139. </div>
  140. </td>
  141. </tr>
  142. </table>
  143. </body>
  144. </html>