зеркало из https://github.com/mozilla/pjs.git
Separate the Page Holder concept from sidebar bookmarks.
This commit is contained in:
Родитель
458d395c2b
Коммит
c5b8258428
|
@ -3751,14 +3751,17 @@ nsDefaultEngine.prototype =
|
|||
}
|
||||
|
||||
var gWebPanelURI;
|
||||
function openWebPanel(aURI)
|
||||
function openWebPanel(aTitle, aURI)
|
||||
{
|
||||
// Ensure that the web panels sidebar is open.
|
||||
toggleSidebar('viewWebPanelsSidebar', true);
|
||||
|
||||
// Set the title of the panel.
|
||||
document.getElementById("sidebar-title").value = aTitle;
|
||||
|
||||
// Tell the Web Panels sidebar to load the bookmark.
|
||||
var sidebar = document.getElementById("sidebar");
|
||||
if (sidebar.contentDocument && sidebar.contentDocument.getElementById('webpanels-browser')) {
|
||||
if (sidebar.contentDocument && sidebar.contentDocument.getElementById('web-panels-browser')) {
|
||||
sidebar.contentWindow.loadWebPanel(aURI);
|
||||
if (gWebPanelURI) {
|
||||
gWebPanelURI = "";
|
||||
|
@ -3776,7 +3779,7 @@ function openWebPanel(aURI)
|
|||
function asyncOpenWebPanel(event)
|
||||
{
|
||||
var sidebar = document.getElementById("sidebar");
|
||||
if (gWebPanelURI && sidebar.contentDocument && sidebar.contentDocument.getElementById('webpanels-browser'))
|
||||
if (gWebPanelURI && sidebar.contentDocument && sidebar.contentDocument.getElementById('web-panels-browser'))
|
||||
sidebar.contentWindow.loadWebPanel(gWebPanelURI);
|
||||
gWebPanelURI = "";
|
||||
sidebar.removeEventListener("load", asyncOpenWebPanel, true);
|
||||
|
|
|
@ -176,7 +176,11 @@
|
|||
type="checkbox" group="sidebar" sidebarurl="chrome://browser/content/history/history-panel.xul"
|
||||
oncommand="toggleSidebar('viewHistorySidebar');"/>
|
||||
|
||||
<broadcaster id="viewWebPanelsSidebar" autoCheck="false" label="&webPanelsButton.label;"
|
||||
<broadcaster id="viewPageHolderSidebar" autoCheck="false" label="&pageHolderButton.label;"
|
||||
type="checkbox" group="sidebar" sidebarurl="chrome://browser/content/page-drawer.xul"
|
||||
oncommand="toggleSidebar('viewPageHolderSidebar');"/>
|
||||
|
||||
<broadcaster id="viewWebPanelsSidebar" autoCheck="false"
|
||||
type="checkbox" group="sidebar" sidebarurl="chrome://browser/content/web-panels.xul"
|
||||
oncommand="toggleSidebar('viewWebPanelsSidebar');"/>
|
||||
|
||||
|
@ -248,7 +252,7 @@
|
|||
<key id="viewBookmarksSidebarKb" key="&manBookmarksCmd.commandkey;" command="viewBookmarksSidebar" modifiers="accel"/>
|
||||
<key id="key_stop" keycode="VK_ESCAPE" command="Browser:Stop"/>
|
||||
<key id="key_gotoHistory" key="&history.commandKey;" command="viewHistorySidebar" modifiers="accel"/>
|
||||
<key id="key_webPanelsSidebar" key="&webPanels.commandKey;" command="viewWebPanelsSidebar" modifiers="accel"/>
|
||||
<key id="key_pageHolderSidebar" key="&pageHolder.commandKey;" command="viewPageHolderSidebar" modifiers="accel"/>
|
||||
|
||||
<key id="key_textZoomReduce" key="&textZoomReduceCmd.commandkey;" command="cmd_textZoomReduce" modifiers="accel"/>
|
||||
<key id="key_textZoomEnlarge" key="&textZoomEnlargeCmd.commandkey;" command="cmd_textZoomEnlarge" modifiers="accel"/>
|
||||
|
@ -655,7 +659,7 @@
|
|||
<menuitem key="key_openDownloadsSidebar" observes="viewDownloadsSidebar"/>
|
||||
<menuitem key="viewBookmarksSidebarKb" observes="viewBookmarksSidebar"/>
|
||||
<menuitem key="key_gotoHistory" observes="viewHistorySidebar"/>
|
||||
<menuitem key="key_webPanelsSidebar" observes="viewWebPanelsSidebar"/>
|
||||
<menuitem key="key_pageHolderSidebar" observes="viewPageHolderSidebar"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
|
@ -997,8 +1001,8 @@
|
|||
tooltiptext="&bookmarksButton.tooltip;"/>
|
||||
|
||||
<toolbarbutton id="webpanels-button" class="toolbarbutton-1"
|
||||
observes="viewWebPanelsSidebar"
|
||||
tooltiptext="&webPanelsButton.tooltip;"/>
|
||||
observes="viewPageHolderSidebar"
|
||||
tooltiptext="&pageHolderButton.tooltip;"/>
|
||||
|
||||
<toolbarbutton id="new-tab-button" class="toolbarbutton-1"
|
||||
label="&tabCmd.label;"
|
||||
|
@ -1057,7 +1061,8 @@
|
|||
<hbox flex="1" id="browser">
|
||||
<vbox id="sidebar-box" hidden="true">
|
||||
<sidebarheader align="center">
|
||||
<label id="sidebar-title"/>
|
||||
<label id="sidebar-title" persist="value"/>
|
||||
<image id="sidebar-throbber"/>
|
||||
<spacer flex="1"/>
|
||||
<toolbarbutton class="tabs-closebutton" oncommand="toggleSidebar();"/>
|
||||
</sidebarheader>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/web-panels.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % webPanelsDTD SYSTEM "chrome://browser/locale/page-drawer.dtd" >
|
||||
%webPanelsDTD;
|
||||
]>
|
||||
|
||||
<page id="webpanels-window"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="load()" onunload="unload()">
|
||||
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/contentAreaUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/page-drawer.js"/>
|
||||
<hbox align="center">
|
||||
<toolbarbutton id="addpanel-button" label="&addPanel.label;" oncommand="addWebPanel()"/>
|
||||
<spacer flex="1"/>
|
||||
<toolbarbutton label="&viewPage.label;" oncommand="grabPage()"/>
|
||||
</hbox>
|
||||
<browser id="pageholder-browser" type="content" flex="1"
|
||||
onclick="return window.parent.contentAreaClick(event, true);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, panelAreaDNDObserver);"/>
|
||||
</page>
|
|
@ -17,11 +17,11 @@ var panelProgressListener = {
|
|||
const nsIChannel = Components.interfaces.nsIChannel;
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_START &&
|
||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
document.getElementById('webpanels-throbber').setAttribute("loading", "true");
|
||||
window.parent.document.getElementById('sidebar-throbber').setAttribute("loading", "true");
|
||||
}
|
||||
else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
|
||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
document.getElementById('webpanels-throbber').removeAttribute("loading");
|
||||
window.parent.document.getElementById('sidebar-throbber').removeAttribute("loading");
|
||||
}
|
||||
}
|
||||
,
|
||||
|
@ -45,83 +45,22 @@ var panelProgressListener = {
|
|||
}
|
||||
};
|
||||
|
||||
var panelAreaDNDObserver = {
|
||||
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 so bail out
|
||||
if (!url || !url.length || url.indexOf(" ", 0) != -1)
|
||||
return;
|
||||
|
||||
var uri = getShortcutOrURI(url);
|
||||
try {
|
||||
document.getElementById('webpanels-browser').webNavigation.loadURI(uri, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
|
||||
var addButton = document.getElementById('addpanel-button');
|
||||
addButton.disabled = false;
|
||||
} catch (e) {}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function loadWebPanel(aURI) {
|
||||
gLoadPlaceHolder = false;
|
||||
try {
|
||||
document.getElementById('webpanels-browser').webNavigation.loadURI(aURI, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
|
||||
var addButton = document.getElementById('addpanel-button');
|
||||
addButton.disabled = true;
|
||||
} catch (e) {}
|
||||
var panelBrowser = document.getElementById('web-panels-browser');
|
||||
panelBrowser.removeAttribute("src");
|
||||
panelBrowser.setAttribute("src", aURI);
|
||||
panelBrowser.setAttribute("cachedsrc", aURI);
|
||||
}
|
||||
|
||||
|
||||
function load()
|
||||
{
|
||||
document.getElementById('webpanels-browser').webProgress.addProgressListener(panelProgressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
loadPlaceholderPage();
|
||||
var panelBrowser = document.getElementById('web-panels-browser');
|
||||
panelBrowser.webProgress.addProgressListener(panelProgressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
if (panelBrowser.getAttribute("cachedsrc"))
|
||||
panelBrowser.setAttribute("src", panelBrowser.getAttribute("cachedsrc"));
|
||||
}
|
||||
|
||||
function unload()
|
||||
{
|
||||
document.getElementById('webpanels-browser').webProgress.removeProgressListener(panelProgressListener);
|
||||
}
|
||||
|
||||
// We do this in the onload in order to make sure that the load of this page doesn't delay the onload of
|
||||
// the sidebar itself.
|
||||
var gLoadPlaceHolder = true;
|
||||
function loadPlaceholderPage() {
|
||||
var panelBrowser = document.getElementById('webpanels-browser');
|
||||
var addButton = document.getElementById('addpanel-button');
|
||||
if (gLoadPlaceHolder) {
|
||||
panelBrowser.setAttribute("src", "chrome://browser/content/web-panels.xml");
|
||||
addButton.disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function grabPage()
|
||||
{
|
||||
var panelBrowser = document.getElementById('webpanels-browser');
|
||||
try {
|
||||
panelBrowser.webNavigation.loadURI(window.parent.gBrowser.currentURI.spec, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
|
||||
var addButton = document.getElementById('addpanel-button');
|
||||
addButton.disabled = false;
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function addWebPanel()
|
||||
{
|
||||
window.parent.addBookmarkAs(document.getElementById('webpanels-browser'), true);
|
||||
document.getElementById('web-panels-browser').webProgress.removeProgressListener(panelProgressListener);
|
||||
}
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/web-panels.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % webPanelsDTD SYSTEM "chrome://browser/locale/web-panels.dtd" >
|
||||
%webPanelsDTD;
|
||||
]>
|
||||
|
||||
<page id="webpanels-window"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
|
@ -16,17 +11,6 @@
|
|||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/contentAreaUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/web-panels.js"/>
|
||||
<stack>
|
||||
<hbox pack="center" align="center">
|
||||
<image id="webpanels-throbber"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<toolbarbutton id="addpanel-button" label="&addPanel.label;" oncommand="addWebPanel()"/>
|
||||
<spacer flex="1"/>
|
||||
<toolbarbutton label="&viewPage.label;" oncommand="grabPage()"/>
|
||||
</hbox>
|
||||
</stack>
|
||||
<browser id="webpanels-browser" type="content" flex="1"
|
||||
onclick="return window.parent.contentAreaClick(event, true);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, panelAreaDNDObserver);"/>
|
||||
<browser id="web-panels-browser" persist="cachedsrc" type="content" flex="1"
|
||||
onclick="return window.parent.contentAreaClick(event, true);"/>
|
||||
</page>
|
||||
|
|
|
@ -19,8 +19,10 @@ browser.jar:
|
|||
content/browser/pageInfo.css (content/pageInfo.css)
|
||||
content/browser/web-panels.js (content/web-panels.js)
|
||||
content/browser/web-panels.xul (content/web-panels.xul)
|
||||
content/browser/web-panels.xml (content/web-panels.xml)
|
||||
|
||||
content/browser/page-drawer.xml (content/page-drawer.xml)
|
||||
content/browser/page-drawer.js (content/page-drawer.js)
|
||||
content/browser/page-drawer.xul (content/page-drawer.xul)
|
||||
|
||||
classic.jar:
|
||||
skin/classic/browser/aboutDialog.css (skin/aboutDialog.css)
|
||||
skin/classic/browser/browser.css (skin/browser.css)
|
||||
|
@ -56,7 +58,7 @@ en-US.jar:
|
|||
locale/en-US/browser/pageReportFirstTime.dtd (locale/pageReportFirstTime.dtd)
|
||||
* locale/en-US/browser/pageInfo.dtd (locale/pageInfo.dtd)
|
||||
locale/en-US/browser/pageInfo.properties (locale/pageInfo.properties)
|
||||
locale/en-US/browser/web-panels.dtd (locale/web-panels.dtd)
|
||||
locale/en-US/browser/page-drawer.dtd (locale/page-drawer.dtd)
|
||||
|
||||
US.jar:
|
||||
locale/US/browser-region/region.properties (locale/region.properties)
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
<!ENTITY historyCmd.accesskey "i">
|
||||
<!ENTITY history.commandKey "h">
|
||||
|
||||
<!ENTITY webPanels.commandKey "j">
|
||||
<!ENTITY pageHolder.commandKey "j">
|
||||
|
||||
<!ENTITY tasksMenu.label "Tools">
|
||||
<!ENTITY tasksMenu.accesskey "T">
|
||||
|
@ -252,8 +252,8 @@
|
|||
<!ENTITY historyButton.label "History">
|
||||
<!ENTITY historyButton.tooltip "Displays pages you've viewed recently">
|
||||
|
||||
<!ENTITY webPanelsButton.label "Web Panels">
|
||||
<!ENTITY webPanelsButton.tooltip "Displays pages as sidebar panels">
|
||||
<!ENTITY pageHolderButton.label "Page Holder">
|
||||
<!ENTITY pageHolderButton.tooltip "Displays pages in a sidebar panel">
|
||||
|
||||
<!ENTITY newTabButton.tooltip "Opens a new tab">
|
||||
<!ENTITY newWindowButton.tooltip "Opens a new window">
|
||||
|
|
|
@ -767,3 +767,8 @@ resizer[dir="bottomright"] {
|
|||
-moz-appearance: resizer;
|
||||
cursor: se-resize;
|
||||
}
|
||||
|
||||
#sidebar-throbber[loading="true"] {
|
||||
list-style-image: url(chrome://global/skin/icons/Loading.gif);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#webpanels-throbber[loading="true"] {
|
||||
list-style-image: url(chrome://global/skin/icons/Loading.gif);
|
||||
}
|
|
@ -537,9 +537,9 @@ var BookmarksCommand = {
|
|||
},
|
||||
|
||||
// requires utilityOverlay.js if opening in new window for getTopWin()
|
||||
openWebPanel: function(aURI, aDS)
|
||||
openWebPanel: function(aResource, aDS)
|
||||
{
|
||||
var url = BookmarksUtils.getProperty(aURI, NC_NS+"URL", aDS);
|
||||
var url = BookmarksUtils.getProperty(aResource, NC_NS+"URL", aDS);
|
||||
// Ignore "NC:" and empty urls.
|
||||
if (url == "")
|
||||
return;
|
||||
|
@ -548,7 +548,7 @@ var BookmarksCommand = {
|
|||
openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url);
|
||||
return;
|
||||
}
|
||||
w.openWebPanel(url);
|
||||
w.openWebPanel(BookmarksUtils.getProperty(aResource, NC_NS+"Name"), url);
|
||||
},
|
||||
|
||||
// requires utilityOverlay.js if opening in new window for getTopWin()
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
# 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.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corp. Portions created by Netscape Communications
|
||||
# Corp. are Copyright (C) 1999 Netscape Communications Corp. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Stephen Lamm <slamm@netscape.com>
|
||||
# Robert John Churchill <rjc@netscape.com>
|
||||
# Ben Goodger <ben@netscape.com>
|
||||
|
||||
<!ENTITY bookmarks.windowtitle.label "Properties for "**bm_title**"">
|
||||
|
||||
<!ENTITY generalInfo.label "Info">
|
||||
<!ENTITY generalInfo.accesskey "i">
|
||||
|
||||
<!ENTITY schedule.label "Schedule">
|
||||
<!ENTITY schedule.accesskey "s">
|
||||
<!ENTITY schedule.description "&brandShortName; can check this site for updates and notify you when one occurs. Use these settings to customize the schedule for this Bookmark.">
|
||||
<!ENTITY notification.label "Notify">
|
||||
<!ENTITY notification.accesskey "n">
|
||||
<!-- ICK. fix me -->
|
||||
<!ENTITY notification.description "&brandShortName; will notify you when this site changes. Use these settings to customize notification.">
|
||||
|
||||
<!ENTITY bookmarks.information.label "Information:">
|
||||
<!ENTITY bookmarks.name.label "Name:">
|
||||
<!ENTITY bookmarks.location.label "Location:">
|
||||
<!ENTITY bookmarks.shortcut.label "Keyword:">
|
||||
<!ENTITY bookmarks.description.label "Description:">
|
||||
<!ENTITY bookmarks.webpanels.label "Load this bookmark in the Web Panels sidebar">
|
||||
|
||||
<!ENTITY checkforupdates.legend.label "Check this location for updates:">
|
||||
<!ENTITY when.label "When:">
|
||||
<!ENTITY from.label "from:">
|
||||
<!ENTITY to.label "to: ">
|
||||
<!ENTITY every.label "every">
|
||||
<!ENTITY minutes.label "minute(s)">
|
||||
<!ENTITY notifications.legend.label "Notification:">
|
||||
|
||||
<!ENTITY checknever.label "Never">
|
||||
<!ENTITY checkeveryday.label "Every day">
|
||||
<!ENTITY checkweekdays.label "Weekdays">
|
||||
<!ENTITY checkweekends.label "Weekends">
|
||||
<!ENTITY checkmondays.label "Mondays">
|
||||
<!ENTITY checktuesdays.label "Tuesdays">
|
||||
<!ENTITY checkwednesdays.label "Wednesdays">
|
||||
<!ENTITY checkthursdays.label "Thursdays">
|
||||
<!ENTITY checkfridays.label "Fridays">
|
||||
<!ENTITY checksaturdays.label "Saturdays">
|
||||
<!ENTITY checksundays.label "Sundays">
|
||||
|
||||
<!ENTITY midnight.label "Midnight">
|
||||
<!ENTITY AMone.label "1 AM">
|
||||
<!ENTITY AMtwo.label "2 AM">
|
||||
<!ENTITY AMthree.label "3 AM">
|
||||
<!ENTITY AMfour.label "4 AM">
|
||||
<!ENTITY AMfive.label "5 AM">
|
||||
<!ENTITY AMsix.label "6 AM">
|
||||
<!ENTITY AMseven.label "7 AM">
|
||||
<!ENTITY AMeight.label "8 AM">
|
||||
<!ENTITY AMnine.label "9 AM">
|
||||
<!ENTITY AMten.label "10 AM">
|
||||
<!ENTITY AMeleven.label "11 AM">
|
||||
<!ENTITY noon.label "Noon">
|
||||
<!ENTITY PMone.label "1 PM">
|
||||
<!ENTITY PMtwo.label "2 PM">
|
||||
<!ENTITY PMthree.label "3 PM">
|
||||
<!ENTITY PMfour.label "4 PM">
|
||||
<!ENTITY PMfive.label "5 PM">
|
||||
<!ENTITY PMsix.label "6 PM">
|
||||
<!ENTITY PMseven.label "7 PM">
|
||||
<!ENTITY PMeight.label "8 PM">
|
||||
<!ENTITY PMnine.label "9 PM">
|
||||
<!ENTITY PMten.label "10 PM">
|
||||
<!ENTITY PMeleven.label "11 PM">
|
||||
|
||||
<!ENTITY notification.icon.label "Change the bookmark's icon">
|
||||
<!ENTITY notification.sound.label "Play a sound">
|
||||
<!ENTITY notification.alert.label "Display an alert">
|
||||
<!ENTITY notification.window.label "Open web page in a new window">
|
Загрузка…
Ссылка в новой задаче