fix for bug 63026, r=jag, sr=ben, a=asa - adds a menu to the viewsource window - also fixes 22022 39389 50877 59489 69036 74862 76250 79518 81102 82663.

patch by doronr@naboonline.com
This commit is contained in:
hwaara%chello.se 2006-09-14 05:58:52 +00:00
Родитель 72451088e5
Коммит 134d14a446
2 изменённых файлов: 158 добавлений и 42 удалений

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

@ -1,15 +1,40 @@
<?xml version="1.0"?>
<?xml version="1.0"?> <!-- -*- Mode: HTML -*- -->
<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
<!--
- The contents of this file are subject to the Mozilla Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
-
- The Original Code is mozilla.org viewsource frontend.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 2000 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Doron Rosenberg (doronr@naboonline.com)
-->
<?xul-overlay href="chrome://navigator/content/navigatorOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
%brandDTD;
<!ENTITY % viewSourceDTD SYSTEM "chrome://navigator/locale/viewSource.dtd" >
%viewSourceDTD;
]>
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
%brandDTD;
<!ENTITY % sourceDTD SYSTEM "chrome://navigator/locale/viewSource.dtd" >
%sourceDTD;
<!ENTITY % navigatorDTD SYSTEM "chrome://navigator/locale/navigator.dtd" >
%navigatorDTD;
<!ENTITY % contentAreaCommandsDTD SYSTEM "chrome://communicator/locale/contentAreaCommands.dtd" >
%contentAreaCommandsDTD;
]>
<window id="main-window" xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
@ -22,26 +47,115 @@
windowtype="navigator:view-source"
align="vertical" width="640" height="480"
screenX="10" screenY="10"
persist="screenX screenY width height sizemode">
persist="screenX screenY width height sizemode">
<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaDD.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/findUtils.js"/>
<script type="application/x-javascript" src="chrome://navigator/content/viewsource.js"/>
<script type="application/x-javascript" src="chrome://navigator/content/navigator.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/findUtils.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaUtils.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/utilityOverlay.js"/>
<commandset id="commands"/>
<commandset id="commands">
<commandset id="globalEditMenuItems"/>
<commandset id="selectEditMenuItems"/>
<commandset id="clipboardEditMenuItems"/>
</commandset>
<stringbundleset id="stringbundleset"/>
<!-- keys are appended from the overlay -->
<keyset id="navKeys"/>
<keyset id="viewSourceKeys">
<!-- File Menu -->
<key id="key_newNavigator"/>
<key id="key_newBlankPage"/>
<key id="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/>
<key id="key_editPage" key="&editPageCmd.commandkey;" command="Browser:EditPage" modifiers="accel"/>
<key id="printKb" key="&printCmd.commandkey;" command="Browser:Print" modifiers="accel"/>
<key id="key_close"/>
<!-- Edit Menu -->
<key id="key_undo"/>
<key id="key_redo"/>
<key id="key_cut"/>
<key id="key_copy"/>
<key id="key_paste"/>
<key id="key_delete"/>
<key id="key_selectAll"/>
<!-- Search Menu -->
<key id="key_find" key="&findOnCmd.commandkey;" command="Browser:Find" modifiers="accel"/>
<key id="key_findAgain" key="&findAgainCmd.commandkey;" command="Browser:FindAgain" modifiers="accel"/>
<keyset id="viewZoomKeys"/>
</keyset>
<!-- Menu -->
<toolbox>
<menubar id="zmain-menubar">
<menu id="menu_File">
<menupopup id="filemenu-popup">
<menuitem label="&browserCmd.label;" accesskey="&browserCmd.accesskey;" key="key_newNavigator" observes="cmd_newNavigator"/>
<menu id="menu_New">
<menupopup id="menu_NewPopup">
<menuitem id="menu_newNavigator" observes="cmd_newNavigator"/>
<menuitem id="menu_newEditor" observes="cmd_newEditor"/>
</menupopup>
</menu>
<menuseparator/>
<menuitem id="menu_close"/>
<menuitem label="&savePageCmd.label;" accesskey="&savePageCmd.accesskey;" key="key_savePage" command="Browser:SavePage"/>
<menuitem id="savepage" label="&saveFrameCmd.label;" accesskey="&saveFrameCmd.accesskey;" oncommand="savePage(gFocusedURL);" hidden="true"/>
<menuseparator/>
<menuitem label="&editPageCmd.label;" accesskey="&editPageCmd.accesskey;" key="key_editPage" oncommand="ViewSourceEditPage();"/>
<menuseparator/>
<menuitem label="&printCmd.label;" accesskey="&printCmd.accesskey;" key="printKb" command="Browser:Print"/>
<!-- <menuitem accesskey="&printPreviewCmd.accesskey;" observes="Browser:PrintPreview"/> -->
</menupopup>
</menu>
<menu id="menu_Edit">
<menupopup>
<menuitem id="menu_undo"/>
<menuitem id="menu_redo"/>
<menuseparator/>
<menuitem id="menu_cut"/>
<menuitem id="menu_copy"/>
<menuitem id="menu_paste"/>
<menuitem id="menu_delete"/>
<menuseparator/>
<menuitem id="menu_selectAll"/>
</menupopup>
</menu>
<menu id="menu_view" accesskey="&viewMenu.accesskey;" label="&viewMenu.label;">
<menupopup>
<menu id="menu_textZoom"/>
<menuseparator/>
<!-- <menuitem accesskey="&pageInfoCmd.accesskey;" label="&pageInfoCmd.label;" key="key_viewInfo" observes="View:PageInfo"/>
<menuseparator id="file_moduleSeparator"/>-->
<menu id = "charsetMenu"/>
</menupopup>
</menu>
<menu id="menuSearch" accesskey="&searchMenu.accesskey;" label="&searchMenu.label;">
<menupopup>
<menuitem label="&findOnCmd.label;" accesskey="&findOnCmd.accesskey;" key="key_find" command="Browser:Find"/>
<menuitem label="&findAgainCmd.label;" accesskey="&findAgainCmd.accesskey;" key="key_findAgain" command="Browser:FindAgain"/>
</menupopup>
</menu>
<menu id="menu_Help"/>
</menubar>
</toolbox>
<!-- Menu -->
<box id="appcontent" align="vertical" flex="1"
ondragover="nsDragAndDrop.dragOver(event, contentAreaDNDObserver);"
ondraggesture="nsDragAndDrop.startDrag(event, contentAreaDNDObserver);"

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

@ -1,10 +1,32 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Doron Rosenberg (doronr@naboonline.com)
*/
var gBrowser = null;
var appCore = null;
function onLoadViewSource()
{
viewSource(window.arguments[0]);
window._content.focus();
}
function getBrowser()
@ -50,35 +72,15 @@ function viewSource(url)
return true;
}
function BrowserClose()
{
window.close();
}
function getMarkupDocumentViewer()
{
return getBrowser().markupDocumentViewer;
}
function BrowserFind()
// Strips the |view-source:| for editPage()
function ViewSourceEditPage()
{
var focusedWindow = document.commandDispatcher.focusedWindow;
if (!focusedWindow || focusedWindow == window)
focusedWindow = window._content;
findInPage(getBrowser(), window._content, focusedWindow)
}
function BrowserFindAgain()
{
var focusedWindow = document.commandDispatcher.focusedWindow;
if (!focusedWindow || focusedWindow == window)
focusedWindow = window._content;
findAgainInPage(getBrowser(), window._content, focusedWindow)
}
function BrowserCanFindAgain()
{
return canFindAgainInPage();
var url = window._content.location.href;
url = url.substring(12,url.length);
editPage(url,window, false);
}