зеркало из https://github.com/mozilla/pjs.git
Bug 592900 - Update the bookmarks menu from the nav toolbar to match changes in the Firefox menu. r=dolske a=blocking
This commit is contained in:
Родитель
6ba9b1d856
Коммит
5b026b7210
|
@ -1153,39 +1153,49 @@ let BookmarksMenuButton = {
|
||||||
// handled in the onPopupShowing handler, so it does not hit Ts.
|
// handled in the onPopupShowing handler, so it does not hit Ts.
|
||||||
},
|
},
|
||||||
|
|
||||||
_popupInitialized: false,
|
_popupNeedsUpdate: {},
|
||||||
_popupNeedsUpdating: true,
|
|
||||||
onPopupShowing: function BMB_onPopupShowing(event) {
|
onPopupShowing: function BMB_onPopupShowing(event) {
|
||||||
if (!this._popupNeedsUpdating)
|
// Don't handle events for submenus.
|
||||||
|
if (event.target != event.currentTarget)
|
||||||
return;
|
return;
|
||||||
this._popupNeedsUpdating = false;
|
|
||||||
|
|
||||||
let viewToolbar = document.getElementById("BMB_viewBookmarksToolbar");
|
let popup = event.target;
|
||||||
if (!this._popupInitialized) {
|
let needsUpdate = this._popupNeedsUpdate[popup.id];
|
||||||
// First popupshowing event, initialize immutable attributes.
|
|
||||||
this._popupInitialized = true;
|
// Check if popup contents need to be updated. Note that if needsUpdate is
|
||||||
|
// undefined we have never seen the popup, thus it should be updated.
|
||||||
|
if (needsUpdate === false)
|
||||||
|
return;
|
||||||
|
this._popupNeedsUpdate[popup.id] = false;
|
||||||
|
|
||||||
|
function getPlacesAnonymousElement(aAnonId)
|
||||||
|
document.getAnonymousElementByAttribute(popup.parentNode,
|
||||||
|
"placesanonid",
|
||||||
|
aAnonId);
|
||||||
|
|
||||||
|
let viewToolbarMenuitem = getPlacesAnonymousElement("view-toolbar");
|
||||||
|
if (viewToolbarMenuitem) {
|
||||||
// Update View bookmarks toolbar checkbox menuitem.
|
// Update View bookmarks toolbar checkbox menuitem.
|
||||||
viewToolbar.setAttribute("toolbarId", this.personalToolbar.id);
|
viewToolbarMenuitem.setAttribute("checked",
|
||||||
|
!this.personalToolbar.collapsed);
|
||||||
// Need to set the label on Unsorted Bookmarks menu.
|
|
||||||
let unsortedBookmarksElt =
|
|
||||||
document.getElementById("BMB_unsortedBookmarksFolderMenu");
|
|
||||||
unsortedBookmarksElt.label =
|
|
||||||
PlacesUtils.getString("UnsortedBookmarksFolderTitle");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update View Bookmarks Toolbar checkbox menuitem.
|
let toolbarMenuitem = getPlacesAnonymousElement("toolbar-autohide");
|
||||||
viewToolbar.setAttribute("checked", !this.personalToolbar.collapsed);
|
if (toolbarMenuitem) {
|
||||||
|
// If bookmarks items are visible, hide Bookmarks Toolbar menu and the
|
||||||
// Hide Bookmarks Toolbar menu if the button is next to the bookmarks
|
// separator after it.
|
||||||
// toolbar item, show them otherwise.
|
toolbarMenuitem.collapsed = toolbarMenuitem.nextSibling.collapsed =
|
||||||
let button = this.button;
|
isElementVisible(this.bookmarksToolbarItem);
|
||||||
document.getElementById("BMB_bookmarksToolbarFolderMenu").collapsed =
|
}
|
||||||
button && button.parentNode == this.bookmarksToolbarItem;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePosition: function BMB_updatePosition() {
|
updatePosition: function BMB_updatePosition() {
|
||||||
this._popupNeedsUpdating = true;
|
// Popups will have to be updated when the user customizes the UI, or
|
||||||
|
// changes personal toolbar collapsed status. Both of those location call
|
||||||
|
// updatePosition(), so this is the only point asking for popup updates.
|
||||||
|
for (let popupId in this._popupNeedsUpdate) {
|
||||||
|
this._popupNeedsUpdate[popupId] = true;
|
||||||
|
}
|
||||||
|
|
||||||
let button = this.button;
|
let button = this.button;
|
||||||
if (!button)
|
if (!button)
|
||||||
|
|
|
@ -613,7 +613,7 @@
|
||||||
key="manBookmarkKb"/>
|
key="manBookmarkKb"/>
|
||||||
<menu id="appmenu_bookmarksMenu"
|
<menu id="appmenu_bookmarksMenu"
|
||||||
class="split-menuitem-menu">
|
class="split-menuitem-menu">
|
||||||
<menupopup id="appmenu_bookmarksMenupopup"
|
<menupopup id="appmenu_bookmarksPopup"
|
||||||
placespopup="true"
|
placespopup="true"
|
||||||
context="placesContext"
|
context="placesContext"
|
||||||
openInTabs="children"
|
openInTabs="children"
|
||||||
|
@ -621,16 +621,9 @@
|
||||||
onclick="BookmarksEventHandler.onClick(event);"
|
onclick="BookmarksEventHandler.onClick(event);"
|
||||||
onpopupshowing="BookmarksMenuButton.onPopupShowing(event);
|
onpopupshowing="BookmarksMenuButton.onPopupShowing(event);
|
||||||
if (!this.parentNode._placesView)
|
if (!this.parentNode._placesView)
|
||||||
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');
|
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"
|
||||||
this.appendChild(document.getElementById('appmenu_unsortedBookmarks_seperator'));
|
|
||||||
this.appendChild(document.getElementById('appmenu_unsortedBookmarks'));"
|
|
||||||
tooltip="bhTooltip"
|
tooltip="bhTooltip"
|
||||||
popupsinherittooltip="true">
|
popupsinherittooltip="true">
|
||||||
<menuseparator id="appmenu_unsortedBookmarks_seperator"/>
|
|
||||||
<menuitem id="appmenu_unsortedBookmarks"
|
|
||||||
label="&appMenuUnsorted.label;"
|
|
||||||
oncommand="PlacesCommandHook.showPlacesOrganizer('UnfiledBookmarks');"
|
|
||||||
class="menuitem-iconic"/>
|
|
||||||
<menuitem id="appmenu_showAllBookmarks"
|
<menuitem id="appmenu_showAllBookmarks"
|
||||||
label="&showAllBookmarks.label;"
|
label="&showAllBookmarks.label;"
|
||||||
command="Browser:ShowAllBookmarks"
|
command="Browser:ShowAllBookmarks"
|
||||||
|
@ -658,6 +651,25 @@
|
||||||
onclick="checkForMiddleClick(this, event);"/>
|
onclick="checkForMiddleClick(this, event);"/>
|
||||||
</menu>
|
</menu>
|
||||||
<menuseparator/>
|
<menuseparator/>
|
||||||
|
<menu id="appmenu_bookmarksToolbar"
|
||||||
|
placesanonid="toolbar-autohide"
|
||||||
|
class="menu-iconic bookmark-item"
|
||||||
|
label="&personalbarCmd.label;"
|
||||||
|
container="true">
|
||||||
|
<menupopup id="appmenu_bookmarksToolbarPopup"
|
||||||
|
placespopup="true"
|
||||||
|
context="placesContext"
|
||||||
|
onpopupshowing="if (!this.parentNode._placesView)
|
||||||
|
new PlacesMenu(event, 'place:folder=TOOLBAR');"/>
|
||||||
|
</menu>
|
||||||
|
<menuseparator/>
|
||||||
|
<!-- Bookmarks menu items -->
|
||||||
|
<menuseparator builder="end"
|
||||||
|
class="hide-if-empty-places-result"/>
|
||||||
|
<menuitem id="appmenu_unsortedBookmarks"
|
||||||
|
label="&appMenuUnsorted.label;"
|
||||||
|
oncommand="PlacesCommandHook.showPlacesOrganizer('UnfiledBookmarks');"
|
||||||
|
class="menuitem-iconic"/>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</menu>
|
</menu>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
@ -1009,6 +1021,23 @@
|
||||||
if (!this.parentNode._placesView)
|
if (!this.parentNode._placesView)
|
||||||
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"
|
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"
|
||||||
tooltip="bhTooltip" popupsinherittooltip="true">
|
tooltip="bhTooltip" popupsinherittooltip="true">
|
||||||
|
<menuitem id="BMB_viewBookmarksToolbar"
|
||||||
|
placesanonid="view-toolbar"
|
||||||
|
toolbarId="PersonalToolbar"
|
||||||
|
type="checkbox"
|
||||||
|
oncommand="onViewToolbarCommand(event)"
|
||||||
|
label="&viewBookmarksToolbar.label;"/>
|
||||||
|
<menuseparator/>
|
||||||
|
<menuitem id="BMB_bookmarksShowAll"
|
||||||
|
label="&showAllBookmarks.label;"
|
||||||
|
command="Browser:ShowAllBookmarks"
|
||||||
|
key="manBookmarkKb"/>
|
||||||
|
<menuseparator/>
|
||||||
|
<menuitem id="BMB_bookmarkThisPage"
|
||||||
|
class="menuitem-iconic"
|
||||||
|
label="&bookmarkThisPageCmd.label;"
|
||||||
|
command="Browser:AddBookmarkAs"
|
||||||
|
key="addBookmarkAsKb"/>
|
||||||
<menuitem id="BMB_subscribeToPageMenuitem"
|
<menuitem id="BMB_subscribeToPageMenuitem"
|
||||||
label="&subscribeToPageMenuitem.label;"
|
label="&subscribeToPageMenuitem.label;"
|
||||||
oncommand="return FeedHandler.subscribeToFeed(null, event);"
|
oncommand="return FeedHandler.subscribeToFeed(null, event);"
|
||||||
|
@ -1022,47 +1051,26 @@
|
||||||
oncommand="return FeedHandler.subscribeToFeed(null, event);"
|
oncommand="return FeedHandler.subscribeToFeed(null, event);"
|
||||||
onclick="checkForMiddleClick(this, event);"/>
|
onclick="checkForMiddleClick(this, event);"/>
|
||||||
</menu>
|
</menu>
|
||||||
<menuitem id="BMB_bookmarkAllTabs"
|
|
||||||
label="&addCurPagesCmd.label;"
|
|
||||||
command="Browser:BookmarkAllTabs"
|
|
||||||
key="bookmarkAllTabsKb"/>
|
|
||||||
<menuitem id="BMB_bookmarksShowAll"
|
|
||||||
label="&showAllBookmarks.label;"
|
|
||||||
command="Browser:ShowAllBookmarks"
|
|
||||||
key="manBookmarkKb"/>
|
|
||||||
<menuseparator/>
|
<menuseparator/>
|
||||||
<menuitem id="BMB_viewBookmarksToolbar"
|
<menu id="BMB_bookmarksToolbar"
|
||||||
type="checkbox"
|
placesanonid="toolbar-autohide"
|
||||||
oncommand="onViewToolbarCommand(event)"
|
|
||||||
label="&viewBookmarksToolbar.label;"/>
|
|
||||||
<menuitem id="BMB_viewBookmarksSidebar"
|
|
||||||
label="&viewBookmarksSidebar.label;"
|
|
||||||
type="checkbox"
|
|
||||||
oncommand="toggleSidebar('viewBookmarksSidebar');"
|
|
||||||
key="viewBookmarksSidebarKb">
|
|
||||||
<observes element="viewBookmarksSidebar" attribute="checked"/>
|
|
||||||
</menuitem>
|
|
||||||
<menuseparator/>
|
|
||||||
<menu id="BMB_bookmarksToolbarFolderMenu"
|
|
||||||
class="menu-iconic bookmark-item"
|
class="menu-iconic bookmark-item"
|
||||||
label="&personalbarCmd.label;"
|
label="&personalbarCmd.label;"
|
||||||
container="true">
|
container="true">
|
||||||
<menupopup id="BMB_bookmarksToolbarFolderPopup"
|
<menupopup id="BMB_bookmarksToolbarPopup"
|
||||||
placespopup="true"
|
placespopup="true"
|
||||||
context="placesContext"
|
context="placesContext"
|
||||||
onpopupshowing="if (!this.parentNode._placesView)
|
onpopupshowing="if (!this.parentNode._placesView)
|
||||||
new PlacesMenu(event, 'place:folder=TOOLBAR');"/>
|
new PlacesMenu(event, 'place:folder=TOOLBAR');"/>
|
||||||
</menu>
|
</menu>
|
||||||
<menu id="BMB_unsortedBookmarksFolderMenu"
|
|
||||||
class="menu-iconic bookmark-item"
|
|
||||||
container="true">
|
|
||||||
<menupopup id="BMB_unsortedBookmarksFolderPopup"
|
|
||||||
placespopup="true"
|
|
||||||
context="placesContext"
|
|
||||||
onpopupshowing="if (!this.parentNode._placesView)
|
|
||||||
new PlacesMenu(event, 'place:folder=UNFILED_BOOKMARKS');"/>
|
|
||||||
</menu>
|
|
||||||
<menuseparator/>
|
<menuseparator/>
|
||||||
|
<!-- Bookmarks menu items -->
|
||||||
|
<menuseparator builder="end"
|
||||||
|
class="hide-if-empty-places-result"/>
|
||||||
|
<menuitem id="BMB_unsortedBookmarks"
|
||||||
|
label="&bookmarksMenuButton.unsorted.label;"
|
||||||
|
oncommand="PlacesCommandHook.showPlacesOrganizer('UnfiledBookmarks');"
|
||||||
|
class="menuitem-iconic"/>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</toolbarbutton>
|
</toolbarbutton>
|
||||||
</toolbaritem>
|
</toolbaritem>
|
||||||
|
|
|
@ -149,6 +149,7 @@ can reach it easily. -->
|
||||||
|
|
||||||
<!ENTITY bookmarksMenuButton.label "Bookmarks">
|
<!ENTITY bookmarksMenuButton.label "Bookmarks">
|
||||||
<!ENTITY bookmarksMenuButton.tooltip "Display your bookmarks">
|
<!ENTITY bookmarksMenuButton.tooltip "Display your bookmarks">
|
||||||
|
<!ENTITY bookmarksMenuButton.unsorted.label "Unsorted Bookmarks">
|
||||||
<!ENTITY viewBookmarksSidebar.label "Show in Sidebar">
|
<!ENTITY viewBookmarksSidebar.label "Show in Sidebar">
|
||||||
<!ENTITY viewBookmarksToolbar.label "View Bookmarks Toolbar">
|
<!ENTITY viewBookmarksToolbar.label "View Bookmarks Toolbar">
|
||||||
|
|
||||||
|
|
|
@ -473,11 +473,11 @@ menuitem:not([type]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#bookmarksToolbarFolderMenu,
|
#bookmarksToolbarFolderMenu,
|
||||||
#BMB_bookmarksToolbarFolderMenu {
|
#BMB_bookmarksToolbar {
|
||||||
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
|
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
#unsortedBookmarksFolderMenu {
|
#BMB_unsortedBookmarks {
|
||||||
list-style-image: url("chrome://browser/skin/places/unsortedBookmarks.png");
|
list-style-image: url("chrome://browser/skin/places/unsortedBookmarks.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,11 +281,11 @@ toolbarbutton.bookmark-item > menupopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
#bookmarksToolbarFolderMenu,
|
#bookmarksToolbarFolderMenu,
|
||||||
#BMB_bookmarksToolbarFolderMenu {
|
#BMB_bookmarksToolbar {
|
||||||
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
|
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
#BMB_unsortedBookmarksFolderMenu {
|
#BMB_unsortedBookmarks {
|
||||||
list-style-image: url("chrome://browser/skin/places/unfiledBookmarks.png");
|
list-style-image: url("chrome://browser/skin/places/unfiledBookmarks.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,20 +274,19 @@
|
||||||
list-style-image: url("chrome://browser/skin/Privacy-16.png");
|
list-style-image: url("chrome://browser/skin/Privacy-16.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
#appmenu_unsortedBookmarks {
|
|
||||||
list-style-image: url("chrome://browser/skin/places/unsortedBookmarks.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
#appmenu_addons {
|
#appmenu_addons {
|
||||||
list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric-16.png");
|
list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric-16.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#BMB_subscribeToPage:not([disabled]),
|
||||||
|
#BMB_subscribeToPageMenu,
|
||||||
#appmenu_subscribeToPage:not([disabled]),
|
#appmenu_subscribeToPage:not([disabled]),
|
||||||
#appmenu_subscribeToPageMenu {
|
#appmenu_subscribeToPageMenu {
|
||||||
list-style-image: url("chrome://browser/skin/feeds/feed-icons-16.png");
|
list-style-image: url("chrome://browser/skin/feeds/feed-icons-16.png");
|
||||||
-moz-image-region: rect(0px 16px 16px 0px);
|
-moz-image-region: rect(0px 16px 16px 0px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#BMB_bookmarkThisPage,
|
||||||
#appmenu_bookmarkThisPage {
|
#appmenu_bookmarkThisPage {
|
||||||
list-style-image: url("chrome://browser/skin/places/bookmark.png");
|
list-style-image: url("chrome://browser/skin/places/bookmark.png");
|
||||||
-moz-image-region: rect(0 16px 16px 0);
|
-moz-image-region: rect(0 16px 16px 0);
|
||||||
|
@ -2001,12 +2000,14 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
|
||||||
|
|
||||||
/* Bookmarks roots menu-items */
|
/* Bookmarks roots menu-items */
|
||||||
#bookmarksToolbarFolderMenu,
|
#bookmarksToolbarFolderMenu,
|
||||||
#BMB_bookmarksToolbarFolderMenu {
|
#appmenu_bookmarksToolbar,
|
||||||
|
#BMB_bookmarksToolbar {
|
||||||
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
|
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
|
||||||
-moz-image-region: auto;
|
-moz-image-region: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#BMB_unsortedBookmarksFolderMenu {
|
#appmenu_unsortedBookmarks,
|
||||||
|
#BMB_unsortedBookmarks {
|
||||||
list-style-image: url("chrome://browser/skin/places/unsortedBookmarks.png");
|
list-style-image: url("chrome://browser/skin/places/unsortedBookmarks.png");
|
||||||
-moz-image-region: auto;
|
-moz-image-region: auto;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче