mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Adding viewSource.xul for viewing html source
This commit is contained in:
parent
c087f08751
commit
cf2d575ccb
@ -36,6 +36,7 @@ EXPORT_RESOURCE_SAMPLES = \
|
||||
$(srcdir)/navigator.css \
|
||||
$(srcdir)/navigator.xul \
|
||||
$(srcdir)/saveToDisk.xul \
|
||||
$(srcdir)/viewSource.xul \
|
||||
$(srcdir)/downloadProgress.xul \
|
||||
$(srcdir)/downloadProgress.css \
|
||||
$(srcdir)/navigator-shiny.css \
|
||||
|
@ -73,6 +73,7 @@ install:: $(DLL)
|
||||
$(MAKE_INSTALL) xul.css $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) navigator.css $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) navigator.xul $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) viewSource.xul $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) saveToDisk.xul $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) NetSupportUserPassword.xul $(DIST)\bin\res\samples
|
||||
$(MAKE_INSTALL) downloadProgress.xul $(DIST)\bin\res\samples
|
||||
@ -94,6 +95,7 @@ clobber::
|
||||
rm -f $(DIST)\res\samples\sidebar.html
|
||||
rm -f $(DIST)\res\samples\xul.css
|
||||
rm -f $(DIST)\res\samples\navigator.xul
|
||||
rm -f $(DIST)\res\samples\viewSource.xul
|
||||
rm -f $(DIST)\res\samples\saveToDisk.xul
|
||||
rm -f $(DIST)\res\samples\downloadProgress.xul
|
||||
rm -f $(DIST)\res\samples\downloadProgress.css
|
||||
|
377
xpfe/browser/src/viewSource.xul
Normal file
377
xpfe/browser/src/viewSource.xul
Normal file
@ -0,0 +1,377 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="xul.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window>
|
||||
|
||||
<window id="main-window" xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="Startup()" title="Mozilla">
|
||||
|
||||
<html:script>
|
||||
|
||||
var coreName;
|
||||
var appCore;
|
||||
|
||||
function Startup() {
|
||||
// Generate unique name.
|
||||
coreName = "ViewSource." + ( new Date() ).getTime().toString();
|
||||
|
||||
// Create and initialize the browser app core.
|
||||
appCore = new BrowserAppCore();
|
||||
appCore.Init( coreName );
|
||||
appCore.setContentWindow(window.frames[0]);
|
||||
appCore.setWebShellWindow(window);
|
||||
appCore.setToolbarWindow(window);
|
||||
|
||||
// Get url whose source to view.
|
||||
var url = document.getElementById("args").getAttribute("value");
|
||||
|
||||
// Load the source (the app core will magically know what to do).
|
||||
XPAppCoresManager.Find( coreName ).loadUrl(url);
|
||||
}
|
||||
|
||||
function BrowserNewWindow()
|
||||
{
|
||||
if (appCore != null) {
|
||||
dump("Opening New Window\n");
|
||||
appCore.newWindow();
|
||||
} else {
|
||||
dump("BrowserAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function BrowserOpenWindow()
|
||||
{
|
||||
if (appCore != null) {
|
||||
dump("Opening New Window\n");
|
||||
appCore.openWindow();
|
||||
} else {
|
||||
dump("BrowserAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function BrowserCopy()
|
||||
{
|
||||
if (appCore != null) {
|
||||
dump("Copying\n");
|
||||
appCore.copy();
|
||||
} else {
|
||||
dump("BrowserAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function BrowserEditBookmarks()
|
||||
{
|
||||
var toolkitCore = XPAppCoresManager.Find("toolkitCore");
|
||||
if (!toolkitCore) {
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore) {
|
||||
toolkitCore.Init("toolkitCore");
|
||||
}
|
||||
}
|
||||
if (toolkitCore) {
|
||||
toolkitCore.ShowWindow("resource://res/rdf/bookmarks.xul",window);
|
||||
}
|
||||
}
|
||||
|
||||
function BrowserPrintPreview()
|
||||
{
|
||||
// Borrowing this method to show how to
|
||||
// dynamically change icons
|
||||
dump("BrowserPrintPreview\n");
|
||||
if (appCore != null) {
|
||||
dump("Changing Icons\n");
|
||||
appCore.printPreview();
|
||||
} else {
|
||||
dump("BrowserAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function BrowserPrint()
|
||||
{
|
||||
// Borrowing this method to show how to
|
||||
// dynamically change icons
|
||||
if (appCore != null) {
|
||||
appCore.print();
|
||||
}
|
||||
}
|
||||
|
||||
function BrowserSetDocumentCharacterSet(aCharset)
|
||||
{
|
||||
if (appCore != null) {
|
||||
appCore.SetDocumentCharset(aCharset);
|
||||
} else {
|
||||
dump("BrowserAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function BrowserClose()
|
||||
{
|
||||
dump("BrowserClose\n");
|
||||
}
|
||||
|
||||
function BrowserExit()
|
||||
{
|
||||
if (appCore != null) {
|
||||
dump("Exiting\n");
|
||||
appCore.exit();
|
||||
} else {
|
||||
dump("BrowserAppCore has not been created!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function OpenMessenger()
|
||||
{
|
||||
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
|
||||
if (!toolkitCore) {
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore) {
|
||||
toolkitCore.Init("ToolkitCore");
|
||||
}
|
||||
}
|
||||
if (toolkitCore) {
|
||||
toolkitCore.ShowWindow("resource:/res/mailnews/messenger/mailshell.xul",
|
||||
window);
|
||||
}
|
||||
}
|
||||
|
||||
function DoPreferences()
|
||||
{
|
||||
var prefsCore = XPAppCoresManager.Find("PrefsCore");
|
||||
if (!prefsCore) {
|
||||
prefsCore = new PrefsCore();
|
||||
if (prefsCore) {
|
||||
prefsCore.Init("PrefsCore");
|
||||
}
|
||||
}
|
||||
if (prefsCore) {
|
||||
prefsCore.ShowWindow(window);
|
||||
}
|
||||
}
|
||||
|
||||
function OpenEditor()
|
||||
{
|
||||
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
|
||||
if (!toolkitCore) {
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore) {
|
||||
toolkitCore.Init("ToolkitCore");
|
||||
}
|
||||
}
|
||||
if (toolkitCore) {
|
||||
toolkitCore.ShowWindow("resource:/res/samples/EditorAppShell.xul",
|
||||
window);
|
||||
}
|
||||
}
|
||||
|
||||
</html:script>
|
||||
|
||||
<broadcaster id="args" value="http://law/"/>
|
||||
<broadcaster id="canPrint"/>
|
||||
<broadcaster id="Browser:LoadingProgress"/>
|
||||
<broadcaster id="Browser:Status"/>
|
||||
<broadcaster id="Browser:Throbber" busy="false"/>
|
||||
|
||||
<menubar>
|
||||
<menu name="File">
|
||||
<menuitem name="New Browser Window" onclick="BrowserNewWindow();"/>
|
||||
<menu name="New">
|
||||
<menuitem name="Mail Message" onclick="MsgNewMessage();"/>
|
||||
<menuitem name="Chat Window" onclick=""/>
|
||||
<separator />
|
||||
<menuitem name="Blank Page" onclick="BrowserNewWindow();"/>
|
||||
<menuitem name="Page Using Template..." onclick="BrowserNewWindow();"/>
|
||||
<menuitem name="Page Using Draft..." onclick="BrowserNewWindow();"/>
|
||||
</menu>
|
||||
<menuitem name="Open" onclick="BrowserOpenWindow();"/>
|
||||
<separator />
|
||||
<menuitem name="Send Page" onclick="NotImplementedYet();"/>
|
||||
<separator />
|
||||
<menu name="Offline">
|
||||
<menuitem name="Go Offline" onclick="NotImplementedYet();"/>
|
||||
<separator />
|
||||
<menuitem name="Synchronize..." onclick="NotImplementedYet();"/>
|
||||
</menu>
|
||||
<separator />
|
||||
<menuitem name="Print Setup" onclick=";"/>
|
||||
<menuitem name="Print Preview" onclick=""/>
|
||||
<menuitem name="Print" onclick="BrowserPrint()"/>
|
||||
<separator />
|
||||
<menuitem name="Close" onclick="BrowserClose();"/>
|
||||
<menuitem name="Quit" onclick="BrowserExit();"/>
|
||||
</menu>
|
||||
<menu name="Edit">
|
||||
<menuitem name="Undo" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Redo" onclick="NotImplementedYet();" disabled=""/>
|
||||
<separator />
|
||||
<menuitem name="Cut" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Copy" onclick="BrowserCopy();"/>
|
||||
<menuitem name="Paste" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Delete" onclick="NotImplementedYet();" disabled=""/>
|
||||
<separator />
|
||||
<menuitem name="Select All" onclick="NotImplementedYet();"/>
|
||||
<separator />
|
||||
<menuitem name="Preferences..." onclick="DoPreferences();"/>
|
||||
</menu>
|
||||
|
||||
<menu name="View">
|
||||
<menuitem name="Toolbars" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Sidebar" onclick="NotImplementedYet();" disabled=""/>
|
||||
<separator />
|
||||
<menuitem name="Enlarge Text Size" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Reduce Text Size" onclick="NotImplementedYet();" disabled=""/>
|
||||
<separator />
|
||||
<menu name="Use Stylesheet" onclick="NotImplementedYet();">
|
||||
<menuitem name="Default" onclick="NotImplementedYet();" disabled=""/>
|
||||
<separator />
|
||||
<menuitem name="Easy Reading" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Maximum Information" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Bizarre" onclick="NotImplementedYet();" disabled=""/>
|
||||
</menu>
|
||||
<separator />
|
||||
<menuitem name="Reload" onclick="BrowserReload();" disabled=""/>
|
||||
<menuitem name="Show Images" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Stop" onclick="NotImplementedYet();"/>
|
||||
<separator />
|
||||
<menuitem name="Page Source" onclick="BrowserViewSource();" disabled=""/>
|
||||
<menuitem name="Page Info" onclick="NotImplementedYet();"/>
|
||||
<separator />
|
||||
<menu name="Character Set">
|
||||
<menuitem name="Latin1" onclick="BrowserSetDocumentCharacterSet('ISO-8859-1');"/>
|
||||
<menuitem name="ISO-2022-JP" onclick="BrowserSetDocumentCharacterSet('ISO-2022-JP');"/>
|
||||
<menuitem name="Shift_JIS" onclick="BrowserSetDocumentCharacterSet('Shift_JIS');"/>
|
||||
<menuitem name="EUC-JP" onclick="BrowserSetDocumentCharacterSet('EUC-JP');"/>
|
||||
</menu>
|
||||
</menu>
|
||||
<menu name="Search">
|
||||
<menuitem name="Find On This page..." onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Find Again" onclick="NotImplementedYet();" disabled=""/>
|
||||
<separator />
|
||||
<menuitem name="Search Parent Item..." onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Search Parent2 Item..." onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="App Specific" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="App Specific" onclick="NotImplementedYet();" disabled=""/>
|
||||
<separator />
|
||||
<menuitem name="Search The Internet..." onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Search All Mail..." onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Search Bookmarks" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Search People" onclick="NotImplementedYet();" disabled=""/>
|
||||
<separator />
|
||||
<menuitem name="Search On This Computer..." onclick="NotImplementedYet();" disabled=""/>
|
||||
</menu>
|
||||
<menu name="Go">
|
||||
<menuitem name="Back" onclick="BrowserBack();" disabled=""/>
|
||||
<menuitem name="Forward" onclick="BrowserForward();" disabled=""/>
|
||||
<menuitem name="Home" onclick="BrowserHome();" disabled=""/>
|
||||
</menu>
|
||||
<menu name="Tasks">
|
||||
<menuitem name="Navigator" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Messenger" onclick="OpenMessenger();" />
|
||||
<menuitem name="Editor" onclick="OpenEditor();" />
|
||||
<menuitem name="Manage History" onclick="OpenHistoryView();" />
|
||||
<menuitem name="Chat" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Shopping Cart" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menu name="Tools">
|
||||
<menuitem name="Plugins Info" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Server Tools" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Java/JS Console" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="JavaScript Debugger" onclick="NotImplementedYet();" disabled=""/>
|
||||
</menu>
|
||||
<separator />
|
||||
<menuitem name="Security Info" onclick="NotImplementedYet();" disabled=""/>
|
||||
<separator/>
|
||||
<menuitem name="Window 1" onclick="NotImplementedYet();" key="1" disabled=""/>
|
||||
<menuitem name="Window 2" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Window 3" onclick="NotImplementedYet();" disabled=""/>
|
||||
</menu>
|
||||
|
||||
<menu name="Help">
|
||||
<menuitem name="Help Contents" onclick="window.frames[0].location.href = 'http://www.mozilla.org/projects/user-docs/local/browserhelp/browsertop.html'" disabled=""/>
|
||||
<separator />
|
||||
<menuitem name="How To Tutorial" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Help Channel" onclick="NotImplementedYet();" disabled=""/>
|
||||
<separator />
|
||||
<menuitem name="Software Updates" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Technical Support" onclick="NotImplementedYet();" disabled=""/>
|
||||
<menuitem name="Release Notes"
|
||||
onclick="window.frames[0].location.href='http://www.mozilla.org/projects/seamonkey/release-notes/index.html'" disabled=""/>
|
||||
|
||||
<separator />
|
||||
<menuitem name="About Communicator Prototype"
|
||||
onclick="window.frames[0].location.href='http://www.mozilla.org/projects/seamonkey/release-notes/index.html'" disabled=""/>
|
||||
</menu>
|
||||
</menubar>
|
||||
|
||||
<box id="outer-box" align="vertical">
|
||||
|
||||
<html:iframe id="content-frame" html:name="content" html:src="about:blank" flex="100%"/>
|
||||
|
||||
<html:script>
|
||||
var bindCount = 0;
|
||||
function onStatus() {
|
||||
var status = document.getElementById("Browser:Status");
|
||||
if ( status ) {
|
||||
var text = status.getAttribute("text");
|
||||
var statusText = document.getElementById("statusText");
|
||||
if ( statusText ) {
|
||||
statusText.setAttribute( "value", text );
|
||||
}
|
||||
} else {
|
||||
dump("Can't find status broadcaster!\n");
|
||||
}
|
||||
}
|
||||
function onProgress() {
|
||||
var throbber = document.getElementById("Browser:Throbber");
|
||||
var meter = document.getElementById("Browser:LoadingProgress");
|
||||
if ( throbber && meter ) {
|
||||
var busy = throbber.getAttribute("busy");
|
||||
if ( busy == "true" ) {
|
||||
mode = "undetermined";
|
||||
} else {
|
||||
mode = "normal";
|
||||
}
|
||||
meter.setAttribute("mode",mode);
|
||||
if ( mode == "normal" ) {
|
||||
var status = document.getElementById("Browser:Status");
|
||||
if ( status ) {
|
||||
status.setAttribute("value","Document: Done");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function dumpProgress() {
|
||||
var broadcaster = document.getElementById("Browser:LoadingProgress");
|
||||
var meter = document.getElementById("meter");
|
||||
dump( "bindCount=" + bindCount + "\n" );
|
||||
dump( "broadcaster mode=" + broadcaster.getAttribute("mode") + "\n" );
|
||||
dump( "broadcaster value=" + broadcaster.getAttribute("value") + "\n" );
|
||||
dump( "meter mode=" + meter.getAttribute("mode") + "\n" );
|
||||
dump( "meter value=" + meter.getAttribute("value") + "\n" );
|
||||
}
|
||||
</html:script>
|
||||
|
||||
<box align="horizontal" id="status-bar">
|
||||
|
||||
<box id="security-box" class="insecure" align="horizontal" flex="100%">
|
||||
<box align="vertical" style="width:100px">
|
||||
<spring flex="100%"/>
|
||||
<progressmeter id="statusbar-icon" mode="normal" value="0" onclick="dumpProgress()">
|
||||
<observes element="Browser:LoadingProgress" attribute="mode"/>
|
||||
<observes element="Browser:Throbber" attribute="busy" onchange="onProgress()"/>
|
||||
</progressmeter>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
|
||||
<titledbutton id="statusText" align="right" flex="1%" value="Document: Done" style="font-family:sans-serif;font-size:2.5mm">
|
||||
<observes element="Browser:Status" attribute="value" onchange="onStatus()"/>
|
||||
</titledbutton>
|
||||
|
||||
<spring flex="100%"/>
|
||||
|
||||
<titledbutton align="right" value="Build ID: 1999040601" style="font-family:sans-serif;font-size:2.5mm;"/>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
</box>
|
||||
</window>
|
Loading…
Reference in New Issue
Block a user