зеркало из https://github.com/mozilla/pjs.git
bug 380786 - clean up xpfe/ after suite moving to toolkit, r=ted sr=Neil
This commit is contained in:
Родитель
fc40cf23b4
Коммит
089dfd0bd6
|
@ -45,7 +45,7 @@
|
|||
# http://www.worldlanguage.com/Languages/
|
||||
# http://www.rosettaproject.org/
|
||||
# http://www.sweb.cz/ls78/diacritics.htm
|
||||
# see also xpfe/global/resources/locale/en-US/languageNames.properties
|
||||
# see also toolkit/locales/en-US/chrome/global/languageNames.properties
|
||||
# and bug 178491
|
||||
#
|
||||
#ab=x-cyrillic
|
||||
|
|
|
@ -780,8 +780,6 @@ nsTextBoxFrame::UpdateAccessTitle()
|
|||
* you need to maintain same logic in following methods. See bug 324159.
|
||||
* toolkit/content/commonDialog.js (setLabelForNode)
|
||||
* toolkit/content/widgets/text.xml (formatAccessKey)
|
||||
* xpfe/global/resources/content/commonDialog.js (setLabelForNode)
|
||||
* xpfe/global/resources/content/bindings/text.xml (formatAccessKey)
|
||||
*/
|
||||
PRInt32 menuAccessKey;
|
||||
nsMenuBarListener::GetMenuAccessKey(&menuAccessKey);
|
||||
|
|
|
@ -606,19 +606,6 @@ MAKEFILES_xpfe="
|
|||
xpfe/appshell/src/Makefile
|
||||
xpfe/appshell/public/Makefile
|
||||
xpfe/bootstrap/appleevents/Makefile
|
||||
xpfe/global/Makefile
|
||||
xpfe/global/buildconfig.html
|
||||
xpfe/global/resources/Makefile
|
||||
xpfe/global/resources/content/Makefile
|
||||
xpfe/global/resources/content/os2/Makefile
|
||||
xpfe/global/resources/content/unix/Makefile
|
||||
xpfe/global/resources/locale/Makefile
|
||||
xpfe/global/resources/locale/en-US/Makefile
|
||||
xpfe/global/resources/locale/en-US/mac/Makefile
|
||||
xpfe/global/resources/locale/en-US/os2/Makefile
|
||||
xpfe/global/resources/locale/en-US/unix/Makefile
|
||||
xpfe/global/resources/locale/en-US/win/Makefile
|
||||
xpfe/communicator/Makefile
|
||||
extensions/spellcheck/Makefile
|
||||
extensions/spellcheck/hunspell/Makefile
|
||||
extensions/spellcheck/idl/Makefile
|
||||
|
|
|
@ -188,7 +188,6 @@ _g_skip_files = [
|
|||
"gfx/cairo/cairo/COPYING-MPL-1.1",
|
||||
|
||||
# Files containing global licensing information
|
||||
"xpfe/global/resources/content/license.html",
|
||||
"toolkit/content/license.html",
|
||||
|
||||
# Ben Bucksch - files are tri-licensed with an extra clause.
|
||||
|
|
|
@ -50,10 +50,6 @@ ifndef MOZ_SUNBIRD
|
|||
DIRS += browser
|
||||
endif
|
||||
|
||||
ifndef MOZ_XUL_APP
|
||||
DIRS += global communicator
|
||||
endif
|
||||
|
||||
# Because of our great use of encapsulation, there are
|
||||
# some header file in xpfe/components that are required
|
||||
# by layout and the dom. This MOZ_XPFE_COMPONENTS, if
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# 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 the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DEFINES += -DMOZ_APP_VERSION=$(MOZ_APP_VERSION)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -1,52 +0,0 @@
|
|||
comm.jar:
|
||||
#ifdef MOZ_XUL_APP
|
||||
% content communicator-platform %content/communicator-platform/ platform xpcnativewrappers=yes
|
||||
% content communicator-region %content/communicator-region/ xpcnativewrappers=yes
|
||||
% content communicator %content/communicator/ xpcnativewrappers=yes
|
||||
#else
|
||||
* content/communicator-platform/contents.rdf (resources/content/contents-platform.rdf)
|
||||
* content/communicator-region/contents.rdf (resources/content/contents-region.rdf)
|
||||
* content/communicator/contents.rdf (resources/content/contents.rdf)
|
||||
#endif
|
||||
content/communicator/communicator.css (resources/content/communicator.css)
|
||||
content/communicator/utilityOverlay.xul (resources/content/utilityOverlay.xul)
|
||||
content/communicator/utilityOverlay.js (resources/content/utilityOverlay.js)
|
||||
content/communicator/openLocation.js (resources/content/openLocation.js)
|
||||
content/communicator/openLocation.xul (resources/content/openLocation.xul)
|
||||
content/communicator/tasksOverlay.js (resources/content/tasksOverlay.js)
|
||||
content/communicator/tasksOverlay.xul (resources/content/tasksOverlay.xul)
|
||||
content/communicator/editorBindings.xul (resources/content/editorBindings.xul)
|
||||
#ifdef XP_MACOSX
|
||||
content/communicator/platformBrowserBindings.xul (resources/content/mac/platformBrowserBindings.xul)
|
||||
content/communicator/platformEditorBindings.xul (resources/content/mac/platformEditorBindings.xul)
|
||||
content/communicator/platformCommunicatorOverlay.xul (resources/content/mac/platformCommunicatorOverlay.xul)
|
||||
#else
|
||||
#ifdef XP_WIN32
|
||||
content/communicator/platformBrowserBindings.xul (resources/content/win/platformBrowserBindings.xul)
|
||||
content/communicator/platformEditorBindings.xul (resources/content/win/platformEditorBindings.xul)
|
||||
content/communicator/platformCommunicatorOverlay.xul (resources/content/win/platformCommunicatorOverlay.xul)
|
||||
#else
|
||||
#ifdef XP_OS2
|
||||
content/communicator/platformBrowserBindings.xul (resources/content/win/platformBrowserBindings.xul)
|
||||
content/communicator/platformEditorBindings.xul (resources/content/win/platformEditorBindings.xul)
|
||||
content/communicator/platformCommunicatorOverlay.xul (resources/content/win/platformCommunicatorOverlay.xul)
|
||||
#else
|
||||
content/communicator/platformBrowserBindings.xul (resources/content/unix/platformBrowserBindings.xul)
|
||||
content/communicator/platformEditorBindings.xul (resources/content/unix/platformEditorBindings.xul)
|
||||
content/communicator/platformCommunicatorOverlay.xul (resources/content/unix/platformCommunicatorOverlay.xul)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
content/communicator/builtinURLs.js (resources/content/builtinURLs.js)
|
||||
content/communicator/contentAreaUtils.js (resources/content/contentAreaUtils.js)
|
||||
content/communicator/contentAreaDD.js (resources/content/contentAreaDD.js)
|
||||
content/communicator/contentAreaClick.js (resources/content/contentAreaClick.js)
|
||||
content/communicator/contentAreaContextOverlay.xul (resources/content/contentAreaContextOverlay.xul)
|
||||
content/communicator/nsContextMenu.js (resources/content/nsContextMenu.js)
|
||||
content/communicator/viewZoomOverlay.xul (resources/content/viewZoomOverlay.xul)
|
||||
content/communicator/viewZoomOverlay.js (resources/content/viewZoomOverlay.js)
|
||||
content/communicator/askViewZoom.xul (resources/content/askViewZoom.xul)
|
||||
content/communicator/askViewZoom.js (resources/content/askViewZoom.js)
|
||||
content/communicator/findUtils.js (resources/content/findUtils.js)
|
||||
content/communicator/printPreviewBindings.xml (resources/content/printPreviewBindings.xml)
|
||||
content/communicator/printing.js (resources/content/printing.js)
|
|
@ -1,102 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- 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 the Initial Developer are Copyright (C) 2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://navigator/skin/navigator.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % aboutPopupsDTD SYSTEM "chrome://communicator/locale/aboutPopups.dtd" >
|
||||
%aboutPopupsDTD;
|
||||
]>
|
||||
|
||||
<dialog id="aboutPopups"
|
||||
buttonpack="center"
|
||||
buttons="accept,cancel,help"
|
||||
buttonlabelaccept="&acceptButton.label;"
|
||||
buttonlabelcancel="&cancelButton.label;"
|
||||
title="&windowtitle.label;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
style="width: 30em;"
|
||||
onload="init();"
|
||||
ondialogaccept="return onAccept();"
|
||||
ondialoghelp="return doHelpButton();">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://help/content/contextHelp.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/utilityOverlay.js"/>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
|
||||
var enableBlock = true;
|
||||
|
||||
function init() {
|
||||
if (!window.arguments[0])
|
||||
document.getElementById("popupDesc").hidden = true;
|
||||
else
|
||||
document.getElementById("popupDescAlt").hidden = true;
|
||||
}
|
||||
|
||||
function onAccept() {
|
||||
var pref;
|
||||
try {
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
pref = prefService.getBranch(null);
|
||||
}
|
||||
catch(ex) { }
|
||||
|
||||
goPreferences("securityItem", "chrome://cookie/content/pref-popups.xul", "popupspref");
|
||||
}
|
||||
|
||||
function doHelpButton() {
|
||||
openHelp("pop_up_blocking");
|
||||
return true;
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<description id="popupDesc">&popupDesc.label;</description>
|
||||
<description id="popupDescAlt">&popupDescAlt.label;</description>
|
||||
<vbox align="center">
|
||||
<image id="popupImage"/>
|
||||
</vbox>
|
||||
<description>&popupNote1.label;</description>
|
||||
<separator class="thin"/>
|
||||
<description>&popupNote2.label;</description>
|
||||
</dialog>
|
|
@ -1,77 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 this file as it was released upon September 7, 2000.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Peter Annema.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var dialog;
|
||||
var args;
|
||||
|
||||
function onLoad() {
|
||||
args = window.arguments[0];
|
||||
args.zoomOK = false;
|
||||
|
||||
dialog = {};
|
||||
dialog.OKButton = document.documentElement.getButton("accept");
|
||||
|
||||
dialog.input = document.getElementById("zoomValue");
|
||||
dialog.input.value = args.value;
|
||||
dialog.input.select();
|
||||
dialog.input.focus();
|
||||
|
||||
moveToAlertPosition();
|
||||
doEnabling();
|
||||
}
|
||||
|
||||
function onAccept() {
|
||||
var zoom = parseFloat(dialog.input.value);
|
||||
if (!isNaN(zoom) && zoom >= args.zoomMin && zoom <= args.zoomMax) {
|
||||
args.value = zoom;
|
||||
args.zoomOK = true;
|
||||
}
|
||||
return args.zoomOK;
|
||||
}
|
||||
|
||||
function doEnabling() {
|
||||
var enable = false;
|
||||
if (dialog.input.value) {
|
||||
var zoom = parseFloat(dialog.input.value);
|
||||
if (!isNaN(zoom) && zoom >= args.zoomMin && zoom <= args.zoomMax)
|
||||
enable = true;
|
||||
}
|
||||
|
||||
dialog.OKButton.disabled = !enable;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- 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 this file as it was released on September 7, 2000.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Peter Annema.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2000
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Peter Annema <disttsc@bart.nl> (Original Author)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
- or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://navigator/skin/navigator.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog SYSTEM "chrome://communicator/locale/askViewZoom.dtd">
|
||||
|
||||
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="askViewZoom"
|
||||
title="&askViewZoom.title;"
|
||||
ondialogaccept="return onAccept();"
|
||||
onload="onLoad();">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/askViewZoom.js"/>
|
||||
|
||||
<hbox>
|
||||
<label value="&selectZoom.label;"/>
|
||||
</hbox>
|
||||
|
||||
<hbox>
|
||||
<textbox id="zoomValue" oninput="doEnabling();"/>
|
||||
</hbox>
|
||||
|
||||
</dialog>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xul-overlay href="chrome://communicator/content/platformCommunicatorOverlay.xul"?>
|
||||
|
||||
<window id="browserBindings"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
</window>
|
|
@ -1,167 +0,0 @@
|
|||
// the rdf service
|
||||
var gRDFService;
|
||||
var gTitleArc;
|
||||
var gContentArc;
|
||||
var gBuiltinUrlsDataSource;
|
||||
var gDataSourceState;
|
||||
var gDataSourceLoaded;
|
||||
var gSinkObserverRegistered;
|
||||
|
||||
var SinkObserver =
|
||||
{
|
||||
onBeginLoad: function( aSink) {
|
||||
gDataSourceState = (gDataSourceState | 1);
|
||||
debug_dump("\n-> SinkObserver:onBeginLoad: " + aSink + ", gDataSourceState=" + gDataSourceState + "\n");
|
||||
},
|
||||
|
||||
onInterrupt: function( aSink) {
|
||||
gDataSourceState = (gDataSourceState | 2);
|
||||
debug_dump("\n-> SinkObserver:onInterrupt: " + aSink + ", gDataSourceState=" + gDataSourceState + "\n");
|
||||
},
|
||||
|
||||
onResume: function( aSink) {
|
||||
gDataSourceState = (gDataSourceState & ~2);
|
||||
debug_dump("\n-> SinkObserver:onResume: " + aSink + ", gDataSourceState=" + gDataSourceState + "\n");
|
||||
},
|
||||
|
||||
onEndLoad: function( aSink) {
|
||||
gDataSourceState = (gDataSourceState | 4);
|
||||
gDataSourceLoaded = (gDataSourceState == 5);
|
||||
|
||||
debug_dump("\n-> onEndLoad: " + aSink + ", gDataSourceState=" + gDataSourceState + ", gDataSourceLoaded=" + gDataSourceLoaded + "\n");
|
||||
|
||||
if (!gDataSourceLoaded) {
|
||||
debug_dump("\n-> builtin URLs not loaded!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gBuiltinUrlsDataSource = aSink.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
|
||||
debug_dump("Got gBuiltinUrlsDataSource " + gBuiltinUrlsDataSource + " with gTitleArc " + gTitleArc + " and gContentArc " + gContentArc + "\n");
|
||||
},
|
||||
|
||||
onError: function( aSink, aStatus, aErrMsg) {
|
||||
gDataSourceState = (gDataSourceState | 8);
|
||||
debug_dump("\n-> SinkObserver:onError: " + aSink + ", status=" + aStatus +
|
||||
", errMsg=" + aErrMsg + ", gDataSourceState=" + gDataSourceState + "\n");
|
||||
}
|
||||
};
|
||||
|
||||
function debug_dump(msg)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
function debug_dump(msg)
|
||||
{
|
||||
dump(msg);
|
||||
}
|
||||
*/
|
||||
|
||||
function loadDS()
|
||||
{
|
||||
debug_dump("\n-->loadDS() called for " + window.document + " <--\n");
|
||||
if (gBuiltinUrlsDataSource && gDataSourceLoaded) {
|
||||
debug_dump("\n-->loadDS(): gBuiltinUrlsDataSource=" + gBuiltinUrlsDataSource + ", gDataSourceLoaded=" + gDataSourceLoaded + ", returning! <--\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (gSinkObserverRegistered)
|
||||
{
|
||||
debug_dump("Already registered SinkObserver in loadDS()\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// initialize
|
||||
gRDFService = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService();
|
||||
gRDFService = gRDFService.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
|
||||
if (!gRDFService) {
|
||||
debug_dump("\n-->loadDS(): gRDFService service is null!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gTitleArc = gRDFService.GetResource("http://home.netscape.com/NC-rdf#title");
|
||||
gContentArc = gRDFService.GetResource("http://home.netscape.com/NC-rdf#content");
|
||||
|
||||
var ds_uri = "chrome://global-region/locale/builtinURLs.rdf";
|
||||
var url_ds = gRDFService.GetDataSource(ds_uri); // return nsIRDFDataSource
|
||||
if (!url_ds) {
|
||||
debug_dump("\n >>Can't get " + ds_uri + "<-\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (url_ds.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).loaded)
|
||||
{
|
||||
ds_uri = "chrome://global-region/locale/builtinURLs.rdf";
|
||||
gBuiltinUrlsDataSource = gRDFService.GetDataSource(ds_uri); // return nsIRDFDataSource
|
||||
gDataSourceLoaded = (gBuiltinUrlsDataSource != null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var rdfXMLSink = url_ds.QueryInterface( Components.interfaces.nsIRDFXMLSink );
|
||||
if (rdfXMLSink) {
|
||||
gBuiltinUrlsDataSource = null;
|
||||
gDataSourceState = 0x0; // init.
|
||||
gDataSourceLoaded = false;
|
||||
gSinkObserverRegistered = true;
|
||||
|
||||
rdfXMLSink.addXMLSinkObserver(SinkObserver);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_dump("rdfXMLSink is null\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function xlateURL(key)
|
||||
{
|
||||
debug_dump("\n>> xlateURL(" + key + "): gBuiltinUrlsDataSource=" + gBuiltinUrlsDataSource + ", gDataSourceLoaded=" + gDataSourceLoaded + "\n");
|
||||
|
||||
if (!gBuiltinUrlsDataSource || !gDataSourceLoaded) {
|
||||
throw("urn translation data source not loaded");
|
||||
}
|
||||
// get data
|
||||
var srcNode = gRDFService.GetResource(key);
|
||||
var titleTarget = gBuiltinUrlsDataSource.GetTarget(srcNode, gTitleArc, true);
|
||||
if (titleTarget) {
|
||||
titleTarget =
|
||||
titleTarget.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
debug_dump("\n-> " + key + "::title=" + titleTarget.Value);
|
||||
}
|
||||
else {
|
||||
debug_dump("\n title target=" + titleTarget + "\n");
|
||||
}
|
||||
|
||||
var contentTarget = gBuiltinUrlsDataSource.GetTarget(srcNode, gContentArc, true);
|
||||
if (contentTarget) {
|
||||
contentTarget =
|
||||
contentTarget.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
debug_dump("\n-> " + key + "::content=" + contentTarget.Value + "\n");
|
||||
return contentTarget.Value;
|
||||
}
|
||||
else {
|
||||
debug_dump("\n content target=" + contentTarget + "\n");
|
||||
throw("urn not found in datasource");
|
||||
}
|
||||
|
||||
// not reached
|
||||
return "";
|
||||
}
|
||||
|
||||
function loadXURL(key)
|
||||
{
|
||||
debug_dump("loadXURL call with " + key + "\n");
|
||||
|
||||
var url = xlateURL(key);
|
||||
//check to see if this is a browser window before opening.
|
||||
var winType = document.documentElement.getAttribute("windowtype");
|
||||
|
||||
if (window.content && winType == "navigator:browser")
|
||||
window.content.location.href = url;
|
||||
else
|
||||
window.open(url); // on mac, there maybe no open windows: see bug 83329
|
||||
}
|
||||
|
||||
loadDS();
|
|
@ -1,84 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
* Karsten Düsterloh <mnyromyr@tprac.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
/* ::::: print preview toolbar ::::: */
|
||||
|
||||
toolbar[printpreview="true"] {
|
||||
-moz-binding: url("chrome://communicator/content/printPreviewBindings.xml#printpreviewtoolbar");
|
||||
}
|
||||
|
||||
|
||||
/* With the move to the new toolkit, SeaMonkey needs to overwrite certain bindings
|
||||
* if it wants to keep its distinctive likeness. The now hidden new toolkit bindings
|
||||
* will stay accessible via a set xpfe="false" attribute, though, where necessary.
|
||||
*/
|
||||
|
||||
/******* toolkit access layer *******/
|
||||
/* These rules' content needs to be a verbatim copy of those in toolkit's xul.css! */
|
||||
toolbox[xpfe="false"] {
|
||||
-moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbox");
|
||||
-moz-box-orient: vertical;
|
||||
}
|
||||
|
||||
toolbar[xpfe="false"] {
|
||||
-moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar");
|
||||
}
|
||||
|
||||
menubar[xpfe="false"] {
|
||||
-moz-binding: url("chrome://global/content/bindings/toolbar.xml#menubar");
|
||||
}
|
||||
|
||||
/******* SeaMonkey XPFE *******/
|
||||
/* These bindings reflect SeaMonkey XPFE, modulo new toolkit features. */
|
||||
toolbox {
|
||||
-moz-binding: url("chrome://communicator/content/bindings/toolbar.xml#grippytoolbox");
|
||||
}
|
||||
|
||||
toolbar {
|
||||
-moz-binding: url("chrome://communicator/content/bindings/toolbar.xml#grippytoolbar");
|
||||
}
|
||||
|
||||
toolbargrippy {
|
||||
-moz-binding: url("chrome://communicator/content/bindings/toolbar.xml#toolbargrippy");
|
||||
}
|
||||
|
||||
menubar {
|
||||
-moz-binding: url("chrome://communicator/content/bindings/toolbar.xml#grippymenubar");
|
||||
}
|
|
@ -1,436 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
* Ben Goodger <ben@netscape.com>
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
* Blake Ross <blakeross@telocity.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* - [ Dependencies ] ---------------------------------------------------------
|
||||
* utilityOverlay.js:
|
||||
* - gatherTextUnder
|
||||
* - startScrolling
|
||||
*/
|
||||
|
||||
var pref = null;
|
||||
pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
// Prefill a single text field
|
||||
function prefillTextBox(target) {
|
||||
// obtain values to be used for prefilling
|
||||
var walletService = Components.classes["@mozilla.org/wallet/wallet-service;1"].getService(Components.interfaces.nsIWalletService);
|
||||
var value = walletService.WALLET_PrefillOneElement(window.content, target);
|
||||
if (value) {
|
||||
|
||||
// result is a linear sequence of values, each preceded by a separator character
|
||||
// convert linear sequence of values into an array of values
|
||||
var separator = value[0];
|
||||
var valueList = value.substring(1, value.length).split(separator);
|
||||
|
||||
target.value = valueList[0];
|
||||
/*
|
||||
* Following code is a replacement for above line. In the case of multiple values, it
|
||||
* presents the user with a dialog containing a list from which he can select the value
|
||||
* he wants. However it is being commented out for now because of several problems, namely
|
||||
*
|
||||
* 1. There is no easy way to put localizable strings for the title and message of
|
||||
* the dialog without introducing a .properties file which currently doesn't exist
|
||||
* 2. Using blank title and messages as shown below have a problem because a zero-length
|
||||
* title is being displayed as some garbage characters (which is why the code below
|
||||
* has a title of " " instead of ""). This is a separate bug which will have to be
|
||||
* investigated further.
|
||||
* 3. The current wallet tables present alternate values for items such as shipping
|
||||
* address -- namely billing address and home address. Up until now, these alternate
|
||||
* values have never been a problem because the preferred value is always first and is
|
||||
* all the user sees when doing a prefill. However now he will be presented with a
|
||||
* list showing all these values and asking him to pick one, even though the wallet
|
||||
* code was clearly able to determine that he meant shipping address and not billing
|
||||
* address.
|
||||
* 4. There is a relatively long delay before the dialog come up whereas values are
|
||||
* filled in quickly when no dialog is involved.
|
||||
*
|
||||
* Once this feature is checked in, a separate bug will be opened asking that the above
|
||||
* problems be examined and this dialog turned on
|
||||
|
||||
if (valueList.length == 1) {
|
||||
// only one value, use it for prefilling
|
||||
target.value = valueList[0];
|
||||
} else {
|
||||
|
||||
// more than one value, have user select the one he wants
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
|
||||
promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService);
|
||||
var position = {};
|
||||
var title = " ";
|
||||
var message = "";
|
||||
var ok =
|
||||
promptService.select
|
||||
(window, title, message, valueList.length, valueList, position)
|
||||
if (ok) {
|
||||
target.value = valueList[position.value];
|
||||
}
|
||||
}
|
||||
|
||||
* End of commented out code
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
function hrefAndLinkNodeForClickEvent(event)
|
||||
{
|
||||
var target = event.target;
|
||||
var href = "";
|
||||
var linkNode = null;
|
||||
|
||||
var isKeyPress = (event.type == "keypress");
|
||||
|
||||
if ( target instanceof HTMLAnchorElement ||
|
||||
target instanceof HTMLAreaElement ||
|
||||
target instanceof HTMLLinkElement ) {
|
||||
if (target.hasAttribute("href"))
|
||||
linkNode = target;
|
||||
}
|
||||
else if ( target instanceof HTMLInputElement
|
||||
&& (event.target.type == "text") // text field
|
||||
&& !isKeyPress // not a key event
|
||||
&& event.detail == 2 // double click
|
||||
&& event.button == 0 // left mouse button
|
||||
&& event.target.value.length == 0 // no text has been entered
|
||||
&& "@mozilla.org/wallet/wallet-service;1" in Components.classes // wallet is available
|
||||
) {
|
||||
prefillTextBox(target); // prefill the empty text field if possible
|
||||
}
|
||||
else {
|
||||
linkNode = event.originalTarget;
|
||||
while (linkNode && !(linkNode instanceof HTMLAnchorElement))
|
||||
linkNode = linkNode.parentNode;
|
||||
// <a> cannot be nested. So if we find an anchor without an
|
||||
// href, there is no useful <a> around the target
|
||||
if (linkNode && !linkNode.hasAttribute("href"))
|
||||
linkNode = null;
|
||||
}
|
||||
|
||||
if (linkNode) {
|
||||
href = linkNode.href;
|
||||
} else {
|
||||
// Try simple XLink
|
||||
linkNode = target;
|
||||
while (linkNode) {
|
||||
if (linkNode.nodeType == Node.ELEMENT_NODE) {
|
||||
href = linkNode.getAttributeNS("http://www.w3.org/1999/xlink", "href");
|
||||
break;
|
||||
}
|
||||
linkNode = linkNode.parentNode;
|
||||
}
|
||||
if (href) {
|
||||
href = makeURLAbsolute(linkNode.baseURI, href);
|
||||
}
|
||||
}
|
||||
|
||||
return href ? {href: href, linkNode: linkNode} : null;
|
||||
}
|
||||
|
||||
// Called whenever the user clicks in the content area,
|
||||
// except when left-clicking on links (special case)
|
||||
// should always return true for click to go through
|
||||
function contentAreaClick(event)
|
||||
{
|
||||
if (!event.isTrusted || event.getPreventDefault()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var isKeyPress = (event.type == "keypress");
|
||||
var ceParams = hrefAndLinkNodeForClickEvent(event);
|
||||
if (ceParams) {
|
||||
var href = ceParams.href;
|
||||
if (isKeyPress) {
|
||||
openNewTabWith(href, true, event.shiftKey);
|
||||
event.stopPropagation();
|
||||
}
|
||||
else {
|
||||
handleLinkClick(event, href, ceParams.linkNode);
|
||||
// if in mailnews block the link left click if we determine
|
||||
// that this URL is phishy (i.e. a potential email scam)
|
||||
if ("gMessengerBundle" in this && !event.button)
|
||||
return !isPhishingURL(ceParams.linkNode, false, href);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pref && !isKeyPress && event.button == 1 &&
|
||||
pref.getBoolPref("middlemouse.contentLoadURL")) {
|
||||
if (middleMousePaste(event)) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function contentAreaMouseDown(event)
|
||||
{
|
||||
if (event.button == 1 && (event.target != event.currentTarget)
|
||||
&& !hrefAndLinkNodeForClickEvent(event)
|
||||
&& !isAutoscrollBlocker(event.originalTarget)) {
|
||||
startScrolling(event);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function isAutoscrollBlocker(node)
|
||||
{
|
||||
if (!pref)
|
||||
return false;
|
||||
|
||||
if (pref.getBoolPref("middlemouse.contentLoadURL"))
|
||||
return true;
|
||||
|
||||
if (!pref.getBoolPref("middlemouse.paste"))
|
||||
return false;
|
||||
|
||||
if (node.ownerDocument.designMode == "on")
|
||||
return true;
|
||||
|
||||
while (node) {
|
||||
if (node instanceof HTMLTextAreaElement ||
|
||||
(node instanceof HTMLInputElement &&
|
||||
(node.type == "text" || node.type == "password")))
|
||||
return true;
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function openNewTabOrWindow(event, href, sendReferrer)
|
||||
{
|
||||
// should we open it in a new tab?
|
||||
if (pref && pref.getBoolPref("browser.tabs.opentabfor.middleclick")) {
|
||||
openNewTabWith(href, sendReferrer, event.shiftKey);
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
}
|
||||
|
||||
// should we open it in a new window?
|
||||
if (pref && pref.getBoolPref("middlemouse.openNewWindow")) {
|
||||
openNewWindowWith(href, sendReferrer);
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
}
|
||||
|
||||
// let someone else deal with it
|
||||
return false;
|
||||
}
|
||||
|
||||
function handleLinkClick(event, href, linkNode)
|
||||
{
|
||||
// Make sure we are allowed to open this URL
|
||||
urlSecurityCheck(href, document);
|
||||
|
||||
switch (event.button) {
|
||||
case 0: // if left button clicked
|
||||
if (event.metaKey || event.ctrlKey) { // and meta or ctrl are down
|
||||
if (openNewTabOrWindow(event, href, true))
|
||||
return true;
|
||||
}
|
||||
var saveModifier = true;
|
||||
if (pref) {
|
||||
try {
|
||||
saveModifier = pref.getBoolPref("ui.key.saveLink.shift");
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
}
|
||||
saveModifier = saveModifier ? event.shiftKey : event.altKey;
|
||||
|
||||
if (saveModifier) { // if saveModifier is down
|
||||
saveURL(href, linkNode ? gatherTextUnder(linkNode) : "",
|
||||
"SaveLinkTitle", false, getReferrer(document));
|
||||
return true;
|
||||
}
|
||||
if (event.altKey) // if alt is down
|
||||
return true; // do nothing
|
||||
return false;
|
||||
case 1: // if middle button clicked
|
||||
if (openNewTabOrWindow(event, href, true))
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function middleMousePaste( event )
|
||||
{
|
||||
var url = readFromClipboard();
|
||||
if (!url)
|
||||
return false;
|
||||
addToUrlbarHistory(url);
|
||||
url = getShortcutOrURI(url);
|
||||
|
||||
// On ctrl-middleclick, open in new window or tab. Do not send referrer.
|
||||
if (event.ctrlKey) {
|
||||
// fix up our pasted URI in case it is malformed.
|
||||
const nsIURIFixup = Components.interfaces.nsIURIFixup;
|
||||
if (!gURIFixup)
|
||||
gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
|
||||
.getService(nsIURIFixup);
|
||||
|
||||
url = gURIFixup.createFixupURI(url, nsIURIFixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI).spec;
|
||||
|
||||
return openNewTabOrWindow(event, url, false);
|
||||
}
|
||||
|
||||
// If ctrl wasn't down, then just load the url in the targeted win/tab.
|
||||
var browser = getBrowser();
|
||||
var tab = event.originalTarget;
|
||||
if (tab.localName == "tab" &&
|
||||
tab.parentNode == browser.mTabContainer) {
|
||||
tab.linkedBrowser.userTypedValue = url;
|
||||
if (tab == browser.mCurrentTab && url != "about:blank") {
|
||||
gURLBar.value = url;
|
||||
}
|
||||
tab.linkedBrowser.loadURI(url);
|
||||
if (event.shiftKey != (pref && pref.getBoolPref("browser.tabs.loadInBackground")))
|
||||
browser.selectedTab = tab;
|
||||
}
|
||||
else if (event.target == browser) {
|
||||
tab = browser.addTab(url);
|
||||
if (event.shiftKey != (pref && pref.getBoolPref("browser.tabs.loadInBackground")))
|
||||
browser.selectedTab = tab;
|
||||
}
|
||||
else {
|
||||
if (url != "about:blank") {
|
||||
gURLBar.value = url;
|
||||
}
|
||||
loadURI(url);
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
}
|
||||
|
||||
function addToUrlbarHistory(aUrlToAdd)
|
||||
{
|
||||
// Remove leading and trailing spaces first
|
||||
aUrlToAdd = aUrlToAdd.replace(/^\s+/, '').replace(/\s+$/, '');
|
||||
|
||||
if (!aUrlToAdd)
|
||||
return;
|
||||
if (aUrlToAdd.search(/[\x00-\x1F]/) != -1) // don't store bad URLs
|
||||
return;
|
||||
|
||||
if (!gRDF)
|
||||
gRDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||
.getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
if (!gGlobalHistory)
|
||||
gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
|
||||
.getService(Components.interfaces.nsIBrowserHistory);
|
||||
|
||||
if (!gURIFixup)
|
||||
gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
|
||||
.getService(Components.interfaces.nsIURIFixup);
|
||||
if (!gLocalStore)
|
||||
gLocalStore = gRDF.GetDataSource("rdf:local-store");
|
||||
|
||||
if (!gRDFC)
|
||||
gRDFC = Components.classes["@mozilla.org/rdf/container-utils;1"]
|
||||
.getService(Components.interfaces.nsIRDFContainerUtils);
|
||||
|
||||
var entries = gRDFC.MakeSeq(gLocalStore, gRDF.GetResource("nc:urlbar-history"));
|
||||
if (!entries)
|
||||
return;
|
||||
var elements = entries.GetElements();
|
||||
if (!elements)
|
||||
return;
|
||||
var index = 0;
|
||||
|
||||
var urlToCompare = aUrlToAdd.toUpperCase();
|
||||
while(elements.hasMoreElements()) {
|
||||
var entry = elements.getNext();
|
||||
if (!entry) continue;
|
||||
|
||||
index ++;
|
||||
try {
|
||||
entry = entry.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
} catch(ex) {
|
||||
// XXXbar not an nsIRDFLiteral for some reason. see 90337.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (urlToCompare == entry.Value.toUpperCase()) {
|
||||
// URL already present in the database
|
||||
// Remove it from its current position.
|
||||
// It is inserted to the top after the while loop.
|
||||
entries.RemoveElementAt(index, true);
|
||||
break;
|
||||
}
|
||||
} // while
|
||||
|
||||
// Otherwise, we've got a new URL in town. Add it!
|
||||
|
||||
try {
|
||||
var url = getShortcutOrURI(aUrlToAdd);
|
||||
var fixedUpURI = gURIFixup.createFixupURI(url, 0);
|
||||
if (!fixedUpURI.schemeIs("data"))
|
||||
gGlobalHistory.markPageAsTyped(fixedUpURI);
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
|
||||
// Put the value as it was typed by the user in to RDF
|
||||
// Insert it to the beginning of the list.
|
||||
var entryToAdd = gRDF.GetLiteral(aUrlToAdd);
|
||||
entries.InsertElementAt(entryToAdd, 1, true);
|
||||
|
||||
// Remove any expired history items so that we don't let
|
||||
// this grow without bound.
|
||||
for (index = entries.GetCount(); index > MAX_URLBAR_HISTORY_ITEMS; --index) {
|
||||
entries.RemoveElementAt(index, true);
|
||||
} // for
|
||||
}
|
||||
|
||||
function makeURLAbsolute(base, url)
|
||||
{
|
||||
// Construct nsIURL.
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var baseURI = ioService.newURI(base, null, null);
|
||||
|
||||
return ioService.newURI(baseURI.resolve(url), null, null).spec;
|
||||
}
|
|
@ -1,265 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- 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 Communicator client code, released
|
||||
- March 31, 1998.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Blake Ross <blakeross@telocity.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
- or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
<!DOCTYPE overlay SYSTEM "chrome://communicator/locale/contentAreaCommands.dtd" >
|
||||
<overlay id="contentAreaContextOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- Context menu -->
|
||||
<!-- XXX: Replace strres.js when nsContextMenu.js is converted -->
|
||||
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="application/x-javascript">
|
||||
// Global variable that holds the nsContextMenu instance.
|
||||
var gContextMenu = null;
|
||||
|
||||
// Global variable that caches the default search engine info
|
||||
var gDefaultEngine = null;
|
||||
</script>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/nsContextMenu.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaUtils.js"/>
|
||||
|
||||
<popupset id="contentAreaContextSet">
|
||||
<!-- This is a generic context menu for a content area. It contains
|
||||
each and every possible menu choice. The appropriate items are
|
||||
hidden/shown upon display, based on what the user has clicked-on.
|
||||
-->
|
||||
<popup id="contentAreaContextMenu"
|
||||
onpopupshowing="if (event.target != this) return true; gContextMenu = new nsContextMenu( this ); return gContextMenu.shouldDisplay;"
|
||||
onpopuphiding="if (event.target == this) gContextMenu = null;">
|
||||
<menuitem id="popupwindow-reject"
|
||||
label="&popupWindowRejectCmd.label;"
|
||||
accesskey="&popupWindowRejectCmd.accesskey;"
|
||||
oncommand="gContextMenu.rejectPopupWindows(event.shiftKey);"/>
|
||||
<menuitem id="popupwindow-allow"
|
||||
label="&popupWindowAllowCmd.label;"
|
||||
accesskey="&popupWindowAllowCmd.accesskey;"
|
||||
oncommand="gContextMenu.allowPopupWindows();"/>
|
||||
<menuseparator id="context-sep-popup"/>
|
||||
|
||||
<menuitem id="context-openlink"
|
||||
label="&openLinkCmd.label;"
|
||||
accesskey="&openLinkCmd.accesskey;"
|
||||
oncommand="gContextMenu.openLink();"/>
|
||||
<menuitem id="context-openlinkintab"
|
||||
label="&openLinkCmdInTab.label;"
|
||||
accesskey="&openLinkCmdInTab.accesskey;"
|
||||
oncommand="gContextMenu.openLinkInTab(event.shiftKey);"/>
|
||||
<menuseparator id="context-sep-open"/>
|
||||
<menuitem id="context-bookmarklink"
|
||||
label="&bookmarkLinkCmd.label;"
|
||||
accesskey="&bookmarkLinkCmd.accesskey;"
|
||||
oncommand="BookmarksUtils.addBookmark(gContextMenu.linkURL(),
|
||||
gContextMenu.linkText(),
|
||||
undefined, false);"/>
|
||||
<menuitem id="context-savelink"
|
||||
valueSaveAs="&saveLinkAsCmd.label;"
|
||||
valueSave="&saveLinkCmd.label;"
|
||||
accesskey="&saveLinkCmd.accesskey;"
|
||||
oncommand="gContextMenu.saveLink();"/>
|
||||
<menuitem id="context-copyemail"
|
||||
label="©EmailCmd.label;"
|
||||
accesskey="©EmailCmd.accesskey;"
|
||||
oncommand="gContextMenu.copyEmail();"/>
|
||||
<menuitem id="context-copylink"
|
||||
label="©LinkCmd.label;"
|
||||
accesskey="©LinkCmd.accesskey;"
|
||||
command="cmd_copyLink"/>
|
||||
<menuseparator id="context-sep-copylink"/>
|
||||
<menuitem id="context-fitimage"
|
||||
type="checkbox"
|
||||
label="&fitImageCmd.label;"
|
||||
accesskey="&fitImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.toggleImageSize();"/>
|
||||
<menuitem id="context-reloadimage"
|
||||
label="&reloadImageCmd.label;"
|
||||
accesskey="&reloadImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.reloadImage();"/>
|
||||
<menuitem id="context-viewimage"
|
||||
label="&viewImageCmd.label;"
|
||||
accesskey="&viewImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewImage();"/>
|
||||
<menuitem id="context-copyimage"
|
||||
label="©ImageCmd.label;"
|
||||
accesskey="©ImageCmd.accesskey;"
|
||||
command="cmd_copyImage"/>
|
||||
<menuseparator id="context-sep-copyimage"/>
|
||||
<menuitem id="context-saveimage"
|
||||
valueSaveAs="&saveImageAsCmd.label;"
|
||||
valueSave="&saveImageCmd.label;"
|
||||
accesskey="&saveImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.saveImage();"/>
|
||||
<menuitem id="context-setWallpaper"
|
||||
label="&setWallpaperCmd.label;"
|
||||
accesskey="&setWallpaperCmd.accesskey;"
|
||||
oncommand="gContextMenu.setWallpaper();"/>
|
||||
<menuseparator id="context-sep-image"/>
|
||||
<menuitem id="context-back"
|
||||
label="&goBackCmd.label;"
|
||||
accesskey="&goBackCmd.accesskey;"
|
||||
oncommand="BrowserBack()"/>
|
||||
<menuitem id="context-forward"
|
||||
label="&goForwardCmd.label;"
|
||||
accesskey="&goForwardCmd.accesskey;"
|
||||
oncommand="BrowserForward()"/>
|
||||
<menuitem id="context-reload"
|
||||
label="&reloadCmd.label;"
|
||||
accesskey="&reloadCmd.accesskey;"
|
||||
oncommand="BrowserReload();"/>
|
||||
<menuitem id="context-stop"
|
||||
label="&stopCmd.label;"
|
||||
accesskey="&stopCmd.accesskey;"
|
||||
disabled="true"
|
||||
oncommand="BrowserStop();"/>
|
||||
<menuseparator id="context-sep-stop"/>
|
||||
<menuitem id="context-bookmarkpage"
|
||||
label="&bookmarkPageCmd.label;"
|
||||
accesskey="&bookmarkPageCmd.accesskey;"
|
||||
oncommand="gContextMenu.addBookmark();"/>
|
||||
<menuitem id="context-savepage"
|
||||
valueSaveAs="&savePageAsCmd.label;"
|
||||
valueSave="&savePageCmd.label;"
|
||||
accesskey="&savePageCmd.accesskey;"
|
||||
oncommand="saveDocument(window.content.document);"/>
|
||||
<menuseparator id="context-sep-viewbgimage"/>
|
||||
<menuitem id="context-viewbgimage"
|
||||
label="&viewBGImageCmd.label;"
|
||||
accesskey="&viewBGImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewBGImage();"/>
|
||||
<menuitem id="context-undo"
|
||||
label="&undoCmd.label;"
|
||||
accesskey="&undoCmd.accesskey;"
|
||||
command="cmd_undo"/>
|
||||
<menuitem id="context-redo"
|
||||
label="&redoCmd.label;"
|
||||
accesskey="&redoCmd.accesskey;"
|
||||
command="cmd_redo"/>
|
||||
<menuseparator id="context-sep-undo"/>
|
||||
<menuitem id="context-cut"
|
||||
label="&cutCmd.label;"
|
||||
accesskey="&cutCmd.accesskey;"
|
||||
command="cmd_cut"/>
|
||||
<menuitem id="context-copy"
|
||||
label="©Cmd.label;"
|
||||
accesskey="©Cmd.accesskey;"
|
||||
command="cmd_copy"/>
|
||||
<menuitem id="context-paste"
|
||||
label="&pasteCmd.label;"
|
||||
accesskey="&pasteCmd.accesskey;"
|
||||
command="cmd_paste"/>
|
||||
<menuitem id="context-delete"
|
||||
label="&deleteCmd.label;"
|
||||
accesskey="&deleteCmd.accesskey;"
|
||||
command="cmd_delete"/>
|
||||
<menuseparator id="context-sep-paste"/>
|
||||
<menuitem id="context-selectall"
|
||||
label="&selectAllCmd.label;"
|
||||
accesskey="&selectAllCmd.accesskey;"
|
||||
command="cmd_selectAll"/>
|
||||
<menuseparator id="context-sep-selectall"/>
|
||||
<menuitem id="context-searchselect"
|
||||
accesskey="&search.accesskey;"
|
||||
oncommand="OpenSearch('internet', gContextMenu.searchSelected(), true);"/>
|
||||
<menuseparator id="frame-sep"/>
|
||||
<menu id="frame" label="&thisFrameMenu.label;" accesskey="&thisFrameMenu.accesskey;">
|
||||
<menupopup id="frame_popup">
|
||||
<menuitem label="&showOnlyThisFrameCmd.label;"
|
||||
accesskey="&showOnlyThisFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.showOnlyThisFrame();"/>
|
||||
<menuitem label="&openFrameCmd.label;"
|
||||
accesskey="&openFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.openFrame();"/>
|
||||
<menuitem label="&openFrameCmdInTab.label;"
|
||||
accesskey="&openFrameCmdInTab.accesskey;"
|
||||
oncommand="gContextMenu.openFrameInTab(event.shiftKey);"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="context-reload-frame"
|
||||
label="&reloadFrameCmd.label;"
|
||||
accesskey="&reloadFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.reloadFrame();"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&bookmarkFrameCmd.label;"
|
||||
accesskey="&bookmarkFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.addBookmarkForFrame();"/>
|
||||
<menuitem id="saveframeas"
|
||||
valueSaveAs="&saveFrameAsCmd.label;"
|
||||
valueSave="&saveFrameCmd.label;"
|
||||
accesskey="&saveFrameCmd.accesskey;"
|
||||
oncommand="saveDocument(gContextMenu.target.ownerDocument);"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&viewFrameSourceCmd.label;"
|
||||
accesskey="&viewFrameSourceCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewFrameSource();"/>
|
||||
<menuitem label="&viewFrameInfoCmd.label;"
|
||||
accesskey="&viewFrameInfoCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewFrameInfo();"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator id="context-sep-properties"/>
|
||||
<menuitem id="context-viewpartialsource-selection"
|
||||
label="&viewPartialSourceForSelectionCmd.label;"
|
||||
accesskey="&viewPartialSourceCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewPartialSource('selection');"/>
|
||||
<menuitem id="context-viewpartialsource-mathml"
|
||||
label="&viewPartialSourceForMathMLCmd.label;"
|
||||
accesskey="&viewPartialSourceCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewPartialSource('mathml');"/>
|
||||
<menuitem id="context-viewsource"
|
||||
label="&viewPageSourceCmd.label;"
|
||||
accesskey="&viewPageSourceCmd.accesskey;"
|
||||
observes="isImage"
|
||||
oncommand="BrowserViewSourceOfDocument(content.document);"/>
|
||||
<menuitem id="context-viewinfo"
|
||||
label="&viewPageInfoCmd.label;"
|
||||
accesskey="&viewPageInfoCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewInfo();"/>
|
||||
<menuitem id="context-metadata"
|
||||
label="&metadataCmd.label;"
|
||||
accesskey="&metadataCmd.accesskey;"
|
||||
oncommand="gContextMenu.showMetadata();"/>
|
||||
<menuseparator hidden="true" id="context-sep-bidi"/>
|
||||
<menuitem hidden="true" id="context-bidi-text-direction-toggle"
|
||||
label="&bidiSwitchTextDirectionItem.label;"
|
||||
accesskey="&bidiSwitchTextDirectionItem.accesskey;"
|
||||
command="cmd_switchTextDirection"/>
|
||||
<menuitem hidden="true" id="context-bidi-page-direction-toggle"
|
||||
label="&bidiSwitchPageDirectionItem.label;"
|
||||
accesskey="&bidiSwitchPageDirectionItem.accesskey;"
|
||||
oncommand="SwitchDocumentDirection(window.content);"/>
|
||||
</popup>
|
||||
</popupset>
|
||||
</overlay>
|
|
@ -1,89 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
* Ben Goodger <ben@netscape.com>
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
* Blake Ross <blakeross@telocity.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Note that most of this routine has been moved into C++ in order to
|
||||
* be available for all <browser> tags as well as gecko embedding. See
|
||||
* mozilla/content/base/src/nsContentAreaDragDrop.cpp.
|
||||
*
|
||||
* Do not add any new fuctionality here other than what is needed for
|
||||
* a standalone product.
|
||||
*/
|
||||
|
||||
var contentAreaDNDObserver = {
|
||||
onDrop: function (aEvent, aXferData, aDragSession)
|
||||
{
|
||||
var url = transferUtils.retrieveURLFromData(aXferData.data, aXferData.flavour.contentType);
|
||||
|
||||
// valid urls don't contain spaces ' '; if we have a space it
|
||||
// isn't a valid url, or if it's a javascript: or data: url,
|
||||
// bail out
|
||||
if (!url || !url.length || url.indexOf(" ", 0) != -1 ||
|
||||
/^\s*(javascript|data):/.test(url))
|
||||
return;
|
||||
|
||||
switch (document.documentElement.getAttribute('windowtype')) {
|
||||
case "navigator:browser":
|
||||
// Perform a security check before loading the URI
|
||||
nsDragAndDrop.dragDropSecurityCheck(aEvent, aDragSession, url);
|
||||
|
||||
loadURI(getShortcutOrURI(url));
|
||||
break;
|
||||
case "navigator:view-source":
|
||||
viewSource(url);
|
||||
break;
|
||||
}
|
||||
|
||||
// keep the event from being handled by the dragDrop listeners
|
||||
// built-in to gecko if they happen to be above us.
|
||||
aEvent.preventDefault();
|
||||
},
|
||||
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
var flavourSet = new FlavourSet();
|
||||
flavourSet.appendFlavour("text/x-moz-url");
|
||||
flavourSet.appendFlavour("text/unicode");
|
||||
flavourSet.appendFlavour("application/x-moz-file", "nsIFile");
|
||||
return flavourSet;
|
||||
}
|
||||
|
||||
};
|
|
@ -1,989 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Save File)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Determine whether or not a given focused DOMWindow is in the content
|
||||
* area.
|
||||
**/
|
||||
function isContentFrame(aFocusedWindow)
|
||||
{
|
||||
if (!aFocusedWindow)
|
||||
return false;
|
||||
|
||||
return (aFocusedWindow.top == window.content);
|
||||
}
|
||||
|
||||
function urlSecurityCheck(url, doc)
|
||||
{
|
||||
// URL Loading Security Check
|
||||
var focusedWindow = doc.commandDispatcher.focusedWindow;
|
||||
var sourceURL = getContentFrameURI(focusedWindow);
|
||||
const nsIScriptSecurityManager = Components.interfaces.nsIScriptSecurityManager;
|
||||
var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(nsIScriptSecurityManager);
|
||||
try {
|
||||
secMan.checkLoadURIStr(sourceURL, url, nsIScriptSecurityManager.STANDARD);
|
||||
} catch (e) {
|
||||
throw "Load of " + url + " denied.";
|
||||
}
|
||||
}
|
||||
|
||||
function getContentFrameURI(aFocusedWindow)
|
||||
{
|
||||
var contentFrame = isContentFrame(aFocusedWindow) ? aFocusedWindow : window.content;
|
||||
return contentFrame.location.href;
|
||||
}
|
||||
|
||||
function getContentFrameDocument(aFocusedWindow)
|
||||
{
|
||||
var contentFrame = isContentFrame(aFocusedWindow) ?
|
||||
aFocusedWindow : window.content;
|
||||
return contentFrame.document;
|
||||
}
|
||||
|
||||
function getReferrer(doc)
|
||||
{
|
||||
var focusedWindow = doc.commandDispatcher.focusedWindow;
|
||||
var sourceDocument = getContentFrameDocument(focusedWindow);
|
||||
|
||||
try {
|
||||
return makeURI(sourceDocument.location.href, sourceDocument.characterSet);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function openNewWindowWith(url, sendReferrer)
|
||||
{
|
||||
urlSecurityCheck(url, document);
|
||||
|
||||
// if and only if the current window is a browser window and it has a document with a character
|
||||
// set, then extract the current charset menu setting from the current document and use it to
|
||||
// initialize the new browser window...
|
||||
var charsetArg = null;
|
||||
var wintype = document.documentElement.getAttribute('windowtype');
|
||||
if (wintype == "navigator:browser")
|
||||
charsetArg = "charset=" + window.content.document.characterSet;
|
||||
|
||||
var referrer = sendReferrer ? getReferrer(document) : null;
|
||||
window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url, charsetArg, referrer);
|
||||
}
|
||||
|
||||
function openTopBrowserWith(url)
|
||||
{
|
||||
urlSecurityCheck(url, document);
|
||||
|
||||
var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
|
||||
var browserWin = windowMediator.getMostRecentWindow("navigator:browser");
|
||||
|
||||
// if there's an existing browser window, open this url in one
|
||||
if (browserWin) {
|
||||
browserWin.getBrowser().loadURI(url); // Just do a normal load.
|
||||
browserWin.content.focus();
|
||||
}
|
||||
else
|
||||
window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url, null, null);
|
||||
}
|
||||
|
||||
function openNewTabWith(url, sendReferrer, reverseBackgroundPref)
|
||||
{
|
||||
var browser;
|
||||
try {
|
||||
// if we're running in a browser window, this should work
|
||||
//
|
||||
browser = getBrowser();
|
||||
|
||||
} catch (ex if ex instanceof ReferenceError) {
|
||||
|
||||
// must be running somewhere else (eg mailnews message pane); need to
|
||||
// find a browser window first
|
||||
//
|
||||
var windowMediator =
|
||||
Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
|
||||
var browserWin = windowMediator.getMostRecentWindow("navigator:browser");
|
||||
|
||||
// if there's no existing browser window, then, as long as
|
||||
// we are allowed to, open this url in one and return
|
||||
//
|
||||
if (!browserWin) {
|
||||
urlSecurityCheck(url, document);
|
||||
window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no",
|
||||
url, null, referrer);
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise, get the existing browser object
|
||||
//
|
||||
browser = browserWin.getBrowser();
|
||||
}
|
||||
|
||||
// Get the XUL document that the browser is actually contained in.
|
||||
// This is needed if we are trying to load a URL from a non-navigator
|
||||
// window such as the JS Console.
|
||||
var browserDocument = browser.ownerDocument;
|
||||
|
||||
urlSecurityCheck(url, browserDocument);
|
||||
|
||||
var referrer = sendReferrer ? getReferrer(browserDocument) : null;
|
||||
|
||||
// As in openNewWindowWith(), we want to pass the charset of the
|
||||
// current document over to a new tab.
|
||||
var wintype = browserDocument.documentElement.getAttribute('windowtype');
|
||||
var originCharset;
|
||||
if (wintype == "navigator:browser") {
|
||||
originCharset = window.content.document.characterSet;
|
||||
}
|
||||
|
||||
// open link in new tab
|
||||
var loadInBackground = false;
|
||||
if (pref) {
|
||||
loadInBackground = pref.getBoolPref("browser.tabs.loadInBackground");
|
||||
if (reverseBackgroundPref)
|
||||
loadInBackground = !loadInBackground;
|
||||
}
|
||||
browser.addTab(url, referrer, originCharset, !loadInBackground);
|
||||
}
|
||||
|
||||
// Clientelle: (Make sure you don't break any of these)
|
||||
// - File -> Save Page/Frame As...
|
||||
// - Context -> Save Page/Frame As...
|
||||
// - Context -> Save Link As...
|
||||
// - Shift-Click Save Link As
|
||||
//
|
||||
// Try saving each of these types:
|
||||
// - A complete webpage using File->Save Page As, and Context->Save Page As
|
||||
// - A webpage as HTML only using the above methods
|
||||
// - A webpage as Text only using the above methods
|
||||
// - An image with an extension (e.g. .jpg) in its file name, using
|
||||
// Context->Save Image As...
|
||||
// - An image without an extension (e.g. a banner ad on cnn.com) using
|
||||
// the above method.
|
||||
// - A linked document using Save Link As...
|
||||
// - A linked document using shift-click Save Link As...
|
||||
//
|
||||
function saveURL(aURL, aFileName, aFilePickerTitleKey, aShouldBypassCache,
|
||||
aReferrer)
|
||||
{
|
||||
internalSave(aURL, null, aFileName, null, null, aShouldBypassCache,
|
||||
aFilePickerTitleKey, null, aReferrer);
|
||||
}
|
||||
|
||||
// Just like saveURL, but will get some info off the image before
|
||||
// calling internalSave
|
||||
// Clientelle: (Make sure you don't break any of these)
|
||||
// - Context -> Save Image As...
|
||||
const imgICache = Components.interfaces.imgICache;
|
||||
const nsISupportsCString = Components.interfaces.nsISupportsCString;
|
||||
|
||||
function saveImageURL(aURL, aFileName, aFilePickerTitleKey, aShouldBypassCache,
|
||||
aReferrer)
|
||||
{
|
||||
var contentType = null;
|
||||
var contentDisposition = null;
|
||||
if (!aShouldBypassCache) {
|
||||
try {
|
||||
var imageCache = Components.classes["@mozilla.org/image/cache;1"]
|
||||
.getService(imgICache);
|
||||
var props =
|
||||
imageCache.findEntryProperties(makeURI(aURL, getCharsetforSave(null)));
|
||||
if (props) {
|
||||
contentType = props.get("type", nsISupportsCString);
|
||||
contentDisposition = props.get("content-disposition",
|
||||
nsISupportsCString);
|
||||
}
|
||||
} catch (e) {
|
||||
// Failure to get type and content-disposition off the image is non-fatal
|
||||
}
|
||||
}
|
||||
internalSave(aURL, null, aFileName, contentDisposition, contentType,
|
||||
aShouldBypassCache, aFilePickerTitleKey, null, aReferrer);
|
||||
}
|
||||
|
||||
function saveFrameDocument()
|
||||
{
|
||||
var focusedWindow = document.commandDispatcher.focusedWindow;
|
||||
if (isContentFrame(focusedWindow))
|
||||
saveDocument(focusedWindow.document);
|
||||
}
|
||||
|
||||
function saveDocument(aDocument)
|
||||
{
|
||||
if (!aDocument) {
|
||||
throw "Must have a document when calling saveDocument";
|
||||
}
|
||||
|
||||
// We want to use cached data because the document is currently visible.
|
||||
var dispHeader = null;
|
||||
try {
|
||||
dispHeader =
|
||||
aDocument.defaultView
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils)
|
||||
.getDocumentMetadata("content-disposition");
|
||||
} catch (ex) {
|
||||
// Failure to get a content-disposition is ok
|
||||
}
|
||||
internalSave(aDocument.location.href, aDocument, null, dispHeader,
|
||||
aDocument.contentType, false, null, null);
|
||||
}
|
||||
|
||||
function DownloadListener(win, transfer) {
|
||||
function makeClosure(name) {
|
||||
return function() {
|
||||
transfer[name].apply(transfer, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
this.window = win;
|
||||
|
||||
// Now... we need to forward all calls to our transfer
|
||||
for (var i in transfer) {
|
||||
if (i != "QueryInterface")
|
||||
this[i] = makeClosure(i);
|
||||
}
|
||||
}
|
||||
|
||||
DownloadListener.prototype = {
|
||||
QueryInterface: function dl_qi(aIID)
|
||||
{
|
||||
if (aIID.equals(Components.interfaces.nsIInterfaceRequestor) ||
|
||||
aIID.equals(Components.interfaces.nsIWebProgressListener) ||
|
||||
aIID.equals(Components.interfaces.nsIWebProgressListener2) ||
|
||||
aIID.equals(Components.interfaces.nsISupports)) {
|
||||
return this;
|
||||
}
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
getInterface: function dl_gi(aIID)
|
||||
{
|
||||
if (aIID.equals(Components.interfaces.nsIAuthPrompt) ||
|
||||
aIID.equals(Components.interfaces.nsIAuthPrompt2)) {
|
||||
var ww =
|
||||
Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Components.interfaces.nsIPromptFactory);
|
||||
return ww.getPrompt(this.window, aIID);
|
||||
}
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
const SAVETYPE_COMPLETE_PAGE = 0x00;
|
||||
const SAVETYPE_TEXT_ONLY = 0x02;
|
||||
/**
|
||||
* internalSave: Used when saving a document or URL. This method:
|
||||
* - Determines a local target filename to use (unless parameter
|
||||
* aChosenData is non-null)
|
||||
* - Determines content-type if possible
|
||||
* - Prompts the user to confirm the destination filename and save mode
|
||||
* (content-type affects this)
|
||||
* - Creates a 'Persist' object (which will perform the saving in the
|
||||
* background) and then starts it.
|
||||
*
|
||||
* @param aURL The String representation of the URL of the document being saved
|
||||
* @param aDocument The document to be saved
|
||||
* @param aDefaultFileName The caller-provided suggested filename if we don't
|
||||
* find a better one
|
||||
* @param aContentDisposition The caller-provided content-disposition header
|
||||
* to use.
|
||||
* @param aContentType The caller-provided content-type to use
|
||||
* @param aShouldBypassCache If true, the document will always be refetched
|
||||
* from the server
|
||||
* @param aFilePickerTitleKey Alternate title for the file picker
|
||||
* @param aChosenData If non-null this contains an instance of object AutoChosen
|
||||
* (see below) which holds pre-determined data so that the user does not
|
||||
* need to be prompted for a target filename.
|
||||
* @param aReferrer the referrer URI object (not URL string) to use, or null
|
||||
if no referrer should be sent.
|
||||
*/
|
||||
function internalSave(aURL, aDocument, aDefaultFileName, aContentDisposition,
|
||||
aContentType, aShouldBypassCache, aFilePickerTitleKey,
|
||||
aChosenData, aReferrer)
|
||||
{
|
||||
// Note: aDocument == null when this code is used by save-link-as...
|
||||
var saveMode = GetSaveModeForContentType(aContentType);
|
||||
var isDocument = aDocument != null && saveMode != SAVEMODE_FILEONLY;
|
||||
var saveAsType = SAVETYPE_COMPLETE_PAGE;
|
||||
|
||||
var file, fileURL;
|
||||
// Find the URI object for aURL and the FileName/Extension to use when saving.
|
||||
// FileName/Extension will be ignored if aChosenData supplied.
|
||||
var fileInfo = new FileInfo(aDefaultFileName);
|
||||
if (aChosenData)
|
||||
file = aChosenData.file;
|
||||
else {
|
||||
var charset = null;
|
||||
if (aDocument)
|
||||
charset = aDocument.characterSet;
|
||||
else if (aReferrer)
|
||||
charset = aReferrer.originCharset;
|
||||
initFileInfo(fileInfo, aURL, charset, aDocument,
|
||||
aContentType, aContentDisposition);
|
||||
var fpParams = {
|
||||
fpTitleKey: aFilePickerTitleKey,
|
||||
isDocument: isDocument,
|
||||
fileInfo: fileInfo,
|
||||
contentType: aContentType,
|
||||
saveMode: saveMode,
|
||||
saveAsType: saveAsType,
|
||||
file: file,
|
||||
fileURL: fileURL
|
||||
};
|
||||
if (!poseFilePicker(fpParams))
|
||||
// If the method returned false this is because the user cancelled from
|
||||
// the save file picker dialog.
|
||||
return;
|
||||
|
||||
saveAsType = fpParams.saveAsType;
|
||||
saveMode = fpParams.saveMode;
|
||||
file = fpParams.file;
|
||||
fileURL = fpParams.fileURL;
|
||||
}
|
||||
|
||||
if (!fileURL)
|
||||
fileURL = makeFileURI(file);
|
||||
|
||||
// XXX We depend on the following holding true in appendFiltersForContentType():
|
||||
// If we should save as a complete page, the saveAsType is SAVETYPE_COMPLETE_PAGE.
|
||||
// If we should save as text, the saveAsType is SAVETYPE_TEXT_ONLY.
|
||||
var useSaveDocument = isDocument &&
|
||||
(((saveMode & SAVEMODE_COMPLETE_DOM) && (saveAsType == SAVETYPE_COMPLETE_PAGE)) ||
|
||||
((saveMode & SAVEMODE_COMPLETE_TEXT) && (saveAsType == SAVETYPE_TEXT_ONLY)));
|
||||
|
||||
// If we're saving a document, and are saving either in complete mode or
|
||||
// as converted text, pass the document to the web browser persist component.
|
||||
// If we're just saving the HTML (second option in the list), send only the URI.
|
||||
var source = useSaveDocument ? aDocument : fileInfo.uri;
|
||||
var persistArgs = {
|
||||
source : source,
|
||||
contentType : (!aChosenData && useSaveDocument &&
|
||||
saveAsType == SAVETYPE_TEXT_ONLY) ?
|
||||
"text/plain" : null,
|
||||
target : fileURL,
|
||||
postData : isDocument ? getPostData() : null,
|
||||
bypassCache : aShouldBypassCache
|
||||
};
|
||||
|
||||
var persist = makeWebBrowserPersist();
|
||||
|
||||
// Calculate persist flags.
|
||||
const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
|
||||
const flags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
|
||||
if (aShouldBypassCache)
|
||||
persist.persistFlags = flags | nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
||||
else
|
||||
persist.persistFlags = flags | nsIWBP.PERSIST_FLAGS_FROM_CACHE;
|
||||
|
||||
// Leave it to WebBrowserPersist to discover the encoding type (or lack thereof):
|
||||
persist.persistFlags |= nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
|
||||
|
||||
// Create download and initiate it (below)
|
||||
var tr = Components.classes["@mozilla.org/transfer;1"].createInstance(Components.interfaces.nsITransfer);
|
||||
|
||||
if (useSaveDocument) {
|
||||
// Saving a Document, not a URI:
|
||||
var filesFolder = null;
|
||||
if (persistArgs.contentType != "text/plain") {
|
||||
// Create the local directory into which to save associated files.
|
||||
filesFolder = file.clone();
|
||||
|
||||
var nameWithoutExtension = filesFolder.leafName.replace(/\.[^.]*$/, "");
|
||||
var filesFolderLeafName = getStringBundle().formatStringFromName("filesFolder",
|
||||
[nameWithoutExtension],
|
||||
1);
|
||||
|
||||
filesFolder.leafName = filesFolderLeafName;
|
||||
}
|
||||
|
||||
var encodingFlags = 0;
|
||||
if (persistArgs.contentType == "text/plain") {
|
||||
encodingFlags |= nsIWBP.ENCODE_FLAGS_FORMATTED;
|
||||
encodingFlags |= nsIWBP.ENCODE_FLAGS_ABSOLUTE_LINKS;
|
||||
encodingFlags |= nsIWBP.ENCODE_FLAGS_NOFRAMES_CONTENT;
|
||||
}
|
||||
else {
|
||||
encodingFlags |= nsIWBP.ENCODE_FLAGS_ENCODE_BASIC_ENTITIES;
|
||||
}
|
||||
|
||||
const kWrapColumn = 80;
|
||||
tr.init((aChosenData ? aChosenData.uri : fileInfo.uri),
|
||||
persistArgs.target, "", null, null, null, persist);
|
||||
persist.progressListener = new DownloadListener(window, tr);
|
||||
persist.saveDocument(persistArgs.source, persistArgs.target, filesFolder,
|
||||
persistArgs.contentType, encodingFlags, kWrapColumn);
|
||||
} else {
|
||||
tr.init((aChosenData ? aChosenData.uri : source),
|
||||
persistArgs.target, "", null, null, null, persist);
|
||||
persist.progressListener = new DownloadListener(window, tr);
|
||||
persist.saveURI((aChosenData ? aChosenData.uri : source),
|
||||
null, aReferrer, persistArgs.postData, null,
|
||||
persistArgs.target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Structure for holding info about automatically supplied parameters for
|
||||
* internalSave(...). This allows parameters to be supplied so the user does not
|
||||
* need to be prompted for file info.
|
||||
* @param aFileAutoChosen This is an nsILocalFile object that has been
|
||||
* pre-determined as the filename for the target to save to
|
||||
* @param aUriAutoChosen This is the nsIURI object for the target
|
||||
*/
|
||||
function AutoChosen(aFileAutoChosen, aUriAutoChosen) {
|
||||
this.file = aFileAutoChosen;
|
||||
this.uri = aUriAutoChosen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Structure for holding info about a URL and the target filename it should be
|
||||
* saved to. This structure is populated by initFileInfo(...).
|
||||
* @param aSuggestedFileName This is used by initFileInfo(...) when it
|
||||
* cannot 'discover' the filename from the url
|
||||
* @param aFileName The target filename
|
||||
* @param aFileBaseName The filename without the file extension
|
||||
* @param aFileExt The extension of the filename
|
||||
* @param aUri An nsIURI object for the url that is being saved
|
||||
*/
|
||||
function FileInfo(aSuggestedFileName, aFileName, aFileBaseName, aFileExt, aUri) {
|
||||
this.suggestedFileName = aSuggestedFileName;
|
||||
this.fileName = aFileName;
|
||||
this.fileBaseName = aFileBaseName;
|
||||
this.fileExt = aFileExt;
|
||||
this.uri = aUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine what the 'default' filename string is, its file extension and the
|
||||
* filename without the extension. This filename is used when prompting the user
|
||||
* for confirmation in the file picker dialog.
|
||||
* @param aFI A FileInfo structure into which we'll put the results of this method.
|
||||
* @param aURL The String representation of the URL of the document being saved
|
||||
* @param aURLCharset The charset of aURL.
|
||||
* @param aDocument The document to be saved
|
||||
* @param aContentType The content type we're saving, if it could be
|
||||
* determined by the caller.
|
||||
* @param aContentDisposition The content-disposition header for the object
|
||||
* we're saving, if it could be determined by the caller.
|
||||
*/
|
||||
function initFileInfo(aFI, aURL, aURLCharset, aDocument,
|
||||
aContentType, aContentDisposition)
|
||||
{
|
||||
try {
|
||||
// Get an nsIURI object from aURL if possible:
|
||||
try {
|
||||
aFI.uri = makeURI(aURL, aURLCharset);
|
||||
// Assuming nsiUri is valid, calling QueryInterface(...) on it will
|
||||
// populate extra object fields (eg filename and file extension).
|
||||
var url = aFI.uri.QueryInterface(Components.interfaces.nsIURL);
|
||||
aFI.fileExt = url.fileExtension;
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
// Get the default filename:
|
||||
aFI.fileName = getDefaultFileName((aFI.suggestedFileName || aFI.fileName),
|
||||
aFI.uri, aDocument, aContentDisposition);
|
||||
// If aFI.fileExt is still blank, consider: aFI.suggestedFileName is supplied
|
||||
// if saveURL(...) was the original caller (hence both aContentType and
|
||||
// aDocument are blank). If they were saving a link to a website then make
|
||||
// the extension .htm .
|
||||
if (!aFI.fileExt && !aDocument && !aContentType && (/^http(s?):\/\//i.test(aURL))) {
|
||||
aFI.fileExt = "htm";
|
||||
aFI.fileBaseName = aFI.fileName;
|
||||
} else {
|
||||
aFI.fileExt = getDefaultExtension(aFI.fileName, aFI.uri, aContentType);
|
||||
aFI.fileBaseName = getFileBaseName(aFI.fileName, aFI.fileExt);
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the Filepicker Parameters (aFpP), show the file picker dialog,
|
||||
* prompting the user to confirm (or change) the fileName.
|
||||
* @param aFpP a structure (see definition in internalSave(...) method)
|
||||
* containing all the data used within this method.
|
||||
* @return true if the user confirmed a filename in the picker; false if they
|
||||
* dismissed the picker.
|
||||
*/
|
||||
function poseFilePicker(aFpP)
|
||||
{
|
||||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
const kDownloadDirPref = "dir";
|
||||
|
||||
var branch = getPrefsBrowserDownload("browser.download.");
|
||||
var dir = null;
|
||||
|
||||
// Try and pull in download directory pref
|
||||
try {
|
||||
dir = branch.getComplexValue(kDownloadDirPref, nsILocalFile);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
var autoDownload = branch.getBoolPref("autoDownload");
|
||||
if (autoDownload && dir && dir.exists()) {
|
||||
dir.append(getNormalizedLeafName(aFpP.fileInfo.fileName, aFpP.fileInfo.fileExt));
|
||||
aFpP.file = uniqueFile(dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Show the file picker that allows the user to confirm the target filename:
|
||||
var fp = makeFilePicker();
|
||||
var titleKey = aFpP.fpTitleKey || "SaveLinkTitle";
|
||||
var bundle = getStringBundle();
|
||||
fp.init(window, bundle.GetStringFromName(titleKey),
|
||||
Components.interfaces.nsIFilePicker.modeSave);
|
||||
|
||||
try {
|
||||
if (dir.exists())
|
||||
fp.displayDirectory = dir;
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
fp.defaultExtension = aFpP.fileInfo.fileExt;
|
||||
fp.defaultString = getNormalizedLeafName(aFpP.fileInfo.fileName,
|
||||
aFpP.fileInfo.fileExt);
|
||||
appendFiltersForContentType(fp, aFpP.contentType, aFpP.fileInfo.fileExt,
|
||||
aFpP.saveMode);
|
||||
|
||||
if (aFpP.isDocument) {
|
||||
try {
|
||||
fp.filterIndex = branch.getIntPref("save_converter_index");
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
if (fp.show() == Components.interfaces.nsIFilePicker.returnCancel || !fp.file)
|
||||
return false;
|
||||
|
||||
if (aFpP.isDocument)
|
||||
branch.setIntPref("save_converter_index", fp.filterIndex);
|
||||
|
||||
// Now that the user has had a chance to change the directory and/or filename,
|
||||
// re-read those values...
|
||||
if (branch.getBoolPref("lastLocation") || autoDownload) {
|
||||
var directory = fp.file.parent.QueryInterface(nsILocalFile);
|
||||
branch.setComplexValue(kDownloadDirPref, nsILocalFile, directory);
|
||||
}
|
||||
fp.file.leafName = validateFileName(fp.file.leafName);
|
||||
|
||||
aFpP.saveAsType = fp.filterIndex;
|
||||
aFpP.file = fp.file;
|
||||
aFpP.fileURL = fp.fileURL;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Since we're automatically downloading, we don't get the file picker's
|
||||
// logic to check for existing files, so we need to do that here.
|
||||
//
|
||||
// Note - this code is identical to that in nsHelperAppDlg.js.
|
||||
// If you are updating this code, update that code too! We can't share code
|
||||
// here since that code is called in a js component.
|
||||
|
||||
function uniqueFile(aLocalFile)
|
||||
{
|
||||
while (aLocalFile.exists()) {
|
||||
parts = /(-\d+)?(\.[^.]+)?$/.test(aLocalFile.leafName);
|
||||
aLocalFile.leafName = RegExp.leftContext + (RegExp.$1 - 1) + RegExp.$2;
|
||||
}
|
||||
return aLocalFile;
|
||||
}
|
||||
|
||||
// We have no DOM, and can only save the URL as is.
|
||||
const SAVEMODE_FILEONLY = 0x00;
|
||||
// We have a DOM and can save as complete.
|
||||
const SAVEMODE_COMPLETE_DOM = 0x01;
|
||||
// We have a DOM which we can serialize as text.
|
||||
const SAVEMODE_COMPLETE_TEXT = 0x02;
|
||||
|
||||
// If we are able to save a complete DOM, the 'save as complete' filter
|
||||
// must be the first filter appended. The 'save page only' counterpart
|
||||
// must be the second filter appended. And the 'save as complete text'
|
||||
// filter must be the third filter appended.
|
||||
function appendFiltersForContentType(aFilePicker, aContentType, aFileExtension, aSaveMode)
|
||||
{
|
||||
var bundle = getStringBundle();
|
||||
// The bundle name for saving only a specific content type.
|
||||
var bundleName;
|
||||
// The corresponding filter string for a specific content type.
|
||||
var filterString;
|
||||
|
||||
// XXX all the cases that are handled explicitly here MUST be handled
|
||||
// in GetSaveModeForContentType to return a non-fileonly filter.
|
||||
switch (aContentType) {
|
||||
case "text/html":
|
||||
bundleName = "WebPageHTMLOnlyFilter";
|
||||
filterString = "*.htm; *.html";
|
||||
break;
|
||||
|
||||
case "application/xhtml+xml":
|
||||
bundleName = "WebPageXHTMLOnlyFilter";
|
||||
filterString = "*.xht; *.xhtml";
|
||||
break;
|
||||
|
||||
case "image/svg+xml":
|
||||
bundleName = "WebPageSVGOnlyFilter";
|
||||
filterString = "*.svg; *.svgz";
|
||||
break;
|
||||
|
||||
case "text/xml":
|
||||
case "application/xml":
|
||||
bundleName = "WebPageXMLOnlyFilter";
|
||||
filterString = "*.xml";
|
||||
break;
|
||||
|
||||
default:
|
||||
if (aSaveMode != SAVEMODE_FILEONLY) {
|
||||
throw "Invalid save mode for type '" + aContentType + "'";
|
||||
}
|
||||
|
||||
var mimeInfo = getMIMEInfoForType(aContentType, aFileExtension);
|
||||
if (mimeInfo) {
|
||||
|
||||
var extEnumerator = mimeInfo.getFileExtensions();
|
||||
|
||||
var extString = "";
|
||||
while (extEnumerator.hasMore()) {
|
||||
var extension = extEnumerator.getNext();
|
||||
if (extString)
|
||||
extString += "; "; // If adding more than one extension,
|
||||
// separate by semi-colon
|
||||
extString += "*." + extension;
|
||||
}
|
||||
|
||||
if (extString) {
|
||||
aFilePicker.appendFilter(mimeInfo.description, extString);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (aSaveMode & SAVEMODE_COMPLETE_DOM) {
|
||||
aFilePicker.appendFilter(bundle.GetStringFromName("WebPageCompleteFilter"), filterString);
|
||||
// We should always offer a choice to save document only if
|
||||
// we allow saving as complete.
|
||||
aFilePicker.appendFilter(bundle.GetStringFromName(bundleName), filterString);
|
||||
}
|
||||
|
||||
if (aSaveMode & SAVEMODE_COMPLETE_TEXT) {
|
||||
aFilePicker.appendFilters(Components.interfaces.nsIFilePicker.filterText);
|
||||
}
|
||||
|
||||
// Always append the all files (*) filter
|
||||
aFilePicker.appendFilters(Components.interfaces.nsIFilePicker.filterAll);
|
||||
}
|
||||
|
||||
function getPostData()
|
||||
{
|
||||
try {
|
||||
var sessionHistory = getWebNavigation().sessionHistory;
|
||||
return sessionHistory.getEntryAtIndex(sessionHistory.index, false)
|
||||
.QueryInterface(Components.interfaces.nsISHEntry)
|
||||
.postData;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getStringBundle()
|
||||
{
|
||||
const bundleURL = "chrome://communicator/locale/contentAreaCommands.properties";
|
||||
|
||||
const sbsContractID = "@mozilla.org/intl/stringbundle;1";
|
||||
const sbsIID = Components.interfaces.nsIStringBundleService;
|
||||
const sbs = Components.classes[sbsContractID].getService(sbsIID);
|
||||
|
||||
const lsContractID = "@mozilla.org/intl/nslocaleservice;1";
|
||||
const lsIID = Components.interfaces.nsILocaleService;
|
||||
const ls = Components.classes[lsContractID].getService(lsIID);
|
||||
var appLocale = ls.getApplicationLocale();
|
||||
return sbs.createBundle(bundleURL, appLocale);
|
||||
}
|
||||
|
||||
// Get the preferences branch ("browser.download." for normal 'save' mode)...
|
||||
function getPrefsBrowserDownload(branch)
|
||||
{
|
||||
const prefSvcContractID = "@mozilla.org/preferences-service;1";
|
||||
const prefSvcIID = Components.interfaces.nsIPrefService;
|
||||
return Components.classes[prefSvcContractID].getService(prefSvcIID).getBranch(branch);
|
||||
}
|
||||
|
||||
function makeWebBrowserPersist()
|
||||
{
|
||||
const persistContractID = "@mozilla.org/embedding/browser/nsWebBrowserPersist;1";
|
||||
const persistIID = Components.interfaces.nsIWebBrowserPersist;
|
||||
return Components.classes[persistContractID].createInstance(persistIID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new URI, using nsIIOService.
|
||||
* @param aURL The URI spec.
|
||||
* @param aOriginCharset The charset of the URI.
|
||||
* @return an nsIURI object based on aURL.
|
||||
*/
|
||||
function makeURI(aURL, aOriginCharset)
|
||||
{
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
return ioService.newURI(aURL, aOriginCharset, null);
|
||||
}
|
||||
|
||||
function makeFileURI(aFile)
|
||||
{
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
return ioService.newFileURI(aFile);
|
||||
}
|
||||
|
||||
function makeFilePicker()
|
||||
{
|
||||
const fpContractID = "@mozilla.org/filepicker;1";
|
||||
const fpIID = Components.interfaces.nsIFilePicker;
|
||||
return Components.classes[fpContractID].createInstance(fpIID);
|
||||
}
|
||||
|
||||
function getMIMEService()
|
||||
{
|
||||
const mimeSvcContractID = "@mozilla.org/mime;1";
|
||||
const mimeSvcIID = Components.interfaces.nsIMIMEService;
|
||||
const mimeSvc = Components.classes[mimeSvcContractID].getService(mimeSvcIID);
|
||||
return mimeSvc;
|
||||
}
|
||||
|
||||
// Given aFileName, find the fileName without the extension on the end.
|
||||
function getFileBaseName(aFileName, aFileExt)
|
||||
{
|
||||
// Remove the file extension from aFileName:
|
||||
return aFileName.replace(/\.[^.]*$/, "");
|
||||
}
|
||||
|
||||
function getMIMETypeForURI(aURI)
|
||||
{
|
||||
try {
|
||||
return getMIMEService().getTypeFromURI(aURI);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getMIMEInfoForType(aMIMEType, aExtension)
|
||||
{
|
||||
if (aMIMEType || aExtension) {
|
||||
try {
|
||||
return getMIMEService().getFromTypeAndExtension(aMIMEType, aExtension);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getDefaultFileName(aDefaultFileName, aURI, aDocument,
|
||||
aContentDisposition)
|
||||
{
|
||||
// 1) look for a filename in the content-disposition header, if any
|
||||
if (aContentDisposition) {
|
||||
const mhpContractID = "@mozilla.org/network/mime-hdrparam;1";
|
||||
const mhpIID = Components.interfaces.nsIMIMEHeaderParam;
|
||||
const mhp = Components.classes[mhpContractID].getService(mhpIID);
|
||||
var dummy = { value: null }; // Need an out param...
|
||||
var charset = getCharsetforSave(aDocument);
|
||||
|
||||
var fileName = null;
|
||||
try {
|
||||
fileName = mhp.getParameter(aContentDisposition, "filename", charset,
|
||||
true, dummy);
|
||||
}
|
||||
catch (e) {
|
||||
try {
|
||||
fileName = mhp.getParameter(aContentDisposition, "name", charset, true,
|
||||
dummy);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
if (fileName) {
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var url = aURI.QueryInterface(Components.interfaces.nsIURL);
|
||||
if (url.fileName != "") {
|
||||
// 2) Use the actual file name, if present
|
||||
var textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
|
||||
.getService(Components.interfaces.nsITextToSubURI);
|
||||
return validateFileName(textToSubURI.unEscapeURIForUI(url.originCharset || "UTF-8", url.fileName));
|
||||
}
|
||||
} catch (e) {
|
||||
// This is something like a data: and so forth URI... no filename here.
|
||||
}
|
||||
|
||||
if (aDocument) {
|
||||
var docTitle = GenerateValidFilename(aDocument.title, "");
|
||||
|
||||
if (docTitle) {
|
||||
// 3) Use the document title
|
||||
return docTitle;
|
||||
}
|
||||
}
|
||||
|
||||
if (aDefaultFileName)
|
||||
// 4) Use the caller-provided name, if any
|
||||
return validateFileName(aDefaultFileName);
|
||||
|
||||
// 5) If this is a directory, use the last directory name
|
||||
var path = aURI.path.match(/\/([^\/]+)\/$/);
|
||||
if (path && path.length > 1) {
|
||||
return validateFileName(path[1]);
|
||||
}
|
||||
|
||||
try {
|
||||
if (aURI.host)
|
||||
// 6) Use the host.
|
||||
return aURI.host;
|
||||
} catch (e) {
|
||||
// Some files have no information at all, like Javascript generated pages
|
||||
}
|
||||
try {
|
||||
// 7) Use the default file name
|
||||
return getStringBundle().GetStringFromName("DefaultSaveFileName");
|
||||
} catch (e) {
|
||||
//in case localized string cannot be found
|
||||
}
|
||||
// 8) If all else fails, use "index"
|
||||
return "index";
|
||||
}
|
||||
|
||||
function getNormalizedLeafName(aFile, aDefaultExtension)
|
||||
{
|
||||
if (!aDefaultExtension)
|
||||
return aFile;
|
||||
|
||||
// Remove trailing dots and spaces on windows
|
||||
if (/Win/.test(navigator.platform))
|
||||
aFile = aFile.replace(/[\s.]+$/, "");
|
||||
|
||||
// Fix up the file name we're saving to to include the default extension
|
||||
var i = aFile.lastIndexOf(".");
|
||||
if (aFile.substr(i + 1) != aDefaultExtension)
|
||||
return aFile + "." + aDefaultExtension;
|
||||
|
||||
return aFile;
|
||||
}
|
||||
|
||||
function getDefaultExtension(aFilename, aURI, aContentType)
|
||||
{
|
||||
if (aContentType == "text/plain" || aContentType == "application/octet-stream" || aURI.scheme == "ftp")
|
||||
return ""; // temporary fix for bug 120327
|
||||
|
||||
// First try the extension from the filename
|
||||
const stdURLContractID = "@mozilla.org/network/standard-url;1";
|
||||
const stdURLIID = Components.interfaces.nsIURL;
|
||||
var url = Components.classes[stdURLContractID].createInstance(stdURLIID);
|
||||
url.filePath = aFilename;
|
||||
|
||||
var ext = url.fileExtension;
|
||||
|
||||
// This mirrors some code in nsExternalHelperAppService::DoContent
|
||||
// Use the filename first and then the URI if that fails
|
||||
|
||||
var mimeInfo = getMIMEInfoForType(aContentType, ext);
|
||||
|
||||
if (ext && mimeInfo && mimeInfo.extensionExists(ext)) {
|
||||
return ext;
|
||||
}
|
||||
|
||||
// Well, that failed. Now try the extension from the URI
|
||||
var urlext;
|
||||
try {
|
||||
url = aURI.QueryInterface(Components.interfaces.nsIURL);
|
||||
urlext = url.fileExtension;
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
if (urlext && mimeInfo && mimeInfo.extensionExists(urlext)) {
|
||||
return urlext;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
if (mimeInfo)
|
||||
return mimeInfo.primaryExtension;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
// Fall back on the extensions in the filename and URI for lack
|
||||
// of anything better.
|
||||
return ext || urlext;
|
||||
}
|
||||
}
|
||||
|
||||
function GetSaveModeForContentType(aContentType)
|
||||
{
|
||||
var saveMode = SAVEMODE_FILEONLY;
|
||||
switch (aContentType) {
|
||||
case "text/html":
|
||||
case "application/xhtml+xml":
|
||||
case "image/svg+xml":
|
||||
saveMode |= SAVEMODE_COMPLETE_TEXT;
|
||||
// Fall through
|
||||
case "text/xml":
|
||||
case "application/xml":
|
||||
saveMode |= SAVEMODE_COMPLETE_DOM;
|
||||
break;
|
||||
}
|
||||
|
||||
return saveMode;
|
||||
}
|
||||
|
||||
function getCharsetforSave(aDocument)
|
||||
{
|
||||
if (aDocument)
|
||||
return aDocument.characterSet;
|
||||
|
||||
if (document.commandDispatcher.focusedWindow)
|
||||
return document.commandDispatcher.focusedWindow.document.characterSet;
|
||||
|
||||
return window.content.document.characterSet;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the packages being supplied by this jar -->
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:communicator-platform"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- package information -->
|
||||
<RDF:Description about="urn:mozilla:package:communicator-platform"
|
||||
chrome:displayName="Platform Specific Bindings"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="communicator-platform"
|
||||
#expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__">
|
||||
</RDF:Description>
|
||||
</RDF:RDF>
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the packages being supplied by this jar -->
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:communicator-region"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- package information -->
|
||||
<RDF:Description about="urn:mozilla:package:communicator-region"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="communicator-region"
|
||||
#expand chrome:localeVersion="__MOZILLA_REGION_VERSION__">
|
||||
</RDF:Description>
|
||||
|
||||
</RDF:RDF>
|
|
@ -1,40 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the packages being supplied by this jar -->
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:communicator"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- package information -->
|
||||
<RDF:Description about="urn:mozilla:package:communicator"
|
||||
chrome:displayName="Communicator Shared"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="communicator"
|
||||
chrome:xpcNativeWrappers="true"
|
||||
#expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__"
|
||||
#expand chrome:skinVersion="__MOZILLA_SKIN_VERSION__">
|
||||
</RDF:Description>
|
||||
|
||||
<!-- overlay information -->
|
||||
<RDF:Seq about="urn:mozilla:overlays">
|
||||
<RDF:li resource="chrome://communicator/content/contentAreaContextOverlay.xul"/>
|
||||
<RDF:li resource="chrome://communicator/content/pref/preftree.xul"/>
|
||||
<RDF:li resource="chrome://navigator/content/navigatorOverlay.xul"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq about="chrome://communicator/content/contentAreaContextOverlay.xul">
|
||||
<RDF:li>chrome://communicator/content/permissions/imageContextOverlay.xul</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq about="chrome://communicator/content/pref/preftree.xul">
|
||||
<RDF:li>chrome://communicator/content/pref/permissionsPrefsOverlay.xul</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq about="chrome://navigator/content/navigatorOverlay.xul">
|
||||
<RDF:li>chrome://communicator/content/permissions/permissionsNavigatorOverlay.xul</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
</RDF:RDF>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<window id="editorBindings"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
</window>
|
|
@ -1,141 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Simon Fraser <sfraser@netscape.com>
|
||||
* Dean Tessman <dean_tessman@hotmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var gPromptService;
|
||||
var gFindBundle;
|
||||
|
||||
function nsFindInstData() {}
|
||||
nsFindInstData.prototype =
|
||||
{
|
||||
// set the next three attributes on your object to override the defaults
|
||||
browser : null,
|
||||
|
||||
get rootSearchWindow() { return this._root || this.window.content; },
|
||||
set rootSearchWindow(val) { this._root = val; },
|
||||
|
||||
get currentSearchWindow() {
|
||||
if (this._current)
|
||||
return this._current;
|
||||
|
||||
var focusedWindow = this.window.document.commandDispatcher.focusedWindow;
|
||||
if (!focusedWindow || focusedWindow == this.window)
|
||||
focusedWindow = this.window.content;
|
||||
|
||||
return focusedWindow;
|
||||
},
|
||||
set currentSearchWindow(val) { this._current = val; },
|
||||
|
||||
get webBrowserFind() { return this.browser.webBrowserFind; },
|
||||
|
||||
init : function() {
|
||||
var findInst = this.webBrowserFind;
|
||||
// set up the find to search the focussedWindow, bounded by the content window.
|
||||
var findInFrames = findInst.QueryInterface(Components.interfaces.nsIWebBrowserFindInFrames);
|
||||
findInFrames.rootSearchFrame = this.rootSearchWindow;
|
||||
findInFrames.currentSearchFrame = this.currentSearchWindow;
|
||||
|
||||
// always search in frames for now. We could add a checkbox to the dialog for this.
|
||||
findInst.searchFrames = true;
|
||||
},
|
||||
|
||||
window : window,
|
||||
_root : null,
|
||||
_current : null
|
||||
}
|
||||
|
||||
// browser is the <browser> element
|
||||
// rootSearchWindow is the window to constrain the search to (normally window.content)
|
||||
// currentSearchWindow is the frame to start searching (can be, and normally, rootSearchWindow)
|
||||
function findInPage(findInstData)
|
||||
{
|
||||
// is the dialog up already?
|
||||
if ("findDialog" in window && window.findDialog)
|
||||
window.findDialog.focus();
|
||||
else
|
||||
{
|
||||
findInstData.init();
|
||||
window.findDialog = window.openDialog("chrome://global/content/finddialog.xul", "_blank", "chrome,resizable=no,dependent=yes", findInstData);
|
||||
}
|
||||
}
|
||||
|
||||
function findAgainInPage(findInstData, reverse)
|
||||
{
|
||||
// get the find service, which stores global find state, and init the
|
||||
// nsIWebBrowser find with it. We don't assume that there was a previous
|
||||
// Find that set this up.
|
||||
var findService = Components.classes["@mozilla.org/find/find_service;1"]
|
||||
.getService(Components.interfaces.nsIFindService);
|
||||
|
||||
var searchString = findService.searchString;
|
||||
if (searchString.length == 0) {
|
||||
// no previous find text
|
||||
findInPage(findInstData);
|
||||
return;
|
||||
}
|
||||
|
||||
findInstData.init();
|
||||
var findInst = findInstData.webBrowserFind;
|
||||
findInst.searchString = searchString;
|
||||
findInst.matchCase = findService.matchCase;
|
||||
findInst.wrapFind = findService.wrapFind;
|
||||
findInst.entireWord = findService.entireWord;
|
||||
findInst.findBackwards = findService.findBackwards ^ reverse;
|
||||
|
||||
var found = findInst.findNext();
|
||||
if (!found) {
|
||||
if (!gPromptService)
|
||||
gPromptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService()
|
||||
.QueryInterface(Components.interfaces.nsIPromptService);
|
||||
if (!gFindBundle)
|
||||
gFindBundle = document.getElementById("findBundle");
|
||||
|
||||
gPromptService.alert(window, gFindBundle.getString("notFoundTitle"), gFindBundle.getString("notFoundWarning"));
|
||||
}
|
||||
|
||||
// Reset to normal value, otherwise setting can get changed in find dialog
|
||||
findInst.findBackwards = findService.findBackwards;
|
||||
}
|
||||
|
||||
function canFindAgainInPage()
|
||||
{
|
||||
var findService = Components.classes["@mozilla.org/find/find_service;1"]
|
||||
.getService(Components.interfaces.nsIFindService);
|
||||
return (findService.searchString.length > 0);
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- mac version of platformBrowserBindings.xul -->
|
||||
|
||||
<keybinding id="platformBrowserBindings"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- Mac-specific key bindings -->
|
||||
<keyset id="editorKeySet" xulkey="meta">
|
||||
|
||||
<!-- Mac bindings for home and end -->
|
||||
<key id="macHomekb" keycode="VK_HOME"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_scrollTop');
|
||||
controller.doCommand('cmd_scrollTop');"/>
|
||||
<key id="macEndkb" keycode="VK_END"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_scrollBottom');
|
||||
controller.doCommand('cmd_scrollBottom');"/>
|
||||
|
||||
</keyset>
|
||||
<!-- End Mac-specific key bindings -->
|
||||
|
||||
</keybinding>
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- mac version of platformCommunicatorOverlay.xul -->
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
|
||||
<!ENTITY % platformCommunicatorDTD SYSTEM "chrome://communicator-platform/locale/platformCommunicatorOverlay.dtd">
|
||||
%platformCommunicatorDTD;
|
||||
<!ENTITY % utilityDTD SYSTEM "chrome://communicator/locale/utilityOverlay.dtd">
|
||||
%utilityDTD;
|
||||
|
||||
]>
|
||||
|
||||
<overlay id="platformCommunicatorOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- close -->
|
||||
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" command="cmd_close"/>
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
|
||||
<key id="key_gotoHistory" key="&historyCmd.key;" oncommand="toHistory();" modifiers="accel,shift"/>
|
||||
|
||||
<menupopup id="menu_FilePopup">
|
||||
<!-- quit -->
|
||||
<menuseparator id="menu_FileQuitSeparator"/>
|
||||
<menuitem label="&quitApplicationCmd.label;" id="menu_FileQuitItem"
|
||||
key="key_quit" command="cmd_quit"/>
|
||||
</menupopup>
|
||||
<key id="key_quit" key="&quitApplicationCmd.key;" command="cmd_quit" modifiers="accel"/>
|
||||
<command id="cmd_quit" oncommand="goQuitApplication()"/>
|
||||
|
||||
<!-- Edit Menu -->
|
||||
<menuitem id="menu_redo" label="&redoCmd.label;" key="key_redo" command="cmd_redo"/>
|
||||
<key id="key_redo" key="&redoCmd.key;" command="cmd_redo" modifiers="shift, accel"/>
|
||||
<!-- Select All Key -->
|
||||
<key id="key_selectAll" key="&selectAllCmd.key;" modifiers="accel"/>
|
||||
|
||||
<!-- Delete Key -->
|
||||
<!-- not all Mac keyboards have a VK_DELETE key, so we use VK_BACK as
|
||||
the primary and provide VK_DELETE as a secondary key definition -->
|
||||
<key id="key_delete" keycode="VK_BACK" command="cmd_delete"/>
|
||||
<key id="key_delete2" keycode="VK_DELETE" command="cmd_delete"/>
|
||||
|
||||
<!-- This adds the Print Setup item to both Browser and Composer's
|
||||
Print toolbar button popup
|
||||
-->
|
||||
<menupopup id="printMenu">
|
||||
<menuitem id="printSetupToolbar"
|
||||
insertafter="printMenuItemToolbar"
|
||||
label="&printSetupCmd.label;"
|
||||
accesskey="&printSetupCmd.accesskey;"
|
||||
command="cmd_printSetup"/>
|
||||
</menupopup>
|
||||
|
||||
<!-- Find As You Type Keys -->
|
||||
<key id="key_findTypeText"
|
||||
key="&findTypeTextCmd.key;"/>
|
||||
<key id="key_findTypeLinks"
|
||||
key="&findTypeLinksCmd.key;"/>
|
||||
|
||||
<menuitem id="printPreviewMenuItem" hidden="true"/>
|
||||
<menuitem id="printPreviewMenuItemToolbar" hidden="true"/>
|
||||
<menuitem id="printPreviewAddressBook" hidden="true"/>
|
||||
<menuitem id="threadPaneContext-printpreview" hidden="true"/>
|
||||
<menuitem id="messagePaneContext-printpreview" hidden="true"/>
|
||||
|
||||
<!-- Tasks Commands -->
|
||||
<commandset id="tasksCommands">
|
||||
<command id="cmd_minimizeWindow" oncommand="window.minimize();"/>
|
||||
<command id="cmd_zoomWindow" oncommand="ZoomCurrentWindow();"/>
|
||||
</commandset>
|
||||
|
||||
<!-- Tasks Keys -->
|
||||
<keyset id="tasksKeys">
|
||||
<key id="key_minimizeWindow"
|
||||
command="cmd_minimizeWindow"
|
||||
key="&minimizeWindowCmd.key;"
|
||||
modifiers="accel"/>
|
||||
|
||||
<!-- Standard OS X shortcut for opening Help (Cmd+? on most locales), visible
|
||||
in the Help menu (if there's a Help viewer) -->
|
||||
<key id="key_openHelp"
|
||||
key="&openHelpFrontend.key;"
|
||||
modifiers="&openHelpFrontend.modifiers;"/>
|
||||
|
||||
<!-- The Shift key is needed for the "?", thus we need openHelpCmd.key and
|
||||
openHelpCmd.modifiers for the mapping -->
|
||||
<key key="&openHelpCmd.key;"
|
||||
modifiers="&openHelpCmd.modifiers;"
|
||||
command="cmd_openHelp"/>
|
||||
|
||||
<key keycode="&openHelp2Cmd.key;"
|
||||
command="cmd_openHelp"/>
|
||||
</keyset>
|
||||
|
||||
<!-- Window menu -->
|
||||
<menupopup id="windowPopup">
|
||||
<menuitem command="cmd_minimizeWindow"
|
||||
label="&minimizeWindowCmd.label;"
|
||||
key="key_minimizeWindow"
|
||||
position="1"/>
|
||||
<menuitem command="cmd_zoomWindow"
|
||||
label="&zoomWindowCmd.label;"
|
||||
position="2"/>
|
||||
<menuseparator position="3"/>
|
||||
</menupopup>
|
||||
|
||||
</overlay>
|
|
@ -1,51 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- mac version of platformEditorBindings.xul -->
|
||||
|
||||
<keybinding id="platformEditorBindings"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- Mac-specific key bindings -->
|
||||
<keyset id="editorKeySet" xulkey="meta">
|
||||
|
||||
<!-- replace the Windows/Unix xul-Y Redo binding with xul-shift-Z -->
|
||||
<key id="noWinRedo" key="y" cancel="true" modifiers="accel"/>
|
||||
<key id="macRedokb" key="Z"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_redo');
|
||||
controller.doCommand('cmd_redo');" modifiers="accel, shift"/>
|
||||
|
||||
<!-- Mac bindings for home and end -->
|
||||
<key id="macHomekb" keycode="VK_HOME"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_scrollTop');
|
||||
controller.doCommand('cmd_scrollTop');"/>
|
||||
<key id="macEndkb" keycode="VK_END"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_scrollBottom');
|
||||
controller.doCommand('cmd_scrollBottom');"/>
|
||||
|
||||
<!-- Command-left/right arrow won't work on Macintosh non-Roman scripts systems since they are
|
||||
reserved for keyboard layout in the OS (source: Macintosh Human Interface Guidelines) -->
|
||||
|
||||
<key id="key_leftcontrol" keycode="VK_LEFT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_wordPrevious');
|
||||
controller.doCommand('cmd_wordPrevious');" modifiers="alt"/>
|
||||
<key id="key_rightcontrol" keycode="VK_RIGHT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_wordNext');
|
||||
controller.doCommand('cmd_wordNext');" modifiers="alt"/>
|
||||
<key id="key_leftshiftcontrol" keycode="VK_LEFT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_selectWordPrevious');
|
||||
controller.doCommand('cmd_selectWordPrevious');" modifiers="shift, alt"/>
|
||||
<key id="key_rightshiftcontrol" keycode="VK_RIGHT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_selectWordNext');
|
||||
controller.doCommand('cmd_selectWordNext');" modifiers="shift, alt"/>
|
||||
|
||||
</keyset>
|
||||
<!-- End Mac-specific key bindings -->
|
||||
|
||||
</keybinding>
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the packages being supplied by this jar -->
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:communicator"/>
|
||||
<RDF:li resource="urn:mozilla:package:editor"/>
|
||||
<RDF:li resource="urn:mozilla:package:navigator"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- package information -->
|
||||
<RDF:Description about="urn:mozilla:package:communicator"
|
||||
chrome:displayName="Communicator Shared"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="communicator">
|
||||
</RDF:Description>
|
||||
<RDF:Description about="urn:mozilla:package:editor"
|
||||
chrome:displayName="Editor"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="editor">
|
||||
</RDF:Description>
|
||||
<RDF:Description about="urn:mozilla:package:navigator"
|
||||
chrome:displayName="Navigator"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="navigator">
|
||||
</RDF:Description>
|
||||
|
||||
<!-- overlay information -->
|
||||
<RDF:Seq about="urn:mozilla:overlays">
|
||||
<RDF:li resource="chrome://communicator/content/pref/preftree.xul"/>
|
||||
<RDF:li resource="chrome://communicator/content/pref/pref-appearance.xul"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- editor preferences branches -->
|
||||
<RDF:Seq about="chrome://communicator/content/pref/preftree.xul">
|
||||
<RDF:li>chrome://editor/content/editorPrefsOverlay.xul</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- editor startup pref -->
|
||||
<RDF:Seq about="chrome://communicator/content/pref/pref-appearance.xul">
|
||||
<RDF:li>chrome://editor/content/editorPrefsOverlay.xul</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
</RDF:RDF>
|
||||
|
|
@ -1,934 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* William A. ("PowerGUI") Law <law@netscape.com>
|
||||
* Blake Ross <blakeross@telocity.com>
|
||||
* Gervase Markham <gerv@gerv.net>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*------------------------------ nsContextMenu ---------------------------------
|
||||
| This JavaScript "class" is used to implement the browser's content-area |
|
||||
| context menu. |
|
||||
| |
|
||||
| For usage, see references to this class in navigator.xul. |
|
||||
| |
|
||||
| Currently, this code is relatively useless for any other purpose. In the |
|
||||
| longer term, this code will be restructured to make it more reusable. |
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
function nsContextMenu( xulMenu ) {
|
||||
this.target = null;
|
||||
this.menu = null;
|
||||
this.popupURL = null;
|
||||
this.onTextInput = false;
|
||||
this.onImage = false;
|
||||
this.onLoadedImage = false;
|
||||
this.onLink = false;
|
||||
this.onMailtoLink = false;
|
||||
this.onSaveableLink = false;
|
||||
this.onMetaDataItem = false;
|
||||
this.onMathML = false;
|
||||
this.link = false;
|
||||
this.inFrame = false;
|
||||
this.hasBGImage = false;
|
||||
this.isTextSelected = false;
|
||||
this.inDirList = false;
|
||||
this.shouldDisplay = true;
|
||||
this.autoDownload = false;
|
||||
|
||||
// Initialize new menu.
|
||||
this.initMenu( xulMenu );
|
||||
}
|
||||
|
||||
// Prototype for nsContextMenu "class."
|
||||
nsContextMenu.prototype = {
|
||||
// onDestroy is a no-op at this point.
|
||||
onDestroy : function () {
|
||||
},
|
||||
// Initialize context menu.
|
||||
initMenu : function ( popup ) {
|
||||
// Save menu.
|
||||
this.menu = popup;
|
||||
|
||||
const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
if ( document.popupNode.namespaceURI == xulNS ) {
|
||||
this.shouldDisplay = false;
|
||||
return;
|
||||
}
|
||||
// Get contextual info.
|
||||
this.setTarget( document.popupNode );
|
||||
|
||||
this.isTextSelected = this.isTextSelection();
|
||||
|
||||
this.initPopupURL();
|
||||
|
||||
// Initialize (disable/remove) menu items.
|
||||
this.initItems();
|
||||
},
|
||||
initItems : function () {
|
||||
this.initOpenItems();
|
||||
this.initNavigationItems();
|
||||
this.initViewItems();
|
||||
this.initMiscItems();
|
||||
this.initSaveItems();
|
||||
this.initClipboardItems();
|
||||
this.initMetadataItems();
|
||||
},
|
||||
initOpenItems : function () {
|
||||
var showOpen = this.onSaveableLink || ( this.inDirList && this.onLink );
|
||||
|
||||
this.showItem( "context-openlink", showOpen );
|
||||
this.showItem( "context-openlinkintab", showOpen );
|
||||
|
||||
this.showItem( "context-sep-open", showOpen );
|
||||
},
|
||||
initNavigationItems : function () {
|
||||
// Back determined by canGoBack broadcaster.
|
||||
this.setItemAttrFromNode( "context-back", "disabled", "canGoBack" );
|
||||
|
||||
// Forward determined by canGoForward broadcaster.
|
||||
this.setItemAttrFromNode( "context-forward", "disabled", "canGoForward" );
|
||||
|
||||
var showNav = !( this.isTextSelected || this.onLink || this.onImage || this.onTextInput );
|
||||
|
||||
this.showItem( "context-back", showNav );
|
||||
this.showItem( "context-forward", showNav );
|
||||
|
||||
this.showItem( "context-reload", showNav );
|
||||
|
||||
this.showItem( "context-stop", showNav );
|
||||
this.showItem( "context-sep-stop", showNav );
|
||||
|
||||
// XXX: Stop is determined in navigator.js; the canStop broadcaster is broken
|
||||
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
|
||||
},
|
||||
initSaveItems : function () {
|
||||
var showSave = !( this.inDirList || this.isTextSelected || this.onTextInput || this.onStandaloneImage ||
|
||||
( this.onLink && this.onImage ) );
|
||||
if (showSave)
|
||||
goSetMenuValue( "context-savepage", this.autoDownload ? "valueSave" : "valueSaveAs" );
|
||||
this.showItem( "context-savepage", showSave );
|
||||
|
||||
// Save link depends on whether we're in a link.
|
||||
if (this.onSaveableLink)
|
||||
goSetMenuValue( "context-savelink", this.autoDownload ? "valueSave" : "valueSaveAs" );
|
||||
this.showItem( "context-savelink", this.onSaveableLink );
|
||||
|
||||
// Save/Send image depends on whether there is one.
|
||||
showSave = this.onLoadedImage || this.onStandaloneImage;
|
||||
if (showSave)
|
||||
goSetMenuValue( "context-saveimage", this.autoDownload ? "valueSave" : "valueSaveAs" );
|
||||
this.showItem( "context-saveimage", showSave );
|
||||
this.showItem( "context-sendimage", showSave );
|
||||
},
|
||||
initViewItems : function () {
|
||||
// View source is always OK, unless in directory listing.
|
||||
this.showItem( "context-viewpartialsource-selection", this.isTextSelected && !this.onTextInput );
|
||||
this.showItem( "context-viewpartialsource-mathml", this.onMathML && !this.isTextSelected );
|
||||
|
||||
var showView = !( this.inDirList || this.onImage || this.isTextSelected || this.onLink || this.onTextInput );
|
||||
|
||||
this.showItem( "context-viewsource", showView );
|
||||
this.showItem( "context-viewinfo", showView );
|
||||
|
||||
this.showItem( "context-sep-properties", !( this.inDirList || this.isTextSelected || this.onTextInput ) );
|
||||
// Set As Wallpaper depends on whether an image was clicked on, and only works on Windows.
|
||||
var isWin = navigator.appVersion.indexOf("Windows") != -1;
|
||||
this.showItem( "context-setWallpaper", isWin && (this.onLoadedImage || this.onStandaloneImage));
|
||||
|
||||
this.showItem( "context-sep-image", this.onLoadedImage || this.onStandaloneImage);
|
||||
|
||||
if( isWin && this.onLoadedImage )
|
||||
// Disable the Set As Wallpaper menu item if we're still trying to load the image
|
||||
this.setItemAttr( "context-setWallpaper", "disabled", (("complete" in this.target) && !this.target.complete) ? "true" : null );
|
||||
|
||||
this.showItem( "context-fitimage", this.onStandaloneImage && content.document.imageResizingEnabled );
|
||||
if ( this.onStandaloneImage && content.document.imageResizingEnabled ) {
|
||||
this.setItemAttr( "context-fitimage", "disabled", content.document.imageIsOverflowing ? null : "true");
|
||||
this.setItemAttr( "context-fitimage", "checked", content.document.imageIsResized ? "true" : null);
|
||||
}
|
||||
|
||||
this.showItem( "context-reloadimage", this.onImage);
|
||||
|
||||
// View Image depends on whether an image was clicked on.
|
||||
this.showItem( "context-viewimage", this.onImage && !this.onStandaloneImage);
|
||||
|
||||
// View background image depends on whether there is one.
|
||||
this.showItem( "context-viewbgimage", showView && !this.onStandaloneImage);
|
||||
this.showItem( "context-sep-viewbgimage", showView && !this.onStandaloneImage);
|
||||
this.setItemAttr( "context-viewbgimage", "disabled", this.hasBGImage ? null : "true");
|
||||
},
|
||||
initMiscItems : function () {
|
||||
// Use "Bookmark This Link" if on a link.
|
||||
this.showItem( "context-bookmarkpage", !( this.isTextSelected || this.onTextInput || this.onStandaloneImage ) );
|
||||
this.showItem( "context-bookmarklink", this.onLink && !this.onMailtoLink );
|
||||
this.showItem( "context-searchselect", this.isTextSelected && !this.onTextInput );
|
||||
this.showItem( "frame", this.inFrame );
|
||||
this.showItem( "frame-sep", this.inFrame );
|
||||
if (this.inFrame)
|
||||
goSetMenuValue( "saveframeas", this.autoDownload ? "valueSave" : "valueSaveAs" );
|
||||
var blocking = true;
|
||||
if (this.popupURL)
|
||||
try {
|
||||
const PM = Components.classes["@mozilla.org/PopupWindowManager;1"]
|
||||
.getService(Components.interfaces.nsIPopupWindowManager);
|
||||
blocking = PM.testPermission(this.popupURL) ==
|
||||
Components.interfaces.nsIPopupWindowManager.DENY_POPUP;
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
this.showItem( "popupwindow-reject", this.popupURL && !blocking);
|
||||
this.showItem( "popupwindow-allow", this.popupURL && blocking);
|
||||
this.showItem( "context-sep-popup", this.popupURL);
|
||||
|
||||
// BiDi UI
|
||||
this.showItem( "context-sep-bidi", gShowBiDi);
|
||||
this.showItem( "context-bidi-text-direction-toggle", this.onTextInput && gShowBiDi);
|
||||
this.showItem( "context-bidi-page-direction-toggle", !this.onTextInput && gShowBiDi);
|
||||
},
|
||||
initClipboardItems : function () {
|
||||
|
||||
// Copy depends on whether there is selected text.
|
||||
// Enabling this context menu item is now done through the global
|
||||
// command updating system
|
||||
// this.setItemAttr( "context-copy", "disabled", !this.isTextSelected() );
|
||||
|
||||
goUpdateGlobalEditMenuItems();
|
||||
|
||||
this.showItem( "context-undo", this.onTextInput );
|
||||
this.showItem( "context-redo", this.onTextInput );
|
||||
this.showItem( "context-sep-undo", this.onTextInput );
|
||||
this.showItem( "context-cut", this.onTextInput );
|
||||
this.showItem( "context-copy", this.isTextSelected || this.onTextInput);
|
||||
this.showItem( "context-paste", this.onTextInput );
|
||||
this.showItem( "context-delete", this.onTextInput );
|
||||
this.showItem( "context-sep-paste", this.onTextInput );
|
||||
this.showItem( "context-selectall", true );
|
||||
this.showItem( "context-sep-selectall", this.isTextSelected && !this.onTextInput );
|
||||
// In a text area there will be nothing after select all, so we don't want a sep
|
||||
// Otherwise, if there's text selected then there are extra menu items
|
||||
// (search for selection and view selection source), so we do want a sep
|
||||
|
||||
// XXX dr
|
||||
// ------
|
||||
// nsDocumentViewer.cpp has code to determine whether we're
|
||||
// on a link or an image. we really ought to be using that...
|
||||
|
||||
// Copy email link depends on whether we're on an email link.
|
||||
this.showItem( "context-copyemail", this.onMailtoLink );
|
||||
|
||||
// Copy link location depends on whether we're on a link.
|
||||
this.showItem( "context-copylink", this.onLink );
|
||||
this.showItem( "context-sep-copylink", this.onLink );
|
||||
|
||||
// Copy image location depends on whether we're on an image.
|
||||
this.showItem( "context-copyimage", this.onImage );
|
||||
this.showItem( "context-sep-copyimage", this.onImage );
|
||||
},
|
||||
initMetadataItems : function () {
|
||||
// Show if user clicked on something which has metadata.
|
||||
this.showItem( "context-metadata", this.onMetaDataItem );
|
||||
},
|
||||
// Set various context menu attributes based on the state of the world.
|
||||
setTarget : function ( node ) {
|
||||
// Initialize contextual info.
|
||||
this.onImage = false;
|
||||
this.onLoadedImage = false;
|
||||
this.onStandaloneImage = false;
|
||||
this.onMetaDataItem = false;
|
||||
this.onTextInput = false;
|
||||
this.imageURL = "";
|
||||
this.onLink = false;
|
||||
this.onMathML = false;
|
||||
this.inFrame = false;
|
||||
this.hasBGImage = false;
|
||||
this.bgImageURL = "";
|
||||
|
||||
// Remember the node that was clicked.
|
||||
this.target = node;
|
||||
|
||||
this.autoDownload = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch)
|
||||
.getBoolPref("browser.download.autoDownload");
|
||||
|
||||
// See if the user clicked on an image.
|
||||
if ( this.target.nodeType == Node.ELEMENT_NODE ) {
|
||||
if ( this.target instanceof Components.interfaces.nsIImageLoadingContent && this.target.currentURI ) {
|
||||
this.onImage = true;
|
||||
var request = this.target.getRequest( Components.interfaces.nsIImageLoadingContent.CURRENT_REQUEST );
|
||||
if (request && (request.imageStatus & request.STATUS_SIZE_AVAILABLE))
|
||||
this.onLoadedImage = true;
|
||||
this.imageURL = this.target.currentURI.spec;
|
||||
|
||||
if ( this.target.ownerDocument instanceof ImageDocument )
|
||||
this.onStandaloneImage = true;
|
||||
} else if ( this.target instanceof HTMLInputElement ) {
|
||||
this.onTextInput = this.isTargetATextBox(this.target);
|
||||
} else if ( this.target instanceof HTMLTextAreaElement ) {
|
||||
this.onTextInput = true;
|
||||
} else if ( this.target instanceof HTMLHtmlElement ) {
|
||||
// pages with multiple <body>s are lame. we'll teach them a lesson.
|
||||
var bodyElt = this.target.ownerDocument.getElementsByTagName("body")[0];
|
||||
if ( bodyElt ) {
|
||||
var computedURL = this.getComputedURL( bodyElt, "background-image" );
|
||||
if ( computedURL ) {
|
||||
this.hasBGImage = true;
|
||||
this.bgImageURL = this.makeURLAbsolute( bodyElt.baseURI,
|
||||
computedURL );
|
||||
}
|
||||
}
|
||||
} else if ( "HTTPIndex" in content &&
|
||||
content.HTTPIndex instanceof Components.interfaces.nsIHTTPIndex ) {
|
||||
this.inDirList = true;
|
||||
// Bubble outward till we get to an element with URL attribute
|
||||
// (which should be the href).
|
||||
var root = this.target;
|
||||
while ( root && !this.link ) {
|
||||
if ( root.tagName == "tree" ) {
|
||||
// Hit root of tree; must have clicked in empty space;
|
||||
// thus, no link.
|
||||
break;
|
||||
}
|
||||
if ( root.getAttribute( "URL" ) ) {
|
||||
// Build pseudo link object so link-related functions work.
|
||||
this.onLink = true;
|
||||
this.link = { href : root.getAttribute("URL"),
|
||||
getAttribute: function (attr) {
|
||||
if (attr == "title") {
|
||||
return root.firstChild.firstChild.getAttribute("label");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
};
|
||||
// If element is a directory, then you can't save it.
|
||||
if ( root.getAttribute( "container" ) == "true" ) {
|
||||
this.onSaveableLink = false;
|
||||
} else {
|
||||
this.onSaveableLink = true;
|
||||
}
|
||||
} else {
|
||||
root = root.parentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We have meta data on images.
|
||||
this.onMetaDataItem = this.onImage;
|
||||
|
||||
// See if the user clicked on MathML
|
||||
const NS_MathML = "http://www.w3.org/1998/Math/MathML";
|
||||
if ((this.target.nodeType == Node.TEXT_NODE &&
|
||||
this.target.parentNode.namespaceURI == NS_MathML)
|
||||
|| (this.target.namespaceURI == NS_MathML))
|
||||
this.onMathML = true;
|
||||
|
||||
// See if the user clicked in a frame.
|
||||
if ( this.target.ownerDocument != window.content.document ) {
|
||||
this.inFrame = true;
|
||||
}
|
||||
|
||||
// Bubble out, looking for items of interest
|
||||
const XMLNS = "http://www.w3.org/XML/1998/namespace";
|
||||
var elem = this.target;
|
||||
while ( elem ) {
|
||||
if ( elem.nodeType == Node.ELEMENT_NODE ) {
|
||||
// Link?
|
||||
if ( !this.onLink &&
|
||||
( (elem instanceof HTMLAnchorElement && elem.href) ||
|
||||
elem instanceof HTMLAreaElement ||
|
||||
elem instanceof HTMLLinkElement ||
|
||||
elem.getAttributeNS( "http://www.w3.org/1999/xlink", "type") == "simple" ) ) {
|
||||
// Clicked on a link.
|
||||
this.onLink = true;
|
||||
this.onMetaDataItem = true;
|
||||
// Remember corresponding element.
|
||||
this.link = elem;
|
||||
this.onMailtoLink = this.isLinkType( "mailto:", this.link );
|
||||
// Remember if it is saveable.
|
||||
this.onSaveableLink = this.isLinkSaveable( this.link );
|
||||
}
|
||||
|
||||
// Text input?
|
||||
if ( !this.onTextInput ) {
|
||||
// Clicked on a link.
|
||||
this.onTextInput = this.isTargetATextBox(elem);
|
||||
}
|
||||
|
||||
// Metadata item?
|
||||
if ( !this.onMetaDataItem ) {
|
||||
// We currently display metadata on anything which fits
|
||||
// the below test.
|
||||
if ( ( elem instanceof HTMLQuoteElement && elem.cite) ||
|
||||
( elem instanceof HTMLTableElement && elem.summary) ||
|
||||
( elem instanceof HTMLModElement &&
|
||||
( elem.cite || elem.dateTime ) ) ||
|
||||
( elem instanceof HTMLElement &&
|
||||
( elem.title || elem.lang ) ) ||
|
||||
elem.getAttributeNS(XMLNS, "lang") ) {
|
||||
dump("On metadata item.\n");
|
||||
this.onMetaDataItem = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Background image? Don't bother if we've already found a
|
||||
// background image further down the hierarchy. Otherwise,
|
||||
// we look for the computed background-image style.
|
||||
if ( !this.hasBGImage ) {
|
||||
var bgImgUrl = this.getComputedURL( elem, "background-image" );
|
||||
if ( bgImgUrl ) {
|
||||
this.hasBGImage = true;
|
||||
this.bgImageURL = this.makeURLAbsolute( elem.baseURI,
|
||||
bgImgUrl );
|
||||
}
|
||||
}
|
||||
}
|
||||
elem = elem.parentNode;
|
||||
}
|
||||
},
|
||||
initPopupURL: function() {
|
||||
// quick check: if no opener, it can't be a popup
|
||||
if (!window.content.opener)
|
||||
return;
|
||||
try {
|
||||
var show = false;
|
||||
// is it a popup window?
|
||||
const CI = Components.interfaces;
|
||||
var xulwin = window
|
||||
.QueryInterface(CI.nsIInterfaceRequestor)
|
||||
.getInterface(CI.nsIWebNavigation)
|
||||
.QueryInterface(CI.nsIDocShellTreeItem)
|
||||
.treeOwner
|
||||
.QueryInterface(CI.nsIInterfaceRequestor)
|
||||
.getInterface(CI.nsIXULWindow);
|
||||
if (xulwin.contextFlags &
|
||||
CI.nsIWindowCreator2.PARENT_IS_LOADING_OR_RUNNING_TIMEOUT) {
|
||||
// do the pref settings allow site-by-site popup management?
|
||||
const PB = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(CI.nsIPrefBranch);
|
||||
show = !PB.getBoolPref("dom.disable_open_during_load");
|
||||
}
|
||||
if (show) {
|
||||
// initialize popupURL
|
||||
const IOS = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(CI.nsIIOService);
|
||||
this.popupURL = IOS.newURI(window.content.opener.location.href, null, null);
|
||||
|
||||
// but cancel if it's an unsuitable URL
|
||||
const PM = Components.classes["@mozilla.org/PopupWindowManager;1"]
|
||||
.getService(CI.nsIPopupWindowManager);
|
||||
}
|
||||
} catch(e) {
|
||||
}
|
||||
},
|
||||
// Returns the computed style attribute for the given element.
|
||||
getComputedStyle: function( elem, prop ) {
|
||||
return elem.ownerDocument.defaultView.getComputedStyle( elem, '' ).getPropertyValue( prop );
|
||||
},
|
||||
// Returns a "url"-type computed style attribute value, with the url() stripped.
|
||||
getComputedURL: function( elem, prop ) {
|
||||
var url = elem.ownerDocument.defaultView.getComputedStyle( elem, '' ).getPropertyCSSValue( prop );
|
||||
return ( url.primitiveType == CSSPrimitiveValue.CSS_URI ) ? url.getStringValue() : null;
|
||||
},
|
||||
// Returns true iff clicked on link is saveable.
|
||||
isLinkSaveable : function ( link ) {
|
||||
// We don't do the Right Thing for news/snews yet, so turn them off
|
||||
// until we do.
|
||||
return !(this.isLinkType( "mailto:" , link ) ||
|
||||
this.isLinkType( "javascript:" , link ) ||
|
||||
this.isLinkType( "news:", link ) ||
|
||||
this.isLinkType( "snews:", link ) );
|
||||
},
|
||||
// Returns true iff clicked on link is of type given.
|
||||
isLinkType : function ( linktype, link ) {
|
||||
try {
|
||||
// Test for missing protocol property.
|
||||
if ( !link.protocol ) {
|
||||
// We must resort to testing the URL string :-(.
|
||||
var protocol;
|
||||
if ( link.href ) {
|
||||
protocol = link.href.substr( 0, linktype.length );
|
||||
} else {
|
||||
protocol = link.getAttributeNS("http://www.w3.org/1999/xlink","href");
|
||||
if ( protocol ) {
|
||||
protocol = protocol.substr( 0, linktype.length );
|
||||
}
|
||||
}
|
||||
return protocol.toLowerCase() === linktype;
|
||||
} else {
|
||||
// Presume all but javascript: urls are saveable.
|
||||
return link.protocol.toLowerCase() === linktype;
|
||||
}
|
||||
} catch (e) {
|
||||
// something was wrong with the link,
|
||||
// so we won't be able to save it anyway
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// Block popup windows
|
||||
rejectPopupWindows: function(andClose) {
|
||||
const PM = Components.classes["@mozilla.org/PopupWindowManager;1"]
|
||||
.getService(Components.interfaces.nsIPopupWindowManager);
|
||||
PM.add(this.popupURL, false);
|
||||
if (andClose) {
|
||||
const OS = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
OS.notifyObservers(window, "popup-perm-close", this.popupURL.spec);
|
||||
}
|
||||
},
|
||||
// Unblock popup windows
|
||||
allowPopupWindows: function() {
|
||||
const PM = Components.classes["@mozilla.org/PopupWindowManager;1"]
|
||||
.getService(Components.interfaces.nsIPopupWindowManager);
|
||||
PM.add(this.popupURL, true);
|
||||
},
|
||||
// Open linked-to URL in a new window.
|
||||
openLink : function () {
|
||||
// Determine linked-to URL.
|
||||
openNewWindowWith( this.linkURL(), true );
|
||||
},
|
||||
// Open linked-to URL in a new tab.
|
||||
openLinkInTab : function ( reverseBackgroundPref ) {
|
||||
// Determine linked-to URL.
|
||||
openNewTabWith( this.linkURL(), true, reverseBackgroundPref );
|
||||
},
|
||||
// Open frame in a new tab.
|
||||
openFrameInTab : function ( reverseBackgroundPref ) {
|
||||
// Determine linked-to URL.
|
||||
openNewTabWith( this.target.ownerDocument.location.href, true, reverseBackgroundPref );
|
||||
},
|
||||
// Reload clicked-in frame.
|
||||
reloadFrame : function () {
|
||||
this.target.ownerDocument.location.reload();
|
||||
},
|
||||
// Open clicked-in frame in its own window.
|
||||
openFrame : function () {
|
||||
openNewWindowWith( this.target.ownerDocument.location.href );
|
||||
},
|
||||
// Open clicked-in frame in the same window
|
||||
showOnlyThisFrame : function () {
|
||||
window.loadURI(this.target.ownerDocument.location.href);
|
||||
},
|
||||
// View Partial Source
|
||||
viewPartialSource : function ( context ) {
|
||||
var focusedWindow = document.commandDispatcher.focusedWindow;
|
||||
if (focusedWindow == window)
|
||||
focusedWindow = content;
|
||||
var docCharset = null;
|
||||
if (focusedWindow)
|
||||
docCharset = "charset=" + focusedWindow.document.characterSet;
|
||||
|
||||
// "View Selection Source" and others such as "View MathML Source"
|
||||
// are mutually exclusive, with the precedence given to the selection
|
||||
// when there is one
|
||||
var reference = null;
|
||||
if (context == "selection")
|
||||
reference = focusedWindow.getSelection();
|
||||
else if (context == "mathml")
|
||||
reference = this.target;
|
||||
else
|
||||
throw "not reached";
|
||||
|
||||
var docUrl = null; // unused (and play nice for fragments generated via XSLT too)
|
||||
window.openDialog("chrome://navigator/content/viewPartialSource.xul",
|
||||
"_blank", "scrollbars,resizable,chrome,dialog=no",
|
||||
docUrl, docCharset, reference, context);
|
||||
},
|
||||
// Open new "view source" window with the frame's URL.
|
||||
viewFrameSource : function () {
|
||||
BrowserViewSourceOfDocument(this.target.ownerDocument);
|
||||
},
|
||||
viewInfo : function () {
|
||||
BrowserPageInfo();
|
||||
},
|
||||
viewFrameInfo : function () {
|
||||
BrowserPageInfo(this.target.ownerDocument);
|
||||
},
|
||||
toggleImageSize : function () {
|
||||
content.document.toggleImageSize();
|
||||
},
|
||||
// Reload image
|
||||
reloadImage : function () {
|
||||
urlSecurityCheck( this.imageURL, document );
|
||||
if (this.target instanceof Components.interfaces.nsIImageLoadingContent)
|
||||
this.target.forceReload();
|
||||
},
|
||||
// Change current window to the URL of the image.
|
||||
viewImage : function () {
|
||||
urlSecurityCheck( this.imageURL, document );
|
||||
openTopWin( this.imageURL );
|
||||
},
|
||||
// Change current window to the URL of the background image.
|
||||
viewBGImage : function () {
|
||||
urlSecurityCheck( this.bgImageURL, document );
|
||||
openTopWin( this.bgImageURL );
|
||||
},
|
||||
setWallpaper: function() {
|
||||
// Confirm since it's annoying if you hit this accidentally.
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
|
||||
var gNavigatorBundle = document.getElementById("bundle_navigator");
|
||||
var promptTitle = gNavigatorBundle.getString("wallpaperConfirmTitle");
|
||||
var promptMsg = gNavigatorBundle.getString("wallpaperConfirmMsg");
|
||||
var promptConfirmButton = gNavigatorBundle.getString("wallpaperConfirmButton");
|
||||
|
||||
var buttonPressed = promptService.confirmEx(window, promptTitle, promptMsg,
|
||||
(promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) +
|
||||
(promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
|
||||
promptConfirmButton, null, null, null, {value:0});
|
||||
|
||||
if (buttonPressed != 0)
|
||||
return;
|
||||
|
||||
var winhooks = Components.classes[ "@mozilla.org/winhooks;1" ].
|
||||
getService(Components.interfaces.nsIWindowsHooks);
|
||||
|
||||
winhooks.setImageAsWallpaper(this.target, false);
|
||||
},
|
||||
// Save URL of clicked-on frame.
|
||||
saveFrame : function () {
|
||||
saveDocument( this.target.ownerDocument );
|
||||
},
|
||||
// Save URL of clicked-on link.
|
||||
saveLink : function () {
|
||||
saveURL( this.linkURL(), this.linkText(), null, true,
|
||||
getReferrer(document) );
|
||||
},
|
||||
// Save URL of clicked-on image.
|
||||
saveImage : function () {
|
||||
// Note: getReferrer wants our chrome document, not the actual
|
||||
// target document; it handles getting that itself.
|
||||
saveImageURL( this.imageURL, null, "SaveImageTitle", false,
|
||||
getReferrer(document) );
|
||||
},
|
||||
// Generate email address.
|
||||
getEmail : function () {
|
||||
// Get the comma-separated list of email addresses only.
|
||||
// There are other ways of embedding email addresses in a mailto:
|
||||
// link, but such complex parsing is beyond us.
|
||||
var addresses;
|
||||
try {
|
||||
// Let's try to unescape it using a character set
|
||||
var characterSet = this.target.ownerDocument.characterSet;
|
||||
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
|
||||
.getService(Components.interfaces.nsITextToSubURI);
|
||||
addresses = this.linkURL().match(/^mailto:([^?]+)/)[1];
|
||||
addresses = textToSubURI.unEscapeURIForUI(characterSet, addresses);
|
||||
}
|
||||
catch(ex) {
|
||||
// Do nothing.
|
||||
}
|
||||
return addresses;
|
||||
},
|
||||
// Copy email to clipboard
|
||||
copyEmail : function () {
|
||||
var clipboard = this.getService( "@mozilla.org/widget/clipboardhelper;1",
|
||||
Components.interfaces.nsIClipboardHelper );
|
||||
clipboard.copyString(this.getEmail());
|
||||
},
|
||||
addBookmark : function() {
|
||||
var docshell = document.getElementById( "content" ).webNavigation;
|
||||
BookmarksUtils.addBookmark( docshell.currentURI.spec,
|
||||
docshell.document.title,
|
||||
docshell.document.characterSet,
|
||||
false );
|
||||
},
|
||||
addBookmarkForFrame : function() {
|
||||
var doc = this.target.ownerDocument;
|
||||
var uri = doc.location.href;
|
||||
var title = doc.title;
|
||||
if ( !title )
|
||||
title = uri;
|
||||
BookmarksUtils.addBookmark( uri,
|
||||
title,
|
||||
doc.characterSet,
|
||||
false );
|
||||
},
|
||||
// Open Metadata window for node
|
||||
showMetadata : function () {
|
||||
window.openDialog( "chrome://navigator/content/metadata.xul",
|
||||
"_blank",
|
||||
"scrollbars,resizable,chrome,dialog=no",
|
||||
this.target);
|
||||
},
|
||||
|
||||
///////////////
|
||||
// Utilities //
|
||||
///////////////
|
||||
|
||||
// Create instance of component given contractId and iid (as string).
|
||||
createInstance : function ( contractId, iidName ) {
|
||||
var iid = Components.interfaces[ iidName ];
|
||||
return Components.classes[ contractId ].createInstance( iid );
|
||||
},
|
||||
// Get service given contractId and iid (as string).
|
||||
getService : function ( contractId, iidName ) {
|
||||
var iid = Components.interfaces[ iidName ];
|
||||
return Components.classes[ contractId ].getService( iid );
|
||||
},
|
||||
// Show/hide one item (specified via name or the item element itself).
|
||||
showItem : function ( itemOrId, show ) {
|
||||
var item = itemOrId.constructor == String ? document.getElementById(itemOrId) : itemOrId;
|
||||
if (item)
|
||||
item.hidden = !show;
|
||||
},
|
||||
// Set given attribute of specified context-menu item. If the
|
||||
// value is null, then it removes the attribute (which works
|
||||
// nicely for the disabled attribute).
|
||||
setItemAttr : function ( id, attr, val ) {
|
||||
var elem = document.getElementById( id );
|
||||
if ( elem ) {
|
||||
if ( val == null ) {
|
||||
// null indicates attr should be removed.
|
||||
elem.removeAttribute( attr );
|
||||
} else {
|
||||
// Set attr=val.
|
||||
elem.setAttribute( attr, val );
|
||||
}
|
||||
}
|
||||
},
|
||||
// Set context menu attribute according to like attribute of another node
|
||||
// (such as a broadcaster).
|
||||
setItemAttrFromNode : function ( item_id, attr, other_id ) {
|
||||
var elem = document.getElementById( other_id );
|
||||
if ( elem && elem.getAttribute( attr ) == "true" ) {
|
||||
this.setItemAttr( item_id, attr, "true" );
|
||||
} else {
|
||||
this.setItemAttr( item_id, attr, null );
|
||||
}
|
||||
},
|
||||
// Temporary workaround for DOM api not yet implemented by XUL nodes.
|
||||
cloneNode : function ( item ) {
|
||||
// Create another element like the one we're cloning.
|
||||
var node = document.createElement( item.tagName );
|
||||
|
||||
// Copy attributes from argument item to the new one.
|
||||
var attrs = item.attributes;
|
||||
for ( var i = 0; i < attrs.length; i++ ) {
|
||||
var attr = attrs.item( i );
|
||||
node.setAttribute( attr.nodeName, attr.nodeValue );
|
||||
}
|
||||
|
||||
// Voila!
|
||||
return node;
|
||||
},
|
||||
// Generate fully-qualified URL for clicked-on link.
|
||||
linkURL : function () {
|
||||
if (this.link.href) {
|
||||
return this.link.href;
|
||||
}
|
||||
var href = this.link.getAttributeNS("http://www.w3.org/1999/xlink","href");
|
||||
if (!href || !href.match(/\S/)) {
|
||||
throw "Empty href"; // Without this we try to save as the current doc, for example, HTML case also throws if empty
|
||||
}
|
||||
href = this.makeURLAbsolute(this.link.baseURI,href);
|
||||
return href;
|
||||
},
|
||||
// Get text of link.
|
||||
linkText : function () {
|
||||
var text = gatherTextUnder( this.link );
|
||||
if (!text || !text.match(/\S/)) {
|
||||
text = this.link.getAttribute("title");
|
||||
if (!text || !text.match(/\S/)) {
|
||||
text = this.link.getAttribute("alt");
|
||||
if (!text || !text.match(/\S/)) {
|
||||
if (this.link.href) {
|
||||
text = this.link.href;
|
||||
} else {
|
||||
text = getAttributeNS("http://www.w3.org/1999/xlink", "href");
|
||||
if (text && text.match(/\S/)) {
|
||||
text = this.makeURLAbsolute(this.link.baseURI, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
},
|
||||
|
||||
//Get selected object and convert it to a string to get
|
||||
//selected text. Only use the first 15 chars.
|
||||
isTextSelection : function() {
|
||||
var result = false;
|
||||
var selection = this.searchSelected(16);
|
||||
|
||||
var bundle = srGetStrBundle("chrome://communicator/locale/contentAreaCommands.properties");
|
||||
|
||||
var searchSelectText;
|
||||
if (selection != "") {
|
||||
searchSelectText = selection.toString();
|
||||
if (searchSelectText.length > 15)
|
||||
searchSelectText = searchSelectText.substr(0,15) + "...";
|
||||
result = true;
|
||||
|
||||
// format "Search for <selection>" string to show in menu
|
||||
searchSelectText = bundle.formatStringFromName("searchText",
|
||||
[searchSelectText], 1);
|
||||
this.setItemAttr("context-searchselect", "label", searchSelectText);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
searchSelected : function( charlen ) {
|
||||
var focusedWindow = document.commandDispatcher.focusedWindow;
|
||||
var searchStr = focusedWindow.getSelection();
|
||||
searchStr = searchStr.toString();
|
||||
// searching for more than 150 chars makes no sense
|
||||
if (!charlen)
|
||||
charlen = 150;
|
||||
if (charlen < searchStr.length) {
|
||||
// only use the first charlen important chars. see bug 221361
|
||||
var pattern = new RegExp("^(?:\\s*.){0," + charlen + "}");
|
||||
pattern.test(searchStr);
|
||||
searchStr = RegExp.lastMatch;
|
||||
}
|
||||
searchStr = searchStr.replace(/^\s+/, "");
|
||||
searchStr = searchStr.replace(/\s+$/, "");
|
||||
searchStr = searchStr.replace(/\s+/g, " ");
|
||||
return searchStr;
|
||||
},
|
||||
|
||||
// Convert relative URL to absolute, using document's <base>.
|
||||
makeURLAbsolute : function ( base, url ) {
|
||||
// Construct nsIURL.
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var baseURI = ioService.newURI(base, null, null);
|
||||
|
||||
return ioService.newURI(baseURI.resolve(url), null, null).spec;
|
||||
},
|
||||
toString : function () {
|
||||
return "contextMenu.target = " + this.target + "\n" +
|
||||
"contextMenu.onImage = " + this.onImage + "\n" +
|
||||
"contextMenu.onLink = " + this.onLink + "\n" +
|
||||
"contextMenu.link = " + this.link + "\n" +
|
||||
"contextMenu.inFrame = " + this.inFrame + "\n" +
|
||||
"contextMenu.hasBGImage = " + this.hasBGImage + "\n";
|
||||
},
|
||||
isTargetATextBox : function ( node )
|
||||
{
|
||||
if (node instanceof HTMLInputElement)
|
||||
return (node.type == "text" || node.type == "password")
|
||||
|
||||
return (node instanceof HTMLTextAreaElement);
|
||||
},
|
||||
|
||||
// Determines whether or not the separator with the specified ID should be
|
||||
// shown or not by determining if there are any non-hidden items between it
|
||||
// and the previous separator.
|
||||
shouldShowSeparator : function ( aSeparatorID )
|
||||
{
|
||||
var separator = document.getElementById(aSeparatorID);
|
||||
if (separator) {
|
||||
var sibling = separator.previousSibling;
|
||||
while (sibling && sibling.localName != "menuseparator") {
|
||||
if (sibling.getAttribute("hidden") != "true")
|
||||
return true;
|
||||
sibling = sibling.previousSibling;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* nsDefaultEngine : nsIObserver
|
||||
*
|
||||
*************************************************************************/
|
||||
function nsDefaultEngine()
|
||||
{
|
||||
try
|
||||
{
|
||||
var pb = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
var pbi = pb.QueryInterface(
|
||||
Components.interfaces.nsIPrefBranch2);
|
||||
pbi.addObserver(this.domain, this, false);
|
||||
|
||||
// reuse code by explicitly invoking initial |observe| call
|
||||
// to initialize the |icon| and |name| member variables
|
||||
this.observe(pb, "", this.domain);
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
nsDefaultEngine.prototype =
|
||||
{
|
||||
name: "",
|
||||
icon: "",
|
||||
domain: "browser.search.defaultengine",
|
||||
|
||||
// nsIObserver implementation
|
||||
observe: function(aPrefBranch, aTopic, aPrefName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var rdf = Components.
|
||||
classes["@mozilla.org/rdf/rdf-service;1"].
|
||||
getService(Components.interfaces.nsIRDFService);
|
||||
var ds = rdf.GetDataSource("rdf:internetsearch");
|
||||
var defaultEngine = aPrefBranch.getCharPref(aPrefName);
|
||||
var res = rdf.GetResource(defaultEngine);
|
||||
|
||||
// get engine ``pretty'' name
|
||||
const kNC_Name = rdf.GetResource(
|
||||
"http://home.netscape.com/NC-rdf#Name");
|
||||
var engineName = ds.GetTarget(res, kNC_Name, true);
|
||||
if (engineName)
|
||||
{
|
||||
this.name = engineName.QueryInterface(
|
||||
Components.interfaces.nsIRDFLiteral).Value;
|
||||
}
|
||||
|
||||
// get URL to engine vendor icon
|
||||
const kNC_Icon = rdf.GetResource(
|
||||
"http://home.netscape.com/NC-rdf#Icon");
|
||||
var iconURL = ds.GetTarget(res, kNC_Icon, true);
|
||||
if (iconURL)
|
||||
{
|
||||
this.icon = iconURL.QueryInterface(
|
||||
Components.interfaces.nsIRDFLiteral).Value;
|
||||
}
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,196 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Michael Lowe <michael.lowe@bigfoot.com>
|
||||
* Blake Ross <blaker@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var browser;
|
||||
var dialog = {};
|
||||
var gNavigatorBundle;
|
||||
var pref = null;
|
||||
try {
|
||||
pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
} catch (ex) {
|
||||
// not critical, remain silent
|
||||
}
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
dialog.input = document.getElementById("dialog.input");
|
||||
dialog.open = document.documentElement.getButton("accept");
|
||||
dialog.openAppList = document.getElementById("openAppList");
|
||||
dialog.openTopWindow = document.getElementById("currentWindow");
|
||||
dialog.openEditWindow = document.getElementById("editWindow");
|
||||
dialog.bundle = document.getElementById("openLocationBundle");
|
||||
gNavigatorBundle = document.getElementById("navigatorBundle");
|
||||
|
||||
if ("arguments" in window && window.arguments.length >= 1)
|
||||
browser = window.arguments[0];
|
||||
|
||||
if (!browser) {
|
||||
// No browser supplied - we are calling from Composer
|
||||
dialog.openAppList.selectedItem = dialog.openEditWindow;
|
||||
|
||||
// Change string to make more sense for Composer
|
||||
dialog.openTopWindow.setAttribute("label", dialog.bundle.getString("existingNavigatorWindow"));
|
||||
|
||||
// Find most recent browser window
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
|
||||
if (windowManagerInterface)
|
||||
browser = windowManagerInterface.getMostRecentWindow( "navigator:browser" );
|
||||
|
||||
// Disable "current browser" item if no browser is open
|
||||
if (!browser)
|
||||
dialog.openTopWindow.setAttribute("disabled", "true");
|
||||
}
|
||||
else {
|
||||
dialog.openAppList.selectedItem = dialog.openTopWindow;
|
||||
}
|
||||
|
||||
if (pref) {
|
||||
try {
|
||||
var value = pref.getIntPref("general.open_location.last_window_choice");
|
||||
var element = dialog.openAppList.getElementsByAttribute("value", value)[0];
|
||||
if (element)
|
||||
dialog.openAppList.selectedItem = element;
|
||||
dialog.input.value = pref.getComplexValue("general.open_location.last_url",
|
||||
Components.interfaces.nsISupportsString).data;
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
if (dialog.input.value)
|
||||
dialog.input.select(); // XXX should probably be done automatically
|
||||
}
|
||||
|
||||
doEnabling();
|
||||
}
|
||||
|
||||
function doEnabling()
|
||||
{
|
||||
dialog.open.disabled = !dialog.input.value;
|
||||
}
|
||||
|
||||
function open()
|
||||
{
|
||||
var url;
|
||||
if (browser)
|
||||
url = browser.getShortcutOrURI(dialog.input.value);
|
||||
else
|
||||
url = dialog.input.value;
|
||||
|
||||
try {
|
||||
switch (dialog.openAppList.value) {
|
||||
case "0":
|
||||
browser.loadURI(url);
|
||||
break;
|
||||
case "1":
|
||||
window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no", url);
|
||||
break;
|
||||
case "2":
|
||||
// editPage is in editorApplicationOverlay.js
|
||||
// 3rd param tells editPage to use "delayedOpenWindow"
|
||||
if ("editPage" in window.opener)
|
||||
window.opener.editPage(url, window.opener, true);
|
||||
break;
|
||||
case "3":
|
||||
if (browser.getBrowser && browser.getBrowser().localName == "tabbrowser")
|
||||
browser.delayedOpenTab(url);
|
||||
else
|
||||
browser.loadURI(url); // Just do a normal load.
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(exception) {
|
||||
}
|
||||
|
||||
if (pref) {
|
||||
var str = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
str.data = dialog.input.value;
|
||||
pref.setComplexValue("general.open_location.last_url",
|
||||
Components.interfaces.nsISupportsString, str);
|
||||
pref.setIntPref("general.open_location.last_window_choice", dialog.openAppList.value);
|
||||
}
|
||||
|
||||
// Delay closing slightly to avoid timing bug on Linux.
|
||||
window.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
function createInstance(contractid, iidName)
|
||||
{
|
||||
var iid = Components.interfaces[iidName];
|
||||
return Components.classes[contractid].createInstance(iid);
|
||||
}
|
||||
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
function onChooseFile()
|
||||
{
|
||||
try {
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(window, dialog.bundle.getString("chooseFileDialogTitle"), nsIFilePicker.modeOpen);
|
||||
if (dialog.openAppList.value == "2") {
|
||||
// When loading into Composer, direct user to prefer HTML files and text files,
|
||||
// so we call separately to control the order of the filter list
|
||||
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText);
|
||||
fp.appendFilters(nsIFilePicker.filterText);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
}
|
||||
else {
|
||||
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText |
|
||||
nsIFilePicker.filterAll | nsIFilePicker.filterImages | nsIFilePicker.filterXML);
|
||||
}
|
||||
|
||||
if (fp.show() == nsIFilePicker.returnOK && fp.fileURL.spec && fp.fileURL.spec.length > 0)
|
||||
dialog.input.value = fp.fileURL.spec;
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
doEnabling();
|
||||
}
|
||||
|
||||
function useUBHistoryItem(aMenuItem)
|
||||
{
|
||||
var urlbar = document.getElementById("dialog.input");
|
||||
urlbar.value = aMenuItem.getAttribute("label");
|
||||
urlbar.focus();
|
||||
doEnabling();
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
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 Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Netscape Communications Corporation.
|
||||
Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Ben Goodger <ben@netscape.com>
|
||||
Michael Lowe <michael.lowe@bigfoot.com>
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
use your version of this file under the terms of the MPL, indicate your
|
||||
decision by deleting the provisions above and replace them with the notice
|
||||
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % openDialogDTD SYSTEM "chrome://communicator/locale/openLocation.dtd" >
|
||||
%openDialogDTD;
|
||||
]>
|
||||
|
||||
<dialog id="openLocation"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&caption.label;"
|
||||
onload="onLoad()"
|
||||
ondialogaccept="open()"
|
||||
buttonlabelaccept="&open.label;"
|
||||
style="width: 40em;"
|
||||
persist="screenX screenY"
|
||||
screenX="24" screenY="24">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/openLocation.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/utilityOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://navigator/content/sessionHistoryUI.js"/>
|
||||
|
||||
<stringbundle id="openLocationBundle" src="chrome://communicator/locale/openLocation.properties"/>
|
||||
<stringbundle id="navigatorBundle" src="chrome://navigator/locale/navigator.properties"/>
|
||||
|
||||
<hbox>
|
||||
<separator orient="vertical" class="thin"/>
|
||||
<vbox flex="1">
|
||||
<label value="&enter.label;" control="dialog.input" accesskey="&enter.accesskey;"/>
|
||||
<separator class="thin"/>
|
||||
|
||||
<hbox align="center">
|
||||
<textbox id="dialog.input" flex="1" type="autocomplete"
|
||||
searchSessions="history" timeout="50" maxrows="6"
|
||||
disablehistory="false" class="uri-element"
|
||||
oninput="doEnabling();">
|
||||
<menupopup id="ubhist-popup" class="autocomplete-history-popup"
|
||||
popupalign="topleft" popupanchor="bottomleft"
|
||||
onpopupshowing="createUBHistoryMenu(event.target);"
|
||||
oncommand="useUBHistoryItem(event.target)"/>
|
||||
</textbox>
|
||||
<button label="&chooseFile.label;" accesskey="&chooseFile.accesskey;" oncommand="onChooseFile();"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<label value="&openWhere.label;" accesskey="&openWhere.accesskey;" control="openAppList"/>
|
||||
<menulist id="openAppList">
|
||||
<menupopup>
|
||||
<menuitem value="0" id="currentWindow" label="&topWindow.label;"/>
|
||||
<menuitem value="1" label="&newWindow.label;"/>
|
||||
<menuitem value="3" label="&newTab.label;"/>
|
||||
<menuseparator/>
|
||||
<menuitem value="2" id="editWindow" label="&editNewWindow.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
</dialog>
|
|
@ -1,454 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- 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 the print preview toolbar.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Samir Gehani <sgehani@netscape.com> (Original Author)
|
||||
- Rod Spears <rods@netscape.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!DOCTYPE bindings SYSTEM "chrome://communicator/locale/printPreview.dtd">
|
||||
|
||||
<bindings id="printPreviewBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="printpreviewtoolbar"
|
||||
extends="chrome://global/content/bindings/toolbar.xml#toolbar">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/printing.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:button label="&print.label;" accesskey="&print.accesskey;"
|
||||
oncommand="PrintUtils.print();"/>
|
||||
|
||||
<xul:button label="&pageSetup.label;" accesskey="&pageSetup.accesskey;"
|
||||
oncommand="this.parentNode.doPageSetup();"/>
|
||||
|
||||
<xul:vbox align="center" pack="center">
|
||||
<xul:label value="&page.label;" accesskey="&page.accesskey;" control="pageNumber"/>
|
||||
</xul:vbox>
|
||||
<xul:toolbarbutton class="toolbarbutton-icon home-arrow"
|
||||
oncommand="parentNode.navigate(0, 0, 'home');" tooltiptext="&homearrow.tooltip;"/>
|
||||
<xul:toolbarbutton class="toolbarbutton-icon last-arrow"
|
||||
oncommand="parentNode.navigate(-1, 0, 0);" tooltiptext="&leftarrow.tooltip;"/>
|
||||
<xul:hbox align="center" pack="center">
|
||||
<xul:textbox id="pageNumber" size="3" value="1" lastvalid="1"
|
||||
onchange="navigate(0, this.value, 0);"/>
|
||||
<xul:label value="&of.label;"/>
|
||||
<xul:label value="1"/>
|
||||
</xul:hbox>
|
||||
<xul:toolbarbutton class="toolbarbutton-icon next-arrow"
|
||||
oncommand="parentNode.navigate(1, 0, 0);" tooltiptext="&rightarrow.tooltip;"/>
|
||||
<xul:toolbarbutton class="toolbarbutton-icon end-arrow"
|
||||
oncommand="parentNode.navigate(0, 0, 'end');" tooltiptext="&endarrow.tooltip;"/>
|
||||
|
||||
<xul:toolbarseparator class="toolbarseparator-primary"/>
|
||||
<xul:vbox align="center" pack="center">
|
||||
<xul:label value="&scale.label;" accesskey="&scale.accesskey;" control="scale"/>
|
||||
</xul:vbox>
|
||||
|
||||
<xul:hbox align="center" pack="center">
|
||||
<xul:menulist id="scale" crop="none"
|
||||
oncommand="parentNode.parentNode.scale(this.selectedItem.value);">
|
||||
<xul:menupopup>
|
||||
<xul:menuitem value="0.3" label="&p30.label;"/>
|
||||
<xul:menuitem value="0.4" label="&p40.label;"/>
|
||||
<xul:menuitem value="0.5" label="&p50.label;"/>
|
||||
<xul:menuitem value="0.6" label="&p60.label;"/>
|
||||
<xul:menuitem value="0.7" label="&p70.label;"/>
|
||||
<xul:menuitem value="0.8" label="&p80.label;"/>
|
||||
<xul:menuitem value="0.9" label="&p90.label;"/>
|
||||
<xul:menuitem value="1" label="&p100.label;"/>
|
||||
<xul:menuitem value="1.25" label="&p125.label;"/>
|
||||
<xul:menuitem value="1.5" label="&p150.label;"/>
|
||||
<xul:menuitem value="1.75" label="&p175.label;"/>
|
||||
<xul:menuitem value="2" label="&p200.label;"/>
|
||||
<xul:menuseparator/>
|
||||
<xul:menuitem flex="1" value="ShrinkToFit"
|
||||
label="&ShrinkToFit.label;"/>
|
||||
<xul:menuitem value="Custom" label="&Custom.label;"/>
|
||||
</xul:menupopup>
|
||||
</xul:menulist>
|
||||
</xul:hbox>
|
||||
|
||||
<xul:toolbarseparator class="toolbarseparator-primary"/>
|
||||
<xul:hbox align="center" pack="center">
|
||||
<xul:toolbarbutton label="&portrait.label;" checked="true"
|
||||
accesskey="&portrait.accesskey;"
|
||||
type="radio" group="orient" class="toolbar-portrait-page"
|
||||
oncommand="parentNode.parentNode.orient('portrait');"/>
|
||||
<xul:toolbarbutton label="&landscape.label;"
|
||||
accesskey="&landscape.accesskey;"
|
||||
type="radio" group="orient" class="toolbar-landscape-page"
|
||||
oncommand="parentNode.parentNode.orient('landscape');"/>
|
||||
</xul:hbox>
|
||||
|
||||
<xul:toolbarseparator class="toolbarseparator-primary"/>
|
||||
<xul:button label="&close.label;" accesskey="&close.accesskey;"
|
||||
oncommand="PrintUtils.exitPrintPreview();"/>
|
||||
<xul:data value="&customPrompt.title;"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<field name="mDebug">
|
||||
false
|
||||
</field>
|
||||
<field name="mPrintButton">
|
||||
document.getAnonymousNodes(this)[0]
|
||||
</field>
|
||||
<field name="mPageTextBox">
|
||||
document.getAnonymousNodes(this)[5].firstChild
|
||||
</field>
|
||||
<field name="mTotalPages">
|
||||
document.getAnonymousNodes(this)[5].lastChild
|
||||
</field>
|
||||
<field name="mScaleLabel">
|
||||
document.getAnonymousNodes(this)[9].firstChild
|
||||
</field>
|
||||
<field name="mScaleCombobox">
|
||||
document.getAnonymousNodes(this)[10].firstChild
|
||||
</field>
|
||||
<field name="mOrientButtonsBox">
|
||||
document.getAnonymousNodes(this)[12]
|
||||
</field>
|
||||
<field name="mPortaitButton">
|
||||
this.mOrientButtonsBox.childNodes[0]
|
||||
</field>
|
||||
<field name="mLandscapeButton">
|
||||
this.mOrientButtonsBox.childNodes[1]
|
||||
</field>
|
||||
<field name="mCustomTitle">
|
||||
document.getAnonymousNodes(this)[15].firstChild
|
||||
</field>
|
||||
<field name="mPrintPreviewObs">
|
||||
</field>
|
||||
<field name="mWebProgress">
|
||||
</field>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this._debug("constructor");
|
||||
|
||||
var print = PrintUtils.getWebBrowserPrint();
|
||||
this.mTotalPages.value = print.printPreviewNumPages;
|
||||
|
||||
this.updateToolbar();
|
||||
|
||||
// Hide the ``Print...'' button when the underlying gfx code does not
|
||||
// support multiple devicecontext to be used concurrently
|
||||
// (e.g. printing and printpreview at the same time; required as
|
||||
// legacy support for unices.'s PostScript module
|
||||
// XXX the scaling widgets, and the orientation widgets on unices.
|
||||
var canPrint = true;
|
||||
try
|
||||
{
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
||||
canPrint = prefs.getBoolPref("print.whileInPrintPreview");
|
||||
if (!canPrint)
|
||||
{
|
||||
// Ask the printerfeatures database if this printer device
|
||||
// supports multiple device instances which can be used
|
||||
// concurrently
|
||||
var smdci = prefs.getBoolPref("print.tmp.printerfeatures." +
|
||||
print.currentPrintSettings.printerName +
|
||||
".can_use_multiple_devicecontexts_concurrently");
|
||||
|
||||
// We can print from print preview when we can use multiple
|
||||
// devicecontext instances in parallel (regardless what
|
||||
// "print.whileInPrintPreview" may say here...)
|
||||
if (smdci)
|
||||
{
|
||||
canPrint = true;
|
||||
}
|
||||
}
|
||||
|
||||
} catch(e) {}
|
||||
|
||||
if (!canPrint)
|
||||
{
|
||||
// hide print button
|
||||
this.mPrintButton.setAttribute("hidden", "true");
|
||||
|
||||
// hide page setup button
|
||||
document.getAnonymousNodes(this)[1].setAttribute("hidden", "true");
|
||||
|
||||
// hide scale widgets (indices: 8, 9, 10, 11)
|
||||
// hide orient widgets (indices: 12, 13)
|
||||
for (var i = 8; i <= 13; ++i)
|
||||
{
|
||||
document.getAnonymousNodes(this)[i].setAttribute("hidden", "true");
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<method name="doPageSetup">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var didOK = PrintUtils.showPageSetup();
|
||||
if (didOK) {
|
||||
// the changes that effect the UI
|
||||
this.updateToolbar();
|
||||
|
||||
// Now do PrintPreview
|
||||
PrintUtils.printPreview();
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="navigate">
|
||||
<parameter name="aDirection"/>
|
||||
<parameter name="aPageNum"/>
|
||||
<parameter name="aHomeOrEnd"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this._debug("navigate: " + aDirection + " " + aPageNum +
|
||||
" " + aHomeOrEnd);
|
||||
|
||||
var print = PrintUtils.getWebBrowserPrint();
|
||||
var validInput = false;
|
||||
var total;
|
||||
|
||||
// we use only one of aHomeOrEnd, aDirection, or aPageNum
|
||||
if (aHomeOrEnd)
|
||||
{
|
||||
var homeOrEnd;
|
||||
if (aHomeOrEnd == "home")
|
||||
{
|
||||
homeOrEnd = print.PRINTPREVIEW_HOME;
|
||||
this.mPageTextBox.value = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
homeOrEnd = print.PRINTPREVIEW_END;
|
||||
this.mPageTextBox.value = print.printPreviewNumPages;
|
||||
}
|
||||
|
||||
print.printPreviewNavigate(homeOrEnd, 0);
|
||||
validInput = true;
|
||||
}
|
||||
else if (aDirection)
|
||||
{
|
||||
var textBoxStr = this.mPageTextBox.value;
|
||||
var newPageNum = parseInt(textBoxStr) + aDirection;
|
||||
total = print.printPreviewNumPages;
|
||||
|
||||
// bounds check potentially user-entered number
|
||||
if (newPageNum > 0 && newPageNum <= total)
|
||||
{
|
||||
this.mPageTextBox.value = newPageNum;
|
||||
print.printPreviewNavigate(
|
||||
print.PRINTPREVIEW_GOTO_PAGENUM, newPageNum);
|
||||
validInput = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
total = print.printPreviewNumPages;
|
||||
|
||||
// bounds check potentially user-entered number
|
||||
if (aPageNum > 0 && aPageNum <= total)
|
||||
{
|
||||
print.printPreviewNavigate(
|
||||
print.PRINTPREVIEW_GOTO_PAGENUM, aPageNum);
|
||||
validInput = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (validInput)
|
||||
{
|
||||
// store the valid page number for future use to replace
|
||||
// the textbox value if erroneous input made it in
|
||||
this.mPageTextBox.setAttribute(
|
||||
"lastvalid", this.mPageTextBox.value);
|
||||
}
|
||||
else
|
||||
{
|
||||
// restore last known valid value in place of erroneous input
|
||||
this.mPageTextBox.value =
|
||||
this.mPageTextBox.getAttribute("lastvalid");
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="promptForScaleValue">
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var value = Math.round(aValue);
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var result = {value:value};
|
||||
var confirmed = promptService.prompt(window, this.mCustomTitle,
|
||||
this.mScaleLabel.value, result,
|
||||
null, {value:value});
|
||||
this._debug("confirmed: " + confirmed);
|
||||
if (!confirmed || !result.value || result.value == "" || result.value == value) {
|
||||
return(-1);
|
||||
}
|
||||
return result.value;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="setScaleCombobox">
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var scaleValues = [0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.25, 1.5, 1.75, 2];
|
||||
|
||||
aValue = new Number(aValue);
|
||||
|
||||
for (var i = 0; i < scaleValues.length; i++) {
|
||||
if (aValue == scaleValues[i]) {
|
||||
this.mScaleCombobox.selectedIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.mScaleCombobox.value = "Custom";
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="scale">
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this._debug("scale: " + aValue);
|
||||
|
||||
var settings = PrintUtils.getPrintSettings();
|
||||
if (aValue == "ShrinkToFit") {
|
||||
if (!settings.shrinkToFit) {
|
||||
settings.shrinkToFit = true;
|
||||
this.savePrintSettings(settings, settings.kInitSaveShrinkToFit | settings.kInitSaveScaling);
|
||||
PrintUtils.printPreview();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (aValue == "Custom") {
|
||||
aValue = this.promptForScaleValue(settings.scaling * 100.0);
|
||||
this._debug("promptForScaleValue "+aValue);
|
||||
if (aValue >= 10) {
|
||||
aValue /= 100;
|
||||
} else {
|
||||
this.mScaleCombobox.selectedIndex = this.mScaleCombobox.getAttribute('lastValidInx');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.setScaleCombobox(aValue);
|
||||
this.mScaleCombobox.setAttribute('lastValidInx', this.mScaleCombobox.selectedIndex);
|
||||
|
||||
if (settings.scaling != aValue)
|
||||
{
|
||||
settings.shrinkToFit = false;
|
||||
settings.scaling = aValue;
|
||||
this.savePrintSettings(settings, settings.kInitSaveShrinkToFit | settings.kInitSaveScaling);
|
||||
PrintUtils.printPreview();
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="orient">
|
||||
<parameter name="aOrientation"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this._debug("orient: " + aOrientation);
|
||||
|
||||
const kIPrintSettings = Components.interfaces.nsIPrintSettings;
|
||||
var orientValue = (aOrientation == "portrait") ? kIPrintSettings.kPortraitOrientation :
|
||||
kIPrintSettings.kLandscapeOrientation;
|
||||
var settings = PrintUtils.getPrintSettings();
|
||||
if (settings.orientation != orientValue)
|
||||
{
|
||||
settings.orientation = orientValue;
|
||||
this.savePrintSettings(settings, settings.kInitSaveOrientation);
|
||||
PrintUtils.printPreview();
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="updateToolbar">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var print = PrintUtils.getWebBrowserPrint();
|
||||
var settings = PrintUtils.getPrintSettings();
|
||||
|
||||
var isPortrait = settings.orientation == Components.interfaces.nsIPrintSettings.kPortraitOrientation;
|
||||
|
||||
this.mPortaitButton.checked = isPortrait;
|
||||
this.mLandscapeButton.checked = !isPortrait;
|
||||
|
||||
if (settings.shrinkToFit) {
|
||||
this._debug("setting ShrinkToFit");
|
||||
this.mScaleCombobox.value = "ShrinkToFit";
|
||||
} else {
|
||||
this.setScaleCombobox(settings.scaling);
|
||||
}
|
||||
|
||||
this.mTotalPages.value = print.printPreviewNumPages;
|
||||
this.mPageTextBox.value = 1;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="savePrintSettings">
|
||||
<parameter name="settings"/>
|
||||
<parameter name="flags"/>
|
||||
<body><![CDATA[
|
||||
var printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
|
||||
.getService(Components.interfaces.nsIPrintSettingsService);
|
||||
printService.savePrintSettingsToPrefs(settings, true, flags);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_debug">
|
||||
<parameter name="aMsg"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.mDebug)
|
||||
dump("\t *** printPreviewBindings: " + aMsg + "\n");
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,318 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blake Ross <blakeross@telocity.com>
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var gPrintSettingsAreGlobal = false;
|
||||
var gSavePrintSettings = false;
|
||||
|
||||
var PrintUtils = {
|
||||
|
||||
showPageSetup: function ()
|
||||
{
|
||||
try {
|
||||
var printSettings = this.getPrintSettings();
|
||||
var printingPromptService = Components.classes["@mozilla.org/embedcomp/printingprompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPrintingPromptService);
|
||||
printingPromptService.showPageSetup(window, printSettings, null);
|
||||
if (gSavePrintSettings) {
|
||||
// Page Setup data is a "native" setting on the Mac
|
||||
var printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
|
||||
.getService(Components.interfaces.nsIPrintSettingsService);
|
||||
printService.savePrintSettingsToPrefs(printSettings, true,
|
||||
printSettings.kInitSaveNativeData);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
dump("showPageSetup "+e+"\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
print: function ()
|
||||
{
|
||||
var webBrowserPrint = this.getWebBrowserPrint();
|
||||
var printSettings = this.getPrintSettings();
|
||||
try {
|
||||
webBrowserPrint.print(printSettings, null);
|
||||
if (gPrintSettingsAreGlobal && gSavePrintSettings) {
|
||||
var printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
|
||||
.getService(Components.interfaces.nsIPrintSettingsService);
|
||||
printService.savePrintSettingsToPrefs(printSettings, true,
|
||||
printSettings.kInitSaveAll);
|
||||
printService.savePrintSettingsToPrefs(printSettings, false,
|
||||
printSettings.kInitSavePrinterName);
|
||||
}
|
||||
} catch (e) {
|
||||
// Pressing cancel is expressed as an NS_ERROR_ABORT return value,
|
||||
// causing an exception to be thrown which we catch here.
|
||||
// Unfortunately this will also consume helpful failures, so add a
|
||||
// dump("print: "+e+"\n"); // if you need to debug
|
||||
}
|
||||
},
|
||||
|
||||
printPreview: function (aEnterPPCallback, aExitPPCallback)
|
||||
{
|
||||
// if we're already in PP mode, don't set the callbacks; chances
|
||||
// are they're null because someone is calling printPreview() to
|
||||
// get us to refresh the display.
|
||||
var pptoolbar = document.getElementById("print-preview-toolbar");
|
||||
if (!pptoolbar) {
|
||||
this._onEnterPP = aEnterPPCallback;
|
||||
this._onExitPP = aExitPPCallback;
|
||||
} else {
|
||||
// collapse the browser - it will be shown in
|
||||
// onEnterPrintPreview; this forces a reflow which fixes display
|
||||
// issues in bug 267422.
|
||||
var browser = getPPBrowser();
|
||||
if (browser)
|
||||
browser.collapsed = true;
|
||||
}
|
||||
|
||||
this._webProgressPP = {};
|
||||
var ppParams = {};
|
||||
var notifyOnOpen = {};
|
||||
var webBrowserPrint = this.getWebBrowserPrint();
|
||||
var printSettings = this.getPrintSettings();
|
||||
// Here we get the PrintingPromptService so we can display the PP Progress from script
|
||||
// For the browser implemented via XUL with the PP toolbar we cannot let it be
|
||||
// automatically opened from the print engine because the XUL scrollbars in the PP window
|
||||
// will layout before the content window and a crash will occur.
|
||||
// Doing it all from script, means it lays out before hand and we can let printing do it's own thing
|
||||
var printingPromptService = Components.classes["@mozilla.org/embedcomp/printingprompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPrintingPromptService);
|
||||
// just in case we are already printing,
|
||||
// an error code could be returned if the Progress Dialog is already displayed
|
||||
try {
|
||||
printingPromptService.showProgress(this, webBrowserPrint, printSettings, this._obsPP, false,
|
||||
this._webProgressPP, ppParams, notifyOnOpen);
|
||||
if (ppParams.value) {
|
||||
var webNav = getWebNavigation();
|
||||
ppParams.value.docTitle = webNav.document.title;
|
||||
ppParams.value.docURL = webNav.currentURI.spec;
|
||||
}
|
||||
|
||||
// this tells us whether we should continue on with PP or
|
||||
// wait for the callback via the observer
|
||||
if (!notifyOnOpen.value.valueOf() || this._webProgressPP.value == null)
|
||||
this.enterPrintPreview();
|
||||
} catch (e) {
|
||||
this.enterPrintPreview();
|
||||
}
|
||||
},
|
||||
|
||||
getWebBrowserPrint: function ()
|
||||
{
|
||||
return getEngineWebBrowserPrint();
|
||||
},
|
||||
|
||||
////////////////////////////////////////
|
||||
// "private" methods. Don't use them. //
|
||||
////////////////////////////////////////
|
||||
|
||||
setPrinterDefaultsForSelectedPrinter: function (aPrintService, aPrintSettings)
|
||||
{
|
||||
if (!aPrintSettings.printerName)
|
||||
aPrintSettings.printerName = aPrintService.defaultPrinterName;
|
||||
|
||||
// First get any defaults from the printer
|
||||
aPrintService.initPrintSettingsFromPrinter(aPrintSettings.printerName, aPrintSettings);
|
||||
// now augment them with any values from last time
|
||||
aPrintService.initPrintSettingsFromPrefs(aPrintSettings, true, aPrintSettings.kInitSaveAll);
|
||||
},
|
||||
|
||||
getPrintSettings: function ()
|
||||
{
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
if (pref) {
|
||||
gPrintSettingsAreGlobal = pref.getBoolPref("print.use_global_printsettings", false);
|
||||
gSavePrintSettings = pref.getBoolPref("print.save_print_settings", false);
|
||||
}
|
||||
|
||||
var printSettings;
|
||||
try {
|
||||
var printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
|
||||
.getService(Components.interfaces.nsIPrintSettingsService);
|
||||
if (gPrintSettingsAreGlobal) {
|
||||
printSettings = printService.globalPrintSettings;
|
||||
this.setPrinterDefaultsForSelectedPrinter(printService, printSettings);
|
||||
} else {
|
||||
printSettings = printService.newPrintSettings;
|
||||
}
|
||||
} catch (e) {
|
||||
dump("getPrintSettings: "+e+"\n");
|
||||
}
|
||||
return printSettings;
|
||||
},
|
||||
|
||||
_chromeState: {},
|
||||
_closeHandlerPP: null,
|
||||
_webProgressPP: null,
|
||||
_onEnterPP: null,
|
||||
_onExitPP: null,
|
||||
|
||||
// This observer is called once the progress dialog has been "opened"
|
||||
_obsPP:
|
||||
{
|
||||
observe: function(aSubject, aTopic, aData)
|
||||
{
|
||||
// delay the print preview to show the content of the progress dialog
|
||||
setTimeout(function () { PrintUtils.enterPrintPreview(); }, 0);
|
||||
},
|
||||
|
||||
QueryInterface : function(iid)
|
||||
{
|
||||
if (iid.equals(Components.interfaces.nsIObserver) ||
|
||||
iid.equals(Components.interfaces.nsISupportsWeakReference) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
}
|
||||
},
|
||||
|
||||
enterPrintPreview: function ()
|
||||
{
|
||||
var webBrowserPrint = this.getWebBrowserPrint();
|
||||
var printSettings = this.getPrintSettings();
|
||||
try {
|
||||
webBrowserPrint.printPreview(printSettings, null, this._webProgressPP.value);
|
||||
} catch (e) {
|
||||
// Pressing cancel is expressed as an NS_ERROR_ABORT return value,
|
||||
// causing an exception to be thrown which we catch here.
|
||||
// Unfortunately this will also consume helpful failures, so add a
|
||||
// dump(e); // if you need to debug
|
||||
return;
|
||||
}
|
||||
|
||||
var printPreviewTB = document.getElementById("print-preview-toolbar");
|
||||
if (printPreviewTB) {
|
||||
printPreviewTB.updateToolbar();
|
||||
var browser = getPPBrowser();
|
||||
if (browser)
|
||||
browser.collapsed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// show the toolbar after we go into print preview mode so
|
||||
// that we can initialize the toolbar with total num pages
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
printPreviewTB = document.createElementNS(XUL_NS, "toolbar");
|
||||
printPreviewTB.setAttribute("printpreview", true);
|
||||
printPreviewTB.setAttribute("id", "print-preview-toolbar");
|
||||
|
||||
var navToolbox = getNavToolbox();
|
||||
navToolbox.parentNode.insertBefore(printPreviewTB, navToolbox);
|
||||
|
||||
// copy the window close handler
|
||||
if (document.documentElement.hasAttribute("onclose"))
|
||||
this._closeHandlerPP = document.documentElement.getAttribute("onclose");
|
||||
else
|
||||
this._closeHandlerPP = null;
|
||||
document.documentElement.setAttribute("onclose", "PrintUtils.exitPrintPreview(); return false;");
|
||||
|
||||
// disable chrome shortcuts...
|
||||
window.addEventListener("keypress", this.onKeyPressPP, true);
|
||||
|
||||
// _content.focus();
|
||||
navToolbox.focus();
|
||||
|
||||
// on Enter PP Call back
|
||||
if (this._onEnterPP) {
|
||||
this._onEnterPP();
|
||||
this._onEnterPP = null;
|
||||
}
|
||||
},
|
||||
|
||||
exitPrintPreview: function ()
|
||||
{
|
||||
window.removeEventListener("keypress", this.onKeyPressPP, true);
|
||||
|
||||
// restore the old close handler
|
||||
document.documentElement.setAttribute("onclose", this._closeHandlerPP);
|
||||
this._closeHandlerPP = null;
|
||||
|
||||
var webBrowserPrint = this.getWebBrowserPrint();
|
||||
webBrowserPrint.exitPrintPreview();
|
||||
|
||||
// remove the print preview toolbar
|
||||
var navToolbox = getNavToolbox();
|
||||
var printPreviewTB = document.getElementById("print-preview-toolbar");
|
||||
navToolbox.parentNode.removeChild(printPreviewTB);
|
||||
|
||||
// _content.focus();
|
||||
navToolbox.focus();
|
||||
|
||||
// on Exit PP Call back
|
||||
if (this._onExitPP) {
|
||||
this._onExitPP();
|
||||
this._onExitPP = null;
|
||||
}
|
||||
},
|
||||
|
||||
onKeyPressPP: function (aEvent)
|
||||
{
|
||||
var closeKey;
|
||||
try {
|
||||
closeKey = document.getElementById("key_close")
|
||||
.getAttribute("key");
|
||||
closeKey = aEvent["DOM_VK_"+closeKey];
|
||||
} catch (e) {}
|
||||
var isModif = aEvent.ctrlKey || aEvent.metaKey;
|
||||
// ESC and Ctrl-W exits the PP
|
||||
if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE || isModif &&
|
||||
(aEvent.charCode == closeKey || aEvent.charCode == closeKey + 32))
|
||||
PrintUtils.exitPrintPreview();
|
||||
// cancel shortkeys
|
||||
if (isModif) {
|
||||
aEvent.preventDefault();
|
||||
aEvent.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function NSPrintSetup()
|
||||
{
|
||||
PrintUtils.showPageSetup();
|
||||
}
|
||||
|
||||
function NSPrint()
|
||||
{
|
||||
PrintUtils.print();
|
||||
}
|
|
@ -1,260 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const nsIDOMWindowInternal = Components.interfaces.nsIDOMWindowInternal;
|
||||
const nsIWindowMediator = Components.interfaces.nsIWindowMediator;
|
||||
const nsIWindowDataSource = Components.interfaces.nsIWindowDataSource;
|
||||
|
||||
function toNavigator()
|
||||
{
|
||||
if (!CycleWindow("navigator:browser"))
|
||||
OpenBrowserWindow();
|
||||
}
|
||||
|
||||
function toDownloadManager()
|
||||
{
|
||||
var dlmgr = Components.classes['@mozilla.org/download-manager;1'].getService();
|
||||
dlmgr = dlmgr.QueryInterface(Components.interfaces.nsIDownloadManager);
|
||||
|
||||
var windowMediator = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
windowMediator = windowMediator.QueryInterface(nsIWindowMediator);
|
||||
|
||||
var dlmgrWindow = windowMediator.getMostRecentWindow("Download:Manager");
|
||||
if (dlmgrWindow) {
|
||||
dlmgrWindow.focus();
|
||||
}
|
||||
else {
|
||||
dlmgr.open(window, null);
|
||||
}
|
||||
}
|
||||
|
||||
function toJavaScriptConsole()
|
||||
{
|
||||
toOpenWindowByType("global:console", "chrome://global/content/console.xul");
|
||||
}
|
||||
|
||||
function javaItemEnabling()
|
||||
{
|
||||
var element = document.getElementById("java");
|
||||
if (navigator.javaEnabled())
|
||||
element.removeAttribute("disabled");
|
||||
else
|
||||
element.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
function toJavaConsole()
|
||||
{
|
||||
var jvmMgr = Components.classes['@mozilla.org/oji/jvm-mgr;1']
|
||||
.getService(Components.interfaces.nsIJVMManager)
|
||||
jvmMgr.showJavaConsole();
|
||||
}
|
||||
|
||||
function toOpenWindow( aWindow )
|
||||
{
|
||||
try {
|
||||
// Try to focus the previously focused window e.g. message compose body
|
||||
aWindow.document.commandDispatcher.focusedWindow.focus();
|
||||
} catch (e) {
|
||||
// e.g. full-page plugin or non-XUL document; just raise the top window
|
||||
aWindow.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function toOpenWindowByType( inType, uri )
|
||||
{
|
||||
// Recently opened one.
|
||||
if (uri in window)
|
||||
return;
|
||||
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(nsIWindowMediator);
|
||||
|
||||
var topWindow = windowManager.getMostRecentWindow( inType );
|
||||
|
||||
if ( topWindow )
|
||||
toOpenWindow( topWindow );
|
||||
else
|
||||
{
|
||||
function newWindowLoaded(event) {
|
||||
delete window[uri];
|
||||
}
|
||||
window[uri] = window.openDialog(uri, "", "all,dialog=no");
|
||||
window[uri].addEventListener("load", newWindowLoaded, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function OpenBrowserWindow()
|
||||
{
|
||||
var charsetArg = new String();
|
||||
var handler = Components.classes['@mozilla.org/commandlinehandler/general-startup;1?type=browser'];
|
||||
handler = handler.getService();
|
||||
handler = handler.QueryInterface(Components.interfaces.nsICmdLineHandler);
|
||||
var url = handler.chromeUrlForTask;
|
||||
var wintype = document.documentElement.getAttribute('windowtype');
|
||||
var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
|
||||
var browserWin = windowMediator.getMostRecentWindow("navigator:browser");
|
||||
|
||||
// if a browser window already exists then set startpage to null so
|
||||
// navigator.js can check pref for how new window should be opened
|
||||
var startpage = browserWin ? null : handler.defaultArgs;
|
||||
|
||||
// if and only if the current window is a browser window and it has a document with a character
|
||||
// set, then extract the current charset menu setting from the current document and use it to
|
||||
// initialize the new browser window...
|
||||
if (window && (wintype == "navigator:browser") && window.content && window.content.document)
|
||||
{
|
||||
var DocCharset = window.content.document.characterSet;
|
||||
charsetArg = "charset="+DocCharset;
|
||||
|
||||
//we should "inherit" the charset menu setting in a new window
|
||||
window.openDialog(url, "_blank", "chrome,all,dialog=no", startpage, charsetArg);
|
||||
}
|
||||
else // forget about the charset information.
|
||||
{
|
||||
window.openDialog(url, "_blank", "chrome,all,dialog=no", startpage);
|
||||
}
|
||||
}
|
||||
|
||||
function CycleWindow( aType )
|
||||
{
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
var windowManagerInterface = windowManager.QueryInterface(nsIWindowMediator);
|
||||
|
||||
var topWindowOfType = windowManagerInterface.getMostRecentWindow( aType );
|
||||
var topWindow = windowManagerInterface.getMostRecentWindow( null );
|
||||
|
||||
if ( topWindowOfType == null )
|
||||
return null;
|
||||
|
||||
if ( topWindowOfType != topWindow ) {
|
||||
toOpenWindow(topWindowOfType);
|
||||
return topWindowOfType;
|
||||
}
|
||||
|
||||
var enumerator = windowManagerInterface.getEnumerator( aType );
|
||||
var firstWindow = enumerator.getNext().QueryInterface(nsIDOMWindowInternal);
|
||||
var iWindow = firstWindow;
|
||||
while (iWindow != topWindow && enumerator.hasMoreElements())
|
||||
iWindow = enumerator.getNext().QueryInterface(nsIDOMWindowInternal);
|
||||
|
||||
if (enumerator.hasMoreElements()) {
|
||||
iWindow = enumerator.getNext().QueryInterface(nsIDOMWindowInternal);
|
||||
toOpenWindow(iWindow);
|
||||
return iWindow;
|
||||
}
|
||||
|
||||
if (firstWindow == topWindow) // Only one window
|
||||
return null;
|
||||
|
||||
toOpenWindow(firstWindow);
|
||||
return firstWindow;
|
||||
}
|
||||
|
||||
function ShowWindowFromResource( node )
|
||||
{
|
||||
var windowManagerDS = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService(nsIWindowDataSource);
|
||||
|
||||
var desiredWindow = null;
|
||||
var url = node.getAttribute('id');
|
||||
desiredWindow = windowManagerDS.getWindowForResource( url );
|
||||
if ( desiredWindow )
|
||||
{
|
||||
toOpenWindow(desiredWindow);
|
||||
}
|
||||
}
|
||||
|
||||
function OpenTaskURL( inURL )
|
||||
{
|
||||
|
||||
window.open( inURL );
|
||||
}
|
||||
|
||||
function ShowUpdateFromResource( node )
|
||||
{
|
||||
var url = node.getAttribute('url');
|
||||
// hack until I get a new interface on xpiflash to do a
|
||||
// look up on the name/url pair.
|
||||
OpenTaskURL( "http://www.mozilla.org/binaries.html");
|
||||
}
|
||||
|
||||
function checkFocusedWindow()
|
||||
{
|
||||
var windowManagerDS = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService(nsIWindowDataSource);
|
||||
|
||||
var sep = document.getElementById("sep-window-list");
|
||||
// Using double parens to avoid warning
|
||||
while ((sep = sep.nextSibling)) {
|
||||
var url = sep.getAttribute('id');
|
||||
var win = windowManagerDS.getWindowForResource(url);
|
||||
if (win == window) {
|
||||
sep.setAttribute("checked", "true");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toProfileManager()
|
||||
{
|
||||
const wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var promgrWin = wm.getMostRecentWindow( "mozilla:profileSelection" );
|
||||
if (promgrWin) {
|
||||
promgrWin.focus();
|
||||
} else {
|
||||
var params = Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
|
||||
.createInstance(Components.interfaces.nsIDialogParamBlock);
|
||||
|
||||
params.SetNumberStrings(1);
|
||||
params.SetString(0, "menu");
|
||||
window.openDialog("chrome://communicator/content/profile/profileSelection.xul",
|
||||
"",
|
||||
"centerscreen,chrome,titlebar",
|
||||
params);
|
||||
}
|
||||
// Here, we don't care about the result code
|
||||
// that was returned in the param block.
|
||||
}
|
||||
|
||||
// This function is used by mac's platformCommunicatorOverlay
|
||||
function ZoomCurrentWindow()
|
||||
{
|
||||
if (window.windowState == STATE_NORMAL)
|
||||
window.maximize();
|
||||
else
|
||||
window.restore();
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/tasksOverlay.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
<!ENTITY % tasksDTD SYSTEM "chrome://communicator/locale/tasksOverlay.dtd" >
|
||||
%tasksDTD;
|
||||
]>
|
||||
|
||||
<overlay id="tasksOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/tasksOverlay.js"/>
|
||||
|
||||
|
||||
|
||||
<keyset id="tasksKeys">
|
||||
<key id="key_navigator" key="&navigatorCmd.commandkey;" command="Tasks:Navigator" modifiers="accel"/>
|
||||
|
||||
</keyset>
|
||||
<commandset id="tasksCommands">
|
||||
<command id="Tasks:Navigator" oncommand="toNavigator();"/>
|
||||
</commandset>
|
||||
|
||||
|
||||
<!-- Tasks Menu -->
|
||||
<menu id="tasksMenu" label="&tasksMenu.label;" accesskey="&tasksMenu.accesskey;">
|
||||
<menupopup id="taskPopup">
|
||||
<menuitem id="downloadmgr" label="&downloadManagerCmd.label;" accesskey="&downloadManagerCmd.accesskey;" oncommand="toDownloadManager();"/>
|
||||
<menuseparator/>
|
||||
<menu label="&webDevelopment.label;" accesskey="&webDevelopment.accesskey;">
|
||||
<menupopup id="toolsPopup" onpopupshowing="javaItemEnabling();">
|
||||
<menuitem label="&errorConsoleCmd.label;" accesskey="&errorConsoleCmd.accesskey;" oncommand="toJavaScriptConsole();"/>
|
||||
<menuitem id="java" label="&javaConsoleCmd.label;" accesskey="&javaConsoleCmd.accesskey;" oncommand="toJavaConsole()"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator id="sep_switchprofile"/>
|
||||
<menuitem id="cmd_switchprofile" label="&switchProfileCmd.label;" accesskey="&switchProfileCmd.accesskey;" oncommand="toProfileManager();"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menu id="windowMenu" label="&windowMenu.label;" accesskey="&windowMenu.accesskey;"
|
||||
datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot"
|
||||
onpopupshowing="checkFocusedWindow();">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#KeyIndex rdf:http://home.netscape.com/NC-rdf#Name" type="radio"
|
||||
name="windowList" oncommand="ShowWindowFromResource(event.target)" accesskey="rdf:http://home.netscape.com/NC-rdf#KeyIndex"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup id="windowPopup">
|
||||
<menuitem label="&navigatorCmd.label;" accesskey="&navigatorCmd.accesskey;" key="key_navigator" command="Tasks:Navigator" id="tasksMenuNavigator" class="menuitem-iconic icon-navigator16"/>
|
||||
|
||||
<!-- Overlays get stuffed in here. -->
|
||||
<menuseparator id="sep-window-list"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
|
||||
<statusbarpanel id="component-bar" persist="collapsed">
|
||||
<toolbarbutton class="taskbutton" id="mini-nav" oncommand="toNavigator();"
|
||||
tooltiptext="&taskNavigator.tooltip;"/>
|
||||
</statusbarpanel>
|
||||
</overlay>
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- unix version of platformBrowserBindings.xul -->
|
||||
<!-- This file is ONLY here to show bindings in the menus. -->
|
||||
<!-- The real bindings come from XBL, in platformHTMLBindings.xml -->
|
||||
<!-- See bugs 57078 and 71779. -->
|
||||
|
||||
<keybinding id="platformBrowserBindings"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<keyset id="globalKeySet">
|
||||
|
||||
<key id="sparcCutKey" keycode="VK_F20"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_cut');
|
||||
controller.doCommand('cmd_cut');"/>
|
||||
<key id="sparcCopyKey" keycode="VK_F16"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_copy');
|
||||
controller.doCommand('cmd_copy');"/>
|
||||
<key id="sparcPasteKey" keycode="VK_F18"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_paste');
|
||||
controller.doCommand('cmd_paste');"/>
|
||||
</keyset>
|
||||
|
||||
</keybinding>
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- unix version of platformCommunicatorOverlay.xul -->
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
|
||||
<!ENTITY % platformCommunicatorDTD SYSTEM "chrome://communicator-platform/locale/platformCommunicatorOverlay.dtd">
|
||||
%platformCommunicatorDTD;
|
||||
<!ENTITY % utilityDTD SYSTEM "chrome://communicator/locale/utilityOverlay.dtd">
|
||||
%utilityDTD;
|
||||
|
||||
]>
|
||||
|
||||
<overlay id="platformCommunicatorOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- close -->
|
||||
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" command="cmd_close"/>
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuseparator id="menu_FileQuitSeparator"/>
|
||||
<menuitem label="&quitApplicationCmd.label;" id="menu_FileQuitItem"
|
||||
key="key_quit" accesskey="&quitApplicationCmd.accesskey;" command="cmd_quit"/>
|
||||
</menupopup>
|
||||
<key id="key_quit" key="&quitApplicationCmd.key;" command="cmd_quit" modifiers="accel"/>
|
||||
<command id="cmd_quit" oncommand="goQuitApplication()"/>
|
||||
|
||||
<!-- Edit Menu -->
|
||||
<menuitem id="menu_redo" label="&redoCmd.label;" key="key_redo" accesskey="&redoCmd.accesskey;" command="cmd_redo"/>
|
||||
<!-- Select All Key -->
|
||||
<key id="key_selectAll" key="&selectAllCmd.key;" modifiers="alt"/>
|
||||
|
||||
<!-- Delete Key -->
|
||||
<key id="key_delete" keycode="VK_DELETE" command="cmd_delete"/>
|
||||
|
||||
<!-- Find As You Type Keys -->
|
||||
<key id="key_findTypeText"
|
||||
key="&findTypeTextCmd.key;"/>
|
||||
<key id="key_findTypeLinks"
|
||||
key="&findTypeLinksCmd.key;"/>
|
||||
|
||||
<!-- Tasks Keys -->
|
||||
<keyset id="tasksKeys">
|
||||
<key id="key_openHelp"
|
||||
keycode="&openHelpCmd.key;"
|
||||
command="cmd_openHelp"/>
|
||||
</keyset>
|
||||
|
||||
</overlay>
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- unix version of platformEditorBindings.xul -->
|
||||
<!-- This file is ONLY here to show bindings in the menus. -->
|
||||
<!-- The real bindings come from XBL, in platformHTMLBindings.xml -->
|
||||
<!-- See bugs 57078 and 71779. -->
|
||||
|
||||
<keybinding id="platformEditorBindings"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- End Unix-specific keybindings -->
|
||||
|
||||
</keybinding>
|
||||
|
|
@ -1,705 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Communicator Shared Utility Library
|
||||
* for shared application glue for the Communicator suite of applications
|
||||
**/
|
||||
|
||||
/*
|
||||
Note: All Editor/Composer-related methods have been moved to editorApplicationOverlay.js,
|
||||
so app windows that require those must include editorNavigatorOverlay.xul
|
||||
*/
|
||||
|
||||
/**
|
||||
* Go into online/offline mode
|
||||
**/
|
||||
|
||||
const kIOServiceProgID = "@mozilla.org/network/io-service;1";
|
||||
const kObserverServiceProgID = "@mozilla.org/observer-service;1";
|
||||
const kProxyManual = ["network.proxy.ftp",
|
||||
"network.proxy.gopher",
|
||||
"network.proxy.http",
|
||||
"network.proxy.socks",
|
||||
"network.proxy.ssl"];
|
||||
var gShowBiDi = false;
|
||||
|
||||
function toggleOfflineStatus()
|
||||
{
|
||||
var checkfunc;
|
||||
try {
|
||||
checkfunc = document.getElementById("offline-status").getAttribute('checkfunc');
|
||||
}
|
||||
catch (ex) {
|
||||
checkfunc = null;
|
||||
}
|
||||
|
||||
var ioService = Components.classes[kIOServiceProgID]
|
||||
.getService(Components.interfaces.nsIIOService2);
|
||||
if (checkfunc) {
|
||||
if (!eval(checkfunc)) {
|
||||
// the pre-offline check function returned false, so don't go offline
|
||||
return;
|
||||
}
|
||||
}
|
||||
ioService.manageOfflineStatus = false;
|
||||
ioService.offline = !ioService.offline;
|
||||
}
|
||||
|
||||
function setNetworkStatus(networkProxyType)
|
||||
{
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"];
|
||||
prefService = prefService.getService(Components.interfaces.nsIPrefService);
|
||||
var prefBranch = prefService.getBranch(null);
|
||||
try {
|
||||
prefBranch.setIntPref("network.proxy.type", networkProxyType);
|
||||
}
|
||||
catch (ex) {}
|
||||
}
|
||||
|
||||
function InitProxyMenu()
|
||||
{
|
||||
var networkProxyNo = document.getElementById("network-proxy-no");
|
||||
var networkProxyManual = document.getElementById("network-proxy-manual");
|
||||
var networkProxyPac = document.getElementById("network-proxy-pac");
|
||||
var networkProxyWpad = document.getElementById("network-proxy-wpad");
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"];
|
||||
prefService = prefService.getService(Components.interfaces.nsIPrefService);
|
||||
var prefBranch = prefService.getBranch(null);
|
||||
|
||||
var proxyLocked = prefBranch.prefIsLocked("network.proxy.type");
|
||||
if (proxyLocked) {
|
||||
networkProxyNo.setAttribute("disabled", "true");
|
||||
networkProxyWpad.setAttribute("disabled", "true");
|
||||
}
|
||||
else {
|
||||
networkProxyNo.removeAttribute("disabled");
|
||||
networkProxyWpad.removeAttribute("disabled");
|
||||
}
|
||||
|
||||
// If no proxy is configured, disable the menuitems.
|
||||
// Checking for proxy manual settings.
|
||||
var proxyManuallyConfigured = false;
|
||||
for (var i = 0; i < kProxyManual.length; i++) {
|
||||
if (GetStringPref(kProxyManual[i]) != "") {
|
||||
proxyManuallyConfigured = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (proxyManuallyConfigured && !proxyLocked) {
|
||||
networkProxyManual.removeAttribute("disabled");
|
||||
}
|
||||
else {
|
||||
networkProxyManual.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
//Checking for proxy PAC settings.
|
||||
var proxyAutoConfigured = false;
|
||||
if (GetStringPref("network.proxy.autoconfig_url") != "")
|
||||
proxyAutoConfigured = true;
|
||||
|
||||
if (proxyAutoConfigured && !proxyLocked) {
|
||||
networkProxyPac.removeAttribute("disabled");
|
||||
}
|
||||
else {
|
||||
networkProxyPac.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
var networkProxyType;
|
||||
try {
|
||||
networkProxyType = prefBranch.getIntPref("network.proxy.type");
|
||||
} catch(e) {}
|
||||
|
||||
// The pref value 3 for network.proxy.type is unused to maintain
|
||||
// backwards compatibility. Treat 3 equally to 0. See bug 115720.
|
||||
var networkProxyStatus = [networkProxyNo, networkProxyManual, networkProxyPac,
|
||||
networkProxyNo, networkProxyWpad];
|
||||
networkProxyStatus[networkProxyType].setAttribute("checked", "true");
|
||||
}
|
||||
|
||||
function setProxyTypeUI()
|
||||
{
|
||||
var panel = document.getElementById("offline-status");
|
||||
if (!panel)
|
||||
return;
|
||||
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"];
|
||||
prefService = prefService.getService(Components.interfaces.nsIPrefService);
|
||||
var prefBranch = prefService.getBranch(null);
|
||||
|
||||
try {
|
||||
var networkProxyType = prefBranch.getIntPref("network.proxy.type");
|
||||
} catch(e) {}
|
||||
|
||||
var onlineTooltip = "onlineTooltip" + networkProxyType;
|
||||
var bundle = srGetStrBundle("chrome://communicator/locale/utilityOverlay.properties");
|
||||
panel.setAttribute("tooltiptext", bundle.GetStringFromName(onlineTooltip));
|
||||
}
|
||||
|
||||
function GetStringPref(name)
|
||||
{
|
||||
try {
|
||||
return pref.getComplexValue(name, Components.interfaces.nsISupportsString).data;
|
||||
} catch (e) {}
|
||||
return "";
|
||||
}
|
||||
|
||||
function setOfflineUI(offline)
|
||||
{
|
||||
var broadcaster = document.getElementById("Communicator:WorkMode");
|
||||
var panel = document.getElementById("offline-status");
|
||||
if (!broadcaster || !panel) return;
|
||||
|
||||
//Checking for a preference "network.online", if it's locked, disabling
|
||||
// network icon and menu item
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"];
|
||||
prefService = prefService.getService(Components.interfaces.nsIPrefService);
|
||||
var prefBranch = prefService.getBranch(null);
|
||||
|
||||
var offlineLocked = prefBranch.prefIsLocked("network.online");
|
||||
|
||||
if (offlineLocked ) {
|
||||
broadcaster.setAttribute("disabled","true");
|
||||
}
|
||||
|
||||
var bundle = srGetStrBundle("chrome://communicator/locale/utilityOverlay.properties");
|
||||
|
||||
if (offline)
|
||||
{
|
||||
broadcaster.setAttribute("offline", "true");
|
||||
broadcaster.setAttribute("checked", "true");
|
||||
panel.removeAttribute("context");
|
||||
panel.setAttribute("tooltiptext", bundle.GetStringFromName("offlineTooltip"));
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcaster.removeAttribute("offline");
|
||||
broadcaster.removeAttribute("checked");
|
||||
panel.setAttribute("context", "networkProperties");
|
||||
try {
|
||||
var networkProxyType = prefBranch.getIntPref("network.proxy.type");
|
||||
} catch(e) {}
|
||||
var onlineTooltip = "onlineTooltip" + networkProxyType;
|
||||
panel.setAttribute("tooltiptext", bundle.GetStringFromName(onlineTooltip));
|
||||
}
|
||||
}
|
||||
|
||||
var goPrefWindow = 0;
|
||||
|
||||
function getBrowserURL() {
|
||||
|
||||
try {
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var url = prefs.getCharPref("browser.chromeURL");
|
||||
if (url)
|
||||
return url;
|
||||
} catch(e) {
|
||||
}
|
||||
return "chrome://navigator/content/navigator.xul";
|
||||
}
|
||||
|
||||
function goPreferences(containerID, paneURL, itemID)
|
||||
{
|
||||
var resizable;
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
try {
|
||||
// We are resizable ONLY if in box debugging mode, because in
|
||||
// this special debug mode it is often impossible to see the
|
||||
// content of the debug panel in order to disable debug mode.
|
||||
resizable = pref.getBoolPref("xul.debug.box");
|
||||
}
|
||||
catch (e) {
|
||||
resizable = false;
|
||||
}
|
||||
|
||||
//check for an existing pref window and focus it; it's not application modal
|
||||
const kWindowMediatorContractID = "@mozilla.org/appshell/window-mediator;1";
|
||||
const kWindowMediatorIID = Components.interfaces.nsIWindowMediator;
|
||||
const kWindowMediator = Components.classes[kWindowMediatorContractID].getService(kWindowMediatorIID);
|
||||
var lastPrefWindow = kWindowMediator.getMostRecentWindow("mozilla:preferences");
|
||||
if (lastPrefWindow)
|
||||
lastPrefWindow.focus();
|
||||
else {
|
||||
var resizability = resizable ? "yes" : "no";
|
||||
var features = "chrome,titlebar,resizable=" + resizability;
|
||||
openDialog("chrome://communicator/content/pref/pref.xul","PrefWindow",
|
||||
features, paneURL, containerID, itemID);
|
||||
}
|
||||
}
|
||||
|
||||
function goToggleToolbar( id, elementID )
|
||||
{
|
||||
var toolbar = document.getElementById( id );
|
||||
var element = document.getElementById( elementID );
|
||||
if ( toolbar )
|
||||
{
|
||||
var attribValue = toolbar.getAttribute("hidden") ;
|
||||
|
||||
if ( attribValue == "true" )
|
||||
{
|
||||
toolbar.setAttribute("hidden", "false" );
|
||||
if ( element )
|
||||
element.setAttribute("checked","true")
|
||||
}
|
||||
else
|
||||
{
|
||||
toolbar.setAttribute("hidden", true );
|
||||
if ( element )
|
||||
element.setAttribute("checked","false")
|
||||
}
|
||||
document.persist(id, 'hidden');
|
||||
document.persist(elementID, 'checked');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function goClickThrobber( urlPref )
|
||||
{
|
||||
var url;
|
||||
try {
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
url = pref.getComplexValue(urlPref, Components.interfaces.nsIPrefLocalizedString).data;
|
||||
}
|
||||
|
||||
catch(e) {
|
||||
url = null;
|
||||
}
|
||||
|
||||
if ( url )
|
||||
openTopWin(url);
|
||||
}
|
||||
|
||||
|
||||
//No longer needed. Rip this out since we are using openTopWin
|
||||
function goHelpMenu( url )
|
||||
{
|
||||
/* note that this chrome url should probably change to not have all of the navigator controls */
|
||||
/* also, do we want to limit the number of help windows that can be spawned? */
|
||||
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
|
||||
}
|
||||
|
||||
function getTopWin()
|
||||
{
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
|
||||
var topWindowOfType = windowManagerInterface.getMostRecentWindow( "navigator:browser" );
|
||||
|
||||
if (topWindowOfType) {
|
||||
return topWindowOfType;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function openTopWin( url )
|
||||
{
|
||||
/* note that this chrome url should probably change to not have
|
||||
all of the navigator controls, but if we do this we need to have
|
||||
the option for chrome controls because goClickThrobber() needs to
|
||||
use this function with chrome controls */
|
||||
/* also, do we want to
|
||||
limit the number of help windows that can be spawned? */
|
||||
if ((url == null) || (url == "")) return null;
|
||||
|
||||
// xlate the URL if necessary
|
||||
if (url.indexOf("urn:") == 0)
|
||||
{
|
||||
url = xlateURL(url); // does RDF urn expansion
|
||||
}
|
||||
|
||||
// avoid loading "", since this loads a directory listing
|
||||
if (url == "") {
|
||||
url = "about:blank";
|
||||
}
|
||||
|
||||
var topWindowOfType = getTopWin();
|
||||
if ( topWindowOfType )
|
||||
{
|
||||
topWindowOfType.focus();
|
||||
topWindowOfType.loadURI(url);
|
||||
return topWindowOfType;
|
||||
}
|
||||
return window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
|
||||
}
|
||||
|
||||
function goAboutDialog()
|
||||
{
|
||||
var defaultAboutState = false;
|
||||
try {
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
defaultAboutState = pref.getBoolPref("browser.show_about_as_stupid_modal_window");
|
||||
}
|
||||
catch(e) {
|
||||
defaultAboutState = false;
|
||||
}
|
||||
if( defaultAboutState )
|
||||
window.openDialog("chrome://global/content/about.xul", "About", "modal,chrome,resizable=yes,height=450,width=550");
|
||||
else
|
||||
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", 'about:' );
|
||||
}
|
||||
|
||||
// update menu items that rely on focus
|
||||
function goUpdateGlobalEditMenuItems()
|
||||
{
|
||||
goUpdateCommand('cmd_undo');
|
||||
goUpdateCommand('cmd_redo');
|
||||
goUpdateCommand('cmd_cut');
|
||||
goUpdateCommand('cmd_copy');
|
||||
goUpdateCommand('cmd_paste');
|
||||
goUpdateCommand('cmd_selectAll');
|
||||
goUpdateCommand('cmd_delete');
|
||||
if (gShowBiDi)
|
||||
goUpdateCommand('cmd_switchTextDirection');
|
||||
}
|
||||
|
||||
// update menu items that rely on the current selection
|
||||
function goUpdateSelectEditMenuItems()
|
||||
{
|
||||
goUpdateCommand('cmd_cut');
|
||||
goUpdateCommand('cmd_copy');
|
||||
goUpdateCommand('cmd_delete');
|
||||
goUpdateCommand('cmd_selectAll');
|
||||
}
|
||||
|
||||
// update menu items that relate to undo/redo
|
||||
function goUpdateUndoEditMenuItems()
|
||||
{
|
||||
goUpdateCommand('cmd_undo');
|
||||
goUpdateCommand('cmd_redo');
|
||||
}
|
||||
|
||||
// update menu items that depend on clipboard contents
|
||||
function goUpdatePasteMenuItems()
|
||||
{
|
||||
goUpdateCommand('cmd_paste');
|
||||
}
|
||||
|
||||
// update Find As You Type menu items, they rely on focus
|
||||
function goUpdateFindTypeMenuItems()
|
||||
{
|
||||
goUpdateCommand('cmd_findTypeText');
|
||||
goUpdateCommand('cmd_findTypeLinks');
|
||||
}
|
||||
|
||||
// function that extracts the filename from a url
|
||||
function extractFileNameFromUrl(urlstr) {
|
||||
if (!urlstr) return null;
|
||||
|
||||
// For "http://foo/bar/cheese.jpg", return "cheese.jpg".
|
||||
// For "imap://user@host.com:143/fetch>UID>/INBOX>951?part=1.2&type=image/gif&filename=foo.jpeg", return "foo.jpeg".
|
||||
// The 2nd url (ie, "imap://...") is generated for inline images by MimeInlineImage_parse_begin() in mimeiimg.cpp.
|
||||
var lastSlash = urlstr.slice(urlstr.lastIndexOf( "/" )+1);
|
||||
if (lastSlash)
|
||||
{
|
||||
var nameIndex = lastSlash.lastIndexOf( "filename=" );
|
||||
if (nameIndex != -1)
|
||||
return (lastSlash.slice(nameIndex+9));
|
||||
else
|
||||
return lastSlash;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Gather all descendent text under given document node.
|
||||
function gatherTextUnder ( root )
|
||||
{
|
||||
var text = "";
|
||||
var node = root.firstChild;
|
||||
var depth = 1;
|
||||
while ( node && depth > 0 ) {
|
||||
// See if this node is text.
|
||||
if ( node.nodeType == Node.TEXT_NODE ) {
|
||||
// Add this text to our collection.
|
||||
text += " " + node.data;
|
||||
} else if ( node instanceof HTMLImageElement ) {
|
||||
// If it has an alt= attribute, add that.
|
||||
var altText = node.getAttribute( "alt" );
|
||||
if ( altText && altText != "" ) {
|
||||
text += " " + altText;
|
||||
}
|
||||
}
|
||||
// Find next node to test.
|
||||
// First, see if this node has children.
|
||||
if ( node.hasChildNodes() ) {
|
||||
// Go to first child.
|
||||
node = node.firstChild;
|
||||
depth++;
|
||||
} else {
|
||||
// No children, try next sibling.
|
||||
if ( node.nextSibling ) {
|
||||
node = node.nextSibling;
|
||||
} else {
|
||||
// Last resort is a sibling of an ancestor
|
||||
while ( node && depth > 0 ) {
|
||||
node = node.parentNode;
|
||||
depth--;
|
||||
if ( node.nextSibling ) {
|
||||
node = node.nextSibling;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Strip leading whitespace.
|
||||
text = text.replace( /^\s+/, "" );
|
||||
// Strip trailing whitespace.
|
||||
text = text.replace( /\s+$/, "" );
|
||||
// Compress remaining whitespace.
|
||||
text = text.replace( /\s+/g, " " );
|
||||
return text;
|
||||
}
|
||||
|
||||
var offlineObserver = {
|
||||
observe: function(subject, topic, state) {
|
||||
// sanity checks
|
||||
if (topic != "network:offline-status-changed") return;
|
||||
setOfflineUI(state == "offline");
|
||||
}
|
||||
}
|
||||
|
||||
var proxyTypeObserver = {
|
||||
observe: function(subject, topic, state) {
|
||||
// sanity checks
|
||||
var ioService = Components.classes[kIOServiceProgID]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
if (state == "network.proxy.type" && !ioService.offline)
|
||||
setProxyTypeUI();
|
||||
}
|
||||
}
|
||||
|
||||
function utilityOnLoad(aEvent)
|
||||
{
|
||||
var broadcaster = document.getElementById("Communicator:WorkMode");
|
||||
if (!broadcaster) return;
|
||||
|
||||
var observerService = Components.classes[kObserverServiceProgID]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
observerService.addObserver(offlineObserver, "network:offline-status-changed", false);
|
||||
// make sure we remove this observer later
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"];
|
||||
prefService = prefService.getService(Components.interfaces.nsIPrefService);
|
||||
var prefBranch = prefService.getBranch(null);
|
||||
prefBranch = prefBranch.QueryInterface(Components.interfaces.nsIPrefBranch2);
|
||||
|
||||
prefBranch.addObserver("network.proxy.type", proxyTypeObserver, false);
|
||||
|
||||
addEventListener("unload", utilityOnUnload, false);
|
||||
|
||||
// set the initial state
|
||||
var ioService = Components.classes[kIOServiceProgID]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
setOfflineUI(ioService.offline);
|
||||
}
|
||||
|
||||
function utilityOnUnload(aEvent)
|
||||
{
|
||||
var observerService = Components.classes[kObserverServiceProgID]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
observerService.removeObserver(offlineObserver, "network:offline-status-changed");
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"];
|
||||
prefService = prefService.getService(Components.interfaces.nsIPrefService);
|
||||
var prefBranch = prefService.getBranch(null);
|
||||
prefBranch = prefBranch.QueryInterface(Components.interfaces.nsIPrefBranch2);
|
||||
|
||||
prefBranch.removeObserver("network.proxy.type", proxyTypeObserver);
|
||||
}
|
||||
|
||||
addEventListener("load", utilityOnLoad, false);
|
||||
|
||||
function GenerateValidFilename(filename, extension)
|
||||
{
|
||||
if (filename) // we have a title; let's see if it's usable
|
||||
{
|
||||
// clean up the filename to make it usable and
|
||||
// then trim whitespace from beginning and end
|
||||
filename = validateFileName(filename).replace(/^\s+|\s+$/g, "");
|
||||
if (filename.length > 0)
|
||||
return filename + extension;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function validateFileName(aFileName)
|
||||
{
|
||||
var re = /[\/]+/g;
|
||||
if (navigator.appVersion.indexOf("Windows") != -1) {
|
||||
re = /[\\\/\|]+/g;
|
||||
aFileName = aFileName.replace(/[\"]+/g, "'");
|
||||
aFileName = aFileName.replace(/[\*\:\?]+/g, " ");
|
||||
aFileName = aFileName.replace(/[\<]+/g, "(");
|
||||
aFileName = aFileName.replace(/[\>]+/g, ")");
|
||||
}
|
||||
else if (navigator.appVersion.indexOf("Macintosh") != -1)
|
||||
re = /[\:\/]+/g;
|
||||
|
||||
return aFileName.replace(re, "_");
|
||||
}
|
||||
|
||||
// autoscroll
|
||||
var gStartX;
|
||||
var gStartY;
|
||||
var gCurrX;
|
||||
var gCurrY;
|
||||
var gScrollingView;
|
||||
var gAutoScrollTimer;
|
||||
var gIgnoreMouseEvents;
|
||||
var gAutoScrollPopup = null;
|
||||
var gAccumulatedScrollErrorX;
|
||||
var gAccumulatedScrollErrorY;
|
||||
|
||||
function startScrolling(event)
|
||||
{
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
if (gScrollingView || event.button != 1)
|
||||
return;
|
||||
|
||||
if (!pref.getBoolPref("general.autoScroll"))
|
||||
return;
|
||||
|
||||
if (event.originalTarget instanceof XULElement &&
|
||||
((event.originalTarget.localName == "thumb")
|
||||
|| (event.originalTarget.localName == "slider")
|
||||
|| (event.originalTarget.localName == "scrollbarbutton")))
|
||||
return;
|
||||
|
||||
if (!gAutoScrollPopup) {
|
||||
const XUL_NS
|
||||
= "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
gAutoScrollPopup = document.createElementNS(XUL_NS, "popup");
|
||||
gAutoScrollPopup.id = "autoscroller";
|
||||
gAutoScrollPopup.addEventListener("popuphidden", stopScrolling, true);
|
||||
document.documentElement.appendChild(gAutoScrollPopup);
|
||||
}
|
||||
|
||||
gScrollingView = event.originalTarget.ownerDocument.defaultView;
|
||||
var scrollingDir;
|
||||
if (gScrollingView.scrollMaxX > 0) {
|
||||
gAutoScrollPopup.setAttribute("scrolldir", gScrollingView.scrollMaxY > 0 ? "NSEW" : "EW");
|
||||
}
|
||||
else if (gScrollingView.scrollMaxY > 0) {
|
||||
gAutoScrollPopup.setAttribute("scrolldir", "NS");
|
||||
}
|
||||
else {
|
||||
gScrollingView = null; // abort scrolling
|
||||
return;
|
||||
}
|
||||
|
||||
document.popupNode = null;
|
||||
gAutoScrollPopup.showPopup(document.documentElement, event.screenX, event.screenY,
|
||||
"popup", null, null);
|
||||
gIgnoreMouseEvents = true;
|
||||
gStartX = event.screenX;
|
||||
gStartY = event.screenY;
|
||||
gCurrX = event.screenX;
|
||||
gCurrY = event.screenY;
|
||||
addEventListener('mousemove', handleMouseMove, true);
|
||||
addEventListener('mouseup', handleMouseUpDown, true);
|
||||
addEventListener('mousedown', handleMouseUpDown, true);
|
||||
addEventListener('contextmenu', handleMouseUpDown, true);
|
||||
gAutoScrollTimer = setInterval(autoScrollLoop, 10);
|
||||
gAccumulatedScrollErrorX = 0;
|
||||
gAccumulatedScrollErrorY = 0;
|
||||
}
|
||||
|
||||
function handleMouseMove(event)
|
||||
{
|
||||
gCurrX = event.screenX;
|
||||
gCurrY = event.screenY;
|
||||
}
|
||||
|
||||
function roundToZero(num)
|
||||
{
|
||||
if (num > 0)
|
||||
return Math.floor(num);
|
||||
return Math.ceil(num);
|
||||
}
|
||||
|
||||
function accelerate(curr, start)
|
||||
{
|
||||
var speed = 12;
|
||||
var val = (curr - start) / speed;
|
||||
|
||||
if (val > 1)
|
||||
return val * Math.sqrt(val) - 1;
|
||||
if (val < -1)
|
||||
return val * Math.sqrt(-val) + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function autoScrollLoop()
|
||||
{
|
||||
var x = accelerate(gCurrX, gStartX);
|
||||
var y = accelerate(gCurrY, gStartY);
|
||||
|
||||
if (x || y)
|
||||
gIgnoreMouseEvents = false;
|
||||
|
||||
var desiredScrollX = gAccumulatedScrollErrorX + x;
|
||||
var actualScrollX = roundToZero(desiredScrollX);
|
||||
gAccumulatedScrollErrorX = (desiredScrollX - actualScrollX);
|
||||
var desiredScrollY = gAccumulatedScrollErrorY + y;
|
||||
var actualScrollY = roundToZero(desiredScrollY);
|
||||
gAccumulatedScrollErrorY = (desiredScrollY - actualScrollY);
|
||||
gScrollingView.scrollBy(actualScrollX, actualScrollY);
|
||||
}
|
||||
|
||||
function handleMouseUpDown(event)
|
||||
{
|
||||
if (!gIgnoreMouseEvents)
|
||||
gAutoScrollPopup.hidePopup();
|
||||
gIgnoreMouseEvents = false;
|
||||
}
|
||||
|
||||
function stopScrolling()
|
||||
{
|
||||
if (gScrollingView) {
|
||||
gScrollingView = null;
|
||||
removeEventListener('mousemove', handleMouseMove, true);
|
||||
removeEventListener('mousedown', handleMouseUpDown, true);
|
||||
removeEventListener('mouseup', handleMouseUpDown, true);
|
||||
removeEventListener('contextmenu', handleMouseUpDown, true);
|
||||
clearInterval(gAutoScrollTimer);
|
||||
}
|
||||
}
|
|
@ -1,312 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<?xul-overlay href="chrome://communicator/content/platformCommunicatorOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
%brandDTD;
|
||||
<!ENTITY % globalRegionDTD SYSTEM "chrome://global-region/locale/region.dtd">
|
||||
%globalRegionDTD;
|
||||
<!ENTITY % utilityDTD SYSTEM "chrome://communicator/locale/utilityOverlay.dtd">
|
||||
%utilityDTD;
|
||||
|
||||
]>
|
||||
|
||||
<overlay id="utilityOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://global/content/strres.js"/>
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://communicator/content/utilityOverlay.js"/>
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://communicator/content/builtinURLs.js"/>
|
||||
|
||||
<!-- online/offline status indicators -->
|
||||
<broadcaster id="Communicator:WorkMode"
|
||||
label="&offlineGoOfflineCmd.label;"
|
||||
type="checkbox"
|
||||
oncommand="toggleOfflineStatus();"/>
|
||||
|
||||
<popup id="networkProperties" onpopupshown="InitProxyMenu();">
|
||||
<menuitem id="network-proxy-no"
|
||||
type="radio"
|
||||
name="status"
|
||||
label="&direct.label;"
|
||||
accesskey="&direct.accesskey;"
|
||||
oncommand="setNetworkStatus('0')"/>
|
||||
<menuitem id="network-proxy-wpad"
|
||||
type="radio"
|
||||
name="status"
|
||||
label="&wpad.label;"
|
||||
accesskey="&wpad.accesskey;"
|
||||
oncommand="setNetworkStatus('4')"/>
|
||||
<menuitem id="network-proxy-pac"
|
||||
type="radio"
|
||||
name="status"
|
||||
label="&pac.label;"
|
||||
accesskey="&pac.accesskey;"
|
||||
oncommand="setNetworkStatus('2')"/>
|
||||
<menuitem id="network-proxy-manual"
|
||||
type="radio"
|
||||
name="status"
|
||||
label="&manual.label;"
|
||||
accesskey="&manual.accesskey;"
|
||||
oncommand="setNetworkStatus('1')"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&proxy.label;"
|
||||
accesskey="&proxy.accesskey;"
|
||||
oncommand="goPreferences('advancedItem',
|
||||
'chrome://communicator/content/pref/pref-proxies.xul',
|
||||
'proxiesItem');"/>
|
||||
</popup>
|
||||
|
||||
<statusbarpanel id="offline-status" context="networkProperties"
|
||||
observes="Communicator:WorkMode"/>
|
||||
|
||||
<menuitem id="offlineGoOfflineCmd"
|
||||
label="&offlineGoOfflineCmd.label;"
|
||||
accesskey="&offlineGoOfflineCmd.accesskey;"
|
||||
observes="Communicator:WorkMode"/>
|
||||
|
||||
<!-- File Menu -->
|
||||
<menu id="menu_File"
|
||||
label="&fileMenu.label;"
|
||||
accesskey="&fileMenu.accesskey;"/>
|
||||
|
||||
<!-- New SubMenu (Under File Menu) -->
|
||||
<command id="cmd_newNavigator"
|
||||
oncommand="OpenBrowserWindow()"/>
|
||||
<command id="cmd_newEditor"
|
||||
oncommand="NewEditorWindow();"/>
|
||||
|
||||
<!-- XXX not implemented, temporarily disabled
|
||||
<command id="cmd_newEditorTemplate"
|
||||
disabled="true"
|
||||
oncommand="NewEditorFromTemplate();"/>
|
||||
<command id="cmd_newEditorDraft"
|
||||
disabled="true"
|
||||
oncommand="NewEditorFromDraft();"/>
|
||||
-->
|
||||
|
||||
<menuitem id="menu_newEditor"
|
||||
label="&newBlankPageCmd.label;"
|
||||
accesskey="&newBlankPageCmd.accesskey;"
|
||||
key="key_newBlankPage"
|
||||
command="cmd_newEditor"/>
|
||||
<menuitem id="menu_newEditorTemplate"
|
||||
label="&newPageFromTemplateCmd.label;"
|
||||
accesskey="&newPageFromTemplateCmd.accesskey;"
|
||||
command="cmd_newEditorTemplate"/>
|
||||
<menuitem id="menu_newEditorDraft"
|
||||
label="&newPageFromDraftCmd.label;"
|
||||
accesskey="&newPageFromDraftCmd.accesskey;"
|
||||
command="cmd_newEditorDraft"/>
|
||||
|
||||
<menu id="menu_New"
|
||||
label="&newMenu.label;"
|
||||
accesskey="&newMenu.accesskey;"/>
|
||||
|
||||
<menuitem id="menu_newNavigator"
|
||||
label="&newNavigatorCmd.label;"
|
||||
accesskey="&newNavigatorCmd.accesskey;"
|
||||
key="key_newNavigator"
|
||||
command="cmd_newNavigator"/>
|
||||
|
||||
<key id="key_newBlankPage"
|
||||
key="&newBlankPageCmd.key;"
|
||||
command="cmd_newEditor"
|
||||
modifiers="accel, shift"/>
|
||||
<key id="key_newNavigator"
|
||||
key="&newNavigatorCmd.key;"
|
||||
command="cmd_newNavigator"
|
||||
modifiers="accel"/>
|
||||
|
||||
<!-- Edit Menu -->
|
||||
<menu id="menu_Edit"
|
||||
label="&editMenu.label;"
|
||||
accesskey="&editMenu.accesskey;"/>
|
||||
<menuitem id="menu_undo"
|
||||
label="&undoCmd.label;"
|
||||
key="key_undo"
|
||||
accesskey="&undoCmd.accesskey;"
|
||||
command="cmd_undo"/>
|
||||
<menuitem id="menu_redo"
|
||||
label="&redoCmd.label;"
|
||||
key="key_redo"
|
||||
accesskey="&redoCmd.accesskey;"
|
||||
command="cmd_redo"/>
|
||||
<menuitem id="menu_cut"
|
||||
label="&cutCmd.label;"
|
||||
key="key_cut"
|
||||
accesskey="&cutCmd.accesskey;"
|
||||
command="cmd_cut"/>
|
||||
<menuitem id="menu_copy"
|
||||
label="©Cmd.label;"
|
||||
key="key_copy"
|
||||
accesskey="©Cmd.accesskey;"
|
||||
command="cmd_copy"/>
|
||||
<menuitem id="menu_paste"
|
||||
label="&pasteCmd.label;"
|
||||
key="key_paste"
|
||||
accesskey="&pasteCmd.accesskey;"
|
||||
command="cmd_paste"/>
|
||||
<menuitem id="menu_delete"
|
||||
label="&deleteCmd.label;"
|
||||
key="key_delete"
|
||||
accesskey="&deleteCmd.accesskey;"
|
||||
command="cmd_delete"/>
|
||||
<menuitem id="menu_selectAll"
|
||||
label="&selectAllCmd.label;"
|
||||
key="key_selectAll"
|
||||
accesskey="&selectAllCmd.accesskey;"
|
||||
command="cmd_selectAll"/>
|
||||
<menuitem id="menu_findTypeText"
|
||||
label="&findTypeTextCmd.label;"
|
||||
key="key_findTypeText"
|
||||
accesskey="&findTypeTextCmd.accesskey;"
|
||||
command="cmd_findTypeText"/>
|
||||
<menuitem id="menu_findTypeLinks"
|
||||
label="&findTypeLinksCmd.label;"
|
||||
key="key_findTypeLinks"
|
||||
accesskey="&findTypeLinksCmd.accesskey;"
|
||||
command="cmd_findTypeLinks"/>
|
||||
<menuitem id="textfieldDirection-swap"
|
||||
label="&bidiSwitchTextDirectionItem.label;"
|
||||
key="key_switchTextDirection"
|
||||
accesskey="&bidiSwitchTextDirectionItem.accesskey;"
|
||||
command="cmd_switchTextDirection"/>
|
||||
|
||||
<!-- These key nodes are here only for show. The real bindings come from
|
||||
XBL, in platformHTMLBindings.xml. See bugs 57078 and 71779. -->
|
||||
|
||||
<key id="key_undo"
|
||||
key="&undoCmd.key;"
|
||||
modifiers="accel"/>
|
||||
<key id="key_redo"
|
||||
key="&redoCmd.key;"
|
||||
modifiers="accel"/>
|
||||
<key id="key_cut"
|
||||
key="&cutCmd.key;"
|
||||
modifiers="accel"/>
|
||||
<key id="key_copy"
|
||||
key="©Cmd.key;"
|
||||
modifiers="accel"/>
|
||||
<key id="key_paste"
|
||||
key="&pasteCmd.key;"
|
||||
modifiers="accel"/>
|
||||
<key id="key_switchTextDirection"
|
||||
command="cmd_switchTextDirection"
|
||||
key="&bidiSwitchTextDirectionItem.commandkey;"
|
||||
modifiers="accel,shift"/>
|
||||
|
||||
<commandset id="globalEditMenuItems"
|
||||
commandupdater="true"
|
||||
events="focus"
|
||||
oncommandupdate="goUpdateGlobalEditMenuItems()"/>
|
||||
<commandset id="selectEditMenuItems"
|
||||
commandupdater="true"
|
||||
events="select"
|
||||
oncommandupdate="goUpdateSelectEditMenuItems()"/>
|
||||
<commandset id="undoEditMenuItems"
|
||||
commandupdater="true"
|
||||
events="undo"
|
||||
oncommandupdate="goUpdateUndoEditMenuItems()"/>
|
||||
<commandset id="clipboardEditMenuItems"
|
||||
commandupdater="true"
|
||||
events="clipboard"
|
||||
oncommandupdate="goUpdatePasteMenuItems()"/>
|
||||
<commandset id="findTypeMenuItems"
|
||||
commandupdater="true"
|
||||
events="focus"
|
||||
oncommandupdate="goUpdateFindTypeMenuItems()"/>
|
||||
|
||||
<command id="cmd_copyLink"
|
||||
oncommand="goDoCommand('cmd_copyLink')"
|
||||
disabled="false"/>
|
||||
<command id="cmd_copyImage"
|
||||
oncommand="goDoCommand('cmd_copyImage')"
|
||||
disabled="false"/>
|
||||
<command id="cmd_undo"
|
||||
oncommand="goDoCommand('cmd_undo')"
|
||||
disabled="true"/>
|
||||
<command id="cmd_redo"
|
||||
oncommand="goDoCommand('cmd_redo')"
|
||||
disabled="true"/>
|
||||
<command id="cmd_cut"
|
||||
oncommand="goDoCommand('cmd_cut')"
|
||||
disabled="true"/>
|
||||
<command id="cmd_copy"
|
||||
oncommand="goDoCommand('cmd_copy')"
|
||||
disabled="true"/>
|
||||
<command id="cmd_paste"
|
||||
oncommand="goDoCommand('cmd_paste')"
|
||||
disabled="true"/>
|
||||
<command id="cmd_delete"
|
||||
oncommand="goDoCommand('cmd_delete')"
|
||||
valueDefault="&deleteCmd.label;"
|
||||
valueDefaultAccessKey="&deleteCmd.accesskey;"
|
||||
disabled="true"/>
|
||||
<command id="cmd_selectAll"
|
||||
oncommand="goDoCommand('cmd_selectAll')"
|
||||
disabled="true"/>
|
||||
<command id="cmd_switchTextDirection"
|
||||
oncommand="goDoCommand('cmd_switchTextDirection');"
|
||||
disabled="true"/>
|
||||
<command id="cmd_findTypeText"
|
||||
oncommand="goDoCommand('cmd_findTypeText')"/>
|
||||
<command id="cmd_findTypeLinks"
|
||||
oncommand="goDoCommand('cmd_findTypeLinks')"/>
|
||||
|
||||
<!-- Not needed yet, window will need this: -->
|
||||
<!-- broadcaster id="cmd_preferences"/ -->
|
||||
|
||||
<menuitem id="menu_preferences"
|
||||
label="&preferencesCmd.label;"
|
||||
key="key_preferences"
|
||||
accesskey="&preferencesCmd.accesskey;"/>
|
||||
|
||||
<!-- View Menu -->
|
||||
<menu id="menu_View"
|
||||
label="&viewMenu.label;"
|
||||
accesskey="&viewMenu.accesskey;"/>
|
||||
<menu id="menu_Toolbars"
|
||||
label="&viewToolbarsMenu.label;"
|
||||
accesskey="&viewToolbarsMenu.accesskey;"/>
|
||||
|
||||
<menuitem id="menu_showTaskbar"
|
||||
label="&showTaskbarCmd.label;"
|
||||
accesskey="&showTaskbarCmd.accesskey;"
|
||||
oncommand="goToggleToolbar('status-bar', 'menu_showTaskbar')"
|
||||
checked="true"/>
|
||||
|
||||
<!-- Help Menu -->
|
||||
<menu id="menu_Help"
|
||||
label="&helpMenu.label;"
|
||||
accesskey="&helpMenu.accesskey;">
|
||||
<menupopup id="helpPopup">
|
||||
<menuitem accesskey="&releaseCmd.accesskey;"
|
||||
label="&releaseCmd.label;"
|
||||
id="releaseUrl"
|
||||
oncommand="openTopWin('&releaseURL;');"/>
|
||||
|
||||
<menuseparator id="menu_HelpAboutSeparator"/>
|
||||
|
||||
<menuitem class="about"
|
||||
accesskey="&aboutCommPluginsCmd.accesskey;"
|
||||
label="&aboutCommPluginsCmd.label;"
|
||||
id="pluginInfo"
|
||||
oncommand="openTopWin('about:plugins')"/>
|
||||
<menuitem accesskey="&aboutCmd.accesskey;"
|
||||
label="&aboutCmd.label;"
|
||||
id="aboutName"
|
||||
oncommand="goAboutDialog();"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<!-- Toolbar boxes -->
|
||||
<hbox id="toolbar_button_box"
|
||||
flex="100%"/>
|
||||
|
||||
</overlay>
|
|
@ -1,303 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 this file as it was released upon January 6, 2001.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Peter Annema.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl> (Original Author)
|
||||
* Jonas Sicking <sicking@bigfoot.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/** Document Zoom Management Code
|
||||
*
|
||||
* To use this, you'll need to have a <menu id="menu_textZoom"/>
|
||||
* and a getMarkupDocumentViewer() function which returns a
|
||||
* nsIMarkupDocumentViewer.
|
||||
*
|
||||
**/
|
||||
|
||||
function ZoomManager() {
|
||||
this.bundle = document.getElementById("bundle_viewZoom");
|
||||
|
||||
// factorAnchor starts on factorOther
|
||||
this.factorOther = parseInt(this.bundle.getString("valueOther"));
|
||||
this.factorAnchor = this.factorOther;
|
||||
}
|
||||
|
||||
ZoomManager.prototype = {
|
||||
instance : null,
|
||||
|
||||
getInstance : function() {
|
||||
if (!ZoomManager.prototype.instance)
|
||||
ZoomManager.prototype.instance = new ZoomManager();
|
||||
|
||||
return ZoomManager.prototype.instance;
|
||||
},
|
||||
|
||||
MIN : 1,
|
||||
MAX : 2000,
|
||||
|
||||
bundle : null,
|
||||
|
||||
zoomFactorsString : "", // cache
|
||||
zoomFactors : null,
|
||||
|
||||
factorOther : 300,
|
||||
factorAnchor : 300,
|
||||
steps : 0,
|
||||
|
||||
get textZoom() {
|
||||
var currentZoom;
|
||||
try {
|
||||
currentZoom = Math.round(getMarkupDocumentViewer().textZoom * 100);
|
||||
if (this.indexOf(currentZoom) == -1) {
|
||||
if (currentZoom != this.factorOther) {
|
||||
this.factorOther = currentZoom;
|
||||
this.factorAnchor = this.factorOther;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
currentZoom = 100;
|
||||
}
|
||||
return currentZoom;
|
||||
},
|
||||
|
||||
set textZoom(aZoom) {
|
||||
if (aZoom < this.MIN || aZoom > this.MAX)
|
||||
throw Components.results.NS_ERROR_INVALID_ARG;
|
||||
|
||||
getMarkupDocumentViewer().textZoom = aZoom / 100;
|
||||
},
|
||||
|
||||
enlarge : function() {
|
||||
this.jump(1);
|
||||
},
|
||||
|
||||
reduce : function() {
|
||||
this.jump(-1);
|
||||
},
|
||||
|
||||
reset : function() {
|
||||
this.textZoom = 100;
|
||||
},
|
||||
|
||||
getZoomFactors : function() {
|
||||
this.ensureZoomFactors();
|
||||
|
||||
return this.zoomFactors;
|
||||
},
|
||||
|
||||
indexOf : function(aZoom) {
|
||||
this.ensureZoomFactors();
|
||||
|
||||
var index = -1;
|
||||
if (this.isZoomInRange(aZoom)) {
|
||||
index = this.zoomFactors.length - 1;
|
||||
while (index >= 0 && this.zoomFactors[index] != aZoom)
|
||||
--index;
|
||||
}
|
||||
|
||||
return index;
|
||||
},
|
||||
|
||||
/***** internal helper functions below here *****/
|
||||
|
||||
ensureZoomFactors : function() {
|
||||
var zoomFactorsString = this.bundle.getString("values");
|
||||
if (this.zoomFactorsString != zoomFactorsString) {
|
||||
this.zoomFactorsString = zoomFactorsString;
|
||||
this.zoomFactors = zoomFactorsString.split(",");
|
||||
for (var i = 0; i<this.zoomFactors.length; ++i)
|
||||
this.zoomFactors[i] = parseInt(this.zoomFactors[i]);
|
||||
}
|
||||
},
|
||||
|
||||
isLevelInRange : function(aLevel) {
|
||||
return (aLevel >= 0 && aLevel < this.zoomFactors.length);
|
||||
},
|
||||
|
||||
isZoomInRange : function(aZoom) {
|
||||
return (aZoom >= this.zoomFactors[0] && aZoom <= this.zoomFactors[this.zoomFactors.length - 1]);
|
||||
},
|
||||
|
||||
jump : function(aDirection) {
|
||||
if (aDirection != -1 && aDirection != 1)
|
||||
throw Components.results.NS_ERROR_INVALID_ARG;
|
||||
|
||||
this.ensureZoomFactors();
|
||||
|
||||
var currentZoom = this.textZoom;
|
||||
var insertIndex = -1;
|
||||
var stepFactor = parseFloat(this.bundle.getString("stepFactor"));
|
||||
|
||||
// temporarily add factorOther to list
|
||||
if (this.isZoomInRange(this.factorOther)) {
|
||||
insertIndex = 0;
|
||||
while (this.zoomFactors[insertIndex] < this.factorOther)
|
||||
++insertIndex;
|
||||
|
||||
if (this.zoomFactors[insertIndex] != this.factorOther)
|
||||
this.zoomFactors.splice(insertIndex, 0, this.factorOther);
|
||||
}
|
||||
|
||||
var factor;
|
||||
var done = false;
|
||||
|
||||
if (this.isZoomInRange(currentZoom)) {
|
||||
var index = this.indexOf(currentZoom);
|
||||
if (aDirection == -1 && index == 0 ||
|
||||
aDirection == 1 && index == this.zoomFactors.length - 1) {
|
||||
this.steps = 0;
|
||||
this.factorAnchor = this.zoomFactors[index];
|
||||
} else {
|
||||
factor = this.zoomFactors[index + aDirection];
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!done) {
|
||||
this.steps += aDirection;
|
||||
factor = this.factorAnchor * Math.pow(stepFactor, this.steps);
|
||||
if (factor < this.MIN || factor > this.MAX) {
|
||||
this.steps -= aDirection;
|
||||
factor = this.factorAnchor * Math.pow(stepFactor, this.steps);
|
||||
}
|
||||
factor = Math.round(factor);
|
||||
if (this.isZoomInRange(factor))
|
||||
factor = this.snap(factor);
|
||||
else
|
||||
this.factorOther = factor;
|
||||
}
|
||||
|
||||
if (insertIndex != -1)
|
||||
this.zoomFactors.splice(insertIndex, 1);
|
||||
|
||||
this.textZoom = factor;
|
||||
},
|
||||
|
||||
snap : function(aZoom) {
|
||||
if (this.isZoomInRange(aZoom)) {
|
||||
var level = 0;
|
||||
while (this.zoomFactors[level + 1] < aZoom)
|
||||
++level;
|
||||
|
||||
// if aZoom closer to [level + 1] than [level], snap to [level + 1]
|
||||
if ((this.zoomFactors[level + 1] - aZoom) < (aZoom - this.zoomFactors[level]))
|
||||
++level;
|
||||
|
||||
aZoom = this.zoomFactors[level];
|
||||
}
|
||||
|
||||
return aZoom;
|
||||
}
|
||||
}
|
||||
|
||||
/***** init and helper functions for viewZoomOverlay.xul *****/
|
||||
window.addEventListener("load", registerZoomManager, false);
|
||||
|
||||
function registerZoomManager()
|
||||
{
|
||||
var textZoomMenu = document.getElementById("menu_textZoom");
|
||||
var zoom = ZoomManager.prototype.getInstance();
|
||||
|
||||
var parentMenu = textZoomMenu.parentNode;
|
||||
parentMenu.addEventListener("popupshowing", updateViewMenu, false);
|
||||
|
||||
var insertBefore = document.getElementById("menu_textZoomInsertBefore");
|
||||
var popup = insertBefore.parentNode;
|
||||
var accessKeys = zoom.bundle.getString("accessKeys").split(",");
|
||||
var zoomFactors = zoom.getZoomFactors();
|
||||
for (var i = 0; i < zoomFactors.length; ++i) {
|
||||
var menuItem = document.createElement("menuitem");
|
||||
menuItem.setAttribute("type", "radio");
|
||||
menuItem.setAttribute("name", "textZoom");
|
||||
|
||||
var label;
|
||||
if (zoomFactors[i] == 100) {
|
||||
label = zoom.bundle.getString("labelOriginal");
|
||||
menuItem.setAttribute("key", "key_textZoomReset");
|
||||
}
|
||||
else
|
||||
label = zoom.bundle.getString("label");
|
||||
|
||||
menuItem.setAttribute("label", label.replace(/%zoom%/, zoomFactors[i]));
|
||||
menuItem.setAttribute("accesskey", accessKeys[i]);
|
||||
menuItem.setAttribute("oncommand", "ZoomManager.prototype.getInstance().textZoom = this.value;");
|
||||
menuItem.setAttribute("value", zoomFactors[i]);
|
||||
popup.insertBefore(menuItem, insertBefore);
|
||||
}
|
||||
}
|
||||
|
||||
function updateViewMenu()
|
||||
{
|
||||
var zoom = ZoomManager.prototype.getInstance();
|
||||
|
||||
var textZoomMenu = document.getElementById("menu_textZoom");
|
||||
var menuLabel = zoom.bundle.getString("menuLabel").replace(/%zoom%/, zoom.textZoom);
|
||||
textZoomMenu.setAttribute("label", menuLabel);
|
||||
}
|
||||
|
||||
function updateTextZoomMenu()
|
||||
{
|
||||
var zoom = ZoomManager.prototype.getInstance();
|
||||
|
||||
var currentZoom = zoom.textZoom;
|
||||
|
||||
var textZoomOther = document.getElementById("menu_textZoomOther");
|
||||
var label = zoom.bundle.getString("labelOther");
|
||||
textZoomOther.setAttribute("label", label.replace(/%zoom%/, zoom.factorOther));
|
||||
textZoomOther.setAttribute("value", zoom.factorOther);
|
||||
|
||||
var popup = document.getElementById("menu_textZoomPopup");
|
||||
var item = popup.firstChild;
|
||||
while (item) {
|
||||
if (item.getAttribute("name") == "textZoom") {
|
||||
if (item.getAttribute("value") == currentZoom)
|
||||
item.setAttribute("checked","true");
|
||||
else
|
||||
item.removeAttribute("checked");
|
||||
}
|
||||
item = item.nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
function setTextZoomOther()
|
||||
{
|
||||
var zoom = ZoomManager.prototype.getInstance();
|
||||
|
||||
// open dialog and ask for new value
|
||||
var o = {value: zoom.factorOther, zoomMin: zoom.MIN, zoomMax: zoom.MAX};
|
||||
window.openDialog("chrome://communicator/content/askViewZoom.xul", "AskViewZoom", "chrome,modal,titlebar", o);
|
||||
if (o.zoomOK)
|
||||
zoom.textZoom = o.value;
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- 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 this file as it was released on January 6, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Peter Annema.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2000
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Peter Annema <disttsc@bart.nl> (Original Author)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
- or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!DOCTYPE overlay SYSTEM "chrome://communicator/locale/viewZoomOverlay.dtd">
|
||||
|
||||
<overlay id="viewZoomOverlay"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/viewZoomOverlay.js"/>
|
||||
|
||||
<stringbundle id="bundle_viewZoom" src="chrome://communicator/locale/viewZoomOverlay.properties"/>
|
||||
|
||||
<keyset id="viewZoomKeys">
|
||||
<key id="key_textZoomReduce" key="&textZoomReduceCmd.commandkey;" command="cmd_textZoomReduce" modifiers="accel"/>
|
||||
<key id="key_textZoomEnlarge" key="&textZoomEnlargeCmd.commandkey;" command="cmd_textZoomEnlarge" modifiers="accel"/>
|
||||
<key key="&textZoomEnlargeCmd.commandkey;" command="cmd_textZoomEnlarge" modifiers="accel,shift"/>
|
||||
<key key="&textZoomEnlargeCmd.commandkey2;" command="cmd_textZoomEnlarge" modifiers="accel"/>
|
||||
<key id="key_textZoomReset" key="&textZoomResetCmd.commandkey;" command="cmd_textZoomReset" modifiers="accel"/>
|
||||
</keyset>
|
||||
|
||||
<commandset id="viewZoomCommands">
|
||||
<command id="cmd_textZoomReduce" oncommand="ZoomManager.prototype.getInstance().reduce();"/>
|
||||
<command id="cmd_textZoomEnlarge" oncommand="ZoomManager.prototype.getInstance().enlarge();"/>
|
||||
<command id="cmd_textZoomReset" oncommand="ZoomManager.prototype.getInstance().reset();"/>
|
||||
</commandset>
|
||||
|
||||
<menu id="menu_textZoom" accesskey="&textZoomMenu.accesskey;">
|
||||
<menupopup id="menu_textZoomPopup" onpopupshowing="updateTextZoomMenu();">
|
||||
<menuitem key="key_textZoomReduce" label="&textZoomReduceCmd.label;" accesskey="&textZoomReduceCmd.accesskey;" command="cmd_textZoomReduce"/>
|
||||
<menuitem key="key_textZoomEnlarge" label="&textZoomEnlargeCmd.label;" accesskey="&textZoomEnlargeCmd.accesskey;" command="cmd_textZoomEnlarge"/>
|
||||
<menuseparator/>
|
||||
<menuseparator id="menu_textZoomInsertBefore"/>
|
||||
<menuitem id="menu_textZoomOther" type="radio" name="textZoom" accesskey="&textZoomOtherCmd.accesskey;" oncommand="setTextZoomOther();"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
</overlay>
|
|
@ -1,43 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- windows version of platformBrowserBindings.xul -->
|
||||
|
||||
<keybinding id="platformBrowserBindings"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- xul key for Windows -->
|
||||
<keyset id="globalKeySet" xulkey="ctrl">
|
||||
|
||||
<!-- other keybindings for cut/copy/paste -->
|
||||
<key id="winAlternativeCutKey" keycode="VK_DELETE"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_cut');
|
||||
controller.doCommand('cmd_cut');" modifiers="shift"/>
|
||||
<key id="winAlternateCopy2Key" keycode="VK_DELETE"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_copy');
|
||||
controller.doCommand('cmd_copy');" modifiers="control"/>
|
||||
<key id="winAlternativeCopyKey" keycode="VK_INSERT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_copy');
|
||||
controller.doCommand('cmd_copy');" modifiers="control"/>
|
||||
<key id="winAlternativePasteKey" keycode="VK_INSERT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_paste');
|
||||
controller.doCommand('cmd_paste');" modifiers="shift"/>
|
||||
|
||||
<key id="key_homectrlshift" keycode="VK_HOME"
|
||||
oncommand="
|
||||
var controller =
|
||||
document.commandDispatcher.getControllerForCommand('cmd_selectTop');
|
||||
controller.doCommand('cmd_selectTop');" modifiers="shift, control"/>
|
||||
<key id="key_endctrlshift" keycode="VK_END"
|
||||
oncommand="
|
||||
var controller =
|
||||
document.commandDispatcher.getControllerForCommand('cmd_selectBottom');
|
||||
controller.doCommand('cmd_selectBottom');" modifiers="shift, control"/>
|
||||
</keyset>
|
||||
|
||||
<!-- End Windows-specific keybindings -->
|
||||
|
||||
</keybinding>
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- win version of platformCommunicatorOverlay.xul -->
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
|
||||
<!ENTITY % platformCommunicatorDTD SYSTEM "chrome://communicator-platform/locale/platformCommunicatorOverlay.dtd">
|
||||
%platformCommunicatorDTD;
|
||||
<!ENTITY % utilityDTD SYSTEM "chrome://communicator/locale/utilityOverlay.dtd">
|
||||
%utilityDTD;
|
||||
|
||||
]>
|
||||
|
||||
<overlay id="platformCommunicatorOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- close -->
|
||||
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" command="cmd_close"/>
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuseparator id="menu_FileQuitSeparator"/>
|
||||
<menuitem label="&quitApplicationCmd.label;" id="menu_FileQuitItem"
|
||||
key="key_quit" accesskey="&quitApplicationCmd.accesskey;" command="cmd_quit"/>
|
||||
</menupopup>
|
||||
<key id="key_quit" key="&quitApplicationCmd.key;" command="cmd_quit" modifiers="accel"/>
|
||||
<command id="cmd_quit" oncommand="goQuitApplication()"/>
|
||||
|
||||
<!-- Edit Menu -->
|
||||
<menuitem id="menu_redo" label="&redoCmd.label;" key="key_redo" accesskey="&redoCmd.accesskey;" command="cmd_redo"/>
|
||||
<key id="key_redo" key="&redoCmd.key;" command="cmd_redo" modifiers="accel"/>
|
||||
<!-- Select All Key -->
|
||||
<key id="key_selectAll" key="&selectAllCmd.key;" modifiers="accel"/>
|
||||
|
||||
<!-- Delete Key -->
|
||||
<key id="key_delete" keycode="VK_DELETE" command="cmd_delete"/>
|
||||
|
||||
<!-- Find As You Type Keys -->
|
||||
<key id="key_findTypeText"
|
||||
key="&findTypeTextCmd.key;"/>
|
||||
<key id="key_findTypeLinks"
|
||||
key="&findTypeLinksCmd.key;"/>
|
||||
|
||||
<!-- Tasks Keys -->
|
||||
<keyset id="tasksKeys">
|
||||
<key id="key_openHelp"
|
||||
keycode="&openHelpCmd.key;"
|
||||
command="cmd_openHelp"/>
|
||||
</keyset>
|
||||
|
||||
</overlay>
|
|
@ -1,71 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- windows version of platformEditorBindings.xul -->
|
||||
|
||||
<keybinding id="platformEditorBindings"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- xul key for Windows -->
|
||||
<keyset id="editorKeySet" xulkey="ctrl">
|
||||
|
||||
|
||||
<!-- alternate cut/copy/paste keys for Windows -->
|
||||
<key id="winAlternateCutKey" keycode="VK_DELETE"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_cut');
|
||||
controller.doCommand('cmd_cut');" modifiers="shift"/>
|
||||
<key id="winAlternateCopy2Key" keycode="VK_DELETE"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_copy');
|
||||
controller.doCommand('cmd_copy');" modifiers="control"/>
|
||||
<key id="winAlternateCopyKey" keycode="VK_INSERT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_copy');
|
||||
controller.doCommand('cmd_copy');" modifiers="control"/>
|
||||
<key id="winAlternatePasteKey" keycode="VK_INSERT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_paste');
|
||||
controller.doCommand('cmd_paste');" modifiers="shift"/>
|
||||
|
||||
<key id="key_leftcontrol" keycode="VK_LEFT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_wordPrevious');
|
||||
controller.doCommand('cmd_wordPrevious');" modifiers="accel"/>
|
||||
<key id="key_rightcontrol" keycode="VK_RIGHT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_wordNext');
|
||||
controller.doCommand('cmd_wordNext');" modifiers="accel"/>
|
||||
<key id="key_leftshiftcontrol" keycode="VK_LEFT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_selectWordPrevious');
|
||||
controller.doCommand('cmd_selectWordPrevious');" modifiers="shift, accel"/>
|
||||
<key id="key_rightshiftcontrol" keycode="VK_RIGHT"
|
||||
oncommand="
|
||||
var controller = document.commandDispatcher.getControllerForCommand('cmd_selectWordNext');
|
||||
controller.doCommand('cmd_selectWordNext');" modifiers="shift, accel"/>
|
||||
|
||||
<key id="key_homectrlshift" keycode="VK_HOME"
|
||||
oncommand="
|
||||
var controller =
|
||||
document.commandDispatcher.getControllerForCommand('cmd_selectTop');
|
||||
controller.doCommand('cmd_selectTop');" modifiers="shift, control"/>
|
||||
<key id="key_endctrlshift" keycode="VK_END"
|
||||
oncommand="
|
||||
var controller =
|
||||
document.commandDispatcher.getControllerForCommand('cmd_selectBottom');
|
||||
controller.doCommand('cmd_selectBottom');" modifiers="shift, control"/>
|
||||
<key id="key_homectrl" keycode="VK_HOME"
|
||||
oncommand="
|
||||
var controller =
|
||||
document.commandDispatcher.getControllerForCommand('cmd_moveTop');
|
||||
controller.doCommand('cmd_moveTop');" modifiers="control"/>
|
||||
<key id="key_endctrl" keycode="VK_END"
|
||||
oncommand="
|
||||
var controller =
|
||||
document.commandDispatcher.getControllerForCommand('cmd_moveBottom');
|
||||
controller.doCommand('cmd_moveBottom');" modifiers="control"/>
|
||||
</keyset>
|
||||
|
||||
<!-- End Windows-specific keybindings -->
|
||||
|
||||
</keybinding>
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the skins being supplied by this package -->
|
||||
<RDF:Seq about="urn:mozilla:locale:root">
|
||||
<RDF:li resource="urn:mozilla:locale:en-US"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- locale information -->
|
||||
<RDF:Description about="urn:mozilla:locale:en-US"
|
||||
chrome:displayName="English(US)"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="en-US"
|
||||
chrome:previewURL="http://www.mozilla.org/locales/en-US.gif">
|
||||
<chrome:packages>
|
||||
<RDF:Seq about="urn:mozilla:locale:en-US:packages">
|
||||
<RDF:li resource="urn:mozilla:locale:en-US:communicator"/>
|
||||
<RDF:li resource="urn:mozilla:locale:en-US:editor"/>
|
||||
<RDF:li resource="urn:mozilla:locale:en-US:global"/>
|
||||
<RDF:li resource="urn:mozilla:locale:en-US:messenger"/>
|
||||
<RDF:li resource="urn:mozilla:locale:en-US:navigator"/>
|
||||
</RDF:Seq>
|
||||
</chrome:packages>
|
||||
</RDF:Description>
|
||||
</RDF:RDF>
|
|
@ -1,67 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# 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 the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = resources
|
||||
|
||||
CHROME_DEPS = buildconfig.html
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -DMOZ_APP_VERSION=$(MOZ_APP_VERSION)
|
||||
|
||||
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
CHROME_PLATFORM = mac
|
||||
else
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
CHROME_PLATFORM = win
|
||||
else
|
||||
CHROME_PLATFORM = unix
|
||||
endif
|
||||
endif
|
||||
|
||||
libs realchrome::
|
||||
@$(REGCHROME) locale en-US/global-platform/$(CHROME_PLATFORM) en-US.jar
|
||||
|
||||
install::
|
||||
@$(REGCHROME_INSTALL) locale en-US/global-platform/$(CHROME_PLATFORM) en-US.jar
|
|
@ -1,45 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>about:buildconfig</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>about:buildconfig</h1>
|
||||
<p> </p>
|
||||
<h2>Build platform</h2>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>target</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@target@</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
<h2>Build tools</h2>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Compiler</th>
|
||||
<th>Version</th>
|
||||
<th>Compiler flags</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@CC@</td>
|
||||
<td>@CC_VERSION@</td>
|
||||
<td>@CFLAGS@</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@CXX@</td>
|
||||
<td>@CXX_VERSION@</td>
|
||||
<td>@CXXFLAGS@ @CPPFLAGS@</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
<h2>Configure arguments</h2>
|
||||
@ac_configure_args@
|
||||
</body>
|
||||
</html>
|
|
@ -1,126 +0,0 @@
|
|||
toolkit.jar:
|
||||
* content/global/contents.rdf (resources/content/contents.rdf)
|
||||
* content/global-platform/contents.rdf (resources/content/contents-platform.rdf)
|
||||
* content/global-region/contents.rdf (resources/content/contents-region.rdf)
|
||||
content/global/globalOverlay.xul (resources/content/globalOverlay.xul)
|
||||
content/global/globalOverlay.js (resources/content/globalOverlay.js)
|
||||
content/global/dialogOverlay.xul (resources/content/dialogOverlay.xul)
|
||||
content/global/dialogOverlay.js (resources/content/dialogOverlay.js)
|
||||
content/global/commonDialog.xul (resources/content/commonDialog.xul)
|
||||
content/global/commonDialog.js (resources/content/commonDialog.js)
|
||||
content/global/strres.js (resources/content/strres.js)
|
||||
content/global/config.xul (resources/content/config.xul)
|
||||
content/global/config.js (resources/content/config.js)
|
||||
content/global/mozilla.xhtml (resources/content/mozilla.xhtml)
|
||||
content/global/charsetOverlay.xul (resources/content/charsetOverlay.xul)
|
||||
content/global/charsetOverlay.js (resources/content/charsetOverlay.js)
|
||||
content/global/selectDialog.js (resources/content/selectDialog.js)
|
||||
content/global/selectDialog.xul (resources/content/selectDialog.xul)
|
||||
content/global/nsTreeController.js (resources/content/nsTreeController.js)
|
||||
content/global/nsTreeSorting.js (resources/content/nsTreeSorting.js)
|
||||
content/global/nsClipboard.js (resources/content/nsClipboard.js)
|
||||
content/global/nsDragAndDrop.js (resources/content/nsDragAndDrop.js)
|
||||
content/global/nsTransferable.js (resources/content/nsDragAndDrop.js)
|
||||
content/global/nsUserSettings.js (resources/content/nsUserSettings.js)
|
||||
content/global/xul.css (resources/content/xul.css)
|
||||
* content/global/inlineSpellCheckUI.js (/toolkit/content/inlineSpellCheckUI.js)
|
||||
content/global/plugins.html (/toolkit/content/plugins.html)
|
||||
content/global/plugins.css (/toolkit/content/plugins.css)
|
||||
content/global/printdialog.xul (resources/content/printdialog.xul)
|
||||
content/global/printdialog.js (resources/content/printdialog.js)
|
||||
content/global/printPageSetup.xul (resources/content/printPageSetup.xul)
|
||||
content/global/printPageSetup.js (resources/content/printPageSetup.js)
|
||||
content/global/printProgress.xul (resources/content/printProgress.xul)
|
||||
content/global/printProgress.js (resources/content/printProgress.js)
|
||||
content/global/printPreviewProgress.xul (resources/content/printPreviewProgress.xul)
|
||||
content/global/printPreviewProgress.js (resources/content/printPreviewProgress.js)
|
||||
* content/global/about.xhtml (resources/content/about.xhtml)
|
||||
content/global/license.html (resources/content/license.html)
|
||||
content/global/bindings/browser.xml (resources/content/bindings/browser.xml)
|
||||
content/global/bindings/button.xml (resources/content/bindings/button.xml)
|
||||
content/global/bindings/checkbox.xml (resources/content/bindings/checkbox.xml)
|
||||
content/global/bindings/colorpicker.xml (resources/content/bindings/colorpicker.xml)
|
||||
content/global/bindings/datetimepicker.xml (/toolkit/content/widgets/datetimepicker.xml)
|
||||
content/global/bindings/dialog.xml (resources/content/bindings/dialog.xml)
|
||||
content/global/bindings/editor.xml (resources/content/bindings/editor.xml)
|
||||
content/global/bindings/general.xml (resources/content/bindings/general.xml)
|
||||
content/global/bindings/groupbox.xml (resources/content/bindings/groupbox.xml)
|
||||
content/global/bindings/listbox.xml (resources/content/bindings/listbox.xml)
|
||||
content/global/bindings/menu.xml (resources/content/bindings/menu.xml)
|
||||
content/global/bindings/menulist.xml (resources/content/bindings/menulist.xml)
|
||||
content/global/bindings/numberbox.xml (/toolkit/content/widgets/numberbox.xml)
|
||||
content/global/bindings/popup.xml (resources/content/bindings/popup.xml)
|
||||
content/global/bindings/progressmeter.xml (resources/content/bindings/progressmeter.xml)
|
||||
content/global/bindings/radio.xml (/toolkit/content/widgets/radio.xml)
|
||||
content/global/bindings/scrollbar.xml (resources/content/bindings/scrollbar.xml)
|
||||
content/global/bindings/scale.xml (/toolkit/content/widgets/scale.xml)
|
||||
content/global/bindings/scrollbox.xml (resources/content/bindings/scrollbox.xml)
|
||||
content/global/bindings/splitter.xml (resources/content/bindings/splitter.xml)
|
||||
content/global/bindings/spinbuttons.xml (/toolkit/content/widgets/spinbuttons.xml)
|
||||
content/global/bindings/stringbundle.xml (resources/content/bindings/stringbundle.xml)
|
||||
content/global/bindings/tabbox.xml (resources/content/bindings/tabbox.xml)
|
||||
content/global/bindings/tabbrowser.xml (resources/content/bindings/tabbrowser.xml)
|
||||
content/global/bindings/text.xml (resources/content/bindings/text.xml)
|
||||
content/global/bindings/textbox.xml (resources/content/bindings/textbox.xml)
|
||||
* content/global/bindings/toolbar.xml (/toolkit/content/widgets/toolbar.xml)
|
||||
content/global/bindings/toolbarbutton.xml (resources/content/bindings/toolbarbutton.xml)
|
||||
content/global/bindings/tree.xml (resources/content/bindings/tree.xml)
|
||||
content/global/bindings/wizard.xml (resources/content/bindings/wizard.xml)
|
||||
content/global/buildconfig.html (buildconfig.html)
|
||||
content/global/XPCNativeWrapper.js (resources/content/XPCNativeWrapper.js)
|
||||
#ifdef MOZ_SVG
|
||||
content/global/svg/svgBindings.xml (/layout/svg/base/src/resources/content/svgBindings.xml)
|
||||
#endif
|
||||
content/global/about.xul (resources/content/about.xul)
|
||||
#ifdef MOZ_SUITE
|
||||
content/global/logo.gif (/suite/branding/content/logo.gif)
|
||||
#else
|
||||
content/global/logo.gif (resources/content/logo.gif)
|
||||
content/global/aboutAbout.html (resources/content/aboutAbout.html)
|
||||
content/global/hiddenWindow.xul (resources/content/hiddenWindow.xul)
|
||||
content/global/fullScreen.js (resources/content/fullScreen.js)
|
||||
content/global/nsWidgetStateManager.js (resources/content/nsWidgetStateManager.js)
|
||||
#endif
|
||||
|
||||
en-US.jar:
|
||||
* locale/en-US/global/contents.rdf (resources/locale/en-US/contents.rdf)
|
||||
locale/en-US/global/intl.css (resources/locale/en-US/intl.css)
|
||||
locale/en-US/global/dialogOverlay.dtd (resources/locale/en-US/dialogOverlay.dtd)
|
||||
locale/en-US/global/commonDialog.dtd (resources/locale/en-US/commonDialog.dtd)
|
||||
locale/en-US/global/charsetOverlay.dtd (resources/locale/en-US/charsetOverlay.dtd)
|
||||
locale/en-US/global/textcontext.dtd (resources/locale/en-US/textcontext.dtd)
|
||||
locale/en-US/global/datetimepicker.dtd (/toolkit/locales/en-US/chrome/global/datetimepicker.dtd)
|
||||
locale/en-US/global/brand.dtd (resources/locale/en-US/brand.dtd)
|
||||
locale/en-US/global/tabbrowser.dtd (resources/locale/en-US/tabbrowser.dtd)
|
||||
locale/en-US/global/tabbrowser.properties (resources/locale/en-US/tabbrowser.properties)
|
||||
locale/en-US/global/keys.properties (resources/locale/en-US/keys.properties)
|
||||
locale/en-US/global/config.properties (resources/locale/en-US/config.properties)
|
||||
locale/en-US/global/config.dtd (resources/locale/en-US/config.dtd)
|
||||
locale/en-US/global/about.dtd (resources/locale/en-US/about.dtd)
|
||||
locale/en-US/global/languageNames.properties (resources/locale/en-US/languageNames.properties)
|
||||
locale/en-US/global/regionNames.properties (resources/locale/en-US/regionNames.properties)
|
||||
locale/en-US/global/commonDialogs.properties (resources/locale/en-US/commonDialogs.properties)
|
||||
locale/en-US/global/nsTreeSorting.properties (resources/locale/en-US/nsTreeSorting.properties)
|
||||
locale/en-US/global/dialog.properties (resources/locale/en-US/dialog.properties)
|
||||
locale/en-US/global/printdialog.dtd (resources/locale/en-US/printdialog.dtd)
|
||||
locale/en-US/global/printPageSetup.dtd (resources/locale/en-US/printPageSetup.dtd)
|
||||
locale/en-US/global/printPageSetup.properties (resources/locale/en-US/printPageSetup.properties)
|
||||
locale/en-US/global/printProgress.dtd (resources/locale/en-US/printProgress.dtd)
|
||||
locale/en-US/global/printPreviewProgress.dtd (resources/locale/en-US/printPreviewProgress.dtd)
|
||||
locale/en-US/global/tree.dtd (resources/locale/en-US/tree.dtd)
|
||||
* locale/en-US/global-region/contents.rdf (resources/locale/en-US/contents-region.rdf)
|
||||
* locale/en-US/global-region/region.dtd (resources/locale/en-US/region.dtd)
|
||||
locale/en-US/global-region/region.properties (resources/locale/en-US/region.properties)
|
||||
* locale/en-US/global-platform/win/contents.rdf (resources/locale/en-US/win/contents-platform.rdf)
|
||||
locale/en-US/global-platform/win/platformDialogOverlay.dtd (resources/locale/en-US/win/platformDialogOverlay.dtd)
|
||||
locale/en-US/global-platform/win/platformKeys.properties (resources/locale/en-US/win/platformKeys.properties)
|
||||
locale/en-US/global-platform/win/wizard.properties (resources/locale/en-US/win/wizard.properties)
|
||||
* locale/en-US/global-platform/unix/contents.rdf (resources/locale/en-US/unix/contents-platform.rdf)
|
||||
locale/en-US/global-platform/unix/platformDialogOverlay.dtd (resources/locale/en-US/unix/platformDialogOverlay.dtd)
|
||||
locale/en-US/global-platform/unix/platformKeys.properties (resources/locale/en-US/unix/platformKeys.properties)
|
||||
locale/en-US/global-platform/unix/wizard.properties (resources/locale/en-US/unix/wizard.properties)
|
||||
locale/en-US/global-platform/unix/printjoboptions.dtd (resources/locale/en-US/unix/printjoboptions.dtd)
|
||||
* locale/en-US/global-platform/mac/contents.rdf (resources/locale/en-US/mac/contents-platform.rdf)
|
||||
locale/en-US/global-platform/mac/platformDialogOverlay.dtd (resources/locale/en-US/mac/platformDialogOverlay.dtd)
|
||||
locale/en-US/global-platform/mac/platformKeys.properties (resources/locale/en-US/mac/platformKeys.properties)
|
||||
locale/en-US/global-platform/mac/wizard.properties (resources/locale/en-US/mac/wizard.properties)
|
|
@ -1,48 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# 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 the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = content locale
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# 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 the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ifneq (,$(filter os2 windows,$(MOZ_WIDGET_TOOLKIT)))
|
||||
DIRS = win
|
||||
else
|
||||
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
DIRS = mac
|
||||
else
|
||||
DIRS = unix
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs realchrome::
|
||||
@$(REGCHROME) content global toolkit.jar
|
||||
@$(REGCHROME) locale en-US/global en-US.jar
|
||||
|
||||
install::
|
||||
@$(REGCHROME_INSTALL) content global toolkit.jar
|
||||
@$(REGCHROME_INSTALL) locale en-US/global en-US.jar
|
|
@ -1,40 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 XPConnect Native Wrapper.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Christopher A. Aillon <christopher@aillon.com>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Christopher A. Aillon <christopher@aillon.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Moved to C++ implementation in XPConnect. See bug 281988.
|
||||
*/
|
|
@ -1,128 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
<!ENTITY % regionDTD SYSTEM "chrome://global-region/locale/region.dtd" >
|
||||
%brandDTD;
|
||||
%regionDTD;
|
||||
]>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- 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 Communicator client code, released
|
||||
- March 31, 1998.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Henrik Gemal <mozilla@gemal.dk>
|
||||
- Daniel Veditz <dveditz@netscape.com>
|
||||
- Alexey Chernyak <alexeyc@bigfoot.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>About:</title>
|
||||
<style type="text/css">
|
||||
table {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
p {
|
||||
font-size: smaller;
|
||||
}
|
||||
h1 {
|
||||
margin: 0;
|
||||
}
|
||||
:link {
|
||||
color: #00e;
|
||||
}
|
||||
:visited {
|
||||
color: #551a8b;
|
||||
}
|
||||
:link:active, :visited:active {
|
||||
color: #f00;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<a href="&vendorURL;">
|
||||
<img src="about:logo" alt="&brandShortName;" width="200" height="200" /></a>
|
||||
</td>
|
||||
|
||||
<td id="mozver">
|
||||
<h1>
|
||||
#expand <a id="mozlink" href="&releaseURL;">&brandShortName; __MOZ_APP_VERSION__</a>
|
||||
</h1>
|
||||
<script type="application/x-javascript">
|
||||
document.getElementById("mozver").appendChild(document.createTextNode(navigator.userAgent));
|
||||
</script>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<hr />
|
||||
|
||||
<ul>
|
||||
<li>Copyright © 1998–2007 by <a href="about:credits">Contributors</a> to
|
||||
the Mozilla codebase under the <a href="about:license">Mozilla Public License
|
||||
and other licenses</a>. All Rights Reserved.</li>
|
||||
|
||||
<li>Portions of this software are copyright © 1994 The Regents of the
|
||||
University of California. All Rights Reserved.</li>
|
||||
<li>Portions of this software are copyright © 2000–2002 Japan Network Information
|
||||
Center. All Rights Reserved.</li>
|
||||
<li>This software may contain portions that are copyright © 1998–2002
|
||||
<a href="http://www.supportsoft.com/">SupportSoft, Inc.</a> All Rights Reserved.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
U.S. GOVERNMENT END USERS. The Software is a "commercial
|
||||
item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting
|
||||
of "commercial computer software" and "commercial computer software
|
||||
documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995).
|
||||
Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4
|
||||
(June 1995), all U.S. Government End Users acquire the Software with only
|
||||
those rights set forth herein.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,68 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
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 Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Netscape Communications Corporation.
|
||||
Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
use your version of this file under the terms of the MPL, indicate your
|
||||
decision by deleting the provisions above and replace them with the notice
|
||||
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % aboutDTD SYSTEM "chrome://global/locale/about.dtd" >
|
||||
%aboutDTD;
|
||||
]>
|
||||
|
||||
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&title.label;"
|
||||
buttons="accept">
|
||||
|
||||
<vbox flex="100%" style="margin: 0.5em;">
|
||||
|
||||
<tabbox flex="100%">
|
||||
<tabs>
|
||||
<tab label="&aboutTab.label;"/>
|
||||
<tab label="&contributorsTab.label;"/>
|
||||
</tabs>
|
||||
|
||||
<tabpanels flex="100%">
|
||||
<iframe src="about:"/>
|
||||
<iframe src="about:credits"/>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
|
||||
</vbox>
|
||||
</dialog>
|
|
@ -1,126 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
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 about:about.
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Christopher A. Aillon <christopher@aillon.com>.
|
||||
Portions created by the Initial Developer are Copyright (C) 2003
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Christopher A. Aillon <christopher@aillon.com>
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
use your version of this file under the terms of the MPL, indicate your
|
||||
decision by deleting the provisions above and replace them with the notice
|
||||
and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>About About</title>
|
||||
<style type="text/css">
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
tr {
|
||||
background-color: #eeeeee;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
td {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: 0.5em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.note {
|
||||
text-align: center;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
<script type="application/x-javascript">
|
||||
|
||||
var gProtocols = new Array();
|
||||
var gContainer;
|
||||
window.onload = Start;
|
||||
function Start()
|
||||
{
|
||||
gContainer = document.getElementById("abouts");
|
||||
|
||||
findAbouts();
|
||||
}
|
||||
|
||||
function findAbouts()
|
||||
{
|
||||
for (var cid in Components.classes) {
|
||||
var result = cid.match(/@mozilla.org\/network\/protocol\/about;1\?what\=(.*)$/);
|
||||
if (result) {
|
||||
gProtocols.push(result[1]);
|
||||
}
|
||||
}
|
||||
|
||||
gProtocols.sort();
|
||||
for (var i in gProtocols) {
|
||||
createProtocolListing(gProtocols[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function createProtocolListing(aProtocol)
|
||||
{
|
||||
var uri = "about:" + aProtocol;
|
||||
|
||||
var tr = document.createElement("tr");
|
||||
var td = document.createElement("td");
|
||||
var link = document.createElement("a");
|
||||
var text = document.createTextNode(uri);
|
||||
|
||||
link.href = uri;
|
||||
link.appendChild(text);
|
||||
td.appendChild(link);
|
||||
tr.appendChild(td);
|
||||
gContainer.appendChild(tr);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>about:about</h1>
|
||||
<p class="note">Note: not all of the following URIs may be useful as listed. For instance, some may require query strings.</p>
|
||||
<table id="abouts"></table>
|
||||
</body>
|
||||
</html>
|
|
@ -1,525 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- 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 this file as it was released on March 28, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Peter Annema.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2001
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Peter Annema <disttsc@bart.nl> (Original Author of <browser>)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
- or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<bindings id="browserBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="browser" extends="xul:browser">
|
||||
<implementation type="application/x-javascript" implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.OuterDoc;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="canGoBack"
|
||||
onget="return this.webNavigation.canGoBack;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="canGoForward"
|
||||
onget="return this.webNavigation.canGoForward;"
|
||||
readonly="true"/>
|
||||
|
||||
<method name="goBack">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var webNavigation = this.webNavigation;
|
||||
if (webNavigation.canGoBack) {
|
||||
try {
|
||||
this.userTypedClear++;
|
||||
webNavigation.goBack();
|
||||
} finally {
|
||||
if (this.userTypedClear)
|
||||
this.userTypedClear--;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="goForward">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var webNavigation = this.webNavigation;
|
||||
if (webNavigation.canGoForward) {
|
||||
try {
|
||||
this.userTypedClear++;
|
||||
webNavigation.goForward();
|
||||
} finally {
|
||||
if (this.userTypedClear)
|
||||
this.userTypedClear--;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="reload">
|
||||
<body>
|
||||
<![CDATA[
|
||||
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
|
||||
const flags = nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
this.reloadWithFlags(flags);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="reloadWithFlags">
|
||||
<parameter name="aFlags"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.webNavigation.reload(aFlags);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="stop">
|
||||
<body>
|
||||
<![CDATA[
|
||||
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
|
||||
const flags = nsIWebNavigation.STOP_ALL;
|
||||
this.webNavigation.stop(flags);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- throws exception for unknown schemes -->
|
||||
<method name="loadURI">
|
||||
<parameter name="aURI"/>
|
||||
<parameter name="aReferrerURI"/>
|
||||
<parameter name="aCharset"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
|
||||
const flags = nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
this.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- throws exception for unknown schemes -->
|
||||
<method name="loadURIWithFlags">
|
||||
<parameter name="aURI"/>
|
||||
<parameter name="aFlags"/>
|
||||
<parameter name="aReferrerURI"/>
|
||||
<parameter name="aCharset"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!aURI)
|
||||
aURI = "about:blank";
|
||||
|
||||
if (aCharset) {
|
||||
try {
|
||||
this.documentCharsetInfo.parentCharset = this.mAtomService.getAtom(aCharset);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.userTypedClear++;
|
||||
this.webNavigation.loadURI(aURI, aFlags, aReferrerURI, null, null);
|
||||
} finally {
|
||||
if (this.userTypedClear)
|
||||
this.userTypedClear--;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="goHome">
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
this.loadURI(this.homePage);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="homePage">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var uri;
|
||||
|
||||
if (this.hasAttribute("homepage"))
|
||||
uri = this.getAttribute("homepage");
|
||||
else
|
||||
uri = "http://www.mozilla.org/"; // widget pride
|
||||
|
||||
return uri;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this.setAttribute("homepage", val);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="gotoIndex">
|
||||
<parameter name="aIndex"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
this.userTypedClear++;
|
||||
this.webNavigation.gotoIndex(aIndex);
|
||||
} finally {
|
||||
if (this.userTypedClear)
|
||||
this.userTypedClear--;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="currentURI"
|
||||
onget="return this.webNavigation.currentURI;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="preferences"
|
||||
onget="return Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="docShell"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="webNavigation"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
|
||||
readonly="true"/>
|
||||
|
||||
<field name="_webBrowserFind">null</field>
|
||||
|
||||
<property name="webBrowserFind"
|
||||
readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (!this._webBrowserFind)
|
||||
this._webBrowserFind = this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);
|
||||
return this._webBrowserFind;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="webProgress"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress);"/>
|
||||
|
||||
<property name="contentWindow"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
|
||||
|
||||
<property name="sessionHistory"
|
||||
onget="return this.webNavigation.sessionHistory;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="markupDocumentViewer"
|
||||
onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="contentViewerEdit"
|
||||
onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerEdit);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="contentViewerFile"
|
||||
onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerFile);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="documentCharsetInfo"
|
||||
onget="return this.docShell.documentCharsetInfo;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="contentDocument"
|
||||
onget="return this.webNavigation.document;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="contentTitle"
|
||||
onget="return this.contentDocument.title;"
|
||||
readonly="true"/>
|
||||
|
||||
<field name="mPrefs" readonly="true">
|
||||
Components.classes['@mozilla.org/preferences-service;1']
|
||||
.getService(Components.interfaces.nsIPrefService)
|
||||
.getBranch(null);
|
||||
</field>
|
||||
|
||||
<field name="mAtomService" readonly="true">
|
||||
Components.classes['@mozilla.org/atom-service;1']
|
||||
.getService(Components.interfaces.nsIAtomService);
|
||||
</field>
|
||||
|
||||
<field name="_mStrBundle">null</field>
|
||||
|
||||
<property name="mStrBundle">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (!this._mStrBundle) {
|
||||
// need to create string bundle manually instead of using <xul:stringbundle/>
|
||||
// see bug 63370 for details
|
||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||
.getService(Components.interfaces.nsILocaleService);
|
||||
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var bundleURL = "chrome://global/locale/tabbrowser.properties";
|
||||
this._mStrBundle = stringBundleService.createBundle(bundleURL, localeService.getApplicationLocale());
|
||||
}
|
||||
return this._mStrBundle;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="addProgressListener">
|
||||
<parameter name="aListener"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.webProgress.addProgressListener(aListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeProgressListener">
|
||||
<parameter name="aListener"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.webProgress.removeProgressListener(aListener);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="mDragDropHandler">
|
||||
null
|
||||
</field>
|
||||
|
||||
<property name="securityUI"
|
||||
onget="return this.docShell.securityUI;"
|
||||
onset="this.docShell.securityUI = val;"/>
|
||||
|
||||
<!--
|
||||
This field tracks the location bar state. The value that the user typed
|
||||
in to the location bar may not be changed while this field is zero.
|
||||
However invoking a load will temporarily increase this field to allow
|
||||
the location bar to be updated to the new URL.
|
||||
|
||||
Case 1: Anchor scroll
|
||||
The user appends the anchor to the URL. This sets the location bar
|
||||
into typed state, and disables changes to the location bar. The user
|
||||
then requests the scroll. loadURIWithFlags temporarily increases the
|
||||
flag by 1 so that the anchor scroll's location change resets the
|
||||
location bar state.
|
||||
|
||||
Case 2: Interrupted load
|
||||
The user types in and submits the URL. This triggers an asynchronous
|
||||
network load which increases the flag by 2. (The temporary increase
|
||||
from loadURIWithFlags is not noticeable in this case.) When the load
|
||||
is interrupted the flag returns to zero, and the location bar stays
|
||||
in typed state.
|
||||
|
||||
Case 3: New load
|
||||
This works like case 2, but as the load is not interrupted the
|
||||
location changes while the flag is still 2 thus resetting the
|
||||
location bar state.
|
||||
|
||||
Case 4: Corrected load
|
||||
This is a combination of case 2 and case 3, except that the original
|
||||
load is interrupted by the new load. Normally cancelling and starting
|
||||
a new load would reset the flag to 0 and then increase it to 2 again.
|
||||
However both actions occur as a consequence of the loadURIWithFlags
|
||||
invocation, which adds its temporary increase in to the mix. Since
|
||||
the new URL would have been typed in the flag would have been reset
|
||||
before loadURIWithFlags incremented it. The interruption resets the
|
||||
flag to 0 and increases it to 2. Although loadURIWithFlags will
|
||||
decrement the flag it remains at 1 thus allowing the location bar
|
||||
state to be reset when the new load changes the location.
|
||||
This case also applies when loading into a new browser, as this
|
||||
interrupts the default load of about:blank.
|
||||
-->
|
||||
<field name="userTypedClear">
|
||||
1
|
||||
</field>
|
||||
|
||||
<field name="_userTypedValue">
|
||||
null
|
||||
</field>
|
||||
|
||||
<property name="userTypedValue"
|
||||
onget="return this._userTypedValue;"
|
||||
onset="this.userTypedClear = 0; return this._userTypedValue = val;"/>
|
||||
|
||||
<field name="focusedWindow">
|
||||
null
|
||||
</field>
|
||||
|
||||
<field name="focusedElement">
|
||||
null
|
||||
</field>
|
||||
|
||||
<field name="mDestroyed">
|
||||
false
|
||||
</field>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this.init();
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<destructor>
|
||||
<![CDATA[
|
||||
this.destroy();
|
||||
]]>
|
||||
</destructor>
|
||||
|
||||
<!-- This is necessary because the tabbrowser wants this stuff wired up
|
||||
before adding its progress listener but the browser won't have a
|
||||
docShell if we try to construct it before its frame is created -->
|
||||
<method name="init">
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
if (!this.webNavigation.sessionHistory &&
|
||||
!this.hasAttribute("disablehistory")) {
|
||||
// wire up session history
|
||||
this.webNavigation.sessionHistory = Components.classes["@mozilla.org/browser/shistory;1"].createInstance(Components.interfaces.nsISHistory);
|
||||
|
||||
// enable global history
|
||||
this.docShell.QueryInterface(Components.interfaces.nsIDocShellHistory).useGlobalHistory = true;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
try {
|
||||
if (!this.mDragDropHandler) {
|
||||
this.mDragDropHandler = Components.classes["@mozilla.org:/content/content-area-dragdrop;1"].createInstance(Components.interfaces.nsIDragDropHandler);
|
||||
this.mDragDropHandler.hookupTo(this, null);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
try {
|
||||
const SECUREBROWSERUI_CONTRACTID = "@mozilla.org/secure_browser_ui;1";
|
||||
if (!this.securityUI && !this.hasAttribute("disablesecurity") &&
|
||||
SECUREBROWSERUI_CONTRACTID in Components.classes) {
|
||||
var securityUI = Components.classes[SECUREBROWSERUI_CONTRACTID].createInstance(Components.interfaces.nsISecureBrowserUI);
|
||||
securityUI.init(this.contentWindow);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- This is necessary because the destructor is not called
|
||||
promptly when we are removed from a tabbrowser. This will be
|
||||
explicitly called by tabbrowser -->
|
||||
<method name="destroy">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.mDestroyed)
|
||||
return;
|
||||
this.mDestroyed = true;
|
||||
|
||||
if (this.mDragDropHandler)
|
||||
this.mDragDropHandler.detach();
|
||||
this.mDragDropHandler = null;
|
||||
|
||||
this.focusedWindow = null;
|
||||
this.focusedElement = null;
|
||||
this._webBrowserFind = null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_F7" group="system">
|
||||
<![CDATA[
|
||||
if (event.getPreventDefault() || !event.isTrusted)
|
||||
return;
|
||||
|
||||
// Toggle browse with caret mode
|
||||
var browseWithCaretOn = false;
|
||||
var warn = true;
|
||||
|
||||
try {
|
||||
warn = this.mPrefs.getBoolPref("accessibility.warn_on_browsewithcaret");
|
||||
} catch (ex) {
|
||||
}
|
||||
|
||||
try {
|
||||
browseWithCaretOn = this.mPrefs.getBoolPref("accessibility.browsewithcaret");
|
||||
} catch (ex) {
|
||||
}
|
||||
if (warn && !browseWithCaretOn) {
|
||||
var checkValue = {value:false};
|
||||
promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
var buttonPressed = promptService.confirmEx(window,
|
||||
this.mStrBundle.GetStringFromName('browsewithcaret.checkWindowTitle'),
|
||||
this.mStrBundle.GetStringFromName('browsewithcaret.checkLabel'),
|
||||
promptService.STD_YES_NO_BUTTONS,
|
||||
null, null, null, this.mStrBundle.GetStringFromName('browsewithcaret.checkMsg'),
|
||||
checkValue);
|
||||
if (buttonPressed != 0)
|
||||
return;
|
||||
if (checkValue.value) {
|
||||
try {
|
||||
this.mPrefs.setBoolPref("accessibility.warn_on_browsewithcaret", false);
|
||||
}
|
||||
catch (ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle the pref
|
||||
try {
|
||||
this.mPrefs.setBoolPref("accessibility.browsewithcaret",!browseWithCaretOn);
|
||||
} catch (ex) {
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,353 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="buttonBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="button-base" extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<implementation implements="nsIDOMXULButtonElement, nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULButton;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="type"
|
||||
onget="return this.getAttribute('type');"
|
||||
onset="this.setAttribute('type', val); return val;"/>
|
||||
|
||||
<property name="dlgType"
|
||||
onget="return this.getAttribute('dlgtype');"
|
||||
onset="this.setAttribute('dlgtype', val); return val;"/>
|
||||
|
||||
<property name="group"
|
||||
onget="return this.getAttribute('group');"
|
||||
onset="this.setAttribute('group', val); return val;"/>
|
||||
|
||||
<property name="open" onget="return this.hasAttribute('open');">
|
||||
<setter><![CDATA[
|
||||
if (this.boxObject instanceof
|
||||
Components.interfaces.nsIMenuBoxObject) {
|
||||
this.boxObject.openMenu(val);
|
||||
} else {
|
||||
// Fall back to just setting the attribute
|
||||
if (val) {
|
||||
this.setAttribute('open', 'true');
|
||||
} else {
|
||||
this.removeAttribute('open');
|
||||
}
|
||||
}
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="checked" onget="return this.hasAttribute('checked');">
|
||||
<setter><![CDATA[
|
||||
if (this.type == "checkbox") {
|
||||
this.checkState = val ? 1 : 0;
|
||||
} else if (this.type == "radio" && val) {
|
||||
var sibs = this.parentNode.getElementsByAttribute("group", this.group);
|
||||
for (var i = 0; i < sibs.length; ++i)
|
||||
sibs[i].removeAttribute("checked");
|
||||
}
|
||||
|
||||
if (val)
|
||||
this.setAttribute("checked", "true");
|
||||
else
|
||||
this.removeAttribute("checked");
|
||||
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="checkState">
|
||||
<getter><![CDATA[
|
||||
var state = this.getAttribute("checkState");
|
||||
if (state == "")
|
||||
return this.checked ? 1 : 0;
|
||||
else
|
||||
return state == "0" ? 0 : (state == "2" ? 2 : 1);
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.setAttribute("checkState", val);
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="autoCheck"
|
||||
onget="return this.getAttribute('autoCheck') == 'true';"
|
||||
onset="this.setAttribute('autoCheck', val); return val;"/>
|
||||
|
||||
<method name ="filterButtons">
|
||||
<parameter name="node"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (node.localName == "button" && node.accessKey &&
|
||||
!node.disabled && !node.collapsed && !node.hidden)
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
return NodeFilter.FILTER_SKIP;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="fireAccessKeyButton">
|
||||
<parameter name="aSubtree"/>
|
||||
<parameter name="aAccessKeyLower"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var iterator = aSubtree.ownerDocument.createTreeWalker(aSubtree,
|
||||
NodeFilter.SHOW_ELEMENT,
|
||||
this.filterButtons, false);
|
||||
while (iterator.nextNode()) {
|
||||
var test = iterator.currentNode;
|
||||
if (test.accessKey.toLowerCase() == aAccessKeyLower &&
|
||||
!test.disabled && !test.collapsed && !test.hidden) {
|
||||
test.focus();
|
||||
test.click();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_handleClick">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this.disabled &&
|
||||
(this.autoCheck || !this.hasAttribute("autoCheck"))) {
|
||||
|
||||
if (this.type == "checkbox") {
|
||||
this.checked = !this.checked;
|
||||
} else if (this.type == "radio") {
|
||||
this.checked = true;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<!-- While it would seem we could do this by handling oncommand, we can't
|
||||
because any external oncommand handlers might get called before ours,
|
||||
and then they would see the incorrect value of checked. Additionally
|
||||
a command attribute would redirect the command events anyway.-->
|
||||
<handler event="click" button="0" action="this._handleClick();"/>
|
||||
<handler event="keypress" key=" " action="this._handleClick();"/>
|
||||
|
||||
<handler event="keypress">
|
||||
<![CDATA[
|
||||
if (event.keyCode == KeyEvent.DOM_VK_UP ||
|
||||
(event.keyCode == KeyEvent.DOM_VK_LEFT &&
|
||||
document.defaultView.getComputedStyle(this.parentNode, "")
|
||||
.direction == "ltr") ||
|
||||
(event.keyCode == KeyEvent.DOM_VK_RIGHT &&
|
||||
document.defaultView.getComputedStyle(this.parentNode, "")
|
||||
.direction == "rtl")) {
|
||||
window.document.commandDispatcher.rewindFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.keyCode == KeyEvent.DOM_VK_DOWN ||
|
||||
(event.keyCode == KeyEvent.DOM_VK_RIGHT &&
|
||||
document.defaultView.getComputedStyle(this.parentNode, "")
|
||||
.direction == "ltr") ||
|
||||
(event.keyCode == KeyEvent.DOM_VK_LEFT &&
|
||||
document.defaultView.getComputedStyle(this.parentNode, "")
|
||||
.direction == "rtl")) {
|
||||
window.document.commandDispatcher.advanceFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.keyCode || event.charCode <= 32 || event.altKey ||
|
||||
event.ctrlKey || event.metaKey)
|
||||
return; // No printable char pressed, not a potential accesskey
|
||||
|
||||
// Possible accesskey pressed
|
||||
var charPressedLower = String.fromCharCode(event.charCode).toLowerCase();
|
||||
|
||||
// If the accesskey of the current button is pressed, just activate it
|
||||
if (this.accessKey.toLowerCase() == charPressedLower) {
|
||||
this.click();
|
||||
return;
|
||||
}
|
||||
|
||||
// Search for accesskey in the list of buttons for this doc and each subdoc
|
||||
// Get the buttons for the main document and all sub-frames
|
||||
for (var frameCount = -1; frameCount < window.top.frames.length; frameCount++) {
|
||||
var doc = (frameCount == -1)? window.top.document:
|
||||
window.top.frames[frameCount].document
|
||||
if (this.fireAccessKeyButton(doc.documentElement, charPressedLower))
|
||||
return;
|
||||
}
|
||||
|
||||
// Test anonymous buttons
|
||||
var dlg = window.top.document;
|
||||
var buttonBox = dlg.getAnonymousElementByAttribute(dlg.documentElement,
|
||||
"anonid", "buttons");
|
||||
if (buttonBox)
|
||||
this.fireAccessKeyButton(buttonBox, charPressedLower);
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="button" display="xul:button"
|
||||
extends="chrome://global/content/bindings/button.xml#button-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/button.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<children includes="observes|template|menupopup|tooltip"/>
|
||||
<xul:hbox class="box-inherit button-box" xbl:inherits="align,dir,pack,orient"
|
||||
align="center" pack="center" flex="1">
|
||||
<children>
|
||||
<xul:image class="button-icon" xbl:inherits="src=image"/>
|
||||
<xul:label class="button-text" xbl:inherits="value=label,accesskey,crop"/>
|
||||
</children>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/button.xml#button">
|
||||
<content>
|
||||
<children includes="observes|template|menupopup|tooltip"/>
|
||||
<xul:hbox class="box-inherit button-box" xbl:inherits="align,dir,pack,orient"
|
||||
align="center" pack="center" flex="1">
|
||||
<children>
|
||||
<xul:hbox class="box-inherit" xbl:inherits="align,dir,pack,orient"
|
||||
align="center" pack="center" flex="1">
|
||||
<xul:image class="button-icon" xbl:inherits="src=image"/>
|
||||
<xul:label class="button-text" xbl:inherits="value=label,accesskey,crop"/>
|
||||
</xul:hbox>
|
||||
<xul:dropmarker class="button-menu-dropmarker" xbl:inherits="open,disabled"/>
|
||||
</children>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_RETURN" action="this.open = true;"/>
|
||||
<handler event="keypress" key=" " action="this.open = true;"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-button-base"
|
||||
extends="chrome://global/content/bindings/button.xml#button-base">
|
||||
<implementation implements="nsIDOMEventListener">
|
||||
<constructor>
|
||||
this.init();
|
||||
</constructor>
|
||||
|
||||
<method name="init">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var btn = document.getAnonymousElementByAttribute(this, "anonid", "button");
|
||||
if (!btn)
|
||||
throw "XBL binding for <button type=\"menu-button\"/> binding must contain an element with anonid=\"button\"";
|
||||
|
||||
var menubuttonParent = this;
|
||||
btn.addEventListener("mouseover", function() {
|
||||
if (!this.disabled)
|
||||
menubuttonParent.buttonover = true;
|
||||
}, true);
|
||||
btn.addEventListener("mouseout", function() {
|
||||
menubuttonParent.buttonover = false;
|
||||
}, true);
|
||||
btn.addEventListener("mousedown", function() {
|
||||
if (!this.disabled) {
|
||||
menubuttonParent.buttondown = true;
|
||||
document.addEventListener("mouseup", menubuttonParent, true);
|
||||
}
|
||||
}, true);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="buttonover" onget="return this.getAttribute('buttonover');">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var v = val || val == "true";
|
||||
if (!v && this.buttondown) {
|
||||
this.buttondown = false;
|
||||
this._pendingActive = true;
|
||||
}
|
||||
else {
|
||||
if (this._pendingActive) {
|
||||
this.buttondown = true;
|
||||
this._pendingActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (v)
|
||||
this.setAttribute("buttonover", "true");
|
||||
else
|
||||
this.removeAttribute("buttonover");
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="buttondown" onget="return this.getAttribute('buttondown') == 'true';">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val || val == "true")
|
||||
this.setAttribute("buttondown", "true");
|
||||
else
|
||||
this.removeAttribute("buttondown");
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<field name="_pendingActive">false</field>
|
||||
|
||||
<method name="handleEvent">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this._pendingActive = false;
|
||||
this.buttondown = false;
|
||||
document.removeEventListener("mouseup", this, true);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-button" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/button.xml#menu-button-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/button.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<children includes="observes|template|menupopup|tooltip"/>
|
||||
<xul:button class="box-inherit button-menubutton-button"
|
||||
anonid="button" flex="1" allowevents="true"
|
||||
xbl:inherits="disabled,crop,image,label,accessKey,command,
|
||||
buttonover,buttondown,align,dir,pack,orient">
|
||||
<children/>
|
||||
</xul:button>
|
||||
<xul:dropmarker class="button-menubutton-dropmarker" xbl:inherits="open,disabled"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="button-image" display="xul:button"
|
||||
extends="chrome://global/content/bindings/button.xml#button">
|
||||
<content>
|
||||
<xul:image class="button-image-icon" xbl:inherits="src=image"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="button-repeat" display="xul:autorepeatbutton"
|
||||
extends="chrome://global/content/bindings/button.xml#button"/>
|
||||
|
||||
</bindings>
|
|
@ -1,85 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="checkboxBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="checkbox" extends="chrome://global/content/bindings/checkbox.xml#checkbox-baseline">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/checkbox.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="checkbox-baseline" extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<content>
|
||||
<xul:image class="checkbox-check" xbl:inherits="checked,disabled"/>
|
||||
<xul:hbox class="checkbox-label-box" flex="1">
|
||||
<xul:image class="checkbox-icon" xbl:inherits="src"/>
|
||||
<xul:label class="checkbox-label" xbl:inherits="xbl:text=label,accesskey,crop" flex="1"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULCheckboxElement, nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULCheckbox;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="setChecked">
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var change = (aValue != (this.getAttribute('checked') == 'true'));
|
||||
if (aValue)
|
||||
this.setAttribute('checked', 'true');
|
||||
else
|
||||
this.removeAttribute('checked');
|
||||
if (change) {
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent('CheckboxStateChange', true, true);
|
||||
this.dispatchEvent(event);
|
||||
}
|
||||
return aValue;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- public implementation -->
|
||||
<property name="checked" onset="return this.setChecked(val);"
|
||||
onget="return this.getAttribute('checked') == 'true';"/>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<!-- While it would seem we could do this by handling oncommand, we need can't
|
||||
because any external oncommand handlers might get called before ours, and
|
||||
then they would see the incorrect value of checked. -->
|
||||
<handler event="click" button="0" action="if (!this.disabled) this.checked = !this.checked;"/>
|
||||
<handler event="keypress" key=" ">
|
||||
<![CDATA[
|
||||
this.checked = !this.checked;
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="checkbox-with-spacing"
|
||||
extends="chrome://global/content/bindings/checkbox.xml#checkbox">
|
||||
|
||||
<content>
|
||||
<xul:hbox class="checkbox-spacer-box">
|
||||
<xul:image class="checkbox-check" xbl:inherits="checked,disabled"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox class="checkbox-label-center-box" flex="1">
|
||||
<xul:hbox class="checkbox-label-box" flex="1">
|
||||
<xul:image class="checkbox-icon" xbl:inherits="src"/>
|
||||
<xul:label class="checkbox-label" xbl:inherits="xbl:text=label,accesskey,crop" flex="1"/>
|
||||
</xul:hbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,549 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="colorpickerBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="colorpicker" extends="chrome://global/content/bindings/general.xml#basecontrol">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/colorpicker.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:vbox flex="1">
|
||||
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFFFF" color="#FFFFFF"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFCCCC" color="#FFCCCC"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFCC99" color="#FFCC99"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFF99" color="#FFFF99"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFFCC" color="#FFFFCC"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #99FF99" color="#99FF99"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #99FFFF" color="#99FFFF"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #CCFFFF" color="#CCFFFF"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #CCCCFF" color="#CCCCFF"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFCCFF" color="#FFCCFF"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CCCCCC" color="#CCCCCC"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF6666" color="#FF6666"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF9966" color="#FF9966"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFF66" color="#FFFF66"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFF33" color="#FFFF33"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #66FF99" color="#66FF99"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #33FFFF" color="#33FFFF"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #66FFFF" color="#66FFFF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #9999FF" color="#9999FF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF99FF" color="#FF99FF"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #C0C0C0" color="#C0C0C0"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF0000" color="#FF0000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF9900" color="#FF9900"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FFCC66" color="#FFCC66"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #FFFF00" color="#FFFF00"/>
|
||||
<xul:spacer class="colorpickertile cp-light" style="background-color: #33FF33" color="#33FF33"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #66CCCC" color="#66CCCC"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #33CCFF" color="#33CCFF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #6666CC" color="#6666CC"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CC66CC" color="#CC66CC"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #999999" color="#999999"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CC0000" color="#CC0000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FF6600" color="#FF6600"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FFCC33" color="#FFCC33"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #FFCC00" color="#FFCC00"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #33CC00" color="#33CC00"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #00CCCC" color="#00CCCC"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #3366FF" color="#3366FF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #6633FF" color="#6633FF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CC33CC" color="#CC33CC"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #666666" color="#666666"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #990000" color="#990000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CC6600" color="#CC6600"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #CC9933" color="#CC9933"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #999900" color="#999900"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #009900" color="#009900"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #339999" color="#339999"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #3333FF" color="#3333FF"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #6600CC" color="#6600CC"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #993399" color="#993399"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #333333" color="#333333"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #660000" color="#660000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #993300" color="#993300"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #996633" color="#996633"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #666600" color="#666600"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #006600" color="#006600"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #336666" color="#336666"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #000099" color="#000099"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #333399" color="#333399"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #663366" color="#663366"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #000000" color="#000000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #330000" color="#330000"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #663300" color="#663300"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #663333" color="#663333"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #333300" color="#333300"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #003300" color="#003300"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #003333" color="#003333"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #000066" color="#000066"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #330099" color="#330099"/>
|
||||
<xul:spacer class="colorpickertile" style="background-color: #330033" color="#330033"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
<!-- Something to take tab focus
|
||||
<button style="border : 0px; width: 0px; height: 0px;"/>
|
||||
-->
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMEventListener">
|
||||
|
||||
<property name="color">
|
||||
<getter><![CDATA[
|
||||
return this.mSelectedCell ? this.mSelectedCell.getAttribute("color") : null;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (!val)
|
||||
return null;
|
||||
val = val.toUpperCase();
|
||||
// Translate standard HTML color strings:
|
||||
if (val[0] != "#") {
|
||||
switch (val) {
|
||||
case "GREEN":
|
||||
val = "#008000";
|
||||
break;
|
||||
case "LIME":
|
||||
val = "#00FF00";
|
||||
break;
|
||||
case "OLIVE":
|
||||
val = "#808000";
|
||||
break;
|
||||
case "TEAL":
|
||||
val = "#008080";
|
||||
break;
|
||||
case "YELLOW":
|
||||
val = "#FFFF00";
|
||||
break;
|
||||
case "RED":
|
||||
val = "#FF0000";
|
||||
break;
|
||||
case "MAROON":
|
||||
val = "#800000";
|
||||
break;
|
||||
case "PURPLE":
|
||||
val = "#800080";
|
||||
break;
|
||||
case "FUCHSIA":
|
||||
val = "#FF00FF";
|
||||
break;
|
||||
case "NAVY":
|
||||
val = "#000080";
|
||||
break;
|
||||
case "BLUE":
|
||||
val = "#0000FF";
|
||||
break;
|
||||
case "AQUA":
|
||||
val = "#00FFFF";
|
||||
break;
|
||||
case "WHITE":
|
||||
val = "#FFFFFF";
|
||||
break;
|
||||
case "SILVER":
|
||||
val = "#CC0C0C0";
|
||||
break;
|
||||
case "GRAY":
|
||||
val = "#808080";
|
||||
break;
|
||||
default: // BLACK
|
||||
val = "#000000";
|
||||
break;
|
||||
}
|
||||
}
|
||||
var cells = this.mBox.getElementsByAttribute("color", val);
|
||||
if (cells.item(0)) {
|
||||
this.selectCell(cells[0]);
|
||||
this.hoverCell(this.mSelectedCell);
|
||||
}
|
||||
return null;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<method name="initColor">
|
||||
<parameter name="aColor"/>
|
||||
<body><![CDATA[
|
||||
// Use this to initialize color without
|
||||
// triggering the "onselect" handler,
|
||||
// which closes window when it's a popup
|
||||
this.mDoOnSelect = false;
|
||||
this.color = aColor;
|
||||
this.mDoOnSelect = true;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="initialize">
|
||||
<body><![CDATA[
|
||||
this.mSelectedCell = null;
|
||||
this.mHoverCell = null;
|
||||
this.mBox = document.getAnonymousNodes(this)[0];
|
||||
this.mIsPopup = false;
|
||||
this.mDoOnSelect = true;
|
||||
|
||||
this.hoverCell(this.mBox.childNodes[0].childNodes[0]);
|
||||
|
||||
var onselect = this.getAttribute("onselect");
|
||||
if (onselect) {
|
||||
try {
|
||||
this.onselect = new Function(onselect);
|
||||
} catch (ex) {
|
||||
// watch out for syntax errors in the function code
|
||||
}
|
||||
}
|
||||
// used to capture keydown at the document level
|
||||
this.mPickerKeyDown = function(aEvent)
|
||||
{
|
||||
document._focusedPicker.pickerKeyDown(aEvent);
|
||||
}
|
||||
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="resetHover">
|
||||
<body><![CDATA[
|
||||
if (this.mHoverCell)
|
||||
this.mHoverCell.removeAttribute("hover");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="getColIndex">
|
||||
<parameter name="aCell"/>
|
||||
<body><![CDATA[
|
||||
var cell = aCell;
|
||||
var idx;
|
||||
for (idx = -1; cell; idx++)
|
||||
cell = cell.previousSibling;
|
||||
|
||||
return idx;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="isColorCell">
|
||||
<parameter name="aCell"/>
|
||||
<body><![CDATA[
|
||||
return aCell && aCell.hasAttribute("color");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverLeft">
|
||||
<body><![CDATA[
|
||||
var cell = this.mHoverCell.previousSibling;
|
||||
this.hoverCell(cell);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverRight">
|
||||
<body><![CDATA[
|
||||
var cell = this.mHoverCell.nextSibling;
|
||||
this.hoverCell(cell);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverUp">
|
||||
<body><![CDATA[
|
||||
var row = this.mHoverCell.parentNode.previousSibling;
|
||||
if (row) {
|
||||
var colIdx = this.getColIndex(this.mHoverCell);
|
||||
var cell = row.childNodes[colIdx];
|
||||
this.hoverCell(cell);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverDown">
|
||||
<body><![CDATA[
|
||||
var row = this.mHoverCell.parentNode.nextSibling;
|
||||
if (row) {
|
||||
var colIdx = this.getColIndex(this.mHoverCell);
|
||||
var cell = row.childNodes[colIdx];
|
||||
this.hoverCell(cell);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverTo">
|
||||
<parameter name="aRow"/>
|
||||
<parameter name="aCol"/>
|
||||
|
||||
<body><![CDATA[
|
||||
var row = this.mBox.childNodes[aRow];
|
||||
if (!row) return;
|
||||
var cell = row.childNodes[aCol];
|
||||
if (!cell) return;
|
||||
this.hoverCell(cell);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hoverCell">
|
||||
<parameter name="aCell"/>
|
||||
|
||||
<body><![CDATA[
|
||||
if (this.isColorCell(aCell)) {
|
||||
this.resetHover();
|
||||
aCell.setAttribute("hover", "true");
|
||||
this.mHoverCell = aCell;
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent('DOMMenuItemActive', true, true);
|
||||
aCell.dispatchEvent(event);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="selectHoverCell">
|
||||
<body><![CDATA[
|
||||
this.selectCell(this.mHoverCell);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="selectCell">
|
||||
<parameter name="aCell"/>
|
||||
|
||||
<body><![CDATA[
|
||||
if (this.isColorCell(aCell)) {
|
||||
if (this.mSelectedCell)
|
||||
this.mSelectedCell.removeAttribute("selected");
|
||||
|
||||
this.mSelectedCell = aCell;
|
||||
aCell.setAttribute("selected", "true");
|
||||
|
||||
if (this.mDoOnSelect && this.onselect)
|
||||
this.onselect();
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="handleEvent">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
switch (aEvent.keyCode) {
|
||||
case 37: // left
|
||||
this.hoverLeft();
|
||||
break;
|
||||
case 38: // up
|
||||
this.hoverUp();
|
||||
break;
|
||||
case 39: // right
|
||||
this.hoverRight();
|
||||
break;
|
||||
case 40: // down
|
||||
this.hoverDown();
|
||||
break;
|
||||
case 13: // enter
|
||||
case 32: // space
|
||||
this.selectHoverCell();
|
||||
break;
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<constructor><![CDATA[
|
||||
this.initialize();
|
||||
]]></constructor>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mouseover"><![CDATA[
|
||||
this.hoverCell(event.originalTarget);
|
||||
]]></handler>
|
||||
|
||||
<handler event="click"><![CDATA[
|
||||
if (event.originalTarget.hasAttribute("color")) {
|
||||
this.selectCell(event.originalTarget);
|
||||
this.hoverCell(this.mSelectedCell);
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
|
||||
<handler event="focus" phase="capturing">
|
||||
<![CDATA[
|
||||
if (!mIsPopup && this.getAttribute('focused') != 'true') {
|
||||
this.setAttribute('focused','true');
|
||||
document.addEventListener("keydown", this, true);
|
||||
if (this.mSelectedCell)
|
||||
this.hoverCell(this.mSelectedCell);
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="blur" phase="capturing">
|
||||
<![CDATA[
|
||||
if (!mIsPopup && this.getAttribute('focused') == 'true') {
|
||||
document.removeEventListener("keydown", this, true);
|
||||
this.removeAttribute('focused');
|
||||
this.resetHover();
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="colorpicker-button">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/colorpicker.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:hbox class="colorpicker-button-colorbox" anonid="colorbox" flex="1" xbl:inherits="disabled"/>
|
||||
|
||||
<xul:popupset>
|
||||
<xul:popup class="colorpicker-button-menupopup" anonid="colorpopup"
|
||||
onmousedown="event.stopPropagation()"
|
||||
onpopupshowing="this._colorPicker.onPopupShowing()"
|
||||
onpopuphiding="this._colorPicker.onPopupHiding()">
|
||||
|
||||
<xul:colorpicker xbl:inherits="palettename,disabled" allowevents="true" anonid="colorpicker"
|
||||
onselect="this.parentNode.parentNode.parentNode.pickerChange()"/>
|
||||
|
||||
</xul:popup>
|
||||
</xul:popupset>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider, nsIDOMXULControlElement">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULColorPicker;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="open" onget="return this.mOpen"/>
|
||||
|
||||
<property name="color">
|
||||
<getter><![CDATA[
|
||||
return this.getAttribute("color");
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mColorBox.style.backgroundColor = val;
|
||||
return this.setAttribute("color", val);
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<method name="initialize">
|
||||
<body><![CDATA[
|
||||
this.mOpen = false;
|
||||
this.onchange = null;
|
||||
|
||||
this.mColorBox = document.getAnonymousElementByAttribute(this, "anonid", "colorbox");
|
||||
this.mColorBox.style.backgroundColor = this.color;
|
||||
|
||||
var popup = document.getAnonymousElementByAttribute(this, "anonid", "colorpopup")
|
||||
popup._colorPicker = this;
|
||||
|
||||
this.mPicker = document.getAnonymousElementByAttribute(this, "anonid", "colorpicker")
|
||||
|
||||
var change = this.getAttribute("onchange");
|
||||
if (change) {
|
||||
try {
|
||||
this.onchange = new Function("event", change);
|
||||
} catch (ex) {
|
||||
// watch out for syntax errors in the function code
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="showPopup">
|
||||
<body><![CDATA[
|
||||
this.mPicker.parentNode.showPopup(this, -1, -1, "popup", "bottomleft", "topleft");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="hidePopup">
|
||||
<body><![CDATA[
|
||||
this.mPicker.parentNode.hidePopup();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onPopupShowing">
|
||||
<body><![CDATA[
|
||||
this.mOpen = true;
|
||||
this.setAttribute("open", "true");
|
||||
|
||||
if ("resetHover" in this.mPicker)
|
||||
this.mPicker.resetHover();
|
||||
document.addEventListener("keydown", this.mPicker, true);
|
||||
this.mPicker.mIsPopup = true;
|
||||
// Initialize to current button's color
|
||||
this.mPicker.initColor(this.color);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onPopupHiding">
|
||||
<body><![CDATA[
|
||||
this.mOpen = false;
|
||||
this.removeAttribute("open");
|
||||
// Removes the key listener
|
||||
document.removeEventListener("keydown", this.mPicker, true);
|
||||
this.mPicker.mIsPopup = false;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="pickerChange">
|
||||
<body><![CDATA[
|
||||
this.color = this.mPicker.color;
|
||||
setTimeout(function(aPopup) { aPopup.hidePopup() }, 1, this.mPicker.parentNode);
|
||||
|
||||
if (this.onchange)
|
||||
this.onchange();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<constructor><![CDATA[
|
||||
this.initialize();
|
||||
]]></constructor>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keydown"><![CDATA[
|
||||
// open popup if key is space/up/left/right/down and popup is closed
|
||||
if ( (event.keyCode == 32 || (event.keyCode > 36 && event.keyCode < 41)) && !this.mOpen)
|
||||
|
||||
this.showPopup();
|
||||
]]></handler>
|
||||
|
||||
<handler event="mousedown"><![CDATA[
|
||||
if (this.disabled)
|
||||
return;
|
||||
|
||||
// Though I would prefer the open the popup using the built-in
|
||||
// popup="_child" mechanism, I can't use that because I can't seem to
|
||||
// get it to recognize the popupalign and popupanchor attributes that way
|
||||
// So, I have to do it manually...
|
||||
this.focus();
|
||||
this.showPopup();
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="colorpickertile">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULColorPickerTile;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -1,371 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="dialogBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="dialog-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/dialog.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="dialog" extends="chrome://global/content/bindings/dialog.xml#dialog-base">
|
||||
<content>
|
||||
<xul:vbox class="box-inherit dialog-content-box" flex="1">
|
||||
<children/>
|
||||
</xul:vbox>
|
||||
|
||||
<xul:hbox class="dialog-button-box" pack="end" anonid="buttons"
|
||||
xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient">
|
||||
<xul:button dlgtype="extra2" class="dialog-button" hidden="true" label="" xbl:inherits="label=buttonlabelextra2,accesskey=buttonaccesskeyextra2"/>
|
||||
<xul:spacer xbl:inherits="flex=spacerflex"/>
|
||||
<xul:button dlgtype="accept" class="dialog-button" xbl:inherits="label=buttonlabelaccept,accesskey=buttonaccesskeyaccept,disabled=buttondisabledaccept"/>
|
||||
<xul:button dlgtype="extra1" class="dialog-button" hidden="true" label="" xbl:inherits="label=buttonlabelextra1,accesskey=buttonaccesskeyextra1"/>
|
||||
<xul:button dlgtype="cancel" class="dialog-button" xbl:inherits="label=buttonlabelcancel,accesskey=buttonaccesskeycancel"/>
|
||||
<xul:button dlgtype="help" class="dialog-button" hidden="true" xbl:inherits="label=buttonlabelhelp,accesskey=buttonaccesskeyhelp"/>
|
||||
<xul:button dlgtype="disclosure" class="dialog-button" hidden="true" xbl:inherits="label=buttonlabeldisclosure,accesskey=buttonaccesskeydisclosure"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<field name="_mStrBundle">null</field>
|
||||
<field name="_closeHandler">(function(event) {
|
||||
if (!document.documentElement.cancelDialog())
|
||||
event.preventDefault();
|
||||
})</field>
|
||||
|
||||
<property name="buttons"
|
||||
onget="return this.getAttribute('buttons');"
|
||||
onset="this._configureButtons(val); return val;"/>
|
||||
|
||||
<property name="defaultButton">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (this.hasAttribute("defaultButton"))
|
||||
return this.getAttribute("defaultButton");
|
||||
else // default to the accept button
|
||||
return "accept";
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this._setDefaultButton(val);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="acceptDialog">
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this._doButtonCommand("accept");
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="cancelDialog">
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this._doButtonCommand("cancel");
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="getButton">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this._buttons[aDlgType];
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="moveToAlertPosition">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// hack. we need this so the window has something like its final size
|
||||
if (window.outerWidth == 1) {
|
||||
dump("Trying to position a sizeless window; caller should have called sizeToContent() or sizeTo(). See bug 75649.\n");
|
||||
sizeToContent();
|
||||
}
|
||||
|
||||
var xOffset = (opener.outerWidth - window.outerWidth) / 2;
|
||||
var yOffset = opener.outerHeight / 5;
|
||||
|
||||
var newX = opener.screenX + xOffset;
|
||||
var newY = opener.screenY + yOffset;
|
||||
|
||||
// ensure the window is fully onscreen (if smaller than the screen)
|
||||
if (newX < screen.availLeft)
|
||||
newX = screen.availLeft + 20;
|
||||
if ((newX + window.outerWidth) > (screen.availLeft + screen.availWidth))
|
||||
newX = (screen.availLeft + screen.availWidth) - window.outerWidth - 20;
|
||||
|
||||
if (newY < screen.availTop)
|
||||
newY = screen.availTop + 20;
|
||||
if ((newY + window.outerHeight) > (screen.availTop + screen.availHeight))
|
||||
newY = (screen.availTop + screen.availHeight) - window.outerHeight - 60;
|
||||
|
||||
window.moveTo( newX, newY );
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="centerWindowOnScreen">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var xOffset = screen.availWidth/2 - window.outerWidth/2;
|
||||
var yOffset = screen.availHeight/2 - window.outerHeight/2; //(opener.outerHeight *2)/10;
|
||||
|
||||
xOffset = xOffset > 0 ? xOffset : 0;
|
||||
yOffset = yOffset > 0 ? yOffset : 0;
|
||||
window.moveTo(xOffset, yOffset);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this._configureButtons(this.getAttribute("buttons"));
|
||||
|
||||
// listen for when window is closed via native close buttons
|
||||
window.addEventListener("close", this._closeHandler, false);
|
||||
|
||||
// for things that we need to initialize after onload fires
|
||||
window.addEventListener("load", this.postLoadInit, false);
|
||||
|
||||
window.moveToAlertPosition = this.moveToAlertPosition;
|
||||
window.centerWindowOnScreen = this.centerWindowOnScreen;
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<method name="postLoadInit">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
function focusInit() {
|
||||
// give focus to the first focusable element in the dialog
|
||||
if (!document.commandDispatcher.focusedElement) {
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(document.documentElement);
|
||||
var focusedElt = document.commandDispatcher.focusedElement;
|
||||
if (focusedElt) {
|
||||
if (focusedElt.localName == 'tab') {
|
||||
// Move focus into the tab
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(focusedElt);
|
||||
if (document.commandDispatcher.focusedElement.hasAttribute("dlgtype")) {
|
||||
// We don't want to focus on anonymous OK, Cancel, etc. buttons,
|
||||
// so return focus to the tab itself
|
||||
focusedElt.focus();
|
||||
}
|
||||
} else if (!/Mac/.test(navigator.platform)) {
|
||||
const dialog = document.documentElement;
|
||||
const defaultButton = dialog.getButton(dialog.defaultButton);
|
||||
if (focusedElt.hasAttribute("dlgtype") && focusedElt != defaultButton)
|
||||
defaultButton.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Give focus after onload completes, see bug 103197.
|
||||
setTimeout(focusInit, 0);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="mStrBundle">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (!this._mStrBundle) {
|
||||
// need to create string bundle manually instead of using <xul:stringbundle/>
|
||||
// see bug 63370 for details
|
||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||
.getService(Components.interfaces.nsILocaleService);
|
||||
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var bundleURL = "chrome://global/locale/dialog.properties";
|
||||
this._mStrBundle = stringBundleService.createBundle(bundleURL, localeService.getApplicationLocale());
|
||||
}
|
||||
return this._mStrBundle;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="_configureButtons">
|
||||
<parameter name="aButtons"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// by default, get all the anonymous button elements
|
||||
var buttons = {};
|
||||
this._buttons = buttons;
|
||||
buttons.accept = document.getAnonymousElementByAttribute(this, "dlgtype", "accept");
|
||||
buttons.cancel = document.getAnonymousElementByAttribute(this, "dlgtype", "cancel");
|
||||
buttons.extra1 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra1");
|
||||
buttons.extra2 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra2");
|
||||
buttons.help = document.getAnonymousElementByAttribute(this, "dlgtype", "help");
|
||||
buttons.disclosure = document.getAnonymousElementByAttribute(this, "dlgtype", "disclosure");
|
||||
|
||||
// look for any overriding explicit button elements
|
||||
var exBtns = this.getElementsByAttribute("dlgtype", "*");
|
||||
var dlgtype;
|
||||
var i;
|
||||
for (i = 0; i < exBtns.length; ++i) {
|
||||
dlgtype = exBtns[i].getAttribute("dlgtype");
|
||||
buttons[dlgtype].hidden = true; // hide the anonymous button
|
||||
buttons[dlgtype] = exBtns[i];
|
||||
}
|
||||
|
||||
// add the label and oncommand handler to each button
|
||||
for (dlgtype in buttons) {
|
||||
var button = buttons[dlgtype];
|
||||
button.addEventListener("command", this._handleButtonCommand, true);
|
||||
|
||||
// don't override custom labels with pre-defined labels on explicit buttons
|
||||
if (!button.hasAttribute("label")) {
|
||||
button.setAttribute("label", this.mStrBundle.GetStringFromName("button-"+dlgtype));
|
||||
var accessKey = this.mStrBundle.GetStringFromName("accesskey-"+dlgtype);
|
||||
if (accessKey) {
|
||||
button.setAttribute("accesskey", accessKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ensure that hitting enter triggers the default button command
|
||||
this.defaultButton = this.defaultButton;
|
||||
|
||||
// if there is a special button configuration, use it
|
||||
if (aButtons) {
|
||||
// expect a comma delimited list of dlgtype values
|
||||
var list = aButtons.split(",");
|
||||
|
||||
// mark shown dlgtypes as true
|
||||
var shown = { accept: false, cancel: false, help: false,
|
||||
disclosure: false, extra1: false, extra2: false };
|
||||
for (i = 0; i < list.length; ++i)
|
||||
shown[list[i].replace(/ /g, "")] = true;
|
||||
|
||||
// hide/show the buttons we want
|
||||
for (dlgtype in buttons)
|
||||
buttons[dlgtype].hidden = !shown[dlgtype];
|
||||
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_setDefaultButton">
|
||||
<parameter name="aNewDefault"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// remove the default attribute from the previous default button, if any
|
||||
var oldDefaultButton = this.getButton(this.defaultButton);
|
||||
if (oldDefaultButton)
|
||||
oldDefaultButton.removeAttribute("default");
|
||||
|
||||
var newDefaultButton = this.getButton(aNewDefault);
|
||||
if (newDefaultButton) {
|
||||
newDefaultButton.setAttribute("default", "true");
|
||||
}
|
||||
|
||||
this.setAttribute("defaultButton", aNewDefault);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_handleButtonCommand">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return document.documentElement._doButtonCommand(
|
||||
aEvent.target.getAttribute("dlgtype"));
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_doButtonCommand">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var button = this.getButton(aDlgType);
|
||||
if (!button.disabled) {
|
||||
var noCancel = this._fireButtonEvent(aDlgType);
|
||||
if (noCancel) {
|
||||
if (aDlgType == "accept" || aDlgType == "cancel")
|
||||
window.close();
|
||||
}
|
||||
return noCancel;
|
||||
}
|
||||
return true;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_fireButtonEvent">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("dialog"+aDlgType, true, true);
|
||||
|
||||
// handle dom event handlers
|
||||
var noCancel = this.dispatchEvent(event);
|
||||
|
||||
// handle any xml attribute event handlers
|
||||
var handler = this.getAttribute("ondialog"+aDlgType);
|
||||
if (handler != "") {
|
||||
var fn = new Function("event", handler);
|
||||
var returned = fn(event);
|
||||
if (returned == false)
|
||||
noCancel = false;
|
||||
}
|
||||
|
||||
return noCancel;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_hitEnter">
|
||||
<parameter name="evt"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (evt.getPreventDefault())
|
||||
return;
|
||||
|
||||
var btn = this.getButton(this.defaultButton);
|
||||
if (btn)
|
||||
this._doButtonCommand(this.defaultButton);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_ENTER"
|
||||
group="system" action="this._hitEnter(event);"/>
|
||||
<handler event="keypress" keycode="VK_RETURN"
|
||||
group="system" action="this._hitEnter(event);"/>
|
||||
<handler event="keypress" keycode="VK_ESCAPE" group="system">
|
||||
if (!event.getPreventDefault())
|
||||
this.cancelDialog();
|
||||
</handler>
|
||||
<handler event="focus" phase="capturing">
|
||||
<![CDATA[
|
||||
var btn = this.getButton(this.defaultButton);
|
||||
if (btn && !/Mac/.test(navigator.platform))
|
||||
btn.setAttribute("default", event.originalTarget == btn || !(event.originalTarget instanceof Components.interfaces.nsIDOMXULButtonElement));
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
<binding id="dialogheader" extends="chrome://global/content/bindings/dialog.xml#dialog-base">
|
||||
<content>
|
||||
<xul:label class="dialogheader-title" xbl:inherits="value=title,crop" crop="right" flex="1"/>
|
||||
<xul:label class="dialogheader-description" xbl:inherits="value=description"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,122 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="editorBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="editor">
|
||||
<implementation type="application/x-javascript" implements="nsIAccessibleProvider">
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
// Make window editable immediately only
|
||||
// if the "editortype" attribute is supplied
|
||||
// This allows using same contentWindow for different editortypes,
|
||||
// where the type is determined during the apps's window.onload handler.
|
||||
if (this.editortype)
|
||||
this.makeEditable(this.editortype, true);
|
||||
]]>
|
||||
</constructor>
|
||||
<destructor/>
|
||||
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.OuterDoc;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<field name="_editorContentListener">
|
||||
<![CDATA[
|
||||
({
|
||||
QueryInterface: function(iid)
|
||||
{
|
||||
if (iid.equals(Components.interfaces.nsIURIContentListener) ||
|
||||
iid.equals(Components.interfaces.nsISupportsWeakReference) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return null;
|
||||
},
|
||||
onStartURIOpen: function(uri)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
doContent: function(contentType, isContentPreferred, request, contentHandler)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
isPreferred: function(contentType, desiredContentType)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
canHandleContent: function(contentType, isContentPreferred, desiredContentType)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
loadCookie: null,
|
||||
parentContentListener: null
|
||||
})
|
||||
]]>
|
||||
</field>
|
||||
<method name="makeEditable">
|
||||
<parameter name="editortype"/>
|
||||
<parameter name="waitForUrlLoad"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.editingSession.makeWindowEditable(this.contentWindow, editortype, waitForUrlLoad, true, false);
|
||||
this.setAttribute("editortype", editortype);
|
||||
|
||||
this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIURIContentListener)
|
||||
.parentContentListener = this._editorContentListener;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="getEditor">
|
||||
<parameter name="containingWindow"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this.editingSession.getEditorForWindow(containingWindow);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="getHTMLEditor">
|
||||
<parameter name="containingWindow"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var editor = this.editingSession.getEditorForWindow(containingWindow);
|
||||
return editor.QueryInterface(Components.interfaces.nsIHTMLEditor);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<property name="editortype"
|
||||
onget="return this.getAttribute('editortype');"
|
||||
onset="this.setAttribute('editortype', val); return val;"/>
|
||||
<property name="webNavigation"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
|
||||
readonly="true"/>
|
||||
<property name="contentDocument" readonly="true"
|
||||
onget="return this.webNavigation.document;"/>
|
||||
<property name="docShell"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell;"
|
||||
readonly="true"/>
|
||||
<property name="contentWindow"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
|
||||
<property name="webBrowserFind"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
|
||||
<property name="editingSession"
|
||||
readonly="true"
|
||||
onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIEditingSession);"/>
|
||||
<property name="commandManager"
|
||||
readonly="true"
|
||||
onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsICommandManager);"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -1,372 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="generalBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="basecontrol">
|
||||
<implementation implements="nsIDOMXULControlElement">
|
||||
<!-- public implementation -->
|
||||
<property name="disabled" onset="if (val) this.setAttribute('disabled', 'true');
|
||||
else this.removeAttribute('disabled');
|
||||
return val;"
|
||||
onget="return this.getAttribute('disabled') == 'true';"/>
|
||||
<property name="tabIndex" onget="return parseInt(this.getAttribute('tabindex'));"
|
||||
onset="if (val) this.setAttribute('tabindex', val);
|
||||
else this.removeAttribute('tabindex'); return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="basetext" extends="chrome://global/content/bindings/general.xml#basecontrol">
|
||||
<implementation>
|
||||
<!-- public implementation -->
|
||||
<property name="label" onset="return this.setAttribute('label',val);"
|
||||
onget="return this.getAttribute('label');"/>
|
||||
<property name="crop" onset="return this.setAttribute('crop',val);"
|
||||
onget="return this.getAttribute('crop');"/>
|
||||
<property name="image" onset="return this.setAttribute('image',val);"
|
||||
onget="return this.getAttribute('image');"/>
|
||||
<property name="accessKey">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.labelElement ? this.labelElement.accessKey : this.getAttribute('accesskey');
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
// Always store on the control
|
||||
this.setAttribute('accesskey', val);
|
||||
// If there is a label, change the accesskey on the labelElement
|
||||
// if it's also set there
|
||||
if (this.labelElement) {
|
||||
this.labelElement.accessKey = val;
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<field name="labelElement"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="control-item" extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<implementation>
|
||||
<property name="value" onset="return this.setAttribute('value', val);"
|
||||
onget="return this.getAttribute('value');"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<!--
|
||||
Inline Editable UI Element
|
||||
- This binding forms the basis of the inline edit treecell and the inline edit
|
||||
- buttons.
|
||||
- TODO: investigate creating extensions to the wrapper widgets (tree, toolbar)
|
||||
- to make them provide some object implementing an interface similar to
|
||||
- tree's so we can build in some of the ILE behavior (such as going
|
||||
- in and out of the mode, asking isEditable etc) so as to remove some of
|
||||
- the burden from the implementor.
|
||||
-
|
||||
- Note that this widget will be no longer used in the bookmarks window once
|
||||
- tree is extended to have this functionality built in.
|
||||
-->
|
||||
<binding id="inline-edit-base" extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<implementation>
|
||||
<field name="_mode">0</field>
|
||||
<method name="setMode">
|
||||
<parameter name="val"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var ctr = document.getAnonymousElementByAttribute(this, "ileattr", "text-container");
|
||||
var txt = document.getAnonymousElementByAttribute(this, "ileattr", "text");
|
||||
this.setAttribute("mode", val);
|
||||
if (val == "edit") {
|
||||
var nodes = document.getAnonymousNodes(this);
|
||||
|
||||
if (txt.getAttribute("hidden") != "true") {
|
||||
ctr.setAttribute("mode", "edit");
|
||||
var width = ctr.boxObject.width;
|
||||
txt.setAttribute("hidden", "true");
|
||||
const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var field = document.createElementNS(kXULNS, "textbox");
|
||||
field.className = "textbox-inline-edit";
|
||||
field.setAttribute("flex", "1");
|
||||
field.setAttribute("value", txt.getAttribute("value"));
|
||||
field.setAttribute("ileattr", "field");
|
||||
field.setAttribute("rootcontent", txt.getAttribute("rootcontent"));
|
||||
field.setAttribute("style", "width: " + width + "px");
|
||||
ctr.appendChild(field);
|
||||
field.addEventListener("keydown", this.fieldKeyDown, false);
|
||||
field.addEventListener("change", this.fieldChange, false);
|
||||
field.select();
|
||||
}
|
||||
}
|
||||
else {
|
||||
nodes = document.getAnonymousNodes(this);
|
||||
var fld = document.getAnonymousElementByAttribute(this, "ileattr", "field");
|
||||
if (fld && txt.getAttribute("hidden") == "true") {
|
||||
ctr.removeAttribute("mode");
|
||||
fld.blur();
|
||||
ctr.removeChild(fld);
|
||||
txt.removeAttribute("hidden");
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<field name="_observers">
|
||||
<![CDATA[
|
||||
({
|
||||
reject: [],
|
||||
accept: []
|
||||
})
|
||||
]]>
|
||||
</field>
|
||||
<field name="valueIsRejected">false</field>
|
||||
<method name="addObserver">
|
||||
<parameter name="aObserver"/>
|
||||
<parameter name="aTopic"/>
|
||||
<parameter name="aParams"/>
|
||||
<body>
|
||||
this._observers[aTopic].push({ callback: aObserver, params: aParams });
|
||||
</body>
|
||||
</method>
|
||||
<method name="fieldKeyDown">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var rootLocalName = aEvent.target.getAttribute("rootcontent");
|
||||
if (rootLocalName) {
|
||||
// Root content is the bound element.
|
||||
var rootContent = aEvent.target;
|
||||
while (rootContent && rootContent.localName != rootLocalName)
|
||||
rootContent = rootContent.parentNode;
|
||||
|
||||
if (rootContent) {
|
||||
var ctr = document.getAnonymousElementByAttribute(rootContent, "ileattr", "text-container");
|
||||
if (aEvent.keyCode == 13) {
|
||||
rootContent.valueIsRejected = false;
|
||||
rootContent.fieldChange(aEvent);
|
||||
}
|
||||
if (aEvent.keyCode == 27) {
|
||||
rootContent.valueIsRejected = true;
|
||||
var fld = document.getAnonymousElementByAttribute(rootContent, "ileattr", "field");
|
||||
for (i = 0; i < rootContent._observers["reject"].length; ++i)
|
||||
rootContent._observers["reject"][i].callback(rootContent._observers["reject"][i].params.concat(fld.value), "reject");
|
||||
if ("setMode" in rootContent)
|
||||
rootContent.setMode("normal");
|
||||
}
|
||||
}
|
||||
}
|
||||
aEvent.stopPropagation();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<field name="valueIsAccepted">false</field>
|
||||
<method name="fieldChange">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var rootLocalName = this.getAttribute("rootcontent");
|
||||
if (rootLocalName) {
|
||||
// Root content is the bound element.
|
||||
var rootContent = this;
|
||||
while (rootContent && rootContent.localName != rootLocalName)
|
||||
rootContent = rootContent.parentNode;
|
||||
|
||||
if (rootContent) {
|
||||
var ctr = document.getAnonymousElementByAttribute(rootContent, "ileattr", "text-container");
|
||||
if (!rootContent.valueIsRejected) {
|
||||
var fld = document.getAnonymousElementByAttribute(rootContent, "ileattr", "field");
|
||||
for (var i = 0; i < rootContent._observers["accept"].length; ++i)
|
||||
rootContent._observers["accept"][i].callback(rootContent._observers["accept"][i].params.concat(fld.value), "accept");
|
||||
if ("setMode" in rootContent)
|
||||
rootContent.setMode("normal");
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<!-- inline editable buttons -->
|
||||
<binding id="buttonleft-ile" extends="chrome://global/content/bindings/general.xml#inline-edit-base">
|
||||
<content>
|
||||
<xul:hbox class="button-internal-box" align="center" flex="1">
|
||||
<xul:image class="button-icon" xbl:inherits="src"/>
|
||||
<xul:hbox class="button-text-container" flex="1" ileattr="text-container">
|
||||
<xul:label class="button-text" xbl:inherits="value=label,accesskey,crop,dragover-top" ileattr="text" rootcontent="button" flex="1"/>
|
||||
</xul:hbox>
|
||||
</xul:hbox>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="iframe">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.OuterDoc;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
<property name="docShell"
|
||||
readonly="true"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell"/>
|
||||
<property name="contentWindow"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
|
||||
<property name="webNavigation"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
|
||||
readonly="true"/>
|
||||
<property name="contentDocument" readonly="true"
|
||||
onget="return this.webNavigation.document;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="statusbarpanel" display="xul:button">
|
||||
<content>
|
||||
<children>
|
||||
<xul:label class="statusbarpanel-text" xbl:inherits="value=label,crop" crop="right" flex="1"/>
|
||||
</children>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="label"
|
||||
onget="return this.getAttribute('label');"
|
||||
onset="this.setAttribute('label',val); return val;"/>
|
||||
<property name="src"
|
||||
onget="return this.getAttribute('src');"
|
||||
onset="this.setAttribute('src',val); return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="statusbarpanel-menu-iconic" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/general.xml#statusbarpanel">
|
||||
<content>
|
||||
<xul:image class="statusbarpanel-icon" xbl:inherits="src"/>
|
||||
<children/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="statusbar">
|
||||
<content>
|
||||
<children/>
|
||||
<xul:statusbarpanel class="statusbar-resizerpanel">
|
||||
<xul:resizer dir="bottomright"/>
|
||||
</xul:statusbarpanel>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULStatusBar;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="statusbarpanel-iconic" display="xul:button"
|
||||
extends="chrome://global/content/bindings/general.xml#statusbarpanel">
|
||||
<content>
|
||||
<xul:image class="statusbarpanel-icon" xbl:inherits="src"/>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULButton;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="statusbarpanel-iconic-text" display="xul:button"
|
||||
extends="chrome://global/content/bindings/general.xml#statusbarpanel">
|
||||
<content>
|
||||
<xul:image class="statusbarpanel-icon" xbl:inherits="src"/>
|
||||
<xul:label class="statusbarpanel-text" xbl:inherits="value=label,crop"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="image">
|
||||
<implementation implements="nsIDOMXULImageElement, nsIAccessibleProvider">
|
||||
<property name="src"
|
||||
onget="return this.getAttribute('src');"
|
||||
onset="this.setAttribute('src',val); return val;"/>
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULImage;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="deck">
|
||||
<implementation>
|
||||
<property name="selectedIndex"
|
||||
onget="return this.getAttribute('selectedIndex');">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (this.selectedIndex == val)
|
||||
return val;
|
||||
this.setAttribute("selectedIndex", val);
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent('select', true, true);
|
||||
this.dispatchEvent(event);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedPanel">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.childNodes[this.selectedIndex];
|
||||
]]>
|
||||
</getter>
|
||||
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var selectedIndex = -1;
|
||||
for (var panel = val; panel != null; panel = panel.previousSibling)
|
||||
++selectedIndex;
|
||||
this.selectedIndex = selectedIndex;
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="dropmarker" extends="xul:button">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/dropmarker.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:image class="dropmarker-icon"/>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULDropmarker;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="groupboxBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="groupbox-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/groupbox.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="groupbox" extends="chrome://global/content/bindings/groupbox.xml#groupbox-base">
|
||||
<content>
|
||||
<xul:hbox class="groupbox-title" align="center" pack="start">
|
||||
<children includes="caption"/>
|
||||
</xul:hbox>
|
||||
<xul:box flex="1" class="groupbox-body" xbl:inherits="orient,align,pack">
|
||||
<children/>
|
||||
</xul:box>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULGroupbox;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="caption" extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/groupbox.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<children>
|
||||
<xul:image class="caption-icon" xbl:inherits="src=image"/>
|
||||
<xul:label class="caption-text" flex="1"
|
||||
xbl:inherits="default,value=label,crop,accesskey"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,908 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="listboxBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="listbox-base" extends="chrome://global/content/bindings/general.xml#basecontrol">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/listbox.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="listbox"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listbox-base">
|
||||
<content>
|
||||
<children includes="listcols">
|
||||
<xul:listcols>
|
||||
<xul:listcol flex="1"/>
|
||||
</xul:listcols>
|
||||
</children>
|
||||
<xul:listrows>
|
||||
<children includes="listhead"/>
|
||||
<xul:listboxbody xbl:inherits="rows,size,minheight">
|
||||
<children includes="listitem"/>
|
||||
</xul:listboxbody>
|
||||
</xul:listrows>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULMultiSelectControlElement, nsIAccessibleProvider">
|
||||
<field name="_suppressOnSelect">false</field>
|
||||
<field name="_selectionStart">null</field>
|
||||
<field name="_currentItem">null</field>
|
||||
<field name="_selectTimeout">null</field>
|
||||
<field name="_lastKeyTime">0</field>
|
||||
<field name="_incrementalString">""</field>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
var els = this.getElementsByAttribute("selected", "true");
|
||||
for (var i = 0; i < els.length; ++i)
|
||||
this.selectedItems.push(els[i]);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<!-- ///////////////// nsIAccessibleProvider ///////////////// -->
|
||||
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULListbox;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<!-- ///////////////// public listbox members ///////////////// -->
|
||||
|
||||
<property name="listBoxObject"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIListBoxObject);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="disableKeyNavigation"
|
||||
onget="return this.hasAttribute('disableKeyNavigation');"
|
||||
onset="if (val) this.setAttribute('disableKeyNavigation', 'true');
|
||||
else this.removeAttribute('disableKeyNavigation'); return val;"/>
|
||||
|
||||
<property name="_selectDelay"
|
||||
onset="this.setAttribute('_selectDelay', val);"
|
||||
onget="return this.getAttribute('_selectDelay') || 50;"/>
|
||||
|
||||
<method name="timedSelect">
|
||||
<parameter name="item"/>
|
||||
<parameter name="timeout"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var suppress = this._suppressOnSelect;
|
||||
if (timeout != -1)
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
this.selectItem(item);
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
|
||||
if (timeout != -1) {
|
||||
if (this._selectTimeout)
|
||||
window.clearTimeout(this._selectTimeout);
|
||||
|
||||
this._selectTimeout = window.setTimeout(this._selectTimeoutHandler, timeout, this);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- ///////////////// private listbox members ///////////////// -->
|
||||
|
||||
<method name="_fireOnSelect">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this._suppressOnSelect && this.getAttribute("suppressonselect") != "true") {
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("select", true, true);
|
||||
this.dispatchEvent(event);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_selectTimeoutHandler">
|
||||
<parameter name="me"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
me._fireOnSelect();
|
||||
me._selectTimeout = null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- ///////////////// nsIDOMXULSelectControlElement ///////////////// -->
|
||||
|
||||
<property name="selType"
|
||||
onget="return this.getAttribute('seltype')"
|
||||
onset="this.setAttribute('seltype', val); return val;"/>
|
||||
|
||||
<property name="selectedIndex">
|
||||
<getter><![CDATA[
|
||||
return this.selectedItems.length > 0 ? this.getIndexOfItem(this.selectedItems[0]) : -1;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (val >= 0)
|
||||
this.selectItem(this.getItemAtIndex(val));
|
||||
else
|
||||
this.clearSelection();
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<field name="selectedItems">[]</field>
|
||||
<property name="selectedItem">
|
||||
<getter><![CDATA[
|
||||
return this.selectedItems.length > 0 ? this.selectedItems[0] : null;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.selectItem(val);
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="value">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (this.selectedItems.length > 0)
|
||||
return this.selectedItem.value;
|
||||
else
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var kids = this.getElementsByAttribute("value", val);
|
||||
if (kids && kids.item(0))
|
||||
this.selectItem(kids[0]);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var item = document.createElementNS(XULNS, "listitem");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("value", value);
|
||||
this.appendChild(item);
|
||||
return item;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="insertItemAt">
|
||||
<parameter name="index"/>
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var item = document.createElementNS(XULNS, "listitem");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("value", value);
|
||||
var before = this.getItemAtIndex(index);
|
||||
if (before)
|
||||
this.insertBefore(item, before);
|
||||
else
|
||||
this.appendChild(item);
|
||||
return item;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemAt">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var remove = this.getItemAtIndex(index);
|
||||
if (remove)
|
||||
this.removeChild(remove);
|
||||
return remove;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<!-- ///////////////// nsIDOMXULSelectMultipleControlElement ///////////////// -->
|
||||
|
||||
<property name="currentItem" onget="return this._currentItem;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (this._currentItem)
|
||||
this._currentItem.current = false;
|
||||
this._currentItem = val;
|
||||
if (val) {
|
||||
val.current = true;
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("DOMMenuItemActive", true, true);
|
||||
val.dispatchEvent(event);
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="currentIndex">
|
||||
<getter><![CDATA[
|
||||
return this.currentItem ? this.getIndexOfItem(this.currentItem) : -1;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (val >= 0)
|
||||
this.currentItem = this.getItemAtIndex(val);
|
||||
else
|
||||
this.currentItem = null;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedCount" onget="return this.selectedItems.length;"/>
|
||||
|
||||
<property name="itemCount" readonly="true"
|
||||
onget="return this.listBoxObject.getRowCount()"/>
|
||||
|
||||
<method name="getSelectedItem">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return index < this.selectedItems.length ? this.selectedItems[index] : null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="addItemToSelection">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selType != "multiple" && this.selectedCount)
|
||||
return;
|
||||
|
||||
if (item.selected)
|
||||
return;
|
||||
|
||||
this.selectedItems.push(item);
|
||||
item.selected = true;
|
||||
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemFromSelection">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!item.selected)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < this.selectedItems.length; ++i) {
|
||||
if (this.selectedItems[i] == item) {
|
||||
this.selectedItems.splice(i, 1);
|
||||
item.selected = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="toggleItemSelection">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (item.selected)
|
||||
this.removeItemFromSelection(item);
|
||||
else
|
||||
this.addItemToSelection(item);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectItem">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
if (this.selectedItems.length == 1 && this.selectedItems[0] == item)
|
||||
return;
|
||||
|
||||
this._selectionStart = null;
|
||||
|
||||
var suppress = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
this.clearSelection();
|
||||
this.addItemToSelection(item);
|
||||
this.currentItem = item;
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectItemRange">
|
||||
<parameter name="startItem"/>
|
||||
<parameter name="endItem"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selType != "multiple")
|
||||
return;
|
||||
|
||||
if (!startItem)
|
||||
startItem = this._selectionStart ? this._selectionStart : this.currentItem;
|
||||
if (!startItem)
|
||||
startItem = endItem;
|
||||
|
||||
var suppressSelect = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
this._selectionStart = startItem;
|
||||
|
||||
var currentItem;
|
||||
var startIndex = this.getIndexOfItem(startItem);
|
||||
var endIndex = this.getIndexOfItem(endItem);
|
||||
if (endIndex < startIndex) {
|
||||
currentItem = endItem;
|
||||
endItem = startItem;
|
||||
startItem = currentItem;
|
||||
} else {
|
||||
currentItem = startItem;
|
||||
}
|
||||
|
||||
while (currentItem) {
|
||||
if (currentItem.localName == "listitem")
|
||||
this.addItemToSelection(currentItem);
|
||||
if (currentItem == endItem) {
|
||||
currentItem = this.getNextItem(currentItem, 1);
|
||||
break;
|
||||
}
|
||||
currentItem = this.getNextItem(currentItem, 1);
|
||||
}
|
||||
|
||||
// Clear around new selection
|
||||
// Don't use clearSelection() because it causes a lot of noise
|
||||
// with respect to selection removed notifications used by the
|
||||
// accessibility API support.
|
||||
for (; currentItem; currentItem = this.getNextItem(currentItem, 1))
|
||||
this.removeItemFromSelection(currentItem);
|
||||
for (currentItem = this.getItemAtIndex(0); currentItem != startItem;
|
||||
currentItem = this.getNextItem(currentItem, 1))
|
||||
this.removeItemFromSelection(currentItem);
|
||||
|
||||
this._suppressOnSelect = suppressSelect;
|
||||
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectAll">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var suppress = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
var item = this.getItemAtIndex(0);
|
||||
while (item) {
|
||||
this.addItemToSelection(item);
|
||||
item = this.getNextItem(item, 1);
|
||||
}
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="invertSelection">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var suppress = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
var item = this.getItemAtIndex(0);
|
||||
while (item) {
|
||||
if (item.selected)
|
||||
this.removeItemFromSelection(item);
|
||||
else
|
||||
this.addItemToSelection(item);
|
||||
item = this.getNextItem(item, 1);
|
||||
}
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="clearSelection">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selectedItems)
|
||||
{
|
||||
for (var i = this.selectedItems.length-1; i >= 0; --i)
|
||||
this.selectedItems[i].selected = false;
|
||||
|
||||
this.selectedItems.splice(0, this.selectedItems.length);
|
||||
}
|
||||
this._selectionStart = null;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- ///////////////// nsIListBoxObject ///////////////// -->
|
||||
|
||||
<method name="getNextItem">
|
||||
<parameter name="startItem"/>
|
||||
<parameter name="delta"/>
|
||||
<body><![CDATA[
|
||||
while (startItem) {
|
||||
startItem = startItem.nextSibling;
|
||||
if (startItem && startItem.localName == "listitem") {
|
||||
--delta;
|
||||
if (delta == 0)
|
||||
return startItem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="getPreviousItem">
|
||||
<parameter name="startItem"/>
|
||||
<parameter name="delta"/>
|
||||
<body><![CDATA[
|
||||
while (startItem) {
|
||||
startItem = startItem.previousSibling;
|
||||
if (startItem && startItem.localName == "listitem") {
|
||||
--delta;
|
||||
if (delta == 0)
|
||||
return startItem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="getIndexOfItem">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
return this.listBoxObject.getIndexOfItem(item);
|
||||
</body>
|
||||
</method>
|
||||
<method name="getItemAtIndex">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
return this.listBoxObject.getItemAtIndex(index);
|
||||
</body>
|
||||
</method>
|
||||
<method name="ensureIndexIsVisible">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
return this.listBoxObject.ensureIndexIsVisible(index);
|
||||
</body>
|
||||
</method>
|
||||
<method name="ensureElementIsVisible">
|
||||
<parameter name="element"/>
|
||||
<body>
|
||||
return this.ensureIndexIsVisible(this.listBoxObject.getIndexOfItem(element));
|
||||
</body>
|
||||
</method>
|
||||
<method name="scrollToIndex">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
return this.listBoxObject.scrollToIndex(index);
|
||||
</body>
|
||||
</method>
|
||||
<method name="getNumberOfVisibleRows">
|
||||
<body>
|
||||
return this.listBoxObject.getNumberOfVisibleRows();
|
||||
</body>
|
||||
</method>
|
||||
<method name="getIndexOfFirstVisibleRow">
|
||||
<body>
|
||||
return this.listBoxObject.getIndexOfFirstVisibleRow();
|
||||
</body>
|
||||
</method>
|
||||
<method name="getRowCount">
|
||||
<body>
|
||||
return this.listBoxObject.getRowCount();
|
||||
</body>
|
||||
</method>
|
||||
<method name="moveByOffset">
|
||||
<parameter name="offset"/>
|
||||
<parameter name="isSelecting"/>
|
||||
<parameter name="isSelectingRange"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if ((isSelectingRange || !isSelecting) && this.selType != "multiple")
|
||||
return;
|
||||
var newIndex = this.currentIndex + offset;
|
||||
if (newIndex < 0)
|
||||
newIndex = 0;
|
||||
var numItems = this.getRowCount();
|
||||
if (newIndex > numItems - 1)
|
||||
newIndex = numItems - 1;
|
||||
var newItem = this.getItemAtIndex(newIndex);
|
||||
if (newItem) {
|
||||
this.ensureIndexIsVisible(newIndex);
|
||||
if (isSelectingRange) {
|
||||
this.selectItemRange(null, newItem);
|
||||
}
|
||||
else if (isSelecting) {
|
||||
this.selectItem(newItem);
|
||||
}
|
||||
this.currentItem = newItem;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="scrollOnePage">
|
||||
<parameter name="direction"/> <!-- Must be -1 or 1 -->
|
||||
<body>
|
||||
<![CDATA[
|
||||
var pageOffset = this.getNumberOfVisibleRows() * direction;
|
||||
var newTop = this.getIndexOfFirstVisibleRow() + pageOffset;
|
||||
if (direction == 1) {
|
||||
var maxTop = this.getRowCount() - pageOffset;
|
||||
if (newTop >= maxTop && maxTop > this.currentIndex) {
|
||||
newTop = maxTop;
|
||||
}
|
||||
}
|
||||
else if (newTop < 0)
|
||||
newTop = 0;
|
||||
this.scrollToIndex(newTop);
|
||||
return pageOffset;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_UP" modifiers="control shift any"
|
||||
phase="target" action="moveByOffset(-1, !event.ctrlKey, event.shiftKey);"/>
|
||||
<handler event="keypress" keycode="VK_DOWN" modifiers="control shift any"
|
||||
phase="target" action="moveByOffset(1, !event.ctrlKey, event.shiftKey);"/>
|
||||
<handler event="keypress" keycode="VK_HOME" modifiers="control shift any"
|
||||
phase="target" action="moveByOffset(-this.currentIndex, !event.ctrlKey, event.shiftKey);"/>
|
||||
<handler event="keypress" keycode="VK_END" modifiers="control shift any"
|
||||
phase="target" action="moveByOffset(this.getRowCount() - this.currentIndex - 1, !event.ctrlKey, event.shiftKey);"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="control shift any"
|
||||
phase="target" action="moveByOffset(this.scrollOnePage(-1), !event.ctrlKey, event.shiftKey);"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="control shift any"
|
||||
phase="target" action="moveByOffset(this.scrollOnePage(1), !event.ctrlKey, event.shiftKey);"/>
|
||||
<handler event="keypress" key=" " phase="target">
|
||||
<![CDATA[
|
||||
if (this.currentItem) {
|
||||
if (this.currentItem.getAttribute("type") != "checkbox")
|
||||
this.addItemToSelection(this.currentItem);
|
||||
else if (!this.currentItem.disabled)
|
||||
this.currentItem.checked = !this.currentItem.checked;
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" key=" " modifiers="control" phase="target">
|
||||
<![CDATA[
|
||||
if (this.currentItem && this.selType == "multiple")
|
||||
this.toggleItemSelection(this.currentItem);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" phase="target">
|
||||
<![CDATA[
|
||||
if (!this.disableKeyNavigation && event.charCode > 0 &&
|
||||
!event.altKey && !event.ctrlKey && !event.metaKey) {
|
||||
var key = String.fromCharCode(event.charCode);
|
||||
key = key.toLowerCase();
|
||||
if (event.timeStamp - this._lastKeyTime > 1000)
|
||||
this._incrementalString = key;
|
||||
else
|
||||
this._incrementalString += key;
|
||||
this._lastKeyTime = event.timeStamp;
|
||||
|
||||
var length = this._incrementalString.length;
|
||||
var incrementalString = this._incrementalString;
|
||||
var charIndex = 1;
|
||||
while (charIndex < length && incrementalString[charIndex] == incrementalString[charIndex - 1])
|
||||
charIndex++;
|
||||
// If all letters in incremental string are same, just try to match the first one
|
||||
if (charIndex == length) {
|
||||
length = 1;
|
||||
incrementalString = incrementalString.substring(0, length);
|
||||
}
|
||||
|
||||
var l = this.selectedItems.length;
|
||||
var c = -1;
|
||||
if (l > 0)
|
||||
c = this.getIndexOfItem(this.selectedItems[l-1]);
|
||||
var rowCount = this.getRowCount();
|
||||
var start = 1;
|
||||
|
||||
if (length > 1) {
|
||||
start = 0;
|
||||
if (c < 0)
|
||||
c = 0;
|
||||
}
|
||||
|
||||
for (var i = 0; i < rowCount; i++) {
|
||||
var k = (i + start + c) % rowCount;
|
||||
var item = this.getItemAtIndex(k); //listitem
|
||||
var cellText = item.getAttribute("label");
|
||||
cellText = cellText.substring(0, length).toLowerCase();
|
||||
if (cellText == incrementalString) {
|
||||
this.ensureIndexIsVisible(k);
|
||||
this.timedSelect(item, this._selectDelay);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="listrows"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listbox-base">
|
||||
<handlers>
|
||||
<handler event="DOMMouseScroll" phase="capturing">
|
||||
<![CDATA[
|
||||
var listBox = this.parentNode.listBoxObject;
|
||||
var rows = event.detail;
|
||||
if (rows == NSUIEvent.SCROLL_PAGE_UP)
|
||||
rows = -listBox.getNumberOfVisibleRows();
|
||||
else if (rows == NSUIEvent.SCROLL_PAGE_DOWN)
|
||||
rows = listBox.getNumberOfVisibleRows();
|
||||
|
||||
listBox.scrollByLines(rows);
|
||||
event.preventDefault();
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="listitem"
|
||||
extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/listbox.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<children>
|
||||
<xul:listcell xbl:inherits="label,crop,disabled,flexlabel"/>
|
||||
</children>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULSelectControlItemElement, nsIAccessibleProvider">
|
||||
<property name="current" onget="return this.getAttribute('current') == 'true';">
|
||||
<setter><![CDATA[
|
||||
if (val)
|
||||
this.setAttribute("current", "true");
|
||||
else
|
||||
this.removeAttribute("current");
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<!-- ///////////////// nsIAccessibleProvider ///////////////// -->
|
||||
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULListitem;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<!-- ///////////////// nsIDOMXULSelectControlItemElement ///////////////// -->
|
||||
|
||||
<property name="value" onget="return this.getAttribute('value');"
|
||||
onset="this.setAttribute('value', val); return val;"/>
|
||||
<property name="label" onget="return this.getAttribute('label');"
|
||||
onset="this.setAttribute('label', val); return val;"/>
|
||||
|
||||
<property name="selected" onget="return this.getAttribute('selected') == 'true';">
|
||||
<setter><![CDATA[
|
||||
if (val)
|
||||
this.setAttribute("selected", "true");
|
||||
else
|
||||
this.removeAttribute("selected");
|
||||
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("DOMMenuItemActive", true, true);
|
||||
this.dispatchEvent(event);
|
||||
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="control">
|
||||
<getter><![CDATA[
|
||||
var parent = this.parentNode;
|
||||
while (parent) {
|
||||
if (parent.localName == "listbox")
|
||||
return parent;
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
return null;
|
||||
]]></getter>
|
||||
</property>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<!-- If there is no modifier key, we select on mousedown, not
|
||||
click, so that drags work correctly. -->
|
||||
<handler event="mousedown">
|
||||
<![CDATA[
|
||||
if (this.parentNode.disabled) return;
|
||||
if (!event.ctrlKey && !event.shiftKey && !event.metaKey) {
|
||||
if (!this.selected) {
|
||||
parentNode.selectItem(this);
|
||||
}
|
||||
parentNode.currentItem = this;
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<!-- On a click (up+down on the same item), deselect everything
|
||||
except this item. -->
|
||||
<handler event="click" button="0">
|
||||
<![CDATA[
|
||||
if (this.parentNode.disabled) return;
|
||||
if (parentNode.selType != "multiple") {
|
||||
parentNode.selectItem(this);
|
||||
}
|
||||
else if (event.ctrlKey || event.metaKey) {
|
||||
parentNode.toggleItemSelection(this);
|
||||
parentNode.currentItem = this;
|
||||
}
|
||||
else if (event.shiftKey) {
|
||||
parentNode.selectItemRange(null, this);
|
||||
parentNode.currentItem = this;
|
||||
}
|
||||
else {
|
||||
/* We want to deselect all the selected items except what was
|
||||
clicked, UNLESS it was a right-click. We have to do this
|
||||
in click rather than mousedown so that you can drag a
|
||||
selected group of items */
|
||||
|
||||
var selectedItems = parentNode.selectedItems;
|
||||
var didSuppressSelect = false;
|
||||
var i = 0;
|
||||
while (i < selectedItems.length) {
|
||||
if (selectedItems[i] != this) {
|
||||
if (!didSuppressSelect) {
|
||||
parentNode._suppressOnSelect = true;
|
||||
didSuppressSelect = true;
|
||||
}
|
||||
parentNode.removeItemFromSelection(selectedItems[i]);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
if (didSuppressSelect) {
|
||||
parentNode._suppressOnSelect = false;
|
||||
parentNode._fireOnSelect();
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="listitem-iconic"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listitem">
|
||||
<content>
|
||||
<children>
|
||||
<xul:listcell class="listcell-iconic" xbl:inherits="label,image,crop,disabled,flexlabel"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listitem-checkbox"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listitem">
|
||||
<content>
|
||||
<children>
|
||||
<xul:listcell type="checkbox" xbl:inherits="label,crop,checked,disabled,flexlabel"/>
|
||||
</children>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="checked"
|
||||
onget="return this.getAttribute('checked') == 'true';">
|
||||
<setter><![CDATA[
|
||||
if (val)
|
||||
this.setAttribute('checked', 'true');
|
||||
else
|
||||
this.removeAttribute('checked');
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent('CheckboxStateChange', true, true);
|
||||
this.dispatchEvent(event);
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mousedown" button="0">
|
||||
<![CDATA[
|
||||
if (!this.disabled && !this.parentNode.disabled)
|
||||
this.checked = !this.checked;
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="listitem-checkbox-iconic"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listitem-checkbox">
|
||||
<content>
|
||||
<children>
|
||||
<xul:listcell type="checkbox" class="listcell-iconic" xbl:inherits="label,image,crop,checked,disabled,flexlabel"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listcell"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listbox-base">
|
||||
<content>
|
||||
<children>
|
||||
<xul:label class="listcell-label" xbl:inherits="value=label,flex=flexlabel,crop,disabled" flex="1" crop="right"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listcell-iconic"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listcell">
|
||||
<content>
|
||||
<children>
|
||||
<xul:image class="listcell-icon" xbl:inherits="src=image"/>
|
||||
<xul:label class="listcell-label" xbl:inherits="value=label,flex=flexlabel,crop,disabled" flex="1" crop="right"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listcell-checkbox"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listcell">
|
||||
<content>
|
||||
<children>
|
||||
<xul:image class="listcell-check" xbl:inherits="checked,disabled"/>
|
||||
<xul:label class="listcell-label" xbl:inherits="value=label,flex=flexlabel,crop,disabled" flex="1" crop="right"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listcell-checkbox-iconic"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listcell-checkbox">
|
||||
<content>
|
||||
<children>
|
||||
<xul:image class="listcell-check" xbl:inherits="checked,disabled"/>
|
||||
<xul:image class="listcell-icon" xbl:inherits="src=image"/>
|
||||
<xul:label class="listcell-label" xbl:inherits="value=label,flex=flexlabel,crop,disabled" flex="1" crop="right"/>
|
||||
</children>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listhead"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listbox-base">
|
||||
<content>
|
||||
<xul:listheaditem>
|
||||
<children includes="listheader"/>
|
||||
</xul:listheaditem>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listheader" display="xul:button"
|
||||
extends="chrome://global/content/bindings/listbox.xml#listbox-base">
|
||||
<content>
|
||||
<xul:image class="listheader-icon"/>
|
||||
<xul:label class="listheader-label" xbl:inherits="value=label,crop" flex="1" crop="right"/>
|
||||
<xul:image class="listheader-sortdirection" xbl:inherits="sortDirection"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -1,135 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="menuitemBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="menuitem-base"
|
||||
extends="chrome://global/content/bindings/general.xml#control-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/menu.css"/>
|
||||
</resources>
|
||||
<implementation implements="nsIDOMXULSelectControlItemElement, nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (this.localName == "menuseparator")
|
||||
return Components.interfaces.nsIAccessibleProvider.XULMenuSeparator;
|
||||
return Components.interfaces.nsIAccessibleProvider.XULMenuitem;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
<property name="selected" readonly="true"
|
||||
onget="return this.getAttribute('selected') == 'true';"/>
|
||||
<property name="control" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var parent = this.parentNode;
|
||||
if (parent &&
|
||||
parent.parentNode instanceof Components.interfaces.nsIDOMXULSelectControlElement)
|
||||
return parent.parentNode;
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="menu" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:label class="menu-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<xul:hbox anonid="accel">
|
||||
<xul:label class="menu-accel" xbl:inherits="value=acceltext"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox align="center" class="menu-right" xbl:inherits="_moz-menuactive,disabled">
|
||||
<xul:image/>
|
||||
</xul:hbox>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menuitem" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:label class="menu-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<xul:hbox anonid="accel">
|
||||
<xul:label class="menu-accel" xbl:inherits="value=acceltext"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-menubar" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:label class="menubar-text" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-menubar-iconic" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:image class="menubar-left" xbl:inherits="src=image"/>
|
||||
<xul:label class="menubar-text" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menuitem-iconic" extends="chrome://global/content/bindings/menu.xml#menuitem">
|
||||
<content>
|
||||
<xul:hbox class="menu-iconic-left" align="center" pack="center"
|
||||
xbl:inherits="selected,_moz-menuactive,disabled,checked">
|
||||
<xul:image class="menu-iconic-icon" xbl:inherits="src=image,validate,src"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<xul:hbox anonid="accel">
|
||||
<xul:label class="menu-iconic-accel" xbl:inherits="value=acceltext"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menuitem-iconic-noaccel" extends="chrome://global/content/bindings/menu.xml#menuitem">
|
||||
<content>
|
||||
<xul:hbox class="menu-iconic-left" align="center" pack="center"
|
||||
xbl:inherits="selected,disabled,checked">
|
||||
<xul:image class="menu-iconic-icon" xbl:inherits="src=image,validate,src"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menuitem-iconic-desc-noaccel" extends="chrome://global/content/bindings/menu.xml#menuitem">
|
||||
<content>
|
||||
<xul:hbox class="menu-iconic-left" align="center" pack="center"
|
||||
xbl:inherits="selected,disabled,checked">
|
||||
<xul:image class="menu-iconic-icon" xbl:inherits="src=image,validate,src"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="menu-iconic-text" xbl:inherits="value=label,accesskey,crop" crop="right" flex="1"/>
|
||||
<xul:label class="menu-iconic-text menu-description" xbl:inherits="value=description" crop="right" flex="10000"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-iconic" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:hbox class="menu-iconic-left" align="center" pack="center">
|
||||
<xul:image xbl:inherits="src=image"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<xul:hbox anonid="accel">
|
||||
<xul:label class="menu-iconic-accel" xbl:inherits="value=acceltext"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox class="menu-right" xbl:inherits="_moz-menuactive,disabled" align="center" pack="center">
|
||||
<xul:image/>
|
||||
</xul:hbox>
|
||||
<children includes="menupopup|template"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menubutton-item" extends="chrome://global/content/bindings/menu.xml#menuitem-base">
|
||||
<content>
|
||||
<xul:label class="menubutton-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menuseparator" extends="chrome://global/content/bindings/menu.xml#menuitem-base"/>
|
||||
|
||||
</bindings>
|
|
@ -1,550 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="menulistBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="menulist-base" extends="chrome://global/content/bindings/general.xml#basecontrol">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/menulist.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="menulist" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/menulist.xml#menulist-base">
|
||||
<content sizetopopup="pref">
|
||||
<xul:hbox class="menulist-label-box" flex="1">
|
||||
<xul:image class="menulist-icon" xbl:inherits="src=image,src"/>
|
||||
<xul:label class="menulist-label" xbl:inherits="value=label,crop,accesskey" crop="right" flex="1"/>
|
||||
</xul:hbox>
|
||||
<xul:dropmarker class="menulist-dropmarker" type="menu" xbl:inherits="disabled"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
|
||||
<handlers>
|
||||
<handler event="command" phase="capturing"
|
||||
action="if (event.target.parentNode.parentNode == this) this.selectedItem = event.target;"/>
|
||||
|
||||
<handler event="popupshowing">
|
||||
<![CDATA[
|
||||
if (event.target.parentNode == this && this.selectedItem)
|
||||
// Not ready for auto-setting the active child in hierarchies yet.
|
||||
// For now, only do this when the outermost menupopup opens.
|
||||
this.menuBoxObject.activeChild = this.mSelectedInternal;
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="keypress">
|
||||
<![CDATA[
|
||||
if (event.originalTarget == this) {
|
||||
this.menuBoxObject.activeChild = this.mSelectedInternal;
|
||||
if (this.menuBoxObject.handleKeyPress(event))
|
||||
this.menuBoxObject.activeChild.doCommand();
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
|
||||
<implementation implements="nsIDOMXULMenuListElement, nsIAccessibleProvider">
|
||||
<constructor>
|
||||
this.setInitialSelection()
|
||||
</constructor>
|
||||
|
||||
<method name="setInitialSelection">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popup = this.menupopup;
|
||||
if (popup) {
|
||||
var arr = popup.getElementsByAttribute('selected', 'true');
|
||||
|
||||
var editable = this.editable;
|
||||
var value = this.value;
|
||||
if (!arr.item(0) && value)
|
||||
arr = popup.getElementsByAttribute(editable ? 'label' : 'value', value);
|
||||
|
||||
if (arr.item(0))
|
||||
this.selectedItem = arr[0];
|
||||
else if (!editable)
|
||||
this.selectedIndex = 0;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="value" onget="return this.getAttribute('value');">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var arr = null;
|
||||
var popup = this.menupopup;
|
||||
if (popup)
|
||||
arr = popup.getElementsByAttribute('value', val);
|
||||
|
||||
if (arr && arr.item(0))
|
||||
this.selectedItem = arr[0];
|
||||
else
|
||||
this.setAttribute('value', val);
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="inputField" readonly="true" onget="return null;"/>
|
||||
|
||||
<property name="crop" onset="this.setAttribute('crop',val); return val;"
|
||||
onget="return this.getAttribute('crop');"/>
|
||||
<property name="image" onset="this.setAttribute('image',val); return val;"
|
||||
onget="return this.getAttribute('image');"/>
|
||||
<property name="label" readonly="true" onget="return this.getAttribute('label');"/>
|
||||
<property name="description" onset="this.setAttribute('description',val); return val;"
|
||||
onget="return this.getAttribute('description');"/>
|
||||
<property name="editable" onset="this.setAttribute('editable',val); return val;"
|
||||
onget="return this.getAttribute('editable') == 'true';"/>
|
||||
|
||||
<property name="open" onset="this.menuBoxObject.openMenu(val);
|
||||
return val;"
|
||||
onget="return this.hasAttribute('open');"/>
|
||||
|
||||
<property name="itemCount" readonly="true"
|
||||
onget="return this.menupopup ? this.menupopup.childNodes.length : 0"/>
|
||||
|
||||
<property name="menupopup" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var popup = this.firstChild;
|
||||
while (popup && popup.localName != "menupopup")
|
||||
popup = popup.nextSibling;
|
||||
return popup;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<field name="menuBoxObject" readonly="true">
|
||||
this.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject)
|
||||
</field>
|
||||
|
||||
<field name="mSelectedInternal">
|
||||
null
|
||||
</field>
|
||||
|
||||
<method name="contains">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!item)
|
||||
return false;
|
||||
|
||||
var parent = item.parentNode;
|
||||
return (parent && parent.parentNode == this);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="selectedIndex">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
// Quick and dirty. We won't deal with hierarchical menulists yet.
|
||||
if (!this.selectedItem ||
|
||||
!this.mSelectedInternal.parentNode ||
|
||||
this.mSelectedInternal.parentNode.parentNode != this)
|
||||
return -1;
|
||||
|
||||
var children = this.mSelectedInternal.parentNode.childNodes;
|
||||
var i = children.length;
|
||||
while (i--)
|
||||
if (children[i] == this.mSelectedInternal)
|
||||
break;
|
||||
|
||||
return i;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var popup = this.menupopup;
|
||||
if (popup && 0 <= val && val < popup.childNodes.length)
|
||||
this.selectedItem = popup.childNodes[val];
|
||||
else
|
||||
this.selectedItem = null;
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedItem">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.mSelectedInternal;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var oldval = this.mSelectedInternal;
|
||||
if (oldval == val)
|
||||
return val;
|
||||
|
||||
if (val && !this.contains(val))
|
||||
return val;
|
||||
|
||||
if (oldval)
|
||||
oldval.removeAttribute('selected');
|
||||
|
||||
this.mSelectedInternal = val;
|
||||
if (val) {
|
||||
val.setAttribute('selected', 'true');
|
||||
this.setAttribute('value', val.getAttribute('value'));
|
||||
this.setAttribute('image', val.getAttribute('image'));
|
||||
this.setAttribute('label', val.getAttribute('label'));
|
||||
this.setAttribute('description', val.getAttribute('description'));
|
||||
}
|
||||
else {
|
||||
this.removeAttribute('value');
|
||||
this.removeAttribute('image');
|
||||
this.removeAttribute('label');
|
||||
this.removeAttribute('description');
|
||||
}
|
||||
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("select", true, true);
|
||||
this.dispatchEvent(event);
|
||||
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("ValueChange", true, true);
|
||||
this.dispatchEvent(event);
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="getIndexOfItem">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popup = this.menupopup;
|
||||
if (popup) {
|
||||
var children = popup.childNodes;
|
||||
var i = children.length;
|
||||
while (i--)
|
||||
if (children[i] == item)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="getItemAtIndex">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popup = this.menupopup;
|
||||
if (popup) {
|
||||
var children = popup.childNodes;
|
||||
if (index >= 0 && index < children.length)
|
||||
return children[index];
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<parameter name="description"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var popup = this.menupopup ||
|
||||
this.appendChild(document.createElementNS(XULNS, "menupopup"));
|
||||
var item = document.createElementNS(XULNS, "menuitem");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("value", value);
|
||||
if (description)
|
||||
item.setAttribute("description", description);
|
||||
|
||||
popup.appendChild(item);
|
||||
return item;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="insertItemAt">
|
||||
<parameter name="index"/>
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<parameter name="description"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var popup = this.menupopup ||
|
||||
this.appendChild(document.createElementNS(XULNS, "menupopup"));
|
||||
var item = document.createElementNS(XULNS, "menuitem");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("value", value);
|
||||
if (description)
|
||||
item.setAttribute("description", description);
|
||||
|
||||
if (index >= 0 && index < popup.childNodes.length)
|
||||
popup.insertBefore(item, popup.childNodes[index]);
|
||||
else
|
||||
popup.appendChild(item);
|
||||
return item;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemAt">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popup = this.menupopup;
|
||||
if (popup && 0 <= index && index < popup.childNodes.length) {
|
||||
var remove = popup.childNodes[index];
|
||||
popup.removeChild(remove);
|
||||
return remove;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeAllItems">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.selectedItem = null;
|
||||
var popup = this.menupopup;
|
||||
if (popup)
|
||||
this.removeChild(popup);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULCombobox;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="menulist-editable" extends="chrome://global/content/bindings/menulist.xml#menulist">
|
||||
<content sizetopopup="pref">
|
||||
<xul:hbox class="menulist-editable-box textbox-input-box" xbl:inherits="context" flex="1">
|
||||
<html:input class="menulist-editable-input" flex="1" anonid="input" allowevents="true"
|
||||
xbl:inherits="value=label,value,disabled,tabindex,readonly"/>
|
||||
</xul:hbox>
|
||||
<xul:dropmarker class="menulist-dropmarker" type="menu"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="_selectInputFieldValueInList">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.hasAttribute("disableautoselect"))
|
||||
return;
|
||||
|
||||
// Find and select the menuitem that matches inputField's "value"
|
||||
var arr = null;
|
||||
var popup = this.menupopup;
|
||||
|
||||
if (popup)
|
||||
arr = popup.getElementsByAttribute('label', this.inputField.value);
|
||||
|
||||
this.setSelectionInternal(arr ? arr.item(0) : null);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="setSelectionInternal">
|
||||
<parameter name="val"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// This is called internally to set selected item
|
||||
// without triggering infinite loop
|
||||
// when using selectedItem's setter
|
||||
if (this.mSelectedInternal == val)
|
||||
return val;
|
||||
|
||||
if (this.mSelectedInternal)
|
||||
this.mSelectedInternal.removeAttribute('selected');
|
||||
|
||||
this.mSelectedInternal = val;
|
||||
|
||||
if (val)
|
||||
val.setAttribute('selected', 'true');
|
||||
|
||||
//Do NOT change the "value", which is owned by inputField
|
||||
return val;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="mInputField">null</field>
|
||||
|
||||
<property name="inputField" readonly="true">
|
||||
<getter><![CDATA[
|
||||
if (!this.mInputField)
|
||||
this.mInputField = document.getAnonymousElementByAttribute(this, "anonid", "input");
|
||||
return this.mInputField;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="label" onset="this.inputField.value = val; return val;"
|
||||
onget="return this.inputField.value;"/>
|
||||
|
||||
<property name="value" onget="return this.inputField.value;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
// Override menulist's value setter to refer to the inputField's value
|
||||
// (Allows using "menulist.value" instead of "menulist.inputField.value")
|
||||
this.inputField.value = val;
|
||||
this.setAttribute('value', val);
|
||||
this.setAttribute('label', val);
|
||||
this._selectInputFieldValueInList();
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedItem">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
// Make sure internally-selected item
|
||||
// is in sync with inputField.value
|
||||
this._selectInputFieldValueInList();
|
||||
return this.mSelectedInternal;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var oldval = this.mSelectedInternal;
|
||||
if (oldval == val)
|
||||
return val;
|
||||
|
||||
if (val && !this.contains(val))
|
||||
return val;
|
||||
|
||||
// This doesn't touch inputField.value or "value" and "label" attributes
|
||||
this.setSelectionInternal(val);
|
||||
if (val) {
|
||||
// Editable menulist uses "label" as its "value"
|
||||
var label = val.getAttribute('label');
|
||||
this.inputField.value = label;
|
||||
this.setAttribute('value', label);
|
||||
this.setAttribute('label', label);
|
||||
}
|
||||
else {
|
||||
this.inputField.value = "";
|
||||
this.removeAttribute('value');
|
||||
this.removeAttribute('label');
|
||||
}
|
||||
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("select", true, true);
|
||||
this.dispatchEvent(event);
|
||||
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("ValueChange", true, true);
|
||||
this.dispatchEvent(event);
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
<property name="disableautoselect"
|
||||
onset="if (val) this.setAttribute('disableautoselect','true');
|
||||
else this.removeAttribute('disableautoselect'); return val;"
|
||||
onget="return this.hasAttribute('disableautoselect');"/>
|
||||
|
||||
<property name="editor" readonly="true">
|
||||
<getter><![CDATA[
|
||||
const nsIDOMNSEditableElement = Components.interfaces.nsIDOMNSEditableElement;
|
||||
return this.inputField.QueryInterface(nsIDOMNSEditableElement).editor;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="select">
|
||||
<body>
|
||||
this.inputField.select();
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="focus" phase="capturing">
|
||||
<![CDATA[
|
||||
if (!this.hasAttribute('focused')) {
|
||||
if (event.originalTarget != this.inputField)
|
||||
this.inputField.focus();
|
||||
this.setAttribute('focused','true');
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="blur" phase="capturing">
|
||||
<![CDATA[
|
||||
this.removeAttribute('focused');
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="popupshowing">
|
||||
<![CDATA[
|
||||
// editable menulists elements aren't in the focus order,
|
||||
// so when the popup opens we need to force the focus to the inputField
|
||||
if (event.target.parentNode == this) {
|
||||
if (document.commandDispatcher.focusedElement != this.inputField)
|
||||
this.inputField.focus();
|
||||
|
||||
if (this.selectedItem)
|
||||
// Not ready for auto-setting the active child in hierarchies yet.
|
||||
// For now, only do this when the outermost menupopup opens.
|
||||
this.menuBoxObject.activeChild = this.mSelectedInternal;
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="keypress">
|
||||
<![CDATA[
|
||||
// open popup if key is up arrow, down arrow, or F4
|
||||
if (!event.ctrlKey && !event.shiftKey) {
|
||||
if (event.keyCode == KeyEvent.DOM_VK_UP ||
|
||||
event.keyCode == KeyEvent.DOM_VK_DOWN ||
|
||||
(event.keyCode == KeyEvent.DOM_VK_F4 && !event.altKey)) {
|
||||
event.preventDefault();
|
||||
this.open = true;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="menulist-compact" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/menulist.xml#menulist">
|
||||
<content sizetopopup="false">
|
||||
<xul:dropmarker class="menulist-dropmarker" type="menu"/>
|
||||
<xul:image class="menulist-icon" xbl:inherits="src=image,src"/>
|
||||
<xul:label class="menulist-label" xbl:inherits="value=label,crop,accesskey" crop="right" flex="1"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menulist-description" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/menulist.xml#menulist">
|
||||
<content sizetopopup="pref">
|
||||
<xul:hbox class="menulist-label-box" flex="1">
|
||||
<xul:image class="menulist-icon" xbl:inherits="src=image,src"/>
|
||||
<xul:label class="menulist-label" xbl:inherits="value=label,crop,accesskey" crop="right" flex="1"/>
|
||||
<xul:label class="menulist-label menulist-description" xbl:inherits="value=description" crop="right" flex="10000"/>
|
||||
</xul:hbox>
|
||||
<xul:dropmarker class="menulist-dropmarker" type="menu"/>
|
||||
<children includes="menupopup"/>
|
||||
</content>
|
||||
</binding>
|
||||
</bindings>
|
|
@ -1,682 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="popupBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="popup-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/popup.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="popup" extends="chrome://global/content/bindings/popup.xml#popup-base">
|
||||
<content>
|
||||
<xul:arrowscrollbox class="popup-internal-box" flex="1" orient="vertical">
|
||||
<children/>
|
||||
</xul:arrowscrollbox>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULPopupElement, nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULMenupopup;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="position" onget="return this.getAttribute('position');"
|
||||
onset="this.setAttribute('position', val); return val;"/>
|
||||
<property name="popupBoxObject">
|
||||
<getter>
|
||||
return this.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="openPopup">
|
||||
<parameter name="aAnchorElement"/>
|
||||
<parameter name="aPosition"/>
|
||||
<parameter name="aX"/>
|
||||
<parameter name="aY"/>
|
||||
<parameter name="aIsContextMenu"/>
|
||||
<parameter name="aAttributesOverride"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
var popupBox = this.popupBoxObject;
|
||||
if (popupBox)
|
||||
popupBox.openPopup(aAnchorElement, aPosition, aX, aY,
|
||||
aIsContextMenu, aAttributesOverride);
|
||||
} catch(e) {}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="openPopupAtScreen">
|
||||
<parameter name="aX"/>
|
||||
<parameter name="aY"/>
|
||||
<parameter name="aIsContextMenu"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
var popupBox = this.popupBoxObject;
|
||||
if (popupBox)
|
||||
popupBox.openPopupAtScreen(aX, aY, aIsContextMenu);
|
||||
} catch(e) {}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="showPopup">
|
||||
<parameter name="element"/>
|
||||
<parameter name="xpos"/>
|
||||
<parameter name="ypos"/>
|
||||
<parameter name="popuptype"/>
|
||||
<parameter name="anchoralignment"/>
|
||||
<parameter name="popupalignment"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popupBox = null;
|
||||
var menuBox = null;
|
||||
try {
|
||||
popupBox = this.popupBoxObject;
|
||||
} catch(e) {}
|
||||
try {
|
||||
menuBox = this.parentNode.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
|
||||
} catch(e) {}
|
||||
if (menuBox)
|
||||
menuBox.openMenu(true);
|
||||
else if (popupBox)
|
||||
popupBox.showPopup(element, this, xpos, ypos, popuptype, anchoralignment, popupalignment);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="hidePopup">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var popupBox = null;
|
||||
var menuBox = null;
|
||||
try {
|
||||
popupBox = this.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
|
||||
} catch(e) {}
|
||||
try {
|
||||
menuBox = this.parentNode.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
|
||||
} catch(e) {}
|
||||
if (menuBox)
|
||||
menuBox.openMenu(false);
|
||||
else if (popupBox)
|
||||
popupBox.hidePopup();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="autoPosition">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.popupBoxObject.autoPosition;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
return this.popupBoxObject.autoPosition = val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="enableKeyboardNavigator">
|
||||
<parameter name="aEnableKeyboardNavigator"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.enableKeyboardNavigator(aEnableKeyboardNavigator);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="enableRollup">
|
||||
<parameter name="aEnableRollup"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.enableRollup(aEnableRollup);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="sizeTo">
|
||||
<parameter name="aWidth"/>
|
||||
<parameter name="aHeight"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.sizeTo(aWidth, aHeight);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="moveTo">
|
||||
<parameter name="aLeft"/>
|
||||
<parameter name="aTop"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.moveTo(aLeft, aTop);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="contextmenu" action="event.preventDefault();"/>
|
||||
|
||||
<handler event="popupshowing" phase="target">
|
||||
<![CDATA[
|
||||
var array = [];
|
||||
var width = 0;
|
||||
for (var menuitem = this.firstChild; menuitem; menuitem = menuitem.nextSibling) {
|
||||
if (menuitem.localName == "menuitem" && menuitem.hasAttribute("acceltext")) {
|
||||
var accel = document.getAnonymousElementByAttribute(menuitem, "anonid", "accel");
|
||||
if (accel && accel.boxObject) {
|
||||
array.push(accel);
|
||||
if (accel.boxObject.width > width)
|
||||
width = accel.boxObject.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < array.length; i++)
|
||||
array[i].width = width;
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="tooltip" extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
<content>
|
||||
<children>
|
||||
<xul:label class="tooltip-label" xbl:inherits="value=label,crop" crop="right" flex="1"/>
|
||||
</children>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XULTooltip;
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<field name="_mouseOutCount">0</field>
|
||||
<field name="_isMouseOver">false</field>
|
||||
|
||||
<property name="label"
|
||||
onget="return this.getAttribute('label');"
|
||||
onset="this.setAttribute('label', val); return val;"/>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mouseover"><![CDATA[
|
||||
var rel = event.relatedTarget;
|
||||
//dump("ENTERING " + (rel ? rel.localName : "null") + "\n");
|
||||
if (!rel)
|
||||
return;
|
||||
|
||||
// find out if the node we entered from is one of our anonymous children
|
||||
while (rel) {
|
||||
if (rel == this)
|
||||
break;
|
||||
rel = rel.parentNode;
|
||||
}
|
||||
|
||||
// if the exited node is not a descendant of ours, we are entering for the first time
|
||||
if (rel != this)
|
||||
this._isMouseOver = true;
|
||||
]]></handler>
|
||||
|
||||
<handler event="mouseout"><![CDATA[
|
||||
var rel = event.relatedTarget;
|
||||
//dump("LEAVING " + (rel ? rel.localName : "null") + "\n");
|
||||
|
||||
// relatedTarget is null when the titletip is first shown: a mouseout event fires
|
||||
// because the mouse is exiting the main window and entering the titletip "window".
|
||||
// relatedTarget is also null when the mouse exits the main window completely,
|
||||
// so count how many times relatedTarget was null after titletip is first shown
|
||||
// and hide popup the 2nd time
|
||||
if (!rel) {
|
||||
++this._mouseOutCount;
|
||||
if (this._mouseOutCount > 1)
|
||||
this.hidePopup();
|
||||
return;
|
||||
}
|
||||
|
||||
// find out if the node we are entering is one of our anonymous children
|
||||
while (rel) {
|
||||
if (rel == this)
|
||||
break;
|
||||
rel = rel.parentNode;
|
||||
}
|
||||
|
||||
// if the entered node is not a descendant of ours, hide the tooltip
|
||||
if (rel != this && this._isMouseOver) {
|
||||
this.hidePopup();
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
<handler event="popuphiding"><![CDATA[
|
||||
this._isMouseOver = false;
|
||||
this._mouseOutCount = 0;
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<!-- XXXben this binding is not currently used -->
|
||||
<binding id="resizerbase" extends="xul:box">
|
||||
<implementation>
|
||||
<property name="popup">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var currNode = this.parentNode;
|
||||
while (currNode) {
|
||||
try {
|
||||
var bo = currNode.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
|
||||
if (bo)
|
||||
return currNode;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
currNode = currNode.parentNode;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="screenLeft">0</field>
|
||||
<field name="screenTop">0</field>
|
||||
<field name="resizerDirection">0</field>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mousedown" phase="capturing">
|
||||
<![CDATA[
|
||||
var popup = event.target.popup;
|
||||
var boxObject = popup.boxObject;
|
||||
boxObject.captureMouseEvents = true;
|
||||
event.target.screenLeft = event.screenX;
|
||||
event.target.screenTop = event.screenY;
|
||||
event.target.setMode();
|
||||
event.preventDefault();
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="mouseup" phase="capturing">
|
||||
<![CDATA[
|
||||
var popup = event.target.popup;
|
||||
var boxObject = popup.boxObject;
|
||||
boxObject.captureMouseEvents = false;
|
||||
event.target.screenLeft = event.screenX;
|
||||
event.target.screenTop = event.screenY;
|
||||
event.target.direction = 0;
|
||||
event.preventDefault();
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="mousemove" phase="capturing">
|
||||
<![CDATA[
|
||||
event.target.handleMouseMove(event);
|
||||
event.preventDefault();
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<!-- East-West resizer -->
|
||||
<binding id="ew-resizer" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
|
||||
<content>
|
||||
<xul:hbox class="ew-resizer-box" flex="1"/>
|
||||
</content>
|
||||
<!--
|
||||
<implementation>
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var boxObject = aEvent.target.boxObject;
|
||||
if (boxObject.captureMouseEvents && this.resizerDirection == "right") {
|
||||
var delta = aEvent.screenX - this.screenLeft;
|
||||
this.screenLeft = aEvent.screenX;
|
||||
|
||||
// We can set this directly as we're only modifying one dimension
|
||||
aEvent.target.width += delta;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="setMode">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.resizerDirection = "right";
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
-->
|
||||
</binding>
|
||||
|
||||
<!-- North-South resizer -->
|
||||
<binding id="ns-resizer" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
|
||||
<content>
|
||||
<xul:hbox class="ns-resizer-box" flex="1"/>
|
||||
</content>
|
||||
<!--
|
||||
<implementation>
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var boxObject = aEvent.target.boxObject;
|
||||
if (boxObject.captureMouseEvents && this.resizerDirection == "bottom") {
|
||||
var delta = aEvent.screenY - this.screenTop;
|
||||
this.screenTop = aEvent.screenY;
|
||||
var currWidth = aEvent.target.boxObject.width;
|
||||
|
||||
// We can set this directly as we're only modifying one dimension
|
||||
aEvent.target.height += delta;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="setMode">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.resizerDirection = "bottom";
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
-->
|
||||
</binding>
|
||||
|
||||
<!-- Diagonal resizer -->
|
||||
<binding id="diag-resizer" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
|
||||
<content>
|
||||
<xul:hbox class="diag-resizer-box" align="center" flex="1">
|
||||
<xul:image class="diag-resizer-image"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<!--
|
||||
<implementation>
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var boxObject = aEvent.target.boxObject;
|
||||
if (boxObject.captureMouseEvents && this.resizerDirection == "bottomright") {
|
||||
if (!this.screenLeft || !this.screenTop) {
|
||||
this.screenLeft = aEvent.screenX;
|
||||
this.screenTop = aEvent.screenY;
|
||||
}
|
||||
var deltaX = aEvent.screenX - this.screenLeft;
|
||||
var deltaY = aEvent.screenY - this.screenTop;
|
||||
this.screenLeft = aEvent.screenX;
|
||||
this.screenTop = aEvent.screenY;
|
||||
var currWidth = aEvent.target.boxObject.width;
|
||||
var currHeight = aEvent.target.boxObject.height;
|
||||
aEvent.target.sizeTo(currWidth + deltaX, currHeight + deltaY);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="setMode">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.resizerDirection = "bottomright";
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
-->
|
||||
</binding>
|
||||
|
||||
<binding id="titlebar" extends="xul:box"> <!-- extends="chrome://global/content/bindings/popup.xml#resizerbase"> -->
|
||||
<content>
|
||||
<xul:hbox class="titlebar-box" flex="1">
|
||||
<xul:hbox class="titlebar-title-box" flex="1" tooltiptext="Click and drag to float">
|
||||
<xul:label class="titlebar-title" xbl:inherits="value=title" flex="1" crop="right"/>
|
||||
</xul:hbox>
|
||||
<xul:button class="popupClose" tooltiptext="Close"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<!--
|
||||
<implementation>
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this.popup) this.popup = aEvent.target.popup;
|
||||
var boxObject = this.popup.boxObject;
|
||||
if (boxObject.captureMouseEvents && this.direction == "titlebar") {
|
||||
if (!this.screenLeft || !this.screenTop) {
|
||||
this.screenLeft = aEvent.screenX;
|
||||
this.screenTop = aEvent.screenY;
|
||||
}
|
||||
var deltaX = aEvent.screenX - this.screenLeft;
|
||||
var deltaY = aEvent.screenY - this.screenTop;
|
||||
this.screenLeft = aEvent.screenX;
|
||||
this.screenTop = aEvent.screenY;
|
||||
var currX = aEvent.target.boxObject.screenX;
|
||||
var currY = aEvent.target.boxObject.screenY;
|
||||
aEvent.target.moveTo(currX + deltaX, currY + deltaY);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="setMode">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.direction = "titlebar";
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
-->
|
||||
</binding>
|
||||
|
||||
<binding id="floater-base" display="xul:popup" extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
<implementation>
|
||||
|
||||
<!-- Popup Manipulation Constants -->
|
||||
<field name="MANIPULATE_NONE" readonly="true">0</field>
|
||||
<field name="MANIPULATE_MOVE" readonly="true">1</field>
|
||||
<field name="MANIPULATE_SIZE_EW" readonly="true">2</field>
|
||||
<field name="MANIPULATE_SIZE_NS" readonly="true">3</field>
|
||||
<field name="MANIPULATE_SIZE_DIAG" readonly="true">4</field>
|
||||
|
||||
<method name="handleMouseMove">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var boxObject = this.boxObject;
|
||||
if (boxObject.captureMouseEvents) {
|
||||
var dX, dY;
|
||||
var eScreenX = aEvent.screenX;
|
||||
var eScreenY = aEvent.screenY;
|
||||
switch (this.manipulateMode) {
|
||||
case this.MANIPULATE_SIZE_EW:
|
||||
var width = boxObject.width;
|
||||
dX = eScreenX - this.screenLeft;
|
||||
this.sizeTo(width + dX, this.height);
|
||||
break;
|
||||
case this.MANIPULATE_SIZE_NS:
|
||||
var height = boxObject.height;
|
||||
dY = eScreenY - this.screenTop;
|
||||
this.sizeTo(this.width, height + dY);
|
||||
break;
|
||||
case this.MANIPULATE_SIZE_DIAG:
|
||||
dX = eScreenX - this.screenLeft;
|
||||
dY = eScreenY - this.screenTop;
|
||||
this.sizeTo(this.width + dX, this.height + dY);
|
||||
break;
|
||||
case this.MANIPULATE_MOVE:
|
||||
// XXXben this may not yet be complete. When we drag away from the
|
||||
// owner, we set some properties to ensure that we aren't
|
||||
// positioned as a menu, automatically closed or steal
|
||||
// keyboard navigation in an inappropriate way.
|
||||
this.autoPosition = false;
|
||||
this.enableRollup(false);
|
||||
this.enableKeyboardNavigator(false);
|
||||
dX = eScreenX - this.screenLeft;
|
||||
dY = eScreenY - this.screenTop;
|
||||
this.moveTo(this.left + dX, this.top + dY);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.screenLeft = eScreenX;
|
||||
this.screenTop = eScreenY;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="findParentByLocalName">
|
||||
<parameter name="aNode"/>
|
||||
<parameter name="aLocalName"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var parent = aNode;
|
||||
var names = [].concat(aLocalName);
|
||||
while (parent) {
|
||||
for (var i = 0; i < names.length; ++i) {
|
||||
if (parent.localName == names[i])
|
||||
return parent;
|
||||
}
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="setMode">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var widget = this.findParentByLocalName(aEvent.originalTarget, ["resizer", "titlebar"]);
|
||||
if (widget) {
|
||||
if (widget.localName == "titlebar")
|
||||
this.manipulateMode = this.MANIPULATE_MOVE;
|
||||
else
|
||||
this.sizeDirection = widget.getAttribute("direction");
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="cleanUp">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.boxObject.captureMouseEvents = false;
|
||||
this.screenLeft = aEvent.screenX;
|
||||
this.screenTop = aEvent.screenY;
|
||||
this.manipulateMode = this.MANIPULATE_NONE;
|
||||
aEvent.preventDefault();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<field name="screenLeft">0</field>
|
||||
<field name="screenTop">0</field>
|
||||
<field name="manipulateMode">0</field>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="mousedown" phase="capturing">
|
||||
<![CDATA[
|
||||
this.boxObject.captureMouseEvents = true;
|
||||
this.screenLeft = event.screenX;
|
||||
this.screenTop = event.screenY;
|
||||
this.setMode(event);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="mouseup" phase="capturing">
|
||||
<![CDATA[
|
||||
this.cleanUp(event);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="mousemove" phase="capturing">
|
||||
<![CDATA[
|
||||
this.handleMouseMove(event);
|
||||
event.preventDefault();
|
||||
]]>
|
||||
</handler>
|
||||
<!-- clean up, release the mouse, etc -->
|
||||
<handler event="popuphiding">
|
||||
<![CDATA[
|
||||
this.cleanUp(event);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
// Hide the popup if the [X] box is clicked.
|
||||
// XXXben this may not really belong here, but rather in a derived binding.
|
||||
if (event.originalTarget.className.indexOf("popupClose") != -1)
|
||||
this.popupBoxObject.hidePopup();
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="popup-scrollbars" extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
<content>
|
||||
<xul:hbox class="popup-internal-box" flex="1" orient="vertical" style="overflow: auto;">
|
||||
<children/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="floater-normal" extends="chrome://global/content/bindings/popup.xml#floater-base">
|
||||
<content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
|
||||
<vbox class="floater-box" flex="1">
|
||||
<box class="floater-box-top">
|
||||
<titlebar flex="1" xbl:inherits="title" style="border: 1px outset grey; background-color: grey;"/>
|
||||
</box>
|
||||
<box class="floater-box-center" flex="1">
|
||||
<box class="floater-children" flex="1">
|
||||
<children/>
|
||||
</box>
|
||||
</box>
|
||||
<box class="floater-box-bottom">
|
||||
<resizer direction="bottom" flex="1"/>
|
||||
<resizer direction="bottomright" tooltiptext="Click and drag to resize"/>
|
||||
</box>
|
||||
</vbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="floater-dock-left" extends="chrome://global/content/bindings/popup.xml#floater-base">
|
||||
<content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
|
||||
<vbox class="floater-box" flex="1">
|
||||
<box class="floater-box-top">
|
||||
<titlebar flex="1" xbl:inherits="title"/>
|
||||
</box>
|
||||
<box class="floater-box-center" flex="1">
|
||||
<box class="floater-children" flex="1">
|
||||
<children/>
|
||||
</box>
|
||||
<resizer direction="right" tooltiptext="Click and drag to resize"/>
|
||||
</box>
|
||||
</vbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="close-button" extends="chrome://global/content/bindings/button.xml#button-base">
|
||||
<content>
|
||||
<xul:hbox align="center" flex="1">
|
||||
<xul:image class="close-button-x"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="progressmeterBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="progressmeter">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/progressmeter.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:spacer class="progress-bar" xbl:inherits="mode"/>
|
||||
<xul:spacer class="progress-remainder" xbl:inherits="mode"/>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="label" onset="if (this.label != val) this.setAttribute('label',val); return val;"
|
||||
onget="return this.getAttribute('label');"/>
|
||||
|
||||
<property name="mode" onset="if (this.mode != val) this.setAttribute('mode', val); return val;"
|
||||
onget="return this.getAttribute('mode');"/>
|
||||
|
||||
<property name="value" onget="return this.getAttribute('value');">
|
||||
<setter><![CDATA[
|
||||
var p = Math.round(val);
|
||||
var c = this.value;
|
||||
if (p != c) {
|
||||
var delta = p - c;
|
||||
if (delta < 0)
|
||||
delta = -delta;
|
||||
if (delta > 3 || p == 0 || p == 100) {
|
||||
this.setAttribute("value", p);
|
||||
// Fire DOM event so that accessible value change events occur
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent('ValueChange', true, true);
|
||||
this.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
return p;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULProgressMeter;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="progressmeter-undetermined"
|
||||
extends="chrome://global/content/bindings/progressmeter.xml#progressmeter">
|
||||
<content>
|
||||
<xul:stack class="progress-remainder" flex="1" anonid="stack" style="overflow: -moz-hidden-unscrollable;">
|
||||
<xul:spacer class="progress-bar" anonid="spacer" top="0" style="margin-right: -1000px;"/>
|
||||
</xul:stack>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="init">
|
||||
<body><![CDATA[
|
||||
var stack = document.getAnonymousElementByAttribute(this, "anonid", "stack");
|
||||
var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
|
||||
var position = -1;
|
||||
var interval = setInterval(function nextStep() {
|
||||
try {
|
||||
var width = stack.boxObject.width >> 2;
|
||||
spacer.height = stack.boxObject.height;
|
||||
spacer.width = width;
|
||||
spacer.left = width * position;
|
||||
position += 15 / (width + 150);
|
||||
if (position >= 4)
|
||||
position = -1;
|
||||
} catch (e) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 20);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<constructor>this.init();</constructor>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,470 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="radioBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="radiogroup" extends="chrome://global/content/bindings/general.xml#basecontrol">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/radio.css"/>
|
||||
</resources>
|
||||
|
||||
<implementation implements="nsIDOMXULSelectControlElement, nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULRadioGroup;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="value" onget="return this.getAttribute('value');">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this.setAttribute("value", val);
|
||||
var children = this._getRadioChildren();
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
if (String(children[i].value) == String(val)) {
|
||||
this.selectedItem = children[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
<property name="disabled">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (this.getAttribute('disabled') == 'true')
|
||||
return true;
|
||||
var children = this._getRadioChildren();
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (!children[i].hidden && !children[i].collapsed && !children[i].disabled)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val)
|
||||
this.setAttribute('disabled', 'true');
|
||||
else
|
||||
this.removeAttribute('disabled');
|
||||
var children = this._getRadioChildren();
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
children[i].disabled = val;
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="itemCount" readonly="true"
|
||||
onget="return this._getRadioChildren().length"/>
|
||||
|
||||
<property name="selectedIndex">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var children = this._getRadioChildren();
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (children[i].selected)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this.selectedItem = this._getRadioChildren()[val];
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedItem">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var children = this._getRadioChildren();
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (children[i].selected)
|
||||
return children[i];
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var focused = this.getAttribute("focused") == "true";
|
||||
var alreadySelected = false;
|
||||
|
||||
if (val) {
|
||||
alreadySelected = val.getAttribute("selected") == "true";
|
||||
val.setAttribute("focused", focused);
|
||||
val.setAttribute("selected", "true");
|
||||
this.setAttribute("value", val.value);
|
||||
}
|
||||
|
||||
// uncheck all other group nodes
|
||||
var children = this._getRadioChildren();
|
||||
var previousItem = null;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (children[i] != val) {
|
||||
if (children[i].getAttribute("selected") == "true")
|
||||
previousItem = children[i];
|
||||
|
||||
children[i].removeAttribute("selected");
|
||||
children[i].removeAttribute("focused");
|
||||
}
|
||||
}
|
||||
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("select", false, true);
|
||||
this.dispatchEvent(event);
|
||||
|
||||
if (!alreadySelected && focused) {
|
||||
// Only report if actual change
|
||||
var myEvent;
|
||||
if (val) {
|
||||
myEvent = document.createEvent("Events");
|
||||
myEvent.initEvent("RadioStateChange", true, true);
|
||||
val.dispatchEvent(myEvent);
|
||||
}
|
||||
|
||||
if (previousItem) {
|
||||
myEvent = document.createEvent("Events");
|
||||
myEvent.initEvent("RadioStateChange", true, true);
|
||||
previousItem.dispatchEvent(myEvent);
|
||||
}
|
||||
}
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="focusedItem">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var children = this._getRadioChildren();
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (children[i].getAttribute("focused") == "true")
|
||||
return children[i];
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val) val.setAttribute("focused", "true");
|
||||
|
||||
// unfocus all other group nodes
|
||||
var children = this._getRadioChildren();
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (children[i] != val)
|
||||
children[i].removeAttribute("focused");
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="checkAdjacentElement">
|
||||
<parameter name="aNextFlag"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var currentElement = this.focusedItem;
|
||||
var i;
|
||||
var children = this._getRadioChildren();
|
||||
for (i = 0; i < children.length; ++i ) {
|
||||
if (children[i] == currentElement)
|
||||
break;
|
||||
}
|
||||
var index = i;
|
||||
|
||||
if (aNextFlag) {
|
||||
do {
|
||||
if (++i == children.length)
|
||||
i = 0;
|
||||
if (i == index)
|
||||
break;
|
||||
}
|
||||
while (children[i].hidden || children[i].collapsed || children[i].disabled);
|
||||
// XXX check for display/visibility props too
|
||||
|
||||
this.selectedItem = children[i];
|
||||
children[i].doCommand();
|
||||
}
|
||||
else {
|
||||
do {
|
||||
if (i == 0)
|
||||
i = children.length;
|
||||
if (--i == index)
|
||||
break;
|
||||
}
|
||||
while (children[i].hidden || children[i].collapsed || children[i].disabled);
|
||||
// XXX check for display/visibility props too
|
||||
|
||||
this.selectedItem = children[i];
|
||||
children[i].doCommand();
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<field name="mRadioChildren">null</field>
|
||||
<method name="_getRadioChildren">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.mRadioChildren)
|
||||
return this.mRadioChildren;
|
||||
|
||||
// Don't store the collected child nodes immediately,
|
||||
// collecting the child nodes could trigger constructors
|
||||
// which would blow away our list.
|
||||
var radioChildren = [];
|
||||
var iterator = this.ownerDocument.createTreeWalker(this, NodeFilter.SHOW_ELEMENT, this._filterRadioGroup, true);
|
||||
while (iterator.nextNode())
|
||||
radioChildren.push(iterator.currentNode);
|
||||
return this.mRadioChildren = radioChildren;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="_filterRadioGroup">
|
||||
<parameter name="node"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
switch (node.localName) {
|
||||
case "radio": return NodeFilter.FILTER_ACCEPT;
|
||||
case "template":
|
||||
case "radiogroup": return NodeFilter.FILTER_REJECT;
|
||||
default: return NodeFilter.FILTER_SKIP;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="getIndexOfItem">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
return this._getRadioChildren().indexOf(item);
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="getItemAtIndex">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var children = this._getRadioChildren();
|
||||
return (index >= 0 && index < children.length) ? children[index] : null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var radio = document.createElementNS(XULNS, "radio");
|
||||
radio.setAttribute("label", label);
|
||||
radio.setAttribute("value", value);
|
||||
this.appendChild(radio);
|
||||
this.mRadioChildren = null;
|
||||
return radio;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="insertItemAt">
|
||||
<parameter name="index"/>
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var radio = document.createElementNS(XULNS, "radio");
|
||||
radio.setAttribute("label", label);
|
||||
radio.setAttribute("value", value);
|
||||
var before = this.getItemAtIndex(index);
|
||||
if (before)
|
||||
before.parentNode.insertBefore(radio, before);
|
||||
else
|
||||
this.appendChild(radio);
|
||||
this.mRadioChildren = null;
|
||||
return radio;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemAt">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var remove = this.getItemAtIndex(index);
|
||||
if (remove) {
|
||||
remove.parentNode.removeChild(remove);
|
||||
this.mRadioChildren = null;
|
||||
}
|
||||
return remove;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mousedown">
|
||||
if (this.disabled)
|
||||
event.preventDefault();
|
||||
</handler>
|
||||
|
||||
<!-- keyboard navigation -->
|
||||
<!-- Here's how keyboard navigation works in radio groups on Windows:
|
||||
The group takes 'focus'
|
||||
The user is then free to navigate around inside the group
|
||||
using the arrow keys. Accessing previous or following radio buttons
|
||||
is done solely through the arrow keys and not the tab button. Tab
|
||||
takes you to the next widget in the tab order -->
|
||||
<handler event="keypress" key=" " phase="target">
|
||||
this.selectedItem = this.focusedItem;
|
||||
this.selectedItem.doCommand();
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_UP" phase="target">
|
||||
this.checkAdjacentElement(false);
|
||||
event.stopPropagation();
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_LEFT" phase="target">
|
||||
// left arrow goes back when we are ltr, forward when we are rtl
|
||||
this.checkAdjacentElement(document.defaultView.getComputedStyle(
|
||||
this, "").direction == "rtl");
|
||||
event.stopPropagation();
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_DOWN" phase="target">
|
||||
this.checkAdjacentElement(true);
|
||||
event.stopPropagation();
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_RIGHT" phase="target">
|
||||
// right arrow goes forward when we are ltr, back when we are rtl
|
||||
this.checkAdjacentElement(document.defaultView.getComputedStyle(
|
||||
this, "").direction == "ltr");
|
||||
event.stopPropagation();
|
||||
</handler>
|
||||
|
||||
<!-- set a focused attribute on the selected item when the group
|
||||
receives focus so that we can style it as if it were focused even though
|
||||
it is not (Windows platform behaviour is for the group to receive focus,
|
||||
not the item -->
|
||||
<handler event="focus" phase="target">
|
||||
<![CDATA[
|
||||
this.setAttribute("focused", "true");
|
||||
if (this.focusedItem)
|
||||
return;
|
||||
|
||||
var val = this.selectedItem;
|
||||
if (!val || val.disabled || val.hidden || val.collapsed) {
|
||||
var children = this._getRadioChildren();
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (!children[i].hidden && !children[i].collapsed && !children[i].disabled) {
|
||||
val = children[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.focusedItem = val;
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="blur" phase="target">
|
||||
this.removeAttribute("focused");
|
||||
this.focusedItem = null;
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="radio" extends="chrome://global/content/bindings/general.xml#control-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/radio.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:image class="radio-check" xbl:inherits="disabled,selected"/>
|
||||
<xul:hbox class="radio-label-box" flex="1">
|
||||
<xul:image class="radio-icon" xbl:inherits="src"/>
|
||||
<xul:label class="radio-label" xbl:inherits="xbl:text=label,accesskey,crop" flex="1"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULSelectControlItemElement, nsIDOMXULLabeledControlElement, nsIAccessibleProvider">
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
// Just clear out the parent's cached list of radio children
|
||||
this.radioGroup.mRadioChildren = null;
|
||||
]]>
|
||||
</constructor>
|
||||
<destructor>
|
||||
<![CDATA[
|
||||
var radioList = this.radioGroup.mRadioChildren;
|
||||
if (!radioList)
|
||||
return;
|
||||
for (var i = 0; i < radioList.length; ++i) {
|
||||
if (radioList[i] == this) {
|
||||
radioList.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</destructor>
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULRadioButton;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
<property name="selected" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.hasAttribute('selected');
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
<property name="radioGroup">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var parent = this.parentNode;
|
||||
while (parent) {
|
||||
if (parent.localName == "radiogroup")
|
||||
return parent;
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="click" button="0">
|
||||
<![CDATA[
|
||||
if (!this.disabled)
|
||||
this.radioGroup.selectedItem = this;
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="mousedown" button="0">
|
||||
<![CDATA[
|
||||
if (!this.disabled)
|
||||
this.radioGroup.focusedItem = this;
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="focus">
|
||||
<![CDATA[
|
||||
if (!this.disabled) {
|
||||
this.radioGroup.focusedItem = this;
|
||||
this.radioGroup.focus();
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
</bindings>
|
|
@ -1,168 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="scaleBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="scalethumb" extends="xul:button">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/scale.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="scaleslider" display="xul:slider"
|
||||
extends="chrome://global/content/bindings/general.xml#basecontrol">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/scale.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="scale"
|
||||
extends="chrome://global/content/bindings/general.xml#basecontrol">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/scale.css"/>
|
||||
</resources>
|
||||
|
||||
<content align="center" pack="center">
|
||||
<xul:slider anonid="slider" class="scale-slider" snap="true" flex="1"
|
||||
xbl:inherits="disabled,orient,curpos=value,minpos=min,maxpos=max,increment,pageincrement">
|
||||
<xul:thumb class="scale-thumb" xbl:inherits="disabled,orient"/>
|
||||
</xul:slider>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="value" onget="return this._getIntegerAttribute('curpos', 0);"
|
||||
onset="return this._setIntegerAttribute('curpos', val);"/>
|
||||
<property name="min" onget="return this._getIntegerAttribute('minpos', 0);"
|
||||
onset="return this._setIntegerAttribute('minpos', val);"/>
|
||||
<property name="max" onget="return this._getIntegerAttribute('maxpos', 100);"
|
||||
onset="return this._setIntegerAttribute('maxpos', val);"/>
|
||||
<property name="increment" onget="return this._getIntegerAttribute('increment', 1);"
|
||||
onset="return this._setIntegerAttribute('increment', val);"/>
|
||||
<property name="pageIncrement" onget="return this._getIntegerAttribute('pageincrement', 10);"
|
||||
onset="return this._setIntegerAttribute('pageincrement', val);"/>
|
||||
|
||||
<field name="_sliderElement"/>
|
||||
<property name="_slider" readonly="true">
|
||||
<getter>
|
||||
if (!this._sliderElement)
|
||||
this._sliderElement = document.getAnonymousElementByAttribute(this, "anonid", "slider");
|
||||
return this._sliderElement;
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="_getIntegerAttribute">
|
||||
<parameter name="aAttr"/>
|
||||
<parameter name="aDefaultValue"/>
|
||||
<body>
|
||||
var value = this._slider.getAttribute(aAttr);
|
||||
var intvalue = parseInt(value, 10);
|
||||
if (!isNaN(intvalue))
|
||||
return intvalue;
|
||||
return aDefaultValue;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_setIntegerAttribute">
|
||||
<parameter name="aAttr"/>
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
var intvalue = parseInt(aValue, 10);
|
||||
if (!isNaN(intvalue)) this._slider.setAttribute(aAttr, intvalue);
|
||||
return aValue;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="decrease">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var newpos = this.value - this.increment;
|
||||
var startpos = this.min;
|
||||
this.value = (newpos > startpos) ? newpos : startpos;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="increase">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var newpos = this.value + this.increment;
|
||||
var endpos = this.max;
|
||||
this.value = (newpos < endpos) ? newpos : endpos;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="decreasePage">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var newpos = this.value - this.pageIncrement;
|
||||
var startpos = this.min;
|
||||
this.value = (newpos > startpos) ? newpos : startpos;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="increasePage">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var newpos = this.value + this.pageIncrement;
|
||||
var endpos = this.max;
|
||||
this.value = (newpos < endpos) ? newpos : endpos;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="DOMAttrModified">
|
||||
if (event.originalTarget != this._slider)
|
||||
return;
|
||||
|
||||
switch (event.attrName) {
|
||||
case "curpos":
|
||||
this.setAttribute("value", event.newValue);
|
||||
|
||||
var changeEvent = document.createEvent("Events");
|
||||
changeEvent.initEvent("change", false, true);
|
||||
this.dispatchEvent(changeEvent);
|
||||
break;
|
||||
|
||||
case "minpos":
|
||||
this.setAttribute("min", event.newValue);
|
||||
break;
|
||||
|
||||
case "maxpos":
|
||||
this.setAttribute("max", event.newValue);
|
||||
break;
|
||||
}
|
||||
</handler>
|
||||
|
||||
<handler event="keypress" keycode="VK_UP" preventdefault="true">
|
||||
this.decrease();
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_LEFT" preventdefault="true">
|
||||
this.decrease();
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_DOWN" preventdefault="true">
|
||||
this.increase();
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_RIGHT" preventdefault="true">
|
||||
this.increase();
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_PAGE_UP" preventdefault="true">
|
||||
this.decreasePage();
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_PAGE_DOWN" preventdefault="true">
|
||||
this.increasePage();
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_HOME" preventdefault="true">
|
||||
this.value = this.min;
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_END" preventdefault="true">
|
||||
this.value = this.max;
|
||||
</handler>
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
</bindings>
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="scrollbarBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="thumb" extends="xul:button">
|
||||
<content>
|
||||
<xul:gripper/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="scrollbar-base">
|
||||
<handlers>
|
||||
<handler event="contextmenu" preventdefault="true" action="event.stopPropagation();"/>
|
||||
<handler event="click" preventdefault="true" action="event.stopPropagation();"/>
|
||||
<handler event="dblclick" action="event.stopPropagation();"/>
|
||||
<handler event="command" action="event.stopPropagation();"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="scrollbar" extends="chrome://global/content/bindings/scrollbar.xml#scrollbar-base">
|
||||
<content>
|
||||
<xul:scrollbarbutton sbattr="scrollbar-up-top" type="decrement" xbl:inherits="disabled,sborient=orient"/>
|
||||
<xul:scrollbarbutton sbattr="scrollbar-down-top" type="increment" xbl:inherits="disabled,sborient=orient"/>
|
||||
<xul:slider flex="1" xbl:inherits="disabled,curpos,maxpos,pageincrement,increment,orient,sborient=orient">
|
||||
<xul:thumb sbattr="scrollbar-thumb" xbl:inherits="orient,sborient=orient,collapsed=disabled"
|
||||
align="center" pack="center"/>
|
||||
</xul:slider>
|
||||
<xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement" xbl:inherits="disabled,sborient=orient"/>
|
||||
<xul:scrollbarbutton sbattr="scrollbar-down-bottom" type="increment" xbl:inherits="disabled,sborient=orient"/>
|
||||
</content>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="arrowscrollboxBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="scrollbox-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/scrollbox.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="scrollbox" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
|
||||
<content>
|
||||
<xul:box class="box-inherit scrollbox-innerbox" xbl:inherits="orient,align,pack,dir">
|
||||
<children/>
|
||||
</xul:box>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="arrowscrollbox" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
|
||||
<content>
|
||||
<xul:autorepeatbutton class="autorepeatbutton-up" collapsed="true"
|
||||
oncommand="this.parentNode.scrollByIndex(-1); event.stopPropagation();"/>
|
||||
<xul:scrollbox xbl:inherits="orient,align,pack,dir" flex="1">
|
||||
<children/>
|
||||
</xul:scrollbox>
|
||||
<xul:autorepeatbutton class="autorepeatbutton-down" collapsed="true"
|
||||
oncommand="this.parentNode.scrollByIndex(1); event.stopPropagation();"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="scrollByIndex">
|
||||
<parameter name="lines"/>
|
||||
<body><![CDATA[
|
||||
if (!("mScrollBoxObject" in this)) {
|
||||
var kids = document.getAnonymousNodes(this);
|
||||
this.mScrollBoxObject = kids[1].boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
|
||||
}
|
||||
|
||||
this.mScrollBoxObject.scrollByIndex(lines);
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="DOMMouseScroll" action="this.scrollByIndex(event.detail); event.stopPropagation();"/>
|
||||
|
||||
<handler event="underflow"><![CDATA[
|
||||
// XXX Workaround for unexpected events dispatched during scrollbox
|
||||
// destruction (bug 341047).
|
||||
if (this.boxObject.width <= 0)
|
||||
return;
|
||||
|
||||
var kids = document.getAnonymousNodes(this);
|
||||
kids[0].collapsed = true;
|
||||
kids[2].collapsed = true;
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
|
||||
<handler event="overflow"><![CDATA[
|
||||
// XXX Workaround for unexpected events dispatched during scrollbox
|
||||
// destruction (bug 341047).
|
||||
if (this.boxObject.width <= 0)
|
||||
return;
|
||||
|
||||
var kids = document.getAnonymousNodes(this);
|
||||
kids[0].collapsed = false;
|
||||
kids[2].collapsed = false;
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="autorepeatbutton" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
|
||||
<content repeat="hover">
|
||||
<xul:image class="autorepeatbutton-icon"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="splitterBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="splitter" extends="xul:splitter">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/splitter.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="grippy" extends="xul:button">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/splitter.css"/>
|
||||
</resources>
|
||||
<handlers>
|
||||
<handler event="command">
|
||||
<![CDATA[
|
||||
var splitter = this.parentNode;
|
||||
if (splitter) {
|
||||
var state = splitter.getAttribute("state");
|
||||
if (state == "collapsed")
|
||||
splitter.setAttribute("state", "open");
|
||||
else
|
||||
splitter.setAttribute("state", "collapsed");
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,97 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="stringBundleBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="stringbundleset" extends="xul:box"/>
|
||||
|
||||
<binding id="stringbundle" extends="xul:spacer">
|
||||
<implementation name="XStringBundle">
|
||||
|
||||
<method name="getString">
|
||||
<parameter name="aStringKey"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
return this.stringBundle.GetStringFromName(aStringKey);
|
||||
}
|
||||
catch (e) {
|
||||
dump("*** Failed to get string " + aStringKey + " in bundle: " + this.src + "\n");
|
||||
throw e;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="getFormattedString">
|
||||
<parameter name="aStringKey"/>
|
||||
<parameter name="aStringsArray"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
return this.stringBundle.formatStringFromName(aStringKey, aStringsArray, aStringsArray.length);
|
||||
}
|
||||
catch (e) {
|
||||
dump("*** Failed to format string " + aStringKey + " in bundle: " + this.src + "\n");
|
||||
throw e;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="stringBundle" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (!this._bundle) {
|
||||
try {
|
||||
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
this._bundle = stringBundleService.createBundle(this.src, this.appLocale);
|
||||
}
|
||||
catch (e) {
|
||||
dump("Failed to get stringbundle:\n");
|
||||
dump(e + "\n");
|
||||
}
|
||||
}
|
||||
return this._bundle;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="src">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.getAttribute("src");
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this._bundle = null;
|
||||
this.setAttribute("src", val);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="appLocale">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
try {
|
||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||
.getService(Components.interfaces.nsILocaleService);
|
||||
return localeService.getApplicationLocale();
|
||||
}
|
||||
catch (ex) {
|
||||
return null;
|
||||
}
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<field name="_bundle">null</field>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,616 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="tabBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="tab-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/tabbox.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="tabbox"
|
||||
extends="chrome://global/content/bindings/tabbox.xml#tab-base">
|
||||
<implementation implements="nsIDOMEventListener, nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULTabBox;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="handleCtrlTab">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this.setAttribute("handleCtrlTab", val);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return (this.getAttribute("handleCtrlTab") != "false");
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="handleCtrlPageUpDown">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this.setAttribute("handleCtrlPageUpDown", val);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return (this.getAttribute("handleCtrlPageUpDown") != "false");
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="tabs">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var tabs = this.getElementsByTagNameNS(
|
||||
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
|
||||
"tabs");
|
||||
return tabs.length ? tabs[0] : null;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="tabpanels">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var tabpanels = this.getElementsByTagNameNS(
|
||||
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
|
||||
"tabpanels");
|
||||
return tabpanels.length ? tabpanels[0] : null;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="selectedIndex"
|
||||
onget="return this.tabs ? this.tabs.selectedIndex : -1;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (this.tabs)
|
||||
this.tabs.selectedIndex = val;
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedTab"
|
||||
onget="return this.tabs ? this.tabs.selectedItem : null;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val && this.tabs)
|
||||
this.tabs.selectedItem = val;
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedPanel"
|
||||
onget="return this.tabpanels ? this.tabpanels.selectedPanel : null;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val && this.tabpanels)
|
||||
this.tabpanels.selectedPanel = val;
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="handleEvent">
|
||||
<parameter name="event"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!event.isTrusted) {
|
||||
// Don't let untrusted events mess with tabs.
|
||||
return;
|
||||
}
|
||||
|
||||
const handleMetaAltArrows = /Mac/.test(navigator.platform);
|
||||
|
||||
switch (event.keyCode) {
|
||||
case event.DOM_VK_TAB:
|
||||
if (event.ctrlKey && !event.altKey && !event.metaKey)
|
||||
if (this.tabs && this.handleCtrlTab) {
|
||||
this.tabs.advanceSelectedTab(event.shiftKey ? -1 : 1);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
case event.DOM_VK_PAGE_UP:
|
||||
if (event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey)
|
||||
if (this.tabs && this.handleCtrlPageUpDown) {
|
||||
this.tabs.advanceSelectedTab(-1);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
case event.DOM_VK_PAGE_DOWN:
|
||||
if (event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey)
|
||||
if (this.tabs && this.handleCtrlPageUpDown) {
|
||||
this.tabs.advanceSelectedTab(1);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
case event.DOM_VK_LEFT:
|
||||
if (event.metaKey && event.altKey && !event.shiftKey && !event.ctrlKey)
|
||||
if (this.tabbox.tabs && handleMetaAltArrows) {
|
||||
var offset = window.getComputedStyle(this.tabbox, "")
|
||||
.direction == "ltr" ? -1 : 1;
|
||||
this.tabbox.tabs.advanceSelectedTab(offset);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
case event.DOM_VK_RIGHT:
|
||||
if (event.metaKey && event.altKey && !event.shiftKey && !event.ctrlKey)
|
||||
if (this.tabbox.tabs && handleMetaAltArrows) {
|
||||
var offset = window.getComputedStyle(this.tabbox, "")
|
||||
.direction == "ltr" ? 1 : -1;
|
||||
this.tabbox.tabs.advanceSelectedTab(offset);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="_eventNode">this</field>
|
||||
|
||||
<property name="eventNode" onget="return this._eventNode;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val != this._eventNode) {
|
||||
val.addEventListener("keypress", this, false);
|
||||
this._eventNode.removeEventListener("keypress", this, false);
|
||||
this._eventNode = val;
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<constructor>
|
||||
switch (this.getAttribute("eventnode")) {
|
||||
case "parent": this._eventNode = this.parentNode; break;
|
||||
case "window": this._eventNode = window; break;
|
||||
case "document": this._eventNode = document; break;
|
||||
}
|
||||
this._eventNode.addEventListener("keypress", this, false);
|
||||
</constructor>
|
||||
|
||||
<destructor>
|
||||
this._eventNode.removeEventListener("keypress", this, false);
|
||||
</destructor>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="tabs"
|
||||
extends="chrome://global/content/bindings/general.xml#basecontrol">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/tabbox.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:spacer class="tabs-left"/>
|
||||
<children/>
|
||||
<xul:spacer class="tabs-right" flex="1"/>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULSelectControlElement, nsIAccessibleProvider">
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
// first and last tabs need to be able to have unique styles
|
||||
// and also need to select first tab on startup.
|
||||
if (this.firstChild)
|
||||
this.firstChild.setAttribute("first-tab", "true");
|
||||
if (this.lastChild)
|
||||
this.lastChild.setAttribute("last-tab", "true");
|
||||
this.selectedIndex = 0;
|
||||
var o = this.getAttribute("orient");
|
||||
if (!o)
|
||||
this.setAttribute("orient", "horizontal");
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULTabs;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="itemCount" readonly="true"
|
||||
onget="return this.childNodes.length"/>
|
||||
|
||||
<property name="selectedIndex">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
const tabs = this.childNodes;
|
||||
for (var i = 0; i < tabs.length; i++) {
|
||||
if (tabs[i].selected)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
]]>
|
||||
</getter>
|
||||
|
||||
<setter>
|
||||
<![CDATA[
|
||||
const tabs = this.childNodes;
|
||||
if (0 <= val && val < tabs.length && !tabs[val].selected) {
|
||||
|
||||
for (var i = 0; i < tabs.length; i++)
|
||||
if (i != val && tabs[i].selected)
|
||||
tabs[i]._selected = false;
|
||||
|
||||
tabs[val]._selected = true;
|
||||
|
||||
for (var parent = this.parentNode; parent; parent = parent.parentNode) {
|
||||
if (parent.localName == 'tabbox') {
|
||||
var tabpanels = parent.tabpanels;
|
||||
// This will cause an onselect event to fire for the tabpanel element.
|
||||
if (tabpanels) {
|
||||
// find an id
|
||||
var linkedPanelId = tabs[val].linkedPanel;
|
||||
var linkedPanel = linkedPanelId ? document.getElementById(linkedPanelId) : null;
|
||||
if (linkedPanel)
|
||||
tabpanels.selectedPanel = linkedPanel;
|
||||
else
|
||||
tabpanels.selectedIndex = val;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Fire an onselect event for the tabs element.
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent('select', true, true);
|
||||
this.dispatchEvent(event);
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedItem">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
const tabs = this.childNodes;
|
||||
for (var i = 0; i < tabs.length; i++) {
|
||||
if (tabs[i].selected)
|
||||
return tabs[i];
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val && !val.selected) {
|
||||
const tabs = this.childNodes;
|
||||
for (var i = 0; i < tabs.length; i++)
|
||||
if (tabs[i] == val)
|
||||
this.selectedIndex = i;
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="getIndexOfItem">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var children = this.childNodes;
|
||||
var i = children.length;
|
||||
while (i--)
|
||||
if (children[i] == item)
|
||||
return i;
|
||||
return -1;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="getItemAtIndex">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var children = this.childNodes;
|
||||
if (index >= 0 && index < children.length)
|
||||
return children[index];
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_selectNewTab">
|
||||
<parameter name="aNewTab"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var isTabFocused = false;
|
||||
try {
|
||||
isTabFocused =
|
||||
(document.commandDispatcher.focusedElement == this.selectedItem);
|
||||
} catch (e) {}
|
||||
this.selectedItem = aNewTab;
|
||||
if (isTabFocused) {
|
||||
aNewTab.focus();
|
||||
}
|
||||
else if (this.getAttribute("setfocus") != "false") {
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(aNewTab);
|
||||
|
||||
// Make sure that the focus doesn't move outside the tabbox
|
||||
for (var parent = this.parentNode; parent; parent = parent.parentNode) {
|
||||
if (parent.localName == "tabbox") {
|
||||
try {
|
||||
var el = document.commandDispatcher.focusedElement;
|
||||
while (el && el != parent)
|
||||
el = el.parentNode;
|
||||
if (el != parent)
|
||||
aNewTab.focus();
|
||||
} catch(e) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="advanceSelectedTab">
|
||||
<parameter name="aDir"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var startTab = this.selectedItem;
|
||||
var next = aDir < 0 ? startTab.previousSibling : startTab.nextSibling;
|
||||
|
||||
while (next != startTab && (!next || next.getAttribute("hidden"))) {
|
||||
if (next && next.getAttribute("hidden"))
|
||||
next = aDir < 0 ? next.previousSibling : next.nextSibling;
|
||||
if (!next)
|
||||
next = aDir < 0 ? this.lastChild : this.firstChild;
|
||||
}
|
||||
|
||||
if (next && next != startTab) {
|
||||
this._selectNewTab(next);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var tab = document.createElementNS(XULNS, "tab");
|
||||
tab.setAttribute("label", label);
|
||||
tab.setAttribute("value", value);
|
||||
this.appendChild(tab);
|
||||
return tab;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="insertItemAt">
|
||||
<parameter name="index"/>
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var tab = document.createElementNS(XULNS, "tab");
|
||||
tab.setAttribute("label", label);
|
||||
tab.setAttribute("value", value);
|
||||
var before = this.getItemAtIndex(index);
|
||||
if (before)
|
||||
this.insertBefore(tab, before);
|
||||
else
|
||||
this.appendChild(tab);
|
||||
return tab;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemAt">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var remove = this.getItemAtIndex(index);
|
||||
if (remove)
|
||||
this.removeChild(remove);
|
||||
return remove;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="DOMMouseScroll" phase="capturing">
|
||||
<![CDATA[
|
||||
this.advanceSelectedTab(event.detail);
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="tabs-closebutton"
|
||||
extends="chrome://global/content/bindings/tabbox.xml#tabs">
|
||||
<content>
|
||||
<xul:stack>
|
||||
<xul:spacer class="tabs-left"/>
|
||||
<xul:toolbarbutton ondblclick="event.stopPropagation();" class="tabs-newbutton" xbl:inherits="oncommand=onnewtab,tooltiptext=tooltiptextnew"/>
|
||||
</xul:stack>
|
||||
<xul:hbox flex="1" style="min-width: 1px; overflow: -moz-hidden-unscrollable;">
|
||||
<children/>
|
||||
<xul:spacer class="tabs-right" flex="1"/>
|
||||
</xul:hbox>
|
||||
<xul:stack>
|
||||
<xul:spacer class="tabs-right"/>
|
||||
<xul:hbox class="tabs-closebutton-box" align="center" pack="end">
|
||||
<xul:toolbarbutton ondblclick="event.stopPropagation();" class="tabs-closebutton close-button" xbl:inherits="disabled=disableclose,oncommand=onclosetab"/>
|
||||
</xul:hbox>
|
||||
</xul:stack>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="tabpanels"
|
||||
extends="chrome://global/content/bindings/tabbox.xml#tab-base">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULTabPanels;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<field name="_selectedPanel">null</field>
|
||||
|
||||
<property name="selectedIndex">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var indexStr = this.getAttribute("selectedIndex");
|
||||
return indexStr ? parseInt(indexStr) : -1;
|
||||
]]>
|
||||
</getter>
|
||||
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var panel = this._selectedPanel;
|
||||
this._selectedPanel = this.childNodes[val];
|
||||
this.setAttribute("selectedIndex", val);
|
||||
if (this._selectedPanel != panel) {
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("select", true, true);
|
||||
this.dispatchEvent(event);
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedPanel">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this._selectedPanel;
|
||||
]]>
|
||||
</getter>
|
||||
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var selectedIndex = -1;
|
||||
for (var panel = val; panel != null; panel = panel.previousSibling)
|
||||
++selectedIndex;
|
||||
this.selectedIndex = selectedIndex;
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="tab" display="xul:button"
|
||||
extends="chrome://global/content/bindings/general.xml#control-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/tabbox.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:hbox class="tab-middle box-inherit" xbl:inherits="align,dir,pack,orient,selected" flex="1">
|
||||
<xul:image class="tab-icon" xbl:inherits="validate,src=image" anonid="tab-icon"/>
|
||||
<xul:label class="tab-text" xbl:inherits="value=label,accesskey,crop,disabled" flex="1"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULSelectControlItemElement, nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULTab;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="selected" readonly="true"
|
||||
onget="return this.getAttribute('selected') == 'true';"/>
|
||||
|
||||
<!-- XXX -->
|
||||
<property name="_selected">
|
||||
<getter>
|
||||
return this.getAttribute("selected") == "true" ? true : false;
|
||||
</getter>
|
||||
<setter>
|
||||
this.setAttribute("selected", val);
|
||||
if (this.previousSibling) {
|
||||
if (val)
|
||||
this.previousSibling.setAttribute("beforeselected", val);
|
||||
else
|
||||
this.previousSibling.removeAttribute("beforeselected");
|
||||
}
|
||||
if (this.nextSibling) {
|
||||
if (val)
|
||||
this.nextSibling.setAttribute("afterselected", val);
|
||||
else
|
||||
this.nextSibling.removeAttribute("afterselected");
|
||||
}
|
||||
return val;
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="linkedPanel" onget="return this.getAttribute('linkedpanel')"
|
||||
onset="this.setAttribute('linkedpanel', val); return val;"/>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click" button="0">
|
||||
<![CDATA[
|
||||
this.parentNode._selectNewTab(this);
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="keypress" keycode="VK_LEFT">
|
||||
<![CDATA[
|
||||
var direction = window.getComputedStyle(this.parentNode, null).direction;
|
||||
this.parentNode.advanceSelectedTab(direction == 'ltr' ? -1 : 1);
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="keypress" keycode="VK_RIGHT">
|
||||
<![CDATA[
|
||||
var direction = window.getComputedStyle(this.parentNode, null).direction;
|
||||
this.parentNode.advanceSelectedTab(direction == 'ltr' ? 1 : -1);
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="keypress" keycode="VK_UP">
|
||||
<![CDATA[
|
||||
this.parentNode.advanceSelectedTab(-1);
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="keypress" keycode="VK_DOWN">
|
||||
<![CDATA[
|
||||
this.parentNode.advanceSelectedTab(1);
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,293 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="textBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<!-- bound to <description>s -->
|
||||
<binding id="text-base" extends="chrome://global/content/bindings/general.xml#basecontrol">
|
||||
<implementation implements="nsIDOMXULDescriptionElement, nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULText;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
<property name="value" onget="return this.getAttribute('value');"
|
||||
onset="this.setAttribute('value', val); return val;"/>
|
||||
<property name="crop" onget="return this.getAttribute('crop');"
|
||||
onset="this.setAttribute('crop', val); return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="text-label" extends="chrome://global/content/bindings/text.xml#text-base">
|
||||
<implementation implements="nsIDOMXULLabelElement">
|
||||
<property name="accessKey">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accessKey = this.getAttribute('accesskey');
|
||||
return accessKey ? accessKey[0] : null;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this.setAttribute('accesskey', val);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="control" onget="return getAttribute('control');">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
// After this gets set, the label will use the binding #label-control
|
||||
this.setAttribute('control', val);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="label-control" extends="chrome://global/content/bindings/text.xml#text-label">
|
||||
<content>
|
||||
<html:span anonid="accessKeyParens"><children/></html:span>
|
||||
</content>
|
||||
<implementation implements="nsIDOMXULLabelElement">
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
try {
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
this.mUnderlineAccesskey = (prefs.getIntPref("ui.key.menuAccessKey") != 0);
|
||||
|
||||
const nsIPrefLocalizedString =
|
||||
Components.interfaces.nsIPrefLocalizedString;
|
||||
|
||||
const prefNameInsertSeparator =
|
||||
"intl.menuitems.insertseparatorbeforeaccesskeys";
|
||||
const prefNameAlwaysAppendAccessKey =
|
||||
"intl.menuitems.alwaysappendaccesskeys";
|
||||
|
||||
var val = prefs.getComplexValue(prefNameInsertSeparator,
|
||||
nsIPrefLocalizedString).data;
|
||||
this.mInsertSeparator = (val == "true");
|
||||
|
||||
val = prefs.getComplexValue(prefNameAlwaysAppendAccessKey,
|
||||
nsIPrefLocalizedString).data;
|
||||
this.mAlwaysAppendAccessKey = (val == "true");
|
||||
}
|
||||
catch (e) { }
|
||||
this.formatAccessKey();
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<method name="formatAccessKey">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this.mUnderlineAccesskey)
|
||||
return;
|
||||
|
||||
var control = this.labeledControlElement;
|
||||
if (!control) {
|
||||
var bindingParent = document.getBindingParent(this);
|
||||
if (bindingParent instanceof Components.interfaces.nsIDOMXULLabeledControlElement) {
|
||||
control = bindingParent; // For controls that make the <label> an anon child
|
||||
}
|
||||
}
|
||||
if (control) {
|
||||
control.labelElement = this;
|
||||
}
|
||||
|
||||
var afterLabel = document.getAnonymousElementByAttribute(this, "anonid", "accessKeyParens");
|
||||
afterLabel.textContent = ""; // This does not clear real nodes!
|
||||
|
||||
var oldAccessKey = this.getElementsByAttribute('class', 'accesskey').item(0);
|
||||
if (oldAccessKey) { // Clear old accesskey
|
||||
this.mergeElement(oldAccessKey);
|
||||
}
|
||||
|
||||
var oldHiddenSpan =
|
||||
this.getElementsByAttribute('class', 'hiddenColon').item(0);
|
||||
if (oldHiddenSpan) {
|
||||
this.mergeElement(oldHiddenSpan);
|
||||
}
|
||||
|
||||
var accessKey = this.accessKey;
|
||||
var labelText = this.textContent;
|
||||
if (!accessKey || !labelText || !control) {
|
||||
return;
|
||||
}
|
||||
var accessKeyIndex = -1;
|
||||
if (!this.mAlwaysAppendAccessKey) {
|
||||
accessKeyIndex = labelText.indexOf(accessKey);
|
||||
if (accessKeyIndex < 0) { // Try again in upper case
|
||||
accessKeyIndex =
|
||||
labelText.toUpperCase().indexOf(accessKey.toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
var span = document.createElementNS(HTML_NS, "span");
|
||||
span.className = "accesskey";
|
||||
|
||||
// Note that if you change the following code, see the comment of
|
||||
// nsTextBoxFrame::UpdateAccessTitle.
|
||||
|
||||
// If accesskey is not in string, append in parentheses
|
||||
if (accessKeyIndex < 0) {
|
||||
// If end is colon, we should insert before colon.
|
||||
// i.e., "label:" -> "label(X):"
|
||||
var colonHidden = false;
|
||||
if (/:$/.test(labelText)) {
|
||||
labelText = labelText.slice(0, -1);
|
||||
var hiddenSpan = document.createElementNS(HTML_NS, "span");
|
||||
hiddenSpan.className = "hiddenColon";
|
||||
hiddenSpan.style.display = "none";
|
||||
// Hide the last colon by using span element.
|
||||
// I.e., label<span style="display:none;">:</span>
|
||||
this.wrapChar(hiddenSpan, labelText.length);
|
||||
colonHidden = true;
|
||||
}
|
||||
// If end is space(U+20),
|
||||
// we should not add space before parentheses.
|
||||
var endIsSpace = false;
|
||||
if (/ $/.test(labelText)) {
|
||||
endIsSpace = true;
|
||||
}
|
||||
if (this.mInsertSeparator && !endIsSpace)
|
||||
afterLabel.textContent = " (";
|
||||
else
|
||||
afterLabel.textContent = "(";
|
||||
span.textContent = accessKey.toUpperCase();
|
||||
afterLabel.appendChild(span);
|
||||
if (!colonHidden)
|
||||
afterLabel.appendChild(document.createTextNode(")"));
|
||||
else
|
||||
afterLabel.appendChild(document.createTextNode("):"));
|
||||
return;
|
||||
}
|
||||
this.wrapChar(span, accessKeyIndex);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="wrapChar">
|
||||
<parameter name="element"/>
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var treeWalker = document.createTreeWalker(this,
|
||||
NodeFilter.SHOW_TEXT,
|
||||
null,
|
||||
true);
|
||||
var node = treeWalker.nextNode();
|
||||
while (index >= node.length) {
|
||||
index -= node.length;
|
||||
node = treeWalker.nextNode();
|
||||
}
|
||||
if (index) {
|
||||
node = node.splitText(index);
|
||||
}
|
||||
node.parentNode.insertBefore(element, node);
|
||||
if (node.length > 1) {
|
||||
node.splitText(1);
|
||||
}
|
||||
element.appendChild(node);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="mergeElement">
|
||||
<parameter name="element"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (element.previousSibling instanceof Text) {
|
||||
element.previousSibling.appendData(element.textContent)
|
||||
}
|
||||
else {
|
||||
element.parentNode.insertBefore(element.firstChild, element);
|
||||
}
|
||||
element.parentNode.removeChild(element);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="mUnderlineAccesskey">
|
||||
!/Mac/.test(navigator.platform)
|
||||
</field>
|
||||
<field name="mInsertSeparator">true</field>
|
||||
<field name="mAlwaysAppendAccessKey">false</field>
|
||||
|
||||
<property name="accessKey">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accessKey = null;
|
||||
var labeledEl = this.labeledControlElement;
|
||||
if (labeledEl) {
|
||||
accessKey = labeledEl.getAttribute('accesskey');
|
||||
}
|
||||
if (!accessKey) {
|
||||
accessKey = this.getAttribute('accesskey');
|
||||
}
|
||||
return accessKey ? accessKey[0] : null;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
// If this label already has an accesskey attribute store it here as well
|
||||
if (this.hasAttribute('accesskey')) {
|
||||
this.setAttribute('accesskey', val);
|
||||
}
|
||||
var control = this.labeledControlElement;
|
||||
if (control) {
|
||||
control.setAttribute('accesskey', val);
|
||||
}
|
||||
this.formatAccessKey();
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="labeledControlElement" readonly="true"
|
||||
onget="var control = this.control; return control ? document.getElementById(control) : null;" />
|
||||
|
||||
<property name="control" onget="return this.getAttribute('control');">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var control = this.labeledControlElement;
|
||||
if (control) {
|
||||
control.labelElement = null; // No longer pointed to be this label
|
||||
}
|
||||
this.setAttribute('control', val);
|
||||
this.formatAccessKey();
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click" action="if (this.disabled) return;
|
||||
var controlElementID = this.getAttribute('control');
|
||||
var controlElement;
|
||||
if (controlElementID)
|
||||
controlElement = document.getElementById(controlElementID);
|
||||
if(controlElement)
|
||||
controlElement.focus();
|
||||
"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="text-link" extends="chrome://global/content/bindings/text.xml#text-label">
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_ENTER" action="this.click()" />
|
||||
<handler event="keypress" keycode="VK_RETURN" action="this.click()" />
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -1,294 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE bindings [
|
||||
<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" >
|
||||
%textcontextDTD;
|
||||
]>
|
||||
|
||||
<bindings id="textboxBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="textbox" extends="xul:box">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/textbox.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<children/>
|
||||
<xul:hbox class="textbox-input-box" flex="1" xbl:inherits="context">
|
||||
<html:input class="textbox-input" flex="1" anonid="input"
|
||||
xbl:inherits="onfocus,onblur,value,type,maxlength,disabled,size,readonly,tabindex,accesskey"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider, nsIDOMXULTextBoxElement">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return Components.interfaces.nsIAccessibleProvider.XULTextBox;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<field name="mInputField">null</field>
|
||||
<field name="mIgnoreClick">false</field>
|
||||
<field name="mIgnoreFocus">false</field>
|
||||
|
||||
<property name="inputField" readonly="true">
|
||||
<getter><![CDATA[
|
||||
if (!this.mInputField)
|
||||
this.mInputField = document.getAnonymousElementByAttribute(this, "anonid", "input");
|
||||
return this.mInputField;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="value" onset="this.inputField.value = val; return val;"
|
||||
onget="return this.inputField.value;"/>
|
||||
<property name="defaultValue" onset="this.inputField.defaultValue = val; return val;"
|
||||
onget="return this.inputField.defaultValue;"/>
|
||||
<property name="type" onset="if (val) this.setAttribute('type', val);
|
||||
else this.removeAttribute('type'); return val;"
|
||||
onget="return this.getAttribute('type');"/>
|
||||
<property name="maxLength" onset="this.inputField.maxLength = val; return val;"
|
||||
onget="return this.inputField.maxLength;"/>
|
||||
<property name="disabled" onset="this.inputField.disabled = val;
|
||||
if (val) this.setAttribute('disabled', 'true');
|
||||
else this.removeAttribute('disabled'); return val;"
|
||||
onget="return this.inputField.disabled;"/>
|
||||
<property name="tabIndex" onget="return parseInt(this.getAttribute('tabindex'));"
|
||||
onset="this.inputField.tabIndex = val;
|
||||
if (val) this.setAttribute('tabindex', val);
|
||||
else this.removeAttribute('tabindex'); return val;"/>
|
||||
<property name="size" onset="this.inputField.size = val; return val;"
|
||||
onget="return this.inputField.size;"/>
|
||||
<property name="readOnly" onset="this.inputField.readOnly = val;
|
||||
if (val) this.setAttribute('readonly', 'true');
|
||||
else this.removeAttribute('readonly'); return val;"
|
||||
onget="return this.inputField.readOnly;"/>
|
||||
<property name="clickSelectsAll"
|
||||
onget="return this.getAttribute('clickSelectsAll') == 'true';"
|
||||
onset="if (val) this.setAttribute('clickSelectsAll', 'true');
|
||||
else this.removeAttribute('clickSelectsAll'); return val;" />
|
||||
|
||||
<property name="editor" readonly="true">
|
||||
<getter><![CDATA[
|
||||
const nsIDOMNSEditableElement = Components.interfaces.nsIDOMNSEditableElement;
|
||||
return this.inputField.QueryInterface(nsIDOMNSEditableElement).editor;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="reset">
|
||||
<body><![CDATA[
|
||||
this.value = this.defaultValue;
|
||||
try {
|
||||
this.editor.transactionManager.clear();
|
||||
return true;
|
||||
}
|
||||
catch(e) {}
|
||||
return false;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="select">
|
||||
<body>
|
||||
this.inputField.select();
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="controllers" readonly="true" onget="return this.inputField.controllers"/>
|
||||
<property name="textLength" readonly="true" onget="return this.inputField.textLength;"/>
|
||||
<property name="selectionStart" onset="this.inputField.selectionStart = val; return val;"
|
||||
onget="return this.inputField.selectionStart;"/>
|
||||
<property name="selectionEnd" onset="this.inputField.selectionEnd = val; return val;"
|
||||
onget="return this.inputField.selectionEnd;"/>
|
||||
|
||||
<method name="setSelectionRange">
|
||||
<parameter name="aSelectionStart"/>
|
||||
<parameter name="aSelectionEnd"/>
|
||||
<body>
|
||||
this.inputField.setSelectionRange( aSelectionStart, aSelectionEnd );
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<constructor><![CDATA[
|
||||
var str = this.boxObject.getProperty("value");
|
||||
if (str) {
|
||||
this.inputField.value = str;
|
||||
this.boxObject.removeProperty("value");
|
||||
}
|
||||
|
||||
str = this.getAttribute("newlines");
|
||||
if (str) {
|
||||
const nsIPlaintextEditor = Components.interfaces.nsIPlaintextEditor;
|
||||
for (var x in nsIPlaintextEditor) {
|
||||
if (/^eNewlines/.test(x)) {
|
||||
if (str == RegExp.rightContext.toLowerCase()) {
|
||||
this.editor.QueryInterface(nsIPlaintextEditor)
|
||||
.newlineHandling = nsIPlaintextEditor[x];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]]></constructor>
|
||||
|
||||
<destructor action="if (this.inputField.value) this.boxObject.setProperty('value', this.inputField.value);"/>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="focus" phase="capturing">
|
||||
<![CDATA[
|
||||
if (!this.hasAttribute("focused")) {
|
||||
if (event.originalTarget != this.inputField)
|
||||
this.inputField.focus();
|
||||
else if (this.mIgnoreFocus)
|
||||
this.mIgnoreFocus = false;
|
||||
else if (this.clickSelectsAll)
|
||||
this.inputField.select();
|
||||
|
||||
this.setAttribute("focused", "true");
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="blur" phase="capturing">
|
||||
<![CDATA[
|
||||
this.removeAttribute('focused');
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="mousedown">
|
||||
<![CDATA[
|
||||
this.mIgnoreClick = this.hasAttribute("focused");
|
||||
|
||||
if (!this.mIgnoreClick) {
|
||||
this.mIgnoreFocus = true;
|
||||
this.inputField.setSelectionRange(0, 0);
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
if (!this.mIgnoreClick && this.clickSelectsAll &&
|
||||
this.inputField.selectionStart == this.inputField.selectionEnd)
|
||||
this.inputField.select();
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="timed-textbox" extends="chrome://global/content/bindings/textbox.xml#textbox">
|
||||
<implementation>
|
||||
<field name="_timer">null</field>
|
||||
<property name="timeout"
|
||||
onset="this.setAttribute('timeout', val); return val;"
|
||||
onget="return parseInt(this.getAttribute('timeout')) || 0;"/>
|
||||
<property name="value">
|
||||
<getter>
|
||||
return this.inputField.value;
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this.inputField.value = val;
|
||||
if (this._timer)
|
||||
clearTimeout(this._timer);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
<method name="_fireCommand">
|
||||
<parameter name="me"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
me._timer = null;
|
||||
me.doCommand();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="input">
|
||||
<![CDATA[
|
||||
if (this._timer)
|
||||
clearTimeout(this._timer);
|
||||
this._timer = this.timeout && setTimeout(this._fireCommand, this.timeout, this);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" keycode="VK_RETURN">
|
||||
<![CDATA[
|
||||
if (this._timer)
|
||||
clearTimeout(this._timer);
|
||||
this._fireCommand(this);
|
||||
event.preventDefault();
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="textarea" extends="chrome://global/content/bindings/textbox.xml#textbox">
|
||||
<content>
|
||||
<xul:hbox class="textbox-input-box" flex="1" xbl:inherits="context">
|
||||
<html:textarea class="textbox-textarea" flex="1" anonid="input"
|
||||
xbl:inherits="onfocus,onblur,xbl:text=value,disabled,tabindex,rows,cols,readonly,wrap"><children/></html:textarea>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="input-box">
|
||||
<content context="_child">
|
||||
<children/>
|
||||
<xul:menupopup anonid="input-box-contextmenu"
|
||||
onpopupshowing="if (document.commandDispatcher.focusedElement != this.parentNode.firstChild)
|
||||
this.parentNode.firstChild.focus();
|
||||
this.parentNode.doPopupItemEnabling(this);"
|
||||
oncommand="this.parentNode.doCommand(event.originalTarget.getAttribute('cmd'));event.stopPropagation();">
|
||||
<xul:menuitem label="&undoCmd.label;" accesskey="&undoCmd.accesskey;" cmd="cmd_undo"/>
|
||||
<xul:menuseparator/>
|
||||
<xul:menuitem label="&cutCmd.label;" accesskey="&cutCmd.accesskey;" cmd="cmd_cut"/>
|
||||
<xul:menuitem label="©Cmd.label;" accesskey="©Cmd.accesskey;" cmd="cmd_copy"/>
|
||||
<xul:menuitem label="&pasteCmd.label;" accesskey="&pasteCmd.accesskey;" cmd="cmd_paste"/>
|
||||
<xul:menuitem label="&deleteCmd.label;" accesskey="&deleteCmd.accesskey;" cmd="cmd_delete"/>
|
||||
<xul:menuseparator/>
|
||||
<xul:menuitem label="&selectAllCmd.label;" accesskey="&selectAllCmd.accesskey;" cmd="cmd_selectAll"/>
|
||||
</xul:menupopup>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="doPopupItemEnabling">
|
||||
<parameter name="popupNode"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var children = popupNode.childNodes;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var command = children[i].getAttribute("cmd");
|
||||
if (command) {
|
||||
var controller = document.commandDispatcher.getControllerForCommand(command);
|
||||
var enabled = controller.isCommandEnabled(command);
|
||||
if (enabled)
|
||||
children[i].removeAttribute("disabled");
|
||||
else
|
||||
children[i].setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="doCommand">
|
||||
<parameter name="command"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var controller = document.commandDispatcher.getControllerForCommand(command);
|
||||
controller.doCommand(command);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,72 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="toolbarbuttonBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="toolbarbutton" display="xul:button"
|
||||
extends="chrome://global/content/bindings/button.xml#button-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/toolbarbutton.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<children includes="observes|template|menupopup|tooltip"/>
|
||||
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,toolbarmode,buttonstyle"/>
|
||||
<xul:label class="toolbarbutton-text" crop="right" flex="1"
|
||||
xbl:inherits="value=label,accesskey,crop,toolbarmode,buttonstyle"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
|
||||
<content>
|
||||
<children includes="observes|template|menupopup|tooltip"/>
|
||||
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,toolbarmode,buttonstyle"/>
|
||||
<xul:label class="toolbarbutton-text" crop="right" flex="1"
|
||||
xbl:inherits="value=label,accesskey,crop,dragover-top,toolbarmode,buttonstyle"/>
|
||||
<xul:dropmarker type="menu" class="toolbarbutton-menu-dropmarker" xbl:inherits="disabled"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-vertical" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
|
||||
<content>
|
||||
<children includes="observes|template|menupopup|tooltip"/>
|
||||
<xul:hbox flex="1" align="center">
|
||||
<xul:vbox flex="1" align="center">
|
||||
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,toolbarmode,buttonstyle"/>
|
||||
<xul:label class="toolbarbutton-text" crop="right" flex="1"
|
||||
xbl:inherits="value=label,accesskey,crop,dragover-top,toolbarmode,buttonstyle"/>
|
||||
</xul:vbox>
|
||||
<xul:dropmarker type="menu" class="toolbarbutton-menu-dropmarker" xbl:inherits="disabled"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-button" display="xul:menu"
|
||||
extends="chrome://global/content/bindings/button.xml#menu-button-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/toolbarbutton.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<children includes="observes|template|menupopup|tooltip"/>
|
||||
<xul:toolbarbutton class="box-inherit toolbarbutton-menubutton-button"
|
||||
anonid="button" flex="1" allowevents="true"
|
||||
xbl:inherits="disabled,crop,image,label,accesskey,command,
|
||||
align,dir,pack,orient,toolbarmode,buttonstyle"/>
|
||||
<xul:dropmarker type="menu-button" class="toolbarbutton-menubutton-dropmarker"
|
||||
xbl:inherits="align,dir,pack,orient,disabled,toolbarmode,buttonstyle"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
|
||||
<binding id="toolbarbutton-image"
|
||||
extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
|
||||
<content>
|
||||
<xul:image class="toolbarbutton-icon" xbl:inherits="src=image"/>
|
||||
</content>
|
||||
</binding>
|
||||
</bindings>
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,519 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="wizardBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="wizard-base">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/wizard.css"/>
|
||||
</resources>
|
||||
</binding>
|
||||
|
||||
<binding id="wizard" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<content>
|
||||
<xul:hbox class="wizard-header" anonid="Header"/>
|
||||
|
||||
<xul:deck class="wizard-page-box" flex="1" anonid="Deck">
|
||||
<children includes="wizardpage"/>
|
||||
</xul:deck>
|
||||
<children/>
|
||||
|
||||
<xul:hbox class="wizard-buttons" anonid="Buttons" xbl:inherits="pagestep,firstpage,lastpage"/>
|
||||
|
||||
<children includes="statusbar"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="title" onget="return document.title;"
|
||||
onset="return document.title = val;"/>
|
||||
|
||||
<property name="canAdvance" onget="return this._canAdvance;"
|
||||
onset="this._canAdvance=val; this._nextButton.disabled = !val;"/>
|
||||
<property name="canRewind" onget="return this._canRewind;"
|
||||
onset="this._canRewind=val; this._backButton.disabled = !val;"/>
|
||||
|
||||
<property name="pageStep" onget="return this._pageStack.length"/>
|
||||
|
||||
<field name="pageCount">0</field>
|
||||
|
||||
<field name="_accessMethod">null</field>
|
||||
<field name="_pageStack">null</field>
|
||||
<field name="_currentPage">null</field>
|
||||
|
||||
<property name="wizardPages">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var xulns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
return this.getElementsByTagNameNS(xulns, "wizardpage");
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="currentPage" onget="return this._currentPage">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (!val)
|
||||
return val;
|
||||
|
||||
this._currentPage = val;
|
||||
|
||||
// Setting this attribute allows wizard's clients to dynamically
|
||||
// change the styles of each page based on purpose of the page.
|
||||
this.setAttribute("currentpageid", val.pageid);
|
||||
|
||||
if (this.onFirstPage) {
|
||||
this.canRewind = false;
|
||||
this.setAttribute("firstpage", "true");
|
||||
} else {
|
||||
this.canRewind = true;
|
||||
this.setAttribute("firstpage", "false");
|
||||
}
|
||||
|
||||
if (this.onLastPage) {
|
||||
this.canAdvance = true;
|
||||
this.setAttribute("lastpage", "true");
|
||||
} else {
|
||||
this.setAttribute("lastpage", "false");
|
||||
}
|
||||
|
||||
this._deck.setAttribute("selectedIndex", val.pageIndex);
|
||||
this._advanceFocusToPage(val);
|
||||
|
||||
this._adjustWizardHeader();
|
||||
this._wizardButtons.onPageChange();
|
||||
|
||||
this._fireEvent(val, "pageshow");
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="pageIndex" onget="return this._currentPage.pageIndex;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val < 0 || val >= this.pageCount)
|
||||
return val;
|
||||
|
||||
var page = this.wizardPages[val];
|
||||
this._pageStack[this._pageStack.length-1] = page;
|
||||
this.currentPage = page;
|
||||
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="onFirstPage"
|
||||
onget="return this._pageStack.length == 1;"/>
|
||||
|
||||
<property name="onLastPage">
|
||||
<getter><![CDATA[
|
||||
var cp = this.currentPage;
|
||||
return cp && ((this._accessMethod == "sequential" && cp.pageIndex == this.pageCount-1) ||
|
||||
(this._accessMethod == "random" && cp.next == ""));
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="getButton">
|
||||
<parameter name="aDlgType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var btns = this.getElementsByAttribute("dlgtype", aDlgType);
|
||||
return btns.item(0) ? btns[0] : document.getAnonymousElementByAttribute(this._wizardButtons, "dlgtype", aDlgType);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="_canAdvance"/>
|
||||
<field name="_canRewind"/>
|
||||
<field name="_wizardHeader"/>
|
||||
<field name="_wizardButtons"/>
|
||||
<field name="_deck"/>
|
||||
<field name="_backButton"/>
|
||||
<field name="_nextButton"/>
|
||||
<field name="_cancelButton"/>
|
||||
|
||||
<!-- functions to be added as oncommand listeners to the wizard buttons -->
|
||||
<field name="_backFunc">(function() { document.documentElement.rewind(); })</field>
|
||||
<field name="_nextFunc">(function() { document.documentElement.advance(); })</field>
|
||||
<field name="_finishFunc">(function() { document.documentElement.advance(); })</field>
|
||||
<field name="_cancelFunc">(function() { document.documentElement.cancel(); })</field>
|
||||
|
||||
<field name="_closeHandler">(function(event) {
|
||||
if (document.documentElement.cancel())
|
||||
event.preventDefault();
|
||||
})</field>
|
||||
|
||||
<constructor><![CDATA[
|
||||
this._canAdvance = true;
|
||||
this._canRewind = false;
|
||||
this._hasLoaded = false;
|
||||
|
||||
this._pageStack = [];
|
||||
|
||||
// need to create string bundle manually instead of using <xul:stringbundle/>
|
||||
// see bug 63370 for details
|
||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||
.getService(Components.interfaces.nsILocaleService);
|
||||
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
|
||||
var bundleURL = "chrome://global-platform/locale/wizard.properties";
|
||||
this._bundle = stringBundleService.createBundle(bundleURL, localeService.getApplicationLocale());
|
||||
|
||||
// get anonymous content references
|
||||
this._wizardHeader = document.getAnonymousElementByAttribute(this, "anonid", "Header");
|
||||
this._wizardButtons = document.getAnonymousElementByAttribute(this, "anonid", "Buttons");
|
||||
this._deck = document.getAnonymousElementByAttribute(this, "anonid", "Deck");
|
||||
|
||||
this._initWizardButton("back");
|
||||
this._initWizardButton("next");
|
||||
this._initWizardButton("finish");
|
||||
this._initWizardButton("cancel");
|
||||
|
||||
this._initPages();
|
||||
|
||||
window.addEventListener("close", this._closeHandler, false);
|
||||
|
||||
// start off on the first page
|
||||
this.pageCount = this.wizardPages.length;
|
||||
this.advance();
|
||||
|
||||
// give focus to the first focusable element in the dialog
|
||||
window.addEventListener("load", this._setInitialFocus, false);
|
||||
]]></constructor>
|
||||
|
||||
<method name="getPageById">
|
||||
<parameter name="aPageId"/>
|
||||
<body><![CDATA[
|
||||
var els = this.getElementsByAttribute("pageid", aPageId);
|
||||
return els.item(0);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="rewind">
|
||||
<body><![CDATA[
|
||||
if (!this.canRewind)
|
||||
return;
|
||||
|
||||
if (this.currentPage && !this._fireEvent(this.currentPage, "pagehide"))
|
||||
return;
|
||||
|
||||
if (this.currentPage && !this._fireEvent(this.currentPage, "pagerewound"))
|
||||
return;
|
||||
|
||||
if (!this._fireEvent(this, "wizardback"))
|
||||
return;
|
||||
|
||||
|
||||
this._pageStack.pop();
|
||||
this.currentPage = this._pageStack[this._pageStack.length-1];
|
||||
this.setAttribute("pagestep", this._pageStack.length);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="advance">
|
||||
<parameter name="aPageId"/>
|
||||
<body><![CDATA[
|
||||
if (!this.canAdvance)
|
||||
return;
|
||||
|
||||
if (this.currentPage && !this._fireEvent(this.currentPage, "pagehide"))
|
||||
return;
|
||||
|
||||
if (this.currentPage && !this._fireEvent(this.currentPage, "pageadvanced"))
|
||||
return;
|
||||
|
||||
if (this.onLastPage) {
|
||||
if (this._fireEvent(this, "wizardfinish"))
|
||||
window.setTimeout(function() {window.close();}, 1);
|
||||
} else {
|
||||
if (!this._fireEvent(this, "wizardnext"))
|
||||
return;
|
||||
|
||||
var page;
|
||||
if (aPageId)
|
||||
page = this.getPageById(aPageId);
|
||||
else {
|
||||
if (this.currentPage) {
|
||||
if (this._accessMethod == "random")
|
||||
page = this.getPageById(this.currentPage.next);
|
||||
else
|
||||
page = this.wizardPages[this.currentPage.pageIndex+1];
|
||||
} else
|
||||
page = this.wizardPages[0];
|
||||
}
|
||||
|
||||
if (page) {
|
||||
this._pageStack.push(page);
|
||||
this.setAttribute("pagestep", this._pageStack.length);
|
||||
|
||||
this.currentPage = page;
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="goTo">
|
||||
<parameter name="aPageId"/>
|
||||
<body><![CDATA[
|
||||
var page = this.getPageById(aPageId);
|
||||
if (page) {
|
||||
this._pageStack[this._pageStack.length-1] = page;
|
||||
this.currentPage = page;
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="cancel">
|
||||
<body><![CDATA[
|
||||
if (!this._fireEvent(this, "wizardcancel"))
|
||||
return true;
|
||||
|
||||
window.close();
|
||||
window.setTimeout(function() {window.close();}, 1);
|
||||
return false;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_setInitialFocus">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
document.documentElement._hasLoaded = true;
|
||||
var focusInit =
|
||||
function() {
|
||||
// give focus to the first focusable element in the dialog
|
||||
if (!document.commandDispatcher.focusedElement)
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(document.documentElement);
|
||||
};
|
||||
|
||||
// Give focus after onload completes, see bug 103197.
|
||||
setTimeout(focusInit, 0);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_advanceFocusToPage">
|
||||
<parameter name="aPage"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this._hasLoaded)
|
||||
return;
|
||||
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(aPage);
|
||||
|
||||
// if advanceFocusIntoSubtree tries to focus one of our
|
||||
// dialog buttons, then remove it and put it on the root
|
||||
var focused = document.commandDispatcher.focusedElement;
|
||||
if (focused && focused.hasAttribute("dlgtype"))
|
||||
this.focus();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_initPages">
|
||||
<body><![CDATA[
|
||||
var meth = "sequential";
|
||||
var pages = this.wizardPages;
|
||||
for (var i = 0; i < pages.length; ++i) {
|
||||
var page = pages[i];
|
||||
page.pageIndex = i;
|
||||
if (page.next != "")
|
||||
meth = "random";
|
||||
}
|
||||
this._accessMethod = meth;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_initWizardButton">
|
||||
<parameter name="aName"/>
|
||||
<body><![CDATA[
|
||||
var btn = document.getAnonymousElementByAttribute(this._wizardButtons, "dlgtype", aName);
|
||||
if (btn) {
|
||||
btn.addEventListener("command", this["_"+aName+"Func"], false);
|
||||
btn.setAttribute("label", this._bundle.GetStringFromName("button-"+aName));
|
||||
var accesskey = this._bundle.GetStringFromName("accesskey-"+aName);
|
||||
if (accesskey) {
|
||||
btn.setAttribute("accesskey", accesskey);
|
||||
}
|
||||
this["_"+aName+"Button"] = btn;
|
||||
}
|
||||
return btn;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_adjustWizardHeader">
|
||||
<body><![CDATA[
|
||||
var label = this.currentPage.getAttribute("label");
|
||||
if (!label && this.onFirstPage)
|
||||
label = this._bundle.formatStringFromName("default-first-title", [this.title], 1);
|
||||
else if (!label && this.onLastPage)
|
||||
label = this._bundle.formatStringFromName("default-last-title", [this.title], 1);
|
||||
this._wizardHeader.setAttribute("label", label);
|
||||
this._wizardHeader.setAttribute("description", this.currentPage.getAttribute("description"));
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_hitEnter">
|
||||
<parameter name="evt"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!evt.getPreventDefault())
|
||||
this.advance();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_fireEvent">
|
||||
<parameter name="aTarget"/>
|
||||
<parameter name="aType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent(aType, true, true);
|
||||
|
||||
// handle dom event handlers
|
||||
var noCancel = aTarget.dispatchEvent(event);
|
||||
|
||||
// handle any xml attribute event handlers
|
||||
var handler = aTarget.getAttribute("on"+aType);
|
||||
if (handler != "") {
|
||||
var fn = new Function("event", handler);
|
||||
var returned = fn.apply(aTarget, [event]);
|
||||
if (returned == false)
|
||||
noCancel = false;
|
||||
}
|
||||
|
||||
return noCancel;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_ENTER"
|
||||
group="system" action="this._hitEnter(event)"/>
|
||||
<handler event="keypress" keycode="VK_RETURN"
|
||||
group="system" action="this._hitEnter(event)"/>
|
||||
<handler event="keypress" keycode="VK_ESCAPE" group="system">
|
||||
if (!event.getPreventDefault())
|
||||
this.cancel();
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="wizardpage" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<implementation>
|
||||
<field name="pageIndex">null</field>
|
||||
|
||||
<property name="pageid" onget="return this.getAttribute('pageid');"
|
||||
onset="this.setAttribute('pageid', val);"/>
|
||||
|
||||
<property name="next" onget="return this.getAttribute('next');"
|
||||
onset="this.setAttribute('next', val);
|
||||
this.parentNode._accessMethod = 'random';
|
||||
return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="wizard-header" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<content>
|
||||
<xul:hbox class="wizard-header-box-1" flex="1">
|
||||
<xul:vbox class="wizard-header-box-text" flex="1">
|
||||
<xul:label class="wizard-header-label" xbl:inherits="value=label"/>
|
||||
<xul:label class="wizard-header-description" xbl:inherits="value=description"/>
|
||||
</xul:vbox>
|
||||
<xul:image class="wizard-header-icon" xbl:inherits="src=iconsrc"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="wizard-buttons" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<content>
|
||||
<xul:vbox class="wizard-buttons-box-1" flex="1">
|
||||
<xul:separator class="wizard-buttons-separator groove"/>
|
||||
<xul:hbox class="wizard-buttons-box-2">
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button class="wizard-button" dlgtype="back"/>
|
||||
<xul:deck class="wizard-next-deck" anonid="WizardButtonDeck">
|
||||
<xul:hbox>
|
||||
<xul:button class="wizard-button" dlgtype="finish" default="true" flex="1"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:button class="wizard-button" dlgtype="next" default="true" flex="1"/>
|
||||
</xul:hbox>
|
||||
</xul:deck>
|
||||
<xul:button class="wizard-button" dlgtype="cancel"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<field name="_wizardButtonDeck" readonly="true">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "WizardButtonDeck");
|
||||
</field>
|
||||
|
||||
<method name="onPageChange">
|
||||
<body><![CDATA[
|
||||
if (this.getAttribute("lastpage") == "true") {
|
||||
this._wizardButtonDeck.setAttribute("selectedIndex", 0);
|
||||
} else {
|
||||
this._wizardButtonDeck.setAttribute("selectedIndex", 1);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="wizard-header-mac" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<content>
|
||||
<xul:stack class="wizard-header-stack" flex="1">
|
||||
<xul:vbox class="wizard-header-box-1">
|
||||
<xul:vbox class="wizard-header-box-2">
|
||||
<xul:vbox class="wizard-header-box-text">
|
||||
<xul:label class="wizard-header-label" xbl:inherits="value=label"/>
|
||||
</xul:vbox>
|
||||
</xul:vbox>
|
||||
</xul:vbox>
|
||||
<xul:hbox class="wizard-header-box-icon">
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:image class="wizard-header-icon" xbl:inherits="src=iconsrc"/>
|
||||
</xul:hbox>
|
||||
</xul:stack>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="wizard-buttons-mac" extends="chrome://global/content/bindings/wizard.xml#wizard-base">
|
||||
<content>
|
||||
<xul:vbox flex="1">
|
||||
<xul:hbox class="wizard-buttons-top" xbl:inherits="hidden=hidetoprow">
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button class="wizard-button" dlgtype="cancel"/>
|
||||
<xul:button class="wizard-button" dlgtype="finish" default="true"/>
|
||||
</xul:hbox>
|
||||
<xul:separator class="wizard-buttons-separator groove"/>
|
||||
<xul:hbox class="wizard-buttons-btm">
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button class="wizard-button wizard-nav-button" dlgtype="back"/>
|
||||
<xul:hbox class="wizard-label-box" align="center">
|
||||
<xul:label class="wizard-page-label" xbl:inherits="value=pagestep"/>
|
||||
</xul:hbox>
|
||||
<xul:button class="wizard-button wizard-nav-button" dlgtype="next" default="true" xbl:inherits="disabled=lastpage"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="onPageChange">
|
||||
<body><![CDATA[
|
||||
this.setAttribute("hidetoprow", !(this.getAttribute("lastpage") == "true"));
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,305 +0,0 @@
|
|||
function MultiplexHandler(event)
|
||||
{
|
||||
var node = event.target;
|
||||
var name = node.getAttribute('name');
|
||||
|
||||
if (name == 'detectorGroup') {
|
||||
SetForcedDetector(true);
|
||||
SelectDetector(event, false);
|
||||
} else if (name == 'charsetGroup') {
|
||||
var charset = node.getAttribute('id');
|
||||
charset = charset.substring('charset.'.length, charset.length)
|
||||
SetForcedCharset(charset);
|
||||
SetDefaultCharacterSet(charset);
|
||||
} else if (name == 'charsetCustomize') {
|
||||
// please remove this else statement, once the charset prefs moves to the pref window
|
||||
window.openDialog("chrome://communicator/content/pref/pref-charset.xul",
|
||||
"_blank", "chrome,modal,resizable", "browser");
|
||||
} else {
|
||||
SetForcedCharset(node.getAttribute('id'));
|
||||
SetDefaultCharacterSet(node.getAttribute('id'));
|
||||
}
|
||||
}
|
||||
|
||||
function MailMultiplexHandler(event)
|
||||
{
|
||||
var node = event.target;
|
||||
var name = node.getAttribute('name');
|
||||
|
||||
if (name == 'detectorGroup') {
|
||||
SelectDetector(event, true);
|
||||
} else if (name == 'charsetGroup') {
|
||||
var charset = node.getAttribute('id');
|
||||
charset = charset.substring('charset.'.length, charset.length)
|
||||
MessengerSetForcedCharacterSet(charset);
|
||||
} else if (name == 'charsetCustomize') {
|
||||
// please remove this else statement, once the charset prefs moves to the pref window
|
||||
window.openDialog("chrome://communicator/content/pref/pref-charset.xul",
|
||||
"_blank", "chrome,modal,resizable", "browser");
|
||||
} else {
|
||||
MessengerSetForcedCharacterSet(node.getAttribute('id'));
|
||||
}
|
||||
}
|
||||
|
||||
function ComposerMultiplexHandler(event)
|
||||
{
|
||||
var node = event.target;
|
||||
var name = node.getAttribute('name');
|
||||
|
||||
if (name == 'detectorGroup') {
|
||||
ComposerSelectDetector(event, true);
|
||||
} else if (name == 'charsetGroup') {
|
||||
var charset = node.getAttribute('id');
|
||||
charset = charset.substring('charset.'.length, charset.length)
|
||||
EditorSetDocumentCharacterSet(charset);
|
||||
} else if (name == 'charsetCustomize') {
|
||||
// please remove this else statement, once the charset prefs moves to the pref window
|
||||
window.openDialog("chrome://communicator/content/pref/pref-charset.xul",
|
||||
"_blank", "chrome,modal,resizable", "browser");
|
||||
} else {
|
||||
SetForcedEditorCharset(node.getAttribute('id'));
|
||||
}
|
||||
}
|
||||
|
||||
function MaileditMultiplexHandler(event)
|
||||
{
|
||||
var node = event.target;
|
||||
var name = node.getAttribute('name');
|
||||
|
||||
if (name == 'charsetCustomize') {
|
||||
// please remove this else statement, once the charset prefs moves to the pref window
|
||||
window.openDialog("chrome://communicator/content/pref/pref-charset.xul",
|
||||
"_blank", "chrome,modal,resizable", "mailedit");
|
||||
} else {
|
||||
SetDocumentCharacterSet(node.id);
|
||||
}
|
||||
}
|
||||
|
||||
function SetDefaultCharacterSet(charset)
|
||||
{
|
||||
dump("Charset Overlay menu item pressed: " + charset + "\n");
|
||||
BrowserSetDefaultCharacterSet(charset);
|
||||
}
|
||||
|
||||
function SelectDetector(event, doReload)
|
||||
{
|
||||
dump("Charset Detector menu item pressed: " + event.target.getAttribute('id') + "\n");
|
||||
|
||||
var uri = event.target.getAttribute("id");
|
||||
var prefvalue = uri.substring('chardet.'.length, uri.length);
|
||||
if ("off" == prefvalue) { // "off" is special value to turn off the detectors
|
||||
prefvalue = "";
|
||||
}
|
||||
|
||||
try {
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var str = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
|
||||
str.data = prefvalue;
|
||||
pref.setComplexValue("intl.charset.detector",
|
||||
Components.interfaces.nsISupportsString, str);
|
||||
if (doReload) window.content.location.reload();
|
||||
}
|
||||
catch (ex) {
|
||||
dump("Failed to set the intl.charset.detector preference.\n");
|
||||
}
|
||||
}
|
||||
|
||||
function ComposerSelectDetector(event)
|
||||
{
|
||||
//dump("Charset Detector menu item pressed: " + event.target.getAttribute('id') + "\n");
|
||||
|
||||
var uri = event.target.getAttribute("id");
|
||||
var prefvalue = uri.substring('chardet.'.length, uri.length);
|
||||
if ("off" == prefvalue) { // "off" is special value to turn off the detectors
|
||||
prefvalue = "";
|
||||
}
|
||||
|
||||
try {
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var str = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
|
||||
str.data = prefvalue;
|
||||
pref.setComplexValue("intl.charset.detector",
|
||||
Components.interfaces.nsISupportsString, str);
|
||||
EditorLoadUrl(GetDocumentUrl());
|
||||
}
|
||||
catch (ex) {
|
||||
dump("Failed to set the intl.charset.detector preference.\n");
|
||||
}
|
||||
}
|
||||
|
||||
function SetForcedDetector(doReload)
|
||||
{
|
||||
BrowserSetForcedDetector(doReload);
|
||||
}
|
||||
|
||||
function SetForcedCharset(charset)
|
||||
{
|
||||
BrowserSetForcedCharacterSet(charset);
|
||||
}
|
||||
|
||||
var gPrevCharset = null;
|
||||
function UpdateCurrentCharset()
|
||||
{
|
||||
var menuitem = null;
|
||||
|
||||
// exctract the charset from DOM
|
||||
var wnd = document.commandDispatcher.focusedWindow;
|
||||
if ((window == wnd) || (wnd == null)) wnd = window.content;
|
||||
menuitem = document.getElementById('charset.' + wnd.document.characterSet);
|
||||
|
||||
if (menuitem) {
|
||||
// uncheck previously checked item to workaround Mac checkmark problem
|
||||
// bug 98625
|
||||
if (gPrevCharset) {
|
||||
var pref_item = document.getElementById('charset.' + gPrevCharset);
|
||||
if (pref_item)
|
||||
pref_item.setAttribute('checked', 'false');
|
||||
}
|
||||
menuitem.setAttribute('checked', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
function UpdateCurrentMailCharset()
|
||||
{
|
||||
var charset = msgWindow.mailCharacterSet;
|
||||
dump("Update current mail charset: " + charset + " \n");
|
||||
|
||||
var menuitem = document.getElementById('charset.' + charset);
|
||||
|
||||
if (menuitem) {
|
||||
menuitem.setAttribute('checked', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
function UpdateCharsetDetector()
|
||||
{
|
||||
var prefvalue;
|
||||
|
||||
try {
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
prefvalue = pref.getComplexValue("intl.charset.detector",
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
}
|
||||
catch (ex) {
|
||||
prefvalue = "";
|
||||
}
|
||||
|
||||
if (prefvalue == "") prefvalue = "off";
|
||||
dump("intl.charset.detector = "+ prefvalue + "\n");
|
||||
|
||||
prefvalue = 'chardet.' + prefvalue;
|
||||
var menuitem = document.getElementById(prefvalue);
|
||||
|
||||
if (menuitem) {
|
||||
menuitem.setAttribute('checked', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
function UpdateMenus(event)
|
||||
{
|
||||
// use setTimeout workaround to delay checkmark the menu
|
||||
// when onmenucomplete is ready then use it instead of oncreate
|
||||
// see bug 78290 for the detail
|
||||
UpdateCurrentCharset();
|
||||
setTimeout(UpdateCurrentCharset, 0);
|
||||
UpdateCharsetDetector();
|
||||
setTimeout(UpdateCharsetDetector, 0);
|
||||
}
|
||||
|
||||
function CreateMenu(node)
|
||||
{
|
||||
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
|
||||
observerService.notifyObservers(null, "charsetmenu-selected", node);
|
||||
}
|
||||
|
||||
function UpdateMailMenus(event)
|
||||
{
|
||||
// use setTimeout workaround to delay checkmark the menu
|
||||
// when onmenucomplete is ready then use it instead of oncreate
|
||||
// see bug 78290 for the detail
|
||||
UpdateCurrentMailCharset();
|
||||
setTimeout(UpdateCurrentMailCharset, 0);
|
||||
UpdateCharsetDetector();
|
||||
setTimeout(UpdateCharsetDetector, 0);
|
||||
}
|
||||
|
||||
var gCharsetMenu = Components.classes['@mozilla.org/rdf/datasource;1?name=charset-menu'].getService().QueryInterface(Components.interfaces.nsICurrentCharsetListener);
|
||||
var gLastBrowserCharset = null;
|
||||
|
||||
function charsetLoadListener (event)
|
||||
{
|
||||
var charset = window.content.document.characterSet;
|
||||
|
||||
if (charset.length > 0 && (charset != gLastBrowserCharset)) {
|
||||
gCharsetMenu.SetCurrentCharset(charset);
|
||||
gPrevCharset = gLastBrowserCharset;
|
||||
gLastBrowserCharset = charset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function composercharsetLoadListener (event)
|
||||
{
|
||||
var charset = window.content.document.characterSet;
|
||||
|
||||
|
||||
if (charset.length > 0 ) {
|
||||
gCharsetMenu.SetCurrentComposerCharset(charset);
|
||||
}
|
||||
}
|
||||
|
||||
function SetForcedEditorCharset(charset)
|
||||
{
|
||||
if (charset.length > 0 ) {
|
||||
gCharsetMenu.SetCurrentComposerCharset(charset);
|
||||
}
|
||||
EditorSetDocumentCharacterSet(charset);
|
||||
}
|
||||
|
||||
|
||||
var gLastMailCharset = null;
|
||||
|
||||
function mailCharsetLoadListener (event)
|
||||
{
|
||||
if (msgWindow) {
|
||||
var charset = msgWindow.mailCharacterSet;
|
||||
if (charset.length > 0 && (charset != gLastMailCharset)) {
|
||||
gCharsetMenu.SetCurrentMailCharset(charset);
|
||||
gLastMailCharset = charset;
|
||||
dump("mailCharsetLoadListener: " + charset + " \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var wintype = document.documentElement.getAttribute('windowtype');
|
||||
if (window && (wintype == "navigator:browser"))
|
||||
{
|
||||
var contentArea = window.document.getElementById("appcontent");
|
||||
if (contentArea)
|
||||
contentArea.addEventListener("pageshow", charsetLoadListener, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
var arrayOfStrings = wintype.split(":");
|
||||
if (window && arrayOfStrings[0] == "mail")
|
||||
{
|
||||
var messageContent = window.document.getElementById("messagepane");
|
||||
if (messageContent)
|
||||
messageContent.addEventListener("pageshow", mailCharsetLoadListener, true);
|
||||
}
|
||||
else
|
||||
if (window && arrayOfStrings[0] == "composer")
|
||||
{
|
||||
contentArea = window.document.getElementById("appcontent");
|
||||
if (contentArea)
|
||||
contentArea.addEventListener("pageshow", composercharsetLoadListener, true);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,347 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE overlay SYSTEM "chrome://global/locale/charsetOverlay.dtd">
|
||||
|
||||
<overlay id="charsetOverlay"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/charsetOverlay.js"/>
|
||||
|
||||
<!-- Composer Charset Menu -->
|
||||
<menu id="composerCharsetMenu" label="&charsetMenu.label;" accesskey="&charsetMenu.accesskey;" datasources="rdf:charset-menu" ref="NC:ComposerCharsetMenuRoot" oncommand="ComposerMultiplexHandler(event)" onpopupshowing="CreateMenu('composer');UpdateMenus()" onpopupshown="CreateMenu('more-menu');">
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<menupopup>
|
||||
<menuseparator uri="..." />
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem type="radio" name="charsetGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<menupopup id="composerCharsetMenuPopup">
|
||||
<menu label="&charsetMenuAutodet.label;" accesskey="&charsetMenuAutodet.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserAutodetMenuRoot">
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#CharsetDetector">
|
||||
<menupopup>
|
||||
<menuitem type="radio" name="detectorGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore.label;" accesskey="&charsetMenuMore.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMoreCharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
<menu label="&charsetMenuMore1.label;" accesskey="&charsetMenuMore1.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore1CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore2.label;" accesskey="&charsetMenuMore2.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore2CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore3.label;" accesskey="&charsetMenuMore3.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore3CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore4.label;" accesskey="&charsetMenuMore4.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore4CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore5.label;" accesskey="&charsetMenuMore5.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore5CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuUnicode.label;" accesskey="&charsetMenuUnicode.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserUnicodeCharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator />
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem name="charsetCustomize" label="&charsetCustomize.label;"
|
||||
accesskey="&charsetCustomize.accesskey;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<!-- Mail View Charset Menu -->
|
||||
<menu id="mailviewCharsetMenu" label="&charsetMenu.label;" accesskey="&charsetMenu.accesskey;" datasources="rdf:charset-menu" ref="NC:MailviewCharsetMenuRoot" oncommand="MailMultiplexHandler(event)" onpopupshowing="CreateMenu('mailview');UpdateMailMenus()" onpopupshown="CreateMenu('more-menu');">
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<menupopup>
|
||||
<menuseparator uri="..." />
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem type="radio" name="charsetGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<menupopup>
|
||||
<menu label="&charsetMenuAutodet.label;" accesskey="&charsetMenuAutodet.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserAutodetMenuRoot">
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#CharsetDetector">
|
||||
<menupopup>
|
||||
<menuitem type="radio" name="detectorGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore.label;" accesskey="&charsetMenuMore.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMoreCharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
<menu label="&charsetMenuMore1.label;" datasources="rdf:charset-menu" ref="NC:BrowserMore1CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore2.label;" datasources="rdf:charset-menu" ref="NC:BrowserMore2CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore3.label;" datasources="rdf:charset-menu" ref="NC:BrowserMore3CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore4.label;" datasources="rdf:charset-menu" ref="NC:BrowserMore4CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore5.label;" datasources="rdf:charset-menu" ref="NC:BrowserMore5CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator />
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem name="charsetCustomize" label="&charsetCustomize.label;"
|
||||
accesskey="&charsetCustomize.accesskey;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<!-- Mail Edit Charset Menu -->
|
||||
<menu id="maileditCharsetMenu" label="&charsetMenu.label;" accesskey="&charsetMenu.accesskey;" datasources="rdf:charset-menu" ref="NC:MaileditCharsetMenuRoot" oncommand="MaileditMultiplexHandler(event);" onpopupshowing="CreateMenu('mailedit');InitCharsetMenuCheckMark();" onpopupshown="CreateMenu('more-menu');">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem type="radio" name="charsetGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<menupopup>
|
||||
<menuitem name="charsetCustomize" label="&charsetCustomize.label;"
|
||||
accesskey="&charsetCustomize.accesskey;"/>
|
||||
<menuseparator />
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<!-- Charset Menu -->
|
||||
<menu id="charsetMenu" label="&charsetMenu.label;" accesskey="&charsetMenu.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserCharsetMenuRoot" oncommand="MultiplexHandler(event)" onpopupshowing="CreateMenu('browser');UpdateMenus(event)" onpopupshown="CreateMenu('more-menu');">
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<menupopup>
|
||||
<menuseparator uri="..." />
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem type="radio" name="charsetGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<menupopup>
|
||||
<menu label="&charsetMenuAutodet.label;" accesskey="&charsetMenuAutodet.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserAutodetMenuRoot">
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#CharsetDetector">
|
||||
<menupopup>
|
||||
<menuitem type="radio" name="detectorGroup" checked="rdf:http://home.netscape.com/NC-rdf#Checked" uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore.label;" accesskey="&charsetMenuMore.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMoreCharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
<menu label="&charsetMenuMore1.label;" accesskey="&charsetMenuMore1.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore1CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore2.label;" accesskey="&charsetMenuMore2.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore2CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore3.label;" accesskey="&charsetMenuMore3.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore3CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore4.label;" accesskey="&charsetMenuMore4.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore4CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuMore5.label;" accesskey="&charsetMenuMore5.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore5CharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&charsetMenuUnicode.label;" accesskey="&charsetMenuUnicode.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserUnicodeCharsetMenuRoot">
|
||||
<template>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem uri="..." label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator />
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem name="charsetCustomize" label="&charsetCustomize.label;"
|
||||
accesskey="&charsetCustomize.accesskey;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
</overlay>
|
|
@ -1,348 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
* Ben Goodger <ben@netscape.com>
|
||||
* Blake Ross <blakeross@telocity.com>
|
||||
* Joe Hewitt <hewitt@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// parameters to gCommonDialogParam.Get() are defined in nsPIPromptService.idl
|
||||
var gCommonDialogParam =
|
||||
window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
|
||||
|
||||
function showControls()
|
||||
{
|
||||
// This is called before onload fires, so we can't be certain that any elements
|
||||
// in the document have their bindings ready, so don't call any methods/properties
|
||||
// here on xul elements that come from xbl bindings.
|
||||
|
||||
// show the required textboxes and set their initial values
|
||||
var nTextBoxes = gCommonDialogParam.GetInt(3);
|
||||
if (nTextBoxes == 2) {
|
||||
if (gCommonDialogParam.GetInt(4) == 1) {
|
||||
initTextbox("password1", 4, 6, false);
|
||||
initTextbox("password2", 5, 7, false);
|
||||
}
|
||||
else {
|
||||
initTextbox("login", 4, 6, false);
|
||||
initTextbox("password1", 5, 7, false);
|
||||
}
|
||||
} else if (nTextBoxes == 1) {
|
||||
if (gCommonDialogParam.GetInt(4) == 1)
|
||||
initTextbox("password1", -1, 6, true);
|
||||
else
|
||||
initTextbox("login", 4, 6, true);
|
||||
}
|
||||
}
|
||||
|
||||
function setLabelForNode(aNode, aLabel, aIsLabelFlag)
|
||||
{
|
||||
// This is for labels which may contain embedded access keys.
|
||||
// If we end in (&X) where X represents the access key, optionally preceded
|
||||
// by spaces and/or followed by the ':' character, store the access key and
|
||||
// remove the access key placeholder + leading spaces from the label.
|
||||
// Otherwise a character preceded by one but not two &s is the access key.
|
||||
// Store it and remove the &.
|
||||
|
||||
// Note that if you change the following code, see the comment of
|
||||
// nsTextBoxFrame::UpdateAccessTitle.
|
||||
var accessKey = null;
|
||||
if (/ *\(\&([^&])\)(:)?$/.test(aLabel)) {
|
||||
aLabel = RegExp.leftContext + RegExp.$2;
|
||||
accessKey = RegExp.$1;
|
||||
} else if (/^(.*[^&])?\&(([^&]).*$)/.test(aLabel)) {
|
||||
aLabel = RegExp.$1 + RegExp.$2;
|
||||
accessKey = RegExp.$3;
|
||||
}
|
||||
|
||||
// && is the magic sequence to embed an & in your label.
|
||||
aLabel = aLabel.replace(/\&\&/g, "&");
|
||||
if (aIsLabelFlag) { // Set text for <label> element
|
||||
aNode.setAttribute("value", aLabel);
|
||||
} else { // Set text for other xul elements
|
||||
aNode.label = aLabel;
|
||||
}
|
||||
|
||||
// XXXjag bug 325251
|
||||
// Need to set this after aNode.setAttribute("value", aLabel);
|
||||
if (accessKey)
|
||||
aNode.accessKey = accessKey;
|
||||
}
|
||||
|
||||
function commonDialogOnLoad()
|
||||
{
|
||||
// Set the document title. On Mac, we only care about URI's.
|
||||
if (/Mac/.test(navigator.platform)) {
|
||||
var titleString = gCommonDialogParam.GetString(12);
|
||||
if (/^\w+:\/\/\w/.test(titleString)) {
|
||||
setElementText("info.title", titleString, true);
|
||||
unHideElementById("info.title"); // Show URI inside dialog.
|
||||
}
|
||||
}
|
||||
else {
|
||||
document.title = gCommonDialogParam.GetString(12);
|
||||
}
|
||||
|
||||
// set the number of command buttons
|
||||
var nButtons = gCommonDialogParam.GetInt(2);
|
||||
var dialog = document.documentElement;
|
||||
switch (nButtons) {
|
||||
case 1:
|
||||
dialog.getButton("cancel").hidden = true;
|
||||
break;
|
||||
case 4:
|
||||
dialog.getButton("extra2").hidden = false;
|
||||
case 3:
|
||||
dialog.getButton("extra1").hidden = false;
|
||||
}
|
||||
|
||||
// display the main text
|
||||
var messageText = gCommonDialogParam.GetString(0);
|
||||
var messageParent = document.getElementById("info.box");
|
||||
var messageParagraphs = messageText.split("\n");
|
||||
|
||||
for (var i = 0; i < messageParagraphs.length; i++) {
|
||||
var descriptionNode = document.createElement("description");
|
||||
var text = document.createTextNode(messageParagraphs[i]);
|
||||
descriptionNode.appendChild(text);
|
||||
messageParent.appendChild(descriptionNode);
|
||||
}
|
||||
|
||||
setElementText("info.header", gCommonDialogParam.GetString(3), true);
|
||||
|
||||
// set the icon
|
||||
var iconElement = document.getElementById("info.icon");
|
||||
var iconClass = gCommonDialogParam.GetString(2);
|
||||
if (!iconClass)
|
||||
iconClass = "message-icon";
|
||||
iconElement.setAttribute("class", iconElement.getAttribute("class") + " " + iconClass);
|
||||
|
||||
switch (nButtons) {
|
||||
case 4:
|
||||
setLabelForNode(document.documentElement.getButton("extra2"), gCommonDialogParam.GetString(11));
|
||||
// fall through
|
||||
case 3:
|
||||
setLabelForNode(document.documentElement.getButton("extra1"), gCommonDialogParam.GetString(10));
|
||||
// fall through
|
||||
default:
|
||||
case 2:
|
||||
var string = gCommonDialogParam.GetString(9);
|
||||
if (string)
|
||||
setLabelForNode(document.documentElement.getButton("cancel"), string);
|
||||
// fall through
|
||||
case 1:
|
||||
string = gCommonDialogParam.GetString(8);
|
||||
if (string)
|
||||
setLabelForNode(document.documentElement.getButton("accept"), string);
|
||||
break;
|
||||
}
|
||||
|
||||
// set default result to cancelled
|
||||
gCommonDialogParam.SetInt(0, 1);
|
||||
|
||||
// initialize the checkbox
|
||||
setCheckbox(gCommonDialogParam.GetString(1), gCommonDialogParam.GetInt(1));
|
||||
|
||||
if (gCommonDialogParam.GetInt(3) == 0) // If no text fields
|
||||
{
|
||||
var dlgButtons = ['accept', 'cancel', 'extra1', 'extra2'];
|
||||
|
||||
// Set the default button
|
||||
var dButton = dlgButtons[gCommonDialogParam.GetInt(5)];
|
||||
document.documentElement.defaultButton = dButton;
|
||||
if (!/Mac/.test(navigator.platform))
|
||||
document.documentElement.getButton(dButton).focus();
|
||||
}
|
||||
|
||||
if (gCommonDialogParam.GetInt(6) != 0) // delay button enable
|
||||
{
|
||||
var delayInterval = 2000;
|
||||
try {
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
delayInterval = prefs.getIntPref("security.dialog_enable_delay");
|
||||
} catch (e) {}
|
||||
|
||||
document.documentElement.getButton("accept").disabled = true;
|
||||
document.documentElement.getButton("extra1").disabled = true;
|
||||
document.documentElement.getButton("extra2").disabled = true;
|
||||
|
||||
setTimeout(commonDialogReenableButtons, delayInterval);
|
||||
|
||||
addEventListener("blur", commonDialogBlur, false);
|
||||
addEventListener("focus", commonDialogFocus, false);
|
||||
}
|
||||
|
||||
getAttention();
|
||||
}
|
||||
|
||||
var gDelayExpired = false;
|
||||
var gBlurred = false;
|
||||
|
||||
function commonDialogBlur(aEvent)
|
||||
{
|
||||
if (aEvent.target != document)
|
||||
return;
|
||||
|
||||
gBlurred = true;
|
||||
document.documentElement.getButton("accept").disabled = true;
|
||||
document.documentElement.getButton("extra1").disabled = true;
|
||||
document.documentElement.getButton("extra2").disabled = true;
|
||||
}
|
||||
|
||||
function commonDialogFocus(aEvent)
|
||||
{
|
||||
if (aEvent.target != document)
|
||||
return;
|
||||
|
||||
gBlurred = false;
|
||||
// When refocusing the window, don't enable the buttons unless the countdown
|
||||
// delay has expired.
|
||||
if (gDelayExpired) {
|
||||
var script = "document.documentElement.getButton('accept').disabled = false; ";
|
||||
script += "document.documentElement.getButton('extra1').disabled = false; ";
|
||||
script += "document.documentElement.getButton('extra2').disabled = false;";
|
||||
setTimeout(script, 250);
|
||||
}
|
||||
}
|
||||
|
||||
function commonDialogReenableButtons()
|
||||
{
|
||||
// Don't automatically enable the buttons if we're not in the foreground
|
||||
if (!gBlurred) {
|
||||
document.documentElement.getButton("accept").disabled = false;
|
||||
document.documentElement.getButton("extra1").disabled = false;
|
||||
document.documentElement.getButton("extra2").disabled = false;
|
||||
}
|
||||
gDelayExpired = true;
|
||||
}
|
||||
|
||||
function initTextbox(aName, aLabelIndex, aValueIndex, aAlwaysLabel)
|
||||
{
|
||||
unHideElementById(aName+"Container");
|
||||
|
||||
var label = aLabelIndex < 0 ? "" : gCommonDialogParam.GetString(aLabelIndex);
|
||||
if (label || aAlwaysLabel && !label)
|
||||
setElementText(aName+"Label", label);
|
||||
|
||||
var value = aValueIndex < 0 ? "" : gCommonDialogParam.GetString(aValueIndex);
|
||||
var textbox = document.getElementById(aName + "Textbox");
|
||||
textbox.setAttribute("value", value);
|
||||
}
|
||||
|
||||
function setElementText(aElementID, aValue, aChildNodeFlag)
|
||||
{
|
||||
var element = document.getElementById(aElementID);
|
||||
if (!aChildNodeFlag && element) {
|
||||
setLabelForNode(element, aValue, true);
|
||||
} else if (aChildNodeFlag && element) {
|
||||
element.appendChild(document.createTextNode(aValue));
|
||||
}
|
||||
}
|
||||
|
||||
function setCheckbox(aChkMsg, aChkValue)
|
||||
{
|
||||
if (aChkMsg) {
|
||||
// XXX Would love to use hidden instead of collapsed, but the checkbox
|
||||
// fails to size itself properly when I do this.
|
||||
document.getElementById("checkboxContainer").removeAttribute("collapsed");
|
||||
|
||||
var checkboxElement = document.getElementById("checkbox");
|
||||
setLabelForNode(checkboxElement, aChkMsg);
|
||||
checkboxElement.checked = aChkValue > 0;
|
||||
}
|
||||
}
|
||||
|
||||
function unHideElementById(aElementID)
|
||||
{
|
||||
var element = document.getElementById(aElementID);
|
||||
element.hidden = false;
|
||||
}
|
||||
|
||||
function hideElementById(aElementID)
|
||||
{
|
||||
var element = document.getElementById(aElementID)
|
||||
element.hidden = true;
|
||||
}
|
||||
|
||||
function isVisible(aElementId)
|
||||
{
|
||||
return document.getElementById(aElementId).hasAttribute("hidden");
|
||||
}
|
||||
|
||||
function onCheckboxClick(aCheckboxElement)
|
||||
{
|
||||
gCommonDialogParam.SetInt(1, aCheckboxElement.checked);
|
||||
}
|
||||
|
||||
function commonDialogOnAccept()
|
||||
{
|
||||
gCommonDialogParam.SetInt(0, 0); // say that ok was pressed
|
||||
|
||||
var numTextBoxes = gCommonDialogParam.GetInt(3);
|
||||
var textboxIsPassword1 = gCommonDialogParam.GetInt(4) == 1;
|
||||
|
||||
if (numTextBoxes >= 1) {
|
||||
var editField1;
|
||||
if (textboxIsPassword1)
|
||||
editField1 = document.getElementById("password1Textbox");
|
||||
else
|
||||
editField1 = document.getElementById("loginTextbox");
|
||||
gCommonDialogParam.SetString(6, editField1.value);
|
||||
}
|
||||
|
||||
if (numTextBoxes == 2) {
|
||||
var editField2;
|
||||
if (textboxIsPassword1)
|
||||
// we had two password fields
|
||||
editField2 = document.getElementById("password2Textbox");
|
||||
else
|
||||
// we only had one password field (and one login field)
|
||||
editField2 = document.getElementById("password1Textbox");
|
||||
gCommonDialogParam.SetString(7, editField2.value);
|
||||
}
|
||||
}
|
||||
|
||||
function commonDialogOnExtra1()
|
||||
{
|
||||
gCommonDialogParam.SetInt(0, 2);
|
||||
window.close();
|
||||
}
|
||||
|
||||
function commonDialogOnExtra2()
|
||||
{
|
||||
gCommonDialogParam.SetInt(0, 3);
|
||||
window.close();
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog SYSTEM "chrome://global/locale/commonDialog.dtd">
|
||||
|
||||
<dialog id="commonDialog"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="commonDialogOnLoad();"
|
||||
ondialogaccept="return commonDialogOnAccept();"
|
||||
ondialogextra1="return commonDialogOnExtra1();"
|
||||
ondialogextra2="return commonDialogOnExtra2();"
|
||||
buttonpack="center"
|
||||
style="min-width: 29em; min-height: 8.5em; -moz-user-focus: ignore;">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/commonDialog.js"/>
|
||||
|
||||
<hbox flex="1">
|
||||
<hbox align="start">
|
||||
<image id="info.icon" class="spaced"/>
|
||||
</hbox>
|
||||
|
||||
<vbox flex="1" style="max-width: 45em;">
|
||||
<!-- title -->
|
||||
<description id="info.title" class="header" hidden="true"/>
|
||||
<!-- text -->
|
||||
<description id="info.header" class="header"/>
|
||||
<vbox id="info.box"/>
|
||||
|
||||
<!-- textboxes -->
|
||||
<vbox id="loginContainer" hidden="true">
|
||||
<label id="loginLabel" value="&editfield0.label;" control="loginTextbox"/>
|
||||
<textbox id="loginTextbox"/>
|
||||
<separator class="thin"/>
|
||||
</vbox>
|
||||
<vbox id ="password1Container" hidden="true">
|
||||
<label id="password1Label" value="&editfield1.label;" control="password1Textbox"/>
|
||||
<textbox type="password" id="password1Textbox"/>
|
||||
<separator class="thin"/>
|
||||
</vbox>
|
||||
<vbox id="password2Container" hidden="true">
|
||||
<label id="password2Label" value="&editfield2.label;" control="password2Textbox"/>
|
||||
<textbox type="password" id="password2Textbox"/>
|
||||
<separator class="thin"/>
|
||||
</vbox>
|
||||
|
||||
<!-- checkbox -->
|
||||
<vbox id="checkboxContainer" align="start" collapsed="true">
|
||||
<checkbox id="checkbox" oncommand="onCheckboxClick(this);"/>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
<!-- This method is called inline because it may unset hidden="true" on the
|
||||
above boxes, causing their frames to be build and bindings to load.
|
||||
So, by calling this inline, we guarantee the textboxes and checkboxes
|
||||
above will have their bindings before initButtons is called, and the
|
||||
dialog will be intrinsically sized correctly. -->
|
||||
<script type="application/x-javascript">showControls();</script>
|
||||
</dialog>
|
|
@ -1,618 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chip Clark <chipc@netscape.com>
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
* Neil Rashbrook <neil@parkwaycc.co.uk>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const nsIPrefLocalizedString = Components.interfaces.nsIPrefLocalizedString;
|
||||
const nsISupportsString = Components.interfaces.nsISupportsString;
|
||||
const nsIPromptService = Components.interfaces.nsIPromptService;
|
||||
const nsIPrefService = Components.interfaces.nsIPrefService;
|
||||
const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
|
||||
const nsIClipboardHelper = Components.interfaces.nsIClipboardHelper;
|
||||
const nsIAtomService = Components.interfaces.nsIAtomService;
|
||||
|
||||
const nsSupportsString_CONTRACTID = "@mozilla.org/supports-string;1";
|
||||
const nsPrompt_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1";
|
||||
const nsPrefService_CONTRACTID = "@mozilla.org/preferences-service;1";
|
||||
const nsClipboardHelper_CONTRACTID = "@mozilla.org/widget/clipboardhelper;1";
|
||||
const nsAtomService_CONTRACTID = "@mozilla.org/atom-service;1";
|
||||
|
||||
const gPromptService = Components.classes[nsPrompt_CONTRACTID].getService(nsIPromptService);
|
||||
const gPrefService = Components.classes[nsPrefService_CONTRACTID].getService(nsIPrefService);
|
||||
const gPrefBranch = gPrefService.getBranch(null).QueryInterface(Components.interfaces.nsIPrefBranch2);
|
||||
const gClipboardHelper = Components.classes[nsClipboardHelper_CONTRACTID].getService(nsIClipboardHelper);
|
||||
const gAtomService = Components.classes[nsAtomService_CONTRACTID].getService(nsIAtomService);
|
||||
|
||||
var gLockAtoms = [gAtomService.getAtom("default"), gAtomService.getAtom("user"), gAtomService.getAtom("locked")];
|
||||
// we get these from a string bundle
|
||||
var gLockStrs = [];
|
||||
var gTypeStrs = [];
|
||||
|
||||
const PREF_IS_DEFAULT_VALUE = 0;
|
||||
const PREF_IS_USER_SET = 1;
|
||||
const PREF_IS_LOCKED = 2;
|
||||
|
||||
var gPrefHash = {};
|
||||
var gPrefArray = [];
|
||||
var gPrefView = gPrefArray; // share the JS array
|
||||
var gFastIndex = 0;
|
||||
var gSortedColumn = "prefCol";
|
||||
var gSortFunction = null;
|
||||
var gSortDirection = 1; // 1 is ascending; -1 is descending
|
||||
var gConfigBundle = null;
|
||||
|
||||
var view = {
|
||||
get rowCount() { return gPrefView.length; },
|
||||
getCellText : function(index, col) {
|
||||
if (!(index in gPrefView))
|
||||
return "";
|
||||
|
||||
var value = gPrefView[index][col.id];
|
||||
|
||||
switch (col.id) {
|
||||
case "lockCol":
|
||||
return gLockStrs[value];
|
||||
case "typeCol":
|
||||
return gTypeStrs[value];
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
},
|
||||
getRowProperties : function(index, prop) {},
|
||||
getCellProperties : function(index, col, prop) {
|
||||
if (index in gPrefView)
|
||||
prop.AppendElement(gLockAtoms[gPrefView[index].lockCol]);
|
||||
},
|
||||
getColumnProperties : function(col, prop) {},
|
||||
treebox : null,
|
||||
selection : null,
|
||||
isContainer : function(index) { return false; },
|
||||
isContainerOpen : function(index) { return false; },
|
||||
isContainerEmpty : function(index) { return false; },
|
||||
isSorted : function() { return true; },
|
||||
canDrop : function(index, orientation) { return false; },
|
||||
drop : function(row, orientation) {},
|
||||
setTree : function(out) { this.treebox = out; },
|
||||
getParentIndex: function(rowIndex) { return -1; },
|
||||
hasNextSibling: function(rowIndex, afterIndex) { return false; },
|
||||
getLevel: function(index) { return 1; },
|
||||
getImageSrc: function(row, col) { return ""; },
|
||||
toggleOpenState : function(index) {},
|
||||
cycleHeader: function(col) {
|
||||
var index = this.selection.currentIndex;
|
||||
if (col.id == gSortedColumn)
|
||||
gSortDirection = -gSortDirection;
|
||||
if (col.id == gSortedColumn && gFastIndex == gPrefArray.length) {
|
||||
gPrefArray.reverse();
|
||||
if (gPrefView != gPrefArray)
|
||||
gPrefView.reverse();
|
||||
if (index >= 0)
|
||||
index = gPrefView.length - index - 1;
|
||||
}
|
||||
else {
|
||||
var pref = null;
|
||||
if (index >= 0) {
|
||||
if (gPrefArray != gPrefView)
|
||||
index = gPrefView.length - index - 1;
|
||||
else
|
||||
pref = gPrefArray[index];
|
||||
}
|
||||
var old = document.getElementById(gSortedColumn);
|
||||
old.setAttribute("sortDirection", "");
|
||||
gPrefArray.sort(gSortFunction = gSortFunctions[col.id]);
|
||||
if (gPrefView != gPrefArray) {
|
||||
if (col.id == gSortedColumn)
|
||||
gPrefView.reverse();
|
||||
else
|
||||
gPrefView.sort(gSortFunction);
|
||||
}
|
||||
gSortedColumn = col.id;
|
||||
if (pref)
|
||||
index = getIndexOfPref(pref);
|
||||
}
|
||||
col.element.setAttribute("sortDirection", gSortDirection > 0 ? "ascending" : "descending");
|
||||
this.treebox.invalidate();
|
||||
if (index >= 0) {
|
||||
this.selection.select(index);
|
||||
this.treebox.ensureRowIsVisible(index);
|
||||
}
|
||||
gFastIndex = gPrefArray.length;
|
||||
},
|
||||
selectionChanged : function() {},
|
||||
cycleCell: function(row, col) {},
|
||||
isEditable: function(row, col) {return false; },
|
||||
isSelectable: function(row, col) {return false; },
|
||||
setCellValue: function(row, col, value) {},
|
||||
setCellText: function(row, col, value) {},
|
||||
performAction: function(action) {},
|
||||
performActionOnRow: function(action, row) {},
|
||||
performActionOnCell: function(action, row, col) {},
|
||||
isSeparator: function(index) {return false; }
|
||||
};
|
||||
|
||||
// find the index in gPrefView of a pref object
|
||||
// or -1 if it does not exist in the filtered view
|
||||
function getViewIndexOfPref(pref)
|
||||
{
|
||||
var low = -1, high = gPrefView.length;
|
||||
var index = (low + high) >> 1;
|
||||
while (index > low) {
|
||||
var mid = gPrefView[index];
|
||||
if (mid == pref)
|
||||
return index;
|
||||
if (gSortFunction(mid, pref) < 0)
|
||||
low = index;
|
||||
else
|
||||
high = index;
|
||||
index = (low + high) >> 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// find the index in gPrefArray of a pref object
|
||||
// either one that was looked up in gPrefHash
|
||||
// or in case it was moved after sorting
|
||||
function getIndexOfPref(pref)
|
||||
{
|
||||
var low = -1, high = gFastIndex;
|
||||
var index = (low + high) >> 1;
|
||||
while (index > low) {
|
||||
var mid = gPrefArray[index];
|
||||
if (mid == pref)
|
||||
return index;
|
||||
if (gSortFunction(mid, pref) < 0)
|
||||
low = index;
|
||||
else
|
||||
high = index;
|
||||
index = (low + high) >> 1;
|
||||
}
|
||||
|
||||
for (index = gFastIndex; index < gPrefArray.length; ++index)
|
||||
if (gPrefArray[index] == pref)
|
||||
break;
|
||||
return index;
|
||||
}
|
||||
|
||||
function getNearestIndexOfPref(pref)
|
||||
{
|
||||
var low = -1, high = gFastIndex;
|
||||
var index = (low + high) >> 1;
|
||||
while (index > low) {
|
||||
if (gSortFunction(gPrefArray[index], pref) < 0)
|
||||
low = index;
|
||||
else
|
||||
high = index;
|
||||
index = (low + high) >> 1;
|
||||
}
|
||||
return high;
|
||||
}
|
||||
|
||||
var gPrefListener =
|
||||
{
|
||||
observe: function(subject, topic, prefName)
|
||||
{
|
||||
if (topic != "nsPref:changed")
|
||||
return;
|
||||
|
||||
if (/^capability\./.test(prefName)) // avoid displaying "private" preferences
|
||||
return;
|
||||
|
||||
var index = gPrefArray.length;
|
||||
if (prefName in gPrefHash) {
|
||||
index = getViewIndexOfPref(gPrefHash[prefName]);
|
||||
fetchPref(prefName, getIndexOfPref(gPrefHash[prefName]));
|
||||
if (index >= 0) {
|
||||
// Might need to update the filtered view
|
||||
gPrefView[index] = gPrefHash[prefName];
|
||||
view.treebox.invalidateRow(index);
|
||||
}
|
||||
if (gSortedColumn == "lockCol" || gSortedColumn == "valueCol")
|
||||
gFastIndex = 1; // TODO: reinsert and invalidate range
|
||||
} else {
|
||||
fetchPref(prefName, index);
|
||||
if (index == gFastIndex) {
|
||||
// Keep the array sorted by reinserting the pref object
|
||||
var pref = gPrefArray.pop();
|
||||
index = getNearestIndexOfPref(pref);
|
||||
gPrefArray.splice(index, 0, pref);
|
||||
gFastIndex = gPrefArray.length;
|
||||
}
|
||||
if (gPrefView == gPrefArray)
|
||||
view.treebox.rowCountChanged(index, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function prefObject(prefName, prefIndex)
|
||||
{
|
||||
this.prefCol = prefName;
|
||||
}
|
||||
|
||||
prefObject.prototype =
|
||||
{
|
||||
lockCol: PREF_IS_DEFAULT_VALUE,
|
||||
typeCol: nsIPrefBranch.PREF_STRING,
|
||||
valueCol: ""
|
||||
};
|
||||
|
||||
function fetchPref(prefName, prefIndex)
|
||||
{
|
||||
var pref = new prefObject(prefName);
|
||||
|
||||
gPrefHash[prefName] = pref;
|
||||
gPrefArray[prefIndex] = pref;
|
||||
|
||||
if (gPrefBranch.prefIsLocked(prefName))
|
||||
pref.lockCol = PREF_IS_LOCKED;
|
||||
else if (gPrefBranch.prefHasUserValue(prefName))
|
||||
pref.lockCol = PREF_IS_USER_SET;
|
||||
|
||||
try {
|
||||
switch (gPrefBranch.getPrefType(prefName)) {
|
||||
case gPrefBranch.PREF_BOOL:
|
||||
pref.typeCol = gPrefBranch.PREF_BOOL;
|
||||
// convert to a string
|
||||
pref.valueCol = gPrefBranch.getBoolPref(prefName).toString();
|
||||
break;
|
||||
case gPrefBranch.PREF_INT:
|
||||
pref.typeCol = gPrefBranch.PREF_INT;
|
||||
// convert to a string
|
||||
pref.valueCol = gPrefBranch.getIntPref(prefName).toString();
|
||||
break;
|
||||
default:
|
||||
case gPrefBranch.PREF_STRING:
|
||||
pref.valueCol = gPrefBranch.getComplexValue(prefName, nsISupportsString).data;
|
||||
// Try in case it's a localized string (will throw an exception if not)
|
||||
if (pref.lockCol == PREF_IS_DEFAULT_VALUE &&
|
||||
/^chrome:\/\/.+\/locale\/.+\.properties/.test(pref.valueCol))
|
||||
pref.valueCol = gPrefBranch.getComplexValue(prefName, nsIPrefLocalizedString).data;
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
// Also catch obscure cases in which you can't tell in advance
|
||||
// that the pref exists but has no user or default value...
|
||||
}
|
||||
}
|
||||
|
||||
function onConfigLoad()
|
||||
{
|
||||
// Load strings
|
||||
gConfigBundle = document.getElementById("configBundle");
|
||||
|
||||
gLockStrs[PREF_IS_DEFAULT_VALUE] = gConfigBundle.getString("default");
|
||||
gLockStrs[PREF_IS_USER_SET] = gConfigBundle.getString("user");
|
||||
gLockStrs[PREF_IS_LOCKED] = gConfigBundle.getString("locked");
|
||||
|
||||
gTypeStrs[nsIPrefBranch.PREF_STRING] = gConfigBundle.getString("string");
|
||||
gTypeStrs[nsIPrefBranch.PREF_INT] = gConfigBundle.getString("int");
|
||||
gTypeStrs[nsIPrefBranch.PREF_BOOL] = gConfigBundle.getString("bool");
|
||||
|
||||
var showWarning = gPrefBranch.getBoolPref("general.warnOnAboutConfig");
|
||||
|
||||
if (showWarning)
|
||||
document.getElementById("warningButton").focus();
|
||||
else
|
||||
ShowPrefs();
|
||||
}
|
||||
|
||||
// Unhide the warning message
|
||||
function ShowPrefs()
|
||||
{
|
||||
var prefCount = { value: 0 };
|
||||
var prefArray = gPrefBranch.getChildList("", prefCount);
|
||||
|
||||
for (var i = 0; i < prefCount.value; ++i)
|
||||
{
|
||||
var prefName = prefArray[i];
|
||||
if (/^capability\./.test(prefName)) // avoid displaying "private" preferences
|
||||
continue;
|
||||
|
||||
fetchPref(prefName, gPrefArray.length);
|
||||
}
|
||||
|
||||
var descending = document.getElementsByAttribute("sortDirection", "descending");
|
||||
if (descending.item(0)) {
|
||||
gSortedColumn = descending[0].id;
|
||||
gSortDirection = -1;
|
||||
}
|
||||
else {
|
||||
var ascending = document.getElementsByAttribute("sortDirection", "ascending");
|
||||
if (ascending.item(0))
|
||||
gSortedColumn = ascending[0].id;
|
||||
else
|
||||
document.getElementById(gSortedColumn).setAttribute("sortDirection", "ascending");
|
||||
}
|
||||
gSortFunction = gSortFunctions[gSortedColumn];
|
||||
gPrefArray.sort(gSortFunction);
|
||||
gFastIndex = gPrefArray.length;
|
||||
|
||||
gPrefBranch.addObserver("", gPrefListener, false);
|
||||
|
||||
var configTree = document.getElementById("configTree");
|
||||
configTree.view = view;
|
||||
configTree.controllers.insertControllerAt(0, configController);
|
||||
|
||||
document.getElementById("configDeck").setAttribute("selectedIndex", 1);
|
||||
if (!document.getElementById("showWarningNextTime").checked)
|
||||
gPrefBranch.setBoolPref("general.warnOnAboutConfig", false);
|
||||
|
||||
document.getElementById("textbox").focus();
|
||||
}
|
||||
|
||||
function onConfigUnload()
|
||||
{
|
||||
if (document.getElementById("configDeck").getAttribute("selectedIndex") == 1) {
|
||||
gPrefBranch.removeObserver("", gPrefListener);
|
||||
var configTree = document.getElementById("configTree");
|
||||
configTree.view = null;
|
||||
configTree.controllers.removeController(configController);
|
||||
}
|
||||
}
|
||||
|
||||
function FilterPrefs()
|
||||
{
|
||||
var substring = document.getElementById("textbox").value;
|
||||
var rex;
|
||||
// Check for "/regex/[i]"
|
||||
if (substring.charAt(0) == '/') {
|
||||
var r = substring.match(/^\/(.*)\/(i?)$/);
|
||||
try {
|
||||
rex = RegExp(r[1], r[2]);
|
||||
}
|
||||
catch (e) {
|
||||
return; // Do nothing on incomplete or bad RegExp
|
||||
}
|
||||
}
|
||||
|
||||
var prefCol = view.selection.currentIndex < 0 ? null : gPrefView[view.selection.currentIndex].prefCol;
|
||||
var oldlen = gPrefView.length;
|
||||
gPrefView = gPrefArray;
|
||||
if (substring) {
|
||||
gPrefView = [];
|
||||
if (!rex)
|
||||
rex = RegExp(substring.replace(/([^* \w])/g, "\\$1").replace(/[*]/g, ".*"), "i");
|
||||
for (var i = 0; i < gPrefArray.length; ++i)
|
||||
if (rex.test(gPrefArray[i].prefCol + ";" + gPrefArray[i].valueCol))
|
||||
gPrefView.push(gPrefArray[i]);
|
||||
if (gFastIndex < gPrefArray.length)
|
||||
gPrefView.sort(gSortFunction);
|
||||
}
|
||||
view.treebox.invalidate();
|
||||
view.treebox.rowCountChanged(oldlen, gPrefView.length - oldlen);
|
||||
gotoPref(prefCol);
|
||||
document.getElementById("button").disabled = !substring;
|
||||
}
|
||||
|
||||
function ClearFilter(button)
|
||||
{
|
||||
var textbox = document.getElementById("textbox");
|
||||
textbox.value = "";
|
||||
textbox.focus();
|
||||
FilterPrefs();
|
||||
}
|
||||
|
||||
function prefColSortFunction(x, y)
|
||||
{
|
||||
if (x.prefCol > y.prefCol)
|
||||
return gSortDirection;
|
||||
if (x.prefCol < y.prefCol)
|
||||
return -gSortDirection;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function lockColSortFunction(x, y)
|
||||
{
|
||||
if (x.lockCol != y.lockCol)
|
||||
return gSortDirection * (y.lockCol - x.lockCol);
|
||||
return prefColSortFunction(x, y);
|
||||
}
|
||||
|
||||
function typeColSortFunction(x, y)
|
||||
{
|
||||
if (x.typeCol != y.typeCol)
|
||||
return gSortDirection * (y.typeCol - x.typeCol);
|
||||
return prefColSortFunction(x, y);
|
||||
}
|
||||
|
||||
function valueColSortFunction(x, y)
|
||||
{
|
||||
if (x.valueCol > y.valueCol)
|
||||
return gSortDirection;
|
||||
if (x.valueCol < y.valueCol)
|
||||
return -gSortDirection;
|
||||
return prefColSortFunction(x, y);
|
||||
}
|
||||
|
||||
const gSortFunctions =
|
||||
{
|
||||
prefCol: prefColSortFunction,
|
||||
lockCol: lockColSortFunction,
|
||||
typeCol: typeColSortFunction,
|
||||
valueCol: valueColSortFunction
|
||||
};
|
||||
|
||||
const configController = {
|
||||
supportsCommand: function supportsCommand(command) {
|
||||
return command == "cmd_copy";
|
||||
},
|
||||
isCommandEnabled: function isCommandEnabled(command) {
|
||||
return view.selection && view.selection.currentIndex >= 0;
|
||||
},
|
||||
doCommand: function doCommand(command) {
|
||||
copyPref();
|
||||
},
|
||||
onEvent: function onEvent(event) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateContextMenu()
|
||||
{
|
||||
var lockCol = PREF_IS_LOCKED;
|
||||
var typeCol = nsIPrefBranch.PREF_STRING;
|
||||
var valueCol = "";
|
||||
var copyDisabled = true;
|
||||
|
||||
if (view.selection.currentIndex >= 0) {
|
||||
var prefRow = gPrefView[view.selection.currentIndex];
|
||||
lockCol = prefRow.lockCol;
|
||||
typeCol = prefRow.typeCol;
|
||||
valueCol = prefRow.valueCol;
|
||||
copyDisabled = false;
|
||||
}
|
||||
|
||||
var copyPref = document.getElementById("copyPref");
|
||||
copyPref.setAttribute("disabled", copyDisabled);
|
||||
|
||||
var copyName = document.getElementById("copyName");
|
||||
copyName.setAttribute("disabled", copyDisabled);
|
||||
|
||||
var copyValue = document.getElementById("copyValue");
|
||||
copyValue.setAttribute("disabled", copyDisabled);
|
||||
|
||||
var resetSelected = document.getElementById("resetSelected");
|
||||
resetSelected.setAttribute("disabled", lockCol != PREF_IS_USER_SET);
|
||||
|
||||
var canToggle = typeCol == nsIPrefBranch.PREF_BOOL && valueCol != "";
|
||||
|
||||
var modifySelected = document.getElementById("modifySelected");
|
||||
modifySelected.setAttribute("disabled", lockCol == PREF_IS_LOCKED);
|
||||
modifySelected.hidden = canToggle;
|
||||
|
||||
var toggleSelected = document.getElementById("toggleSelected");
|
||||
toggleSelected.setAttribute("disabled", lockCol == PREF_IS_LOCKED);
|
||||
toggleSelected.hidden = !canToggle;
|
||||
}
|
||||
|
||||
function copyPref()
|
||||
{
|
||||
var pref = gPrefView[view.selection.currentIndex];
|
||||
gClipboardHelper.copyString(pref.prefCol + ';' + pref.valueCol);
|
||||
}
|
||||
|
||||
function copyName()
|
||||
{
|
||||
gClipboardHelper.copyString(gPrefView[view.selection.currentIndex].prefCol);
|
||||
}
|
||||
|
||||
function copyValue()
|
||||
{
|
||||
gClipboardHelper.copyString(gPrefView[view.selection.currentIndex].valueCol);
|
||||
}
|
||||
|
||||
function ModifySelected()
|
||||
{
|
||||
if (view.selection.currentIndex >= 0)
|
||||
ModifyPref(gPrefView[view.selection.currentIndex]);
|
||||
}
|
||||
|
||||
function ResetSelected()
|
||||
{
|
||||
var entry = gPrefView[view.selection.currentIndex];
|
||||
gPrefBranch.clearUserPref(entry.prefCol);
|
||||
}
|
||||
|
||||
function NewPref(type)
|
||||
{
|
||||
var result = { value: "" };
|
||||
var dummy = { value: 0 };
|
||||
if (gPromptService.prompt(window,
|
||||
gConfigBundle.getFormattedString("new_title", [gTypeStrs[type]]),
|
||||
gConfigBundle.getString("new_prompt"),
|
||||
result,
|
||||
null,
|
||||
dummy) && result.value) {
|
||||
var pref;
|
||||
if (result.value in gPrefHash)
|
||||
pref = gPrefHash[result.value];
|
||||
else
|
||||
pref = { prefCol: result.value, lockCol: PREF_IS_DEFAULT_VALUE, typeCol: type, valueCol: "" };
|
||||
if (ModifyPref(pref))
|
||||
setTimeout(gotoPref, 0, result.value);
|
||||
}
|
||||
}
|
||||
|
||||
function gotoPref(pref)
|
||||
{
|
||||
// make sure the pref exists and is displayed in the current view
|
||||
var index = pref in gPrefHash ? getViewIndexOfPref(gPrefHash[pref]) : -1;
|
||||
if (index >= 0) {
|
||||
view.selection.select(index);
|
||||
view.treebox.ensureRowIsVisible(index);
|
||||
} else {
|
||||
view.selection.clearSelection();
|
||||
view.selection.currentIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
function ModifyPref(entry)
|
||||
{
|
||||
if (entry.lockCol == PREF_IS_LOCKED)
|
||||
return false;
|
||||
var title = gConfigBundle.getFormattedString("modify_title", [gTypeStrs[entry.typeCol]]);
|
||||
if (entry.typeCol == nsIPrefBranch.PREF_BOOL) {
|
||||
var check = { value: entry.valueCol == "false" };
|
||||
if (!entry.valueCol && !gPromptService.select(window, title, entry.prefCol, 2, [false, true], check))
|
||||
return false;
|
||||
gPrefBranch.setBoolPref(entry.prefCol, check.value);
|
||||
} else {
|
||||
var result = { value: entry.valueCol };
|
||||
var dummy = { value: 0 };
|
||||
if (!gPromptService.prompt(window, title, entry.prefCol, result, null, dummy))
|
||||
return false;
|
||||
if (entry.typeCol == nsIPrefBranch.PREF_INT) {
|
||||
// | 0 converts to integer or 0; - 0 to float or NaN.
|
||||
// Thus, this check should catch all cases.
|
||||
var val = result.value | 0;
|
||||
if (val != result.value - 0) {
|
||||
var err_title = gConfigBundle.getString("nan_title");
|
||||
var err_text = gConfigBundle.getString("nan_text");
|
||||
gPromptService.alert(window, err_title, err_text);
|
||||
return false;
|
||||
}
|
||||
gPrefBranch.setIntPref(entry.prefCol, val);
|
||||
} else {
|
||||
var supportsString = Components.classes[nsSupportsString_CONTRACTID].createInstance(nsISupportsString);
|
||||
supportsString.data = result.value;
|
||||
gPrefBranch.setComplexValue(entry.prefCol, nsISupportsString, supportsString);
|
||||
}
|
||||
}
|
||||
|
||||
gPrefService.savePrefFile(null);
|
||||
return true;
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/config.css" type="text/css"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
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 Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Netscape Communications Corporation.
|
||||
Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Chip Clark <chipc@netscape.com>
|
||||
Seth Spitzer <sspitzer@netscape.com>
|
||||
Neil Rashbrook <neil@parkwaycc.co.uk>
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
use your version of this file under the terms of the MPL, indicate your
|
||||
decision by deleting the provisions above and replace them with the notice
|
||||
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://global/locale/config.dtd">
|
||||
|
||||
<window id="config"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&window.title;"
|
||||
width="750"
|
||||
height="500"
|
||||
onunload="onConfigUnload();"
|
||||
onload="onConfigLoad();">
|
||||
|
||||
<script src="chrome://global/content/config.js"/>
|
||||
|
||||
<stringbundle id="configBundle" src="chrome://global/locale/config.properties"/>
|
||||
|
||||
<popup id="configContext" onpopupshowing="if (event.target == this) updateContextMenu();">
|
||||
<menuitem id="copyPref" label="©Pref.label;" accesskey="©Pref.accesskey;" oncommand="copyPref();"/>
|
||||
<menuitem id="copyName" label="©Name.label;" accesskey="©Name.accesskey;" oncommand="copyName();"/>
|
||||
<menuitem id="copyValue" label="©Value.label;" accesskey="©Value.accesskey;" oncommand="copyValue();"/>
|
||||
<menu label="&new.label;" accesskey="&new.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem label="&string.label;" accesskey="&string.accesskey;" oncommand="NewPref(nsIPrefBranch.PREF_STRING);"/>
|
||||
<menuitem label="&integer.label;" accesskey="&integer.accesskey;" oncommand="NewPref(nsIPrefBranch.PREF_INT);"/>
|
||||
<menuitem label="&boolean.label;" accesskey="&boolean.accesskey;" oncommand="NewPref(nsIPrefBranch.PREF_BOOL);"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem id="toggleSelected" label="&toggle.label;" accesskey="&toggle.accesskey;" oncommand="ModifySelected();"/>
|
||||
<menuitem id="modifySelected" label="&modify.label;" accesskey="&modify.accesskey;" oncommand="ModifySelected();"/>
|
||||
<menuitem id="resetSelected" label="&reset.label;" accesskey="&reset.accesskey;" oncommand="ResetSelected();"/>
|
||||
</popup>
|
||||
|
||||
<keyset>
|
||||
<key keycode="VK_ENTER" oncommand="ModifySelected();"/>
|
||||
<key keycode="VK_RETURN" oncommand="ModifySelected();"/>
|
||||
</keyset>
|
||||
<deck id="configDeck" flex="1">
|
||||
<vbox id="warningScreen" flex="1" align="center">
|
||||
<spacer flex="1"/>
|
||||
<hbox id="warningBox" align="top">
|
||||
<image id="exclam" class="alert-icon"/>
|
||||
<vbox id="warningInnerBox" flex="1">
|
||||
<label id="warningTitle">&aboutWarningTitle.label;</label>
|
||||
<label id="warningText">&aboutWarningText.label;</label>
|
||||
<checkbox id="showWarningNextTime" label="&aboutWarningCheckbox.label;" checked="true"/>
|
||||
<hbox pack="center">
|
||||
<button id="warningButton" oncommand="ShowPrefs();" label="&aboutWarningButton.label;"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<spacer flex="2"/>
|
||||
</vbox>
|
||||
<vbox flex="1">
|
||||
<hbox id="filterRow" align="center">
|
||||
<label value="&filterPrefs.label;" accesskey="&filterPrefs.accesskey;" control="textbox"/>
|
||||
<textbox id="textbox" flex="1" type="timed" timeout="500" oncommand="FilterPrefs();"/>
|
||||
<button id="button" label="&showAll.label;" accesskey="&showAll.accesskey;" oncommand="ClearFilter();" disabled="true"/>
|
||||
</hbox>
|
||||
|
||||
<tree id="configTree" flex="1" class="plain focusring" seltype="single"
|
||||
onselect="updateCommands('select');"
|
||||
enableColumnDrag="true" context="configContext">
|
||||
<treecols>
|
||||
<treecol id="prefCol" label="&prefColumn.label;" flex="7"
|
||||
class="sortDirectionIndicator"
|
||||
ignoreincolumnpicker="true"
|
||||
persist="hidden width ordinal sortDirection"/>
|
||||
<splitter class="tree-splitter" />
|
||||
<treecol id="lockCol" label="&lockColumn.label;" flex="1"
|
||||
class="sortDirectionIndicator"
|
||||
persist="hidden width ordinal sortDirection"/>
|
||||
<splitter class="tree-splitter" />
|
||||
<treecol id="typeCol" label="&typeColumn.label;" flex="1"
|
||||
class="sortDirectionIndicator"
|
||||
persist="hidden width ordinal sortDirection"/>
|
||||
<splitter class="tree-splitter" />
|
||||
<treecol id="valueCol" label="&valueColumn.label;" flex="10"
|
||||
class="sortDirectionIndicator"
|
||||
persist="hidden width ordinal sortDirection"/>
|
||||
</treecols>
|
||||
|
||||
<treechildren id="configTreeBody" ondblclick="if (event.button == 0) ModifySelected();"/>
|
||||
</tree>
|
||||
</vbox>
|
||||
</deck>
|
||||
</window>
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the packages being supplied by this jar -->
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:global-platform"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- package information -->
|
||||
<RDF:Description about="urn:mozilla:package:global-platform"
|
||||
chrome:displayName="Platform Specific"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="global-platform"
|
||||
#expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__">
|
||||
</RDF:Description>
|
||||
</RDF:RDF>
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the packages being supplied by this jar -->
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:global-region"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- package information -->
|
||||
<RDF:Description about="urn:mozilla:package:global-region"
|
||||
chrome:displayName="US Regional Contents"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="global-region"
|
||||
#expand chrome:localeVersion="__MOZILLA_REGION_VERSION__">
|
||||
</RDF:Description>
|
||||
|
||||
</RDF:RDF>
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the packages being supplied by this jar -->
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:global"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- package information -->
|
||||
<RDF:Description about="urn:mozilla:package:global"
|
||||
chrome:displayName="Toolkit"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="global"
|
||||
chrome:xpcNativeWrappers="true"
|
||||
#expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__"
|
||||
#expand chrome:skinVersion="__MOZILLA_SKIN_VERSION__">
|
||||
</RDF:Description>
|
||||
</RDF:RDF>
|
|
@ -1,98 +0,0 @@
|
|||
var doOKFunction = 0;
|
||||
var doCancelFunction = 0;
|
||||
var doButton2Function = 0;
|
||||
var doButton3Function = 0;
|
||||
|
||||
// call this from dialog onload() to allow ok and cancel to call your code
|
||||
// functions should return true if they want the dialog to close
|
||||
function doSetOKCancel(okFunc, cancelFunc, button2Func, button3Func )
|
||||
{
|
||||
//dump("top.window.navigator.platform: " + top.window.navigator.platform + "\n");
|
||||
|
||||
doOKFunction = okFunc;
|
||||
doCancelFunction = cancelFunc;
|
||||
doButton2Function = button2Func;
|
||||
doButton3Function = button3Func;
|
||||
}
|
||||
|
||||
function doOKButton()
|
||||
{
|
||||
var close = true;
|
||||
|
||||
if ( doOKFunction )
|
||||
close = doOKFunction();
|
||||
|
||||
if (close && top)
|
||||
top.window.close();
|
||||
}
|
||||
|
||||
function doCancelButton()
|
||||
{
|
||||
var close = true;
|
||||
|
||||
if ( doCancelFunction )
|
||||
close = doCancelFunction();
|
||||
|
||||
if (close && top)
|
||||
top.window.close();
|
||||
}
|
||||
|
||||
function doButton2()
|
||||
{
|
||||
var close = true;
|
||||
|
||||
if ( doButton2Function )
|
||||
close = doButton2Function();
|
||||
|
||||
if (close && top)
|
||||
top.window.close();
|
||||
}
|
||||
|
||||
function doButton3()
|
||||
{
|
||||
var close = true;
|
||||
|
||||
if ( doButton3Function )
|
||||
close = doButton3Function();
|
||||
|
||||
if (close && top)
|
||||
top.window.close();
|
||||
}
|
||||
|
||||
function moveToAlertPosition()
|
||||
{
|
||||
// hack. we need this so the window has something like its final size
|
||||
if (window.outerWidth == 1) {
|
||||
dump("Trying to position a sizeless window; caller should have called sizeToContent() or sizeTo(). See bug 75649.\n");
|
||||
sizeToContent();
|
||||
}
|
||||
|
||||
var xOffset = (opener.outerWidth - window.outerWidth) / 2;
|
||||
var yOffset = opener.outerHeight / 5;
|
||||
|
||||
var newX = opener.screenX + xOffset;
|
||||
var newY = opener.screenY + yOffset;
|
||||
|
||||
// ensure the window is fully onscreen (if smaller than the screen)
|
||||
if (newX < screen.availLeft)
|
||||
newX = screen.availLeft + 20;
|
||||
if ((newX + window.outerWidth) > (screen.availLeft + screen.availWidth))
|
||||
newX = (screen.availLeft + screen.availWidth) - window.outerWidth - 20;
|
||||
|
||||
if (newY < screen.availTop)
|
||||
newY = screen.availTop + 20;
|
||||
if ((newY + window.outerHeight) > (screen.availTop + screen.availHeight))
|
||||
newY = (screen.availTop + screen.availHeight) - window.outerHeight - 60;
|
||||
|
||||
window.moveTo( newX, newY );
|
||||
}
|
||||
|
||||
function centerWindowOnScreen()
|
||||
{
|
||||
var xOffset = screen.availWidth/2 - window.outerWidth/2;
|
||||
var yOffset = screen.availHeight/2 - window.outerHeight/2; //(opener.outerHeight *2)/10;
|
||||
|
||||
xOffset = ( xOffset > 0 ) ? xOffset : 0;
|
||||
yOffset = ( yOffset > 0 ) ? yOffset : 0;
|
||||
window.moveTo( xOffset, yOffset);
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/platformDialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE overlay SYSTEM "chrome://global/locale/dialogOverlay.dtd">
|
||||
|
||||
<overlay id="dialogOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/dialogOverlay.js"/>
|
||||
|
||||
</overlay>
|
|
@ -1,92 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Joe Hewitt <hewitt@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var FullScreen =
|
||||
{
|
||||
toggle: function()
|
||||
{
|
||||
// show/hide all menubars, toolbars, and statusbars (except the full screen toolbar)
|
||||
this.showXULChrome("menubar", window.fullScreen);
|
||||
this.showXULChrome("toolbar", window.fullScreen);
|
||||
this.showXULChrome("statusbar", window.fullScreen);
|
||||
},
|
||||
|
||||
showXULChrome: function(aTag, aShow)
|
||||
{
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var els = document.getElementsByTagNameNS(XULNS, aTag);
|
||||
|
||||
var i;
|
||||
for (i = 0; i < els.length; ++i) {
|
||||
// XXX don't interfere with previously collapsed toolbars
|
||||
if (els[i].getAttribute("fullscreentoolbar") == "true") {
|
||||
this.setToolbarButtonMode(els[i], aShow ? "" : "small");
|
||||
} else {
|
||||
// use moz-collapsed so it doesn't persist hidden/collapsed,
|
||||
// so that new windows don't have missing toolbars
|
||||
if (aShow)
|
||||
els[i].removeAttribute("moz-collapsed");
|
||||
else
|
||||
els[i].setAttribute("moz-collapsed", "true");
|
||||
}
|
||||
}
|
||||
|
||||
var controls = document.getElementsByAttribute("fullscreencontrol", "true");
|
||||
for (i = 0; i < controls.length; ++i)
|
||||
controls[i].hidden = aShow;
|
||||
},
|
||||
|
||||
setToolbarButtonMode: function(aToolbar, aMode)
|
||||
{
|
||||
aToolbar.setAttribute("toolbarmode", aMode);
|
||||
this.setToolbarButtonModeFor(aToolbar, "toolbarbutton", aMode);
|
||||
this.setToolbarButtonModeFor(aToolbar, "button", aMode);
|
||||
this.setToolbarButtonModeFor(aToolbar, "textbox", aMode);
|
||||
},
|
||||
|
||||
setToolbarButtonModeFor: function(aToolbar, aTag, aMode)
|
||||
{
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var els = aToolbar.getElementsByTagNameNS(XULNS, aTag);
|
||||
|
||||
for (var i = 0; i < els.length; ++i) {
|
||||
els[i].setAttribute("toolbarmode", aMode);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
|
@ -1,150 +0,0 @@
|
|||
function goQuitApplication()
|
||||
{
|
||||
var ObserverService = Components.classes["@mozilla.org/observer-service;1"].getService();
|
||||
ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
|
||||
if (ObserverService)
|
||||
{
|
||||
try
|
||||
{
|
||||
// XXX FIX! we should have a way to cancel a requested quit; see
|
||||
// bugzilla bug 149764
|
||||
ObserverService.notifyObservers(null, "quit-application-requested", null);
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
// dump("no observer found \n");
|
||||
}
|
||||
}
|
||||
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
|
||||
var enumerator = windowManagerInterface.getEnumerator( null );
|
||||
var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].
|
||||
getService(Components.interfaces.nsIAppStartup);
|
||||
|
||||
var nativeAppSupport = null;
|
||||
try {
|
||||
nativeAppSupport = appStartup.nativeAppSupport;
|
||||
}
|
||||
catch ( ex ) {
|
||||
}
|
||||
|
||||
while ( enumerator.hasMoreElements() )
|
||||
{
|
||||
var domWindow = enumerator.getNext();
|
||||
if (("tryToClose" in domWindow) && !domWindow.tryToClose())
|
||||
return false;
|
||||
domWindow.close();
|
||||
};
|
||||
if (!nativeAppSupport || !nativeAppSupport.isServerMode)
|
||||
appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit);
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// Command Updater functions
|
||||
//
|
||||
function goUpdateCommand(command)
|
||||
{
|
||||
try {
|
||||
var controller = top.document.commandDispatcher.getControllerForCommand(command);
|
||||
|
||||
var enabled = false;
|
||||
|
||||
if ( controller )
|
||||
enabled = controller.isCommandEnabled(command);
|
||||
|
||||
goSetCommandEnabled(command, enabled);
|
||||
}
|
||||
catch (e) {
|
||||
dump("An error occurred updating the "+command+" command\n");
|
||||
}
|
||||
}
|
||||
|
||||
function goDoCommand(command)
|
||||
{
|
||||
try {
|
||||
var controller = top.document.commandDispatcher.getControllerForCommand(command);
|
||||
if ( controller && controller.isCommandEnabled(command))
|
||||
controller.doCommand(command);
|
||||
}
|
||||
catch (e) {
|
||||
dump("An error occurred executing the " + command + " command\n" + e + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function goSetCommandEnabled(id, enabled)
|
||||
{
|
||||
var node = document.getElementById(id);
|
||||
|
||||
if ( node )
|
||||
{
|
||||
if ( enabled )
|
||||
node.removeAttribute("disabled");
|
||||
else
|
||||
node.setAttribute('disabled', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
function goSetMenuValue(command, labelAttribute)
|
||||
{
|
||||
var commandNode = top.document.getElementById(command);
|
||||
if ( commandNode )
|
||||
{
|
||||
var label = commandNode.getAttribute(labelAttribute);
|
||||
if ( label )
|
||||
commandNode.setAttribute('label', label);
|
||||
}
|
||||
}
|
||||
|
||||
function goSetAccessKey(command, valueAttribute)
|
||||
{
|
||||
var commandNode = top.document.getElementById(command);
|
||||
if ( commandNode )
|
||||
{
|
||||
var value = commandNode.getAttribute(valueAttribute);
|
||||
if ( value )
|
||||
commandNode.setAttribute('accesskey', value);
|
||||
}
|
||||
}
|
||||
|
||||
// this function is used to inform all the controllers attached to a node that an event has occurred
|
||||
// (e.g. the tree controllers need to be informed of blur events so that they can change some of the
|
||||
// menu items back to their default values)
|
||||
function goOnEvent(node, event)
|
||||
{
|
||||
var numControllers = node.controllers.getControllerCount();
|
||||
var controller;
|
||||
|
||||
for ( var controllerIndex = 0; controllerIndex < numControllers; controllerIndex++ )
|
||||
{
|
||||
controller = node.controllers.getControllerAt(controllerIndex);
|
||||
if ( controller )
|
||||
controller.onEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
function setTooltipText(aID, aTooltipText)
|
||||
{
|
||||
var element = document.getElementById(aID);
|
||||
if (element)
|
||||
element.setAttribute("tooltiptext", aTooltipText);
|
||||
}
|
||||
|
||||
function FillInTooltip ( tipElement )
|
||||
{
|
||||
var retVal = false;
|
||||
var textNode = document.getElementById("TOOLTIP-tooltipText");
|
||||
if (textNode) {
|
||||
while (textNode.hasChildNodes())
|
||||
textNode.removeChild(textNode.firstChild);
|
||||
var tipText = tipElement.getAttribute("tooltiptext");
|
||||
if (tipText) {
|
||||
var node = document.createTextNode(tipText);
|
||||
textNode.appendChild(node);
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<overlay id="globalOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
|
||||
<popupset id="aTooltipSet">
|
||||
<popup id="aTooltip" class="tooltip" onpopupshowing="return FillInTooltip(document.tooltipNode);" >
|
||||
<label id="TOOLTIP-tooltipText" class="tooltip-label" flex="1"/>
|
||||
</popup>
|
||||
</popupset>
|
||||
|
||||
</overlay>
|
|
@ -1,115 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
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 Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Netscape Communications Corporation.
|
||||
Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
use your version of this file under the terms of the MPL, indicate your
|
||||
decision by deleting the provisions above and replace them with the notice
|
||||
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xul-overlay href="chrome://navigator/content/navigatorOverlay.xul"?>
|
||||
|
||||
<!-- hiddenwindow is a "minimal" XUL window intended for creating the,
|
||||
er, hidden window. This window is never shown, but on platforms
|
||||
which leave the app running after the last (visible) window is shut
|
||||
down, this window does hold a browser menubar.
|
||||
Though this window looks a lot like navigator.xul, that xul
|
||||
is unsuitable because it's subject to the whims of its associated
|
||||
appcore, which among other things causes it to load content documents
|
||||
undesirable for this window.
|
||||
Arguably a simpler menu structure could be substituted, but
|
||||
the full one was included for now in anticipation of the whole thing
|
||||
becoming an included file someday. -->
|
||||
|
||||
<!-- Localizable string definitions from navigator.xul. -->
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % buildDTD SYSTEM "chrome://global/content/build.dtd" >
|
||||
%buildDTD;
|
||||
<!ENTITY % navigatorDTD SYSTEM "chrome://navigator/locale/navigator.dtd" >
|
||||
%navigatorDTD;
|
||||
]>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
title="hidden"
|
||||
titlemodifier="&mainWindow.titlemodifier;"
|
||||
titlemenuseparator="&mainWindow.titlemodifiermenuseparator;"
|
||||
onload="hiddenWindowStartup();">
|
||||
|
||||
<!-- JS from navigator.xul, to handle the menu commands -->
|
||||
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="application/x-javascript" src="chrome://navigator/content/browser.js"/>
|
||||
<script type="application/x-javascript" src="chrome://navigator/content/navigator.js"/>
|
||||
|
||||
<!-- Shared Bookmarks Utility Library -->
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/bookmarks/bookmarks.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/bookmarks/bookmarksMenu.js"/>
|
||||
|
||||
<stringbundleset id="stringbundleset">
|
||||
<stringbundle id="bundle_navigator" src="chrome://navigator/locale/navigator.properties"/>
|
||||
<stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
|
||||
<stringbundle id="bundle_navigator_region" src="chrome://navigator-region/locale/region.properties"/>
|
||||
<stringbundle id="bundle_brand_region" src="chrome://global-region/locale/region.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<!-- keys are appended from the overlay -->
|
||||
<keyset id="tasksKeys">
|
||||
<keyset id="navKeys">
|
||||
<key id="showHideSidebar"/>
|
||||
</keyset>
|
||||
</keyset>
|
||||
|
||||
<!-- commands are appended from the overlay -->
|
||||
<commandset id="commands">
|
||||
<commandset id="tasksCommands"/>
|
||||
<commandset id="globalEditMenuItems"/>
|
||||
<commandset id="selectEditMenuItems"/>
|
||||
<commandset id="undoEditMenuItems"/>
|
||||
<commandset id="clipboardEditMenuItems"/>
|
||||
</commandset>
|
||||
|
||||
<broadcasterset id="navBroadcasters"/>
|
||||
|
||||
<template id="bookmarksMenuTemplate"/>
|
||||
|
||||
<!-- it's the whole navigator.xul menubar! hidden windows need to
|
||||
have a menubar for situations where they're the only window remaining
|
||||
on a platform that wants to leave the app running, like the Mac.
|
||||
-->
|
||||
<toolbox id="toolbox">
|
||||
<menubar id="main-menubar" position="1"/>
|
||||
</toolbox>
|
||||
|
||||
</window>
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Двоичные данные
xpfe/global/resources/content/logo.gif
Двоичные данные
xpfe/global/resources/content/logo.gif
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 9.2 KiB |
|
@ -1,46 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# 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 the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
toolkit.jar:
|
||||
content/global/platformDialogOverlay.xul
|
||||
content/global/platformXUL.css
|
||||
content/global/platformDialog.xml
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="platformDialogBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="dialog" extends="chrome://global/content/bindings/dialog.xml#dialog">
|
||||
<content>
|
||||
<xul:vbox class="box-inherit dialog-content-box" flex="1">
|
||||
<children/>
|
||||
</xul:vbox>
|
||||
|
||||
<xul:hbox class="dialog-button-box"
|
||||
xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient">
|
||||
<xul:button dlgtype="disclosure" class="dialog-button" hidden="true" xbl:inherits="label=buttonlabeldisclosure,accesskey=buttonaccesskeydisclosure"/>
|
||||
<xul:button dlgtype="help" class="dialog-button" hidden="true" xbl:inherits="label=buttonlabelhelp,accesskey=buttonaccesskeyhelp"/>
|
||||
<xul:button dlgtype="extra2" class="dialog-button" hidden="true" label="" xbl:inherits="label=buttonlabelextra2,accesskey=buttonaccesskeyextra2"/>
|
||||
<xul:button dlgtype="extra1" class="dialog-button" hidden="true" label="" xbl:inherits="label=buttonlabelextra1,accesskey=buttonaccesskeyextra1"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button dlgtype="cancel" class="dialog-button" xbl:inherits="label=buttonlabelcancel,accesskey=buttonaccesskeycancel"/>
|
||||
<xul:button dlgtype="accept" class="dialog-button" xbl:inherits="label=buttonlabelaccept,accesskey=buttonaccesskeyaccept,disabled=buttondisabledaccept"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" key="." modifiers="meta" phase="capturing" action="this.cancelDialog();"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -1,86 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- 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 Communicator client code, released
|
||||
- March 31, 1998.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
- or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
<!-- mac version of platformDialogOverlay.xul -->
|
||||
|
||||
<!DOCTYPE overlay SYSTEM "chrome://global-platform/locale/platformDialogOverlay.dtd">
|
||||
|
||||
<overlay id="platformDialogOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<hbox id="okCancelButtons">
|
||||
<spacer flex="1"/>
|
||||
<button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/>
|
||||
<button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/>
|
||||
<button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/>
|
||||
<button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/>
|
||||
</hbox>
|
||||
|
||||
<hbox id="okCancelHelpButtons">
|
||||
<button class="exit-dialog" id="help" label="&helpButton.label;" oncommand="doHelpButton();"/>
|
||||
<spacer flex="1"/>
|
||||
<button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/>
|
||||
<button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/>
|
||||
<button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/>
|
||||
<button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/>
|
||||
</hbox>
|
||||
|
||||
<hbox id="okCancelButtonsRight">
|
||||
<spacer flex="1"/>
|
||||
<button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/>
|
||||
<button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/>
|
||||
<button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/>
|
||||
<button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/>
|
||||
</hbox>
|
||||
|
||||
<hbox id="okCancelHelpButtonsRight">
|
||||
<button class="exit-dialog" id="help" label="&helpButton.label;" oncommand="doHelpButton();"/>
|
||||
<spacer flex="1"/>
|
||||
<button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/>
|
||||
<button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/>
|
||||
<button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/>
|
||||
<button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/>
|
||||
</hbox>
|
||||
|
||||
<keyset id="dialogKeys">
|
||||
<key keycode="VK_ENTER" oncommand="if (!document.getElementById('ok').disabled) doOKButton();"/>
|
||||
<key keycode="VK_RETURN" oncommand="if (!document.getElementById('ok').disabled) doOKButton();"/>
|
||||
<key keycode="VK_ESCAPE" oncommand="doCancelButton();"/>
|
||||
<key key="." modifiers="meta" oncommand="doCancelButton();"/>
|
||||
</keyset>
|
||||
|
||||
</overlay>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче