Bug 313149 the code of findBar.js should be protected in a prototype r=mconnor

This commit is contained in:
masayuki%d-toybox.com 2005-11-01 17:34:45 +00:00
Родитель 8b7e9ecc28
Коммит 48b90c3235
10 изменённых файлов: 900 добавлений и 807 удалений

Просмотреть файл

@ -141,9 +141,9 @@
<command id="View:PageSource" oncommand="BrowserViewSourceOfDocument(content.document);" observes="isImage"/> <command id="View:PageSource" oncommand="BrowserViewSourceOfDocument(content.document);" observes="isImage"/>
<command id="View:PageInfo" oncommand="BrowserPageInfo();"/> <command id="View:PageInfo" oncommand="BrowserPageInfo();"/>
<command id="View:FullScreen" oncommand="BrowserFullScreen();"/> <command id="View:FullScreen" oncommand="BrowserFullScreen();"/>
<command id="cmd_find" oncommand="onFindCmd();" observes="isImage"/> <command id="cmd_find" oncommand="gFindBar.onFindCmd();" observes="isImage"/>
<command id="cmd_findAgain" oncommand="onFindAgainCmd();" observes="isImage"/> <command id="cmd_findAgain" oncommand="gFindBar.onFindAgainCmd();" observes="isImage"/>
<command id="cmd_findPrevious" oncommand="onFindPreviousCmd();" observes="isImage"/> <command id="cmd_findPrevious" oncommand="gFindBar.onFindPreviousCmd();" observes="isImage"/>
<command id="Browser:AddBookmarkAs" oncommand="addBookmarkAs(document.getElementById('content'), false);"/> <command id="Browser:AddBookmarkAs" oncommand="addBookmarkAs(document.getElementById('content'), false);"/>
<command id="Browser:BookmarkAllTabs" oncommand="addBookmarkAs(document.getElementById('content'), true);"/> <command id="Browser:BookmarkAllTabs" oncommand="addBookmarkAs(document.getElementById('content'), true);"/>
<command id="Browser:Home" oncommand="BrowserHome();"/> <command id="Browser:Home" oncommand="BrowserHome();"/>

Просмотреть файл

@ -619,10 +619,10 @@ function BrowserStartup()
var sidebarSplitter; var sidebarSplitter;
if (window.opener && !window.opener.closed) { if (window.opener && !window.opener.closed) {
if (window.opener.gFindMode == FIND_NORMAL) { if (window.opener.gFindBar.mFindMode == FIND_NORMAL) {
var openerFindBar = window.opener.document.getElementById("FindToolbar"); var openerFindBar = window.opener.document.getElementById("FindToolbar");
if (openerFindBar && !openerFindBar.hidden) if (openerFindBar && !openerFindBar.hidden)
openFindBar(); gFindBar.openFindBar();
} }
var openerSidebarBox = window.opener.document.getElementById("sidebar-box"); var openerSidebarBox = window.opener.document.getElementById("sidebar-box");
@ -822,7 +822,7 @@ function delayedStartup()
sidebar.setAttribute("src", sidebarBox.getAttribute("src")); sidebar.setAttribute("src", sidebarBox.getAttribute("src"));
} }
initFindBar(); gFindBar.initFindBar();
// add bookmark options to context menu for tabs // add bookmark options to context menu for tabs
addBookmarkMenuitems(); addBookmarkMenuitems();
@ -984,7 +984,7 @@ function BrowserShutdown()
BrowserOffline.uninit(); BrowserOffline.uninit();
uninitFindBar(); gFindBar.uninitFindBar();
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(); var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator); var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
@ -2405,7 +2405,7 @@ function toggleAffectedChrome(aHide)
var findBar = document.getElementById("FindToolbar"); var findBar = document.getElementById("FindToolbar");
gChromeState.findOpen = !findBar.hidden; gChromeState.findOpen = !findBar.hidden;
closeFindBar(); gFindBar.closeFindBar();
} }
else { else {
if (gChromeState.messageOpen) { if (gChromeState.messageOpen) {
@ -2419,7 +2419,7 @@ function toggleAffectedChrome(aHide)
} }
if (gChromeState.findOpen) if (gChromeState.findOpen)
openFindBar(); gFindBar.openFindBar();
} }
if (gChromeState.sidebarOpen) if (gChromeState.sidebarOpen)
@ -3538,10 +3538,9 @@ nsBrowserStatusHandler.prototype =
} }
} }
UpdateBackForwardButtons(); UpdateBackForwardButtons();
if (findField && gFindMode != FIND_NORMAL) { if (findField && gFindBar.mFindMode != FIND_NORMAL) {
// Close the Find toolbar if we're in old-style TAF mode // Close the Find toolbar if we're in old-style TAF mode
closeFindBar(); gFindBar.closeFindBar();
gBackProtectBuffer = 0;
} }
//fix bug 253793 - turn off highlight when page changes //fix bug 253793 - turn off highlight when page changes

Просмотреть файл

@ -144,7 +144,7 @@ function init() {
strBundle = document.getElementById("bundle_help"); strBundle = document.getElementById("bundle_help");
emptySearchText = strBundle.getString("emptySearchText"); emptySearchText = strBundle.getString("emptySearchText");
initFindBar(); gFindBar.initFindBar();
// Get the content pack, base URL, and help topic // Get the content pack, base URL, and help topic
var helpTopic = defaultTopic; var helpTopic = defaultTopic;

Просмотреть файл

@ -70,7 +70,7 @@
persist="width height screenX screenY" persist="width height screenX screenY"
#endif #endif
onload="init();" onload="init();"
onunload="uninitFindBar(); window.XULBrowserWindow.destroy();"> onunload="gFindBar.uninitFindBar(); window.XULBrowserWindow.destroy();">
<script type="application/x-javascript" src="chrome://help/content/help.js"/> <script type="application/x-javascript" src="chrome://help/content/help.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/> <script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
@ -102,9 +102,9 @@
<command id="cmd_closeWindow" oncommand="close();"/> <command id="cmd_closeWindow" oncommand="close();"/>
<command id="cmd_textZoomReduce" oncommand="ZoomManager.prototype.getInstance().reduce();"/> <command id="cmd_textZoomReduce" oncommand="ZoomManager.prototype.getInstance().reduce();"/>
<command id="cmd_textZoomEnlarge" oncommand="ZoomManager.prototype.getInstance().enlarge();"/> <command id="cmd_textZoomEnlarge" oncommand="ZoomManager.prototype.getInstance().enlarge();"/>
<command id="cmd_find" oncommand="onFindCmd();"/> <command id="cmd_find" oncommand="gFindBar.onFindCmd();"/>
<command id="cmd_findAgain" oncommand="onFindAgainCmd();"/> <command id="cmd_findAgain" oncommand="gFindBar.onFindAgainCmd();"/>
<command id="cmd_findPrevious" oncommand="onFindPreviousCmd();"/> <command id="cmd_findPrevious" oncommand="gFindBar.onFindPreviousCmd();"/>
<command id="cmd_copy" oncommand="goDoCommand('cmd_copy')" disabled="true"/> <command id="cmd_copy" oncommand="goDoCommand('cmd_copy')" disabled="true"/>
<command id="cmd_selectAll" oncommand="goDoCommand('cmd_selectAll')"/> <command id="cmd_selectAll" oncommand="goDoCommand('cmd_selectAll')"/>
</commandset> </commandset>

Просмотреть файл

@ -1,13 +1,14 @@
<toolbar id="FindToolbar" hidden="true" align="center" fullscreentoolbar="true"> <toolbar id="FindToolbar" hidden="true" align="center" fullscreentoolbar="true">
<toolbarbutton id="find-closebutton" tooltiptext="&findCloseButton.tooltip;" <toolbarbutton id="find-closebutton" tooltiptext="&findCloseButton.tooltip;"
oncommand="closeFindBar();"/> oncommand="gFindBar.closeFindBar();"/>
<label control="find-field" value="&find.label;"/> <label control="find-field" value="&find.label;"/>
<hbox id="find-field-container"> <hbox id="find-field-container">
<textbox id="find-field" oninput="find(this.value);" <textbox id="find-field" oninput="gFindBar.find(this.value);"
onkeypress="onFindBarKeyPress(event);" onblur="onFindBarBlur();" onkeypress="gFindBar.onFindBarKeyPress(event);"
oncompositionstart="onFindBarCompositionStart(event);" onblur="gFindBar.onFindBarBlur();"
oncompositionend="onFindBarCompositionEnd(event);"/> oncompositionstart="gFindBar.onFindBarCompositionStart(event);"
oncompositionend="gFindBar.onFindBarCompositionEnd(event);"/>
</hbox> </hbox>
<toolbarbutton id="find-next" label="&findNext.label;" tooltiptext="&findNext.tooltip;" <toolbarbutton id="find-next" label="&findNext.label;" tooltiptext="&findNext.tooltip;"
command="cmd_findAgain" disabled="true" accesskey="&findNext.accesskey;"/> command="cmd_findAgain" disabled="true" accesskey="&findNext.accesskey;"/>
@ -20,11 +21,13 @@
#else #else
tooltiptext="&highlight.tooltip;" tooltiptext="&highlight.tooltip;"
#endif #endif
oncommand="toggleHighlight(!this.checked); oncommand="gFindBar.toggleHighlight(!this.checked);
if (gFindMode != FIND_NORMAL) setFindCloseTimeout();" if (gFindBar.mFindMode != FIND_NORMAL)
gFindBar.setFindCloseTimeout();"
type="checkbox" disabled="true" type="checkbox" disabled="true"
accesskey="&highlight.accesskey;"/> accesskey="&highlight.accesskey;"/>
<checkbox id="find-case-sensitive" oncommand="toggleCaseSensitivity(this.checked);" <checkbox id="find-case-sensitive"
oncommand="gFindBar.toggleCaseSensitivity(this.checked);"
label="&caseSensitiveCheckbox.label;" accesskey="&caseSensitiveCheckbox.accesskey;"/> label="&caseSensitiveCheckbox.label;" accesskey="&caseSensitiveCheckbox.accesskey;"/>
<image id="find-status-icon"/> <image id="find-status-icon"/>
<label id="find-status"/> <label id="find-status"/>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -76,7 +76,7 @@ function onLoadViewPartialSource()
document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true"); document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true");
} }
initFindBar(); gFindBar.initFindBar();
if (window.arguments[3] == 'selection') if (window.arguments[3] == 'selection')
viewPartialSourceForSelection(window.arguments[2]); viewPartialSourceForSelection(window.arguments[2]);
@ -88,7 +88,7 @@ function onLoadViewPartialSource()
function onUnloadViewPartialSource() function onUnloadViewPartialSource()
{ {
uninitFindBar(); gFindBar.uninitFindBar();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -89,9 +89,9 @@
<command id="cmd_pagesetup" oncommand="PrintUtils.showPageSetup();"/> <command id="cmd_pagesetup" oncommand="PrintUtils.showPageSetup();"/>
<command id="cmd_close" oncommand="window.close();"/> <command id="cmd_close" oncommand="window.close();"/>
<commandset id="editMenuCommands"/> <commandset id="editMenuCommands"/>
<command id="cmd_find" oncommand="onFindCmd();"/> <command id="cmd_find" oncommand="gFindBar.onFindCmd();"/>
<command id="cmd_findAgain" oncommand="onFindAgainCmd();"/> <command id="cmd_findAgain" oncommand="gFindBar.onFindAgainCmd();"/>
<command id="cmd_findPrevious" oncommand="onFindPreviousCmd();"/> <command id="cmd_findPrevious" oncommand="gFindBar.onFindPreviousCmd();"/>
<command id="cmd_goToLine" oncommand="ViewSourceGoToLine();" disabled="true"/> <command id="cmd_goToLine" oncommand="ViewSourceGoToLine();" disabled="true"/>
<command id="cmd_highlightSyntax" oncommand="highlightSyntax();"/> <command id="cmd_highlightSyntax" oncommand="highlightSyntax();"/>
<command id="cmd_wrapLongLines" oncommand="wrapLongLines()"/> <command id="cmd_wrapLongLines" oncommand="wrapLongLines()"/>

Просмотреть файл

@ -69,14 +69,14 @@ function onLoadViewSource()
viewSource(window.arguments[0]); viewSource(window.arguments[0]);
document.commandDispatcher.focusedWindow = content; document.commandDispatcher.focusedWindow = content;
#ifdef MOZ_PHOENIX #ifdef MOZ_PHOENIX
initFindBar(); gFindBar.initFindBar();
#endif #endif
} }
function onUnloadViewSource() function onUnloadViewSource()
{ {
#ifdef MOZ_PHOENIX #ifdef MOZ_PHOENIX
uninitFindBar(); gFindBar.uninitFindBar();
#endif #endif
} }

Просмотреть файл

@ -105,9 +105,9 @@
<command id="cmd_close" oncommand="window.close();"/> <command id="cmd_close" oncommand="window.close();"/>
<commandset id="editMenuCommands"/> <commandset id="editMenuCommands"/>
#ifdef USE_FIND_TOOLBAR #ifdef USE_FIND_TOOLBAR
<command id="cmd_find" oncommand="onFindCmd();"/> <command id="cmd_find" oncommand="gFindBar.onFindCmd();"/>
<command id="cmd_findAgain" oncommand="onFindAgainCmd();"/> <command id="cmd_findAgain" oncommand="gFindBar.onFindAgainCmd();"/>
<command id="cmd_findPrevious" oncommand="onFindPreviousCmd();"/> <command id="cmd_findPrevious" oncommand="gFindBar.onFindPreviousCmd();"/>
#else #else
<command id="cmd_find" oncommand="getBrowser().find();"/> <command id="cmd_find" oncommand="getBrowser().find();"/>
<command id="cmd_findAgain" oncommand="getBrowser().findAgain()"/> <command id="cmd_findAgain" oncommand="getBrowser().findAgain()"/>