зеркало из https://github.com/mozilla/pjs.git
Bug 237592 Bookmarks should always show tooltip when hovering with mouse (xpfe version - Bv6a-SM). Patch by Serge GAUTHERIE <gautheri@noos.fr>, r/sr=neil.parkwaycc.co.uk
This commit is contained in:
Родитель
e366d84324
Коммит
91826d00aa
|
@ -1010,10 +1010,11 @@ function addGroupmarkAs()
|
|||
BookmarksUtils.addBookmarkForTabBrowser(gBrowser, true);
|
||||
}
|
||||
|
||||
function updateGroupmarkMenuitem(id)
|
||||
function updateGroupmarkCommand()
|
||||
{
|
||||
const disabled = gBrowser.browsers.length == 1;
|
||||
document.getElementById(id).setAttribute("disabled", disabled);
|
||||
document.getElementById("Browser:AddGroupmarkAs")
|
||||
.setAttribute("disabled", disabled);
|
||||
}
|
||||
|
||||
function readRDFString(aDS,aRes,aProp)
|
||||
|
@ -1022,7 +1023,6 @@ function readRDFString(aDS,aRes,aProp)
|
|||
return n ? n.QueryInterface(Components.interfaces.nsIRDFLiteral).Value : "";
|
||||
}
|
||||
|
||||
|
||||
function ensureDefaultEnginePrefs(aRDF,aDS)
|
||||
{
|
||||
var mPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
||||
|
|
|
@ -291,16 +291,16 @@
|
|||
label="&bookmarksButton.label;"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch"
|
||||
ref="NC:BookmarksRoot" container="true" flags="dont-test-empty"
|
||||
oncommand="BookmarksMenu.loadBookmark(event, this.database)"
|
||||
tooltip="btTooltip"
|
||||
oncommand="BookmarksMenu.loadBookmark(event, this.database);"
|
||||
onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)"
|
||||
template="bookmarksMenuTemplate"
|
||||
ondraggesture="if (event.target.id=='bookmarks-button') event.preventBubble()">
|
||||
<menupopup onpopupshowing="updateGroupmarkMenuitem('PT_bookmarks_groupmark');">
|
||||
<menuitem accesskey="&addCurPageCmd.accesskey;" key="addBookmarkKb" observes="Browser:AddBookmark"/>
|
||||
<menuitem accesskey="&addCurPageAsCmd.accesskey;" key="addBookmarkAsKb" observes="Browser:AddBookmarkAs"/>
|
||||
<menuitem id="PT_bookmarks_groupmark" observes="Browser:AddGroupmarkAs"/>
|
||||
<menuseparator/>
|
||||
<menuitem accesskey="&manBookmarksCmd.accesskey;" key="manBookmarkKb" observes="Browser:ManageBookmark"/>
|
||||
<menupopup onpopupshowing="updateGroupmarkCommand();">
|
||||
<menuitem command="Browser:AddBookmark"/>
|
||||
<menuitem command="Browser:AddBookmarkAs"/>
|
||||
<menuitem command="Browser:AddGroupmarkAs"/>
|
||||
<menuitem command="Browser:ManageBookmark"/>
|
||||
<menuseparator id="lastStaticSeparator"/>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
|
@ -310,6 +310,7 @@
|
|||
context="bookmarks-context-menu" template="bookmarksMenuTemplate"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch"
|
||||
ref="NC:PersonalToolbarFolder" flags="dont-test-empty"
|
||||
tooltip="btTooltip"
|
||||
oncommand="BookmarksUtils.loadBookmarkBrowser(event, this.database)"
|
||||
onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder">
|
||||
|
@ -321,6 +322,7 @@
|
|||
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch"
|
||||
template="bookmarksMenuTemplate"
|
||||
ref="NC:PersonalToolbarFolder" flags="dont-test-empty"
|
||||
tooltip="btTooltip"
|
||||
oncommand="BookmarksUtils.loadBookmarkBrowser(event, this.database)"
|
||||
onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)">
|
||||
<menupopup id="bookmarks-chevron-popup"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
|
@ -280,7 +280,6 @@
|
|||
status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Bookmark"
|
||||
statustext="rdf:http://home.netscape.com/NC-rdf#URL"
|
||||
tooltip="btTooltip"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule nc:FolderGroup="true" iscontainer="true">
|
||||
|
@ -328,7 +327,8 @@
|
|||
src="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
validate="never"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
status="rdf:http://home.netscape.com/WEB-rdf#status"/>
|
||||
status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
statustext="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
@ -468,6 +468,7 @@
|
|||
<menu id="BookmarksMenu" label="&bookmarksMenu.label;" accesskey="&bookmarksMenu.accesskey;"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch"
|
||||
ref="NC:BookmarksRoot" flags="dont-test-empty" template="bookmarksMenuTemplate"
|
||||
tooltip="btTooltip"
|
||||
oncommand="BookmarksMenu.loadBookmark(event, this.database)"
|
||||
onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)"
|
||||
ondraggesture="nsDragAndDrop.startDrag(event, BookmarksMenuDNDObserver)"
|
||||
|
@ -476,12 +477,11 @@
|
|||
ondragexit="nsDragAndDrop.dragExit(event, BookmarksMenuDNDObserver); event.preventBubble()"
|
||||
ondragover="nsDragAndDrop.dragOver(event, BookmarksMenuDNDObserver); event.preventBubble()">
|
||||
<menupopup id="menu_BookmarksPopup"
|
||||
onpopupshowing="updateGroupmarkMenuitem('bookmarks_groupmark');">
|
||||
<!-- for some reason these don't work as command="" -->
|
||||
<menuitem key="addBookmarkKb" observes="Browser:AddBookmark"/>
|
||||
<menuitem key="addBookmarkAsKb" observes="Browser:AddBookmarkAs"/>
|
||||
<menuitem id="bookmarks_groupmark" observes="Browser:AddGroupmarkAs"/>
|
||||
<menuitem key="manBookmarkKb" observes="Browser:ManageBookmark"/>
|
||||
onpopupshowing="updateGroupmarkCommand();">
|
||||
<menuitem key="addBookmarkKb" command="Browser:AddBookmark"/>
|
||||
<menuitem key="addBookmarkAsKb" command="Browser:AddBookmarkAs"/>
|
||||
<menuitem command="Browser:AddGroupmarkAs"/>
|
||||
<menuitem key="manBookmarkKb" command="Browser:ManageBookmark"/>
|
||||
<menuseparator/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
|
|
@ -39,7 +39,6 @@ var BookmarksMenu = {
|
|||
_selection:null,
|
||||
_target:null,
|
||||
_orientation:null,
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Fill a context menu popup with menuitems appropriate for the current
|
||||
|
@ -53,17 +52,17 @@ var BookmarksMenu = {
|
|||
this._target = this.getBTTarget(target, this._orientation);
|
||||
BookmarksCommand.createContextMenu(aEvent, this._selection);
|
||||
this.onCommandUpdate();
|
||||
aEvent.target.addEventListener("mousemove", BookmarksMenuController.onMouseMove, false)
|
||||
aEvent.target.addEventListener("mousemove", BookmarksMenuController.onMouseMove, false);
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Clean up after closing the context menu popup
|
||||
destroyContextMenu: function (aEvent)
|
||||
{
|
||||
if (content)
|
||||
content.focus()
|
||||
if (content)
|
||||
content.focus();
|
||||
BookmarksMenuDNDObserver.onDragRemoveFeedBack(document.popupNode); // needed on cancel
|
||||
aEvent.target.removeEventListener("mousemove", BookmarksMenuController.onMouseMove, false)
|
||||
aEvent.target.removeEventListener("mousemove", BookmarksMenuController.onMouseMove, false);
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -277,6 +276,8 @@ var BookmarksMenu = {
|
|||
BookmarksUtils.loadBookmarkBrowser(aEvent, aDS);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// loads a bookmark with the middle mouse button
|
||||
loadBookmarkMiddleClick: function (aEvent, aDS)
|
||||
{
|
||||
if (aEvent.type != "click" || aEvent.button != 1)
|
||||
|
@ -781,33 +782,32 @@ var BookmarksToolbar =
|
|||
}
|
||||
},
|
||||
|
||||
// Fill in tooltips for personal toolbar
|
||||
// Fill in tooltips for personal toolbar (and Bookmarks menu).
|
||||
fillInBTTooltip: function (tipElement)
|
||||
{
|
||||
// Don't show a tooltip for non bookmark related elements.
|
||||
if (!/bookmark/.test(tipElement.className))
|
||||
return false;
|
||||
|
||||
var title = tipElement.label;
|
||||
var url = tipElement.statusText;
|
||||
|
||||
if (!title && !url) {
|
||||
// bail out early if there is nothing to show
|
||||
// Don't show a tooltip without any data.
|
||||
if (!title && !url)
|
||||
return false;
|
||||
}
|
||||
|
||||
var tooltipTitle = document.getElementById("btTitleText");
|
||||
var tooltipUrl = document.getElementById("btUrlText");
|
||||
if (title && title != url) {
|
||||
tooltipTitle.removeAttribute("hidden");
|
||||
tooltipTitle.setAttribute("value", title);
|
||||
} else {
|
||||
tooltipTitle.setAttribute("hidden", "true");
|
||||
}
|
||||
if (url) {
|
||||
tooltipUrl.removeAttribute("hidden");
|
||||
tooltipUrl.setAttribute("value", url);
|
||||
} else {
|
||||
tooltipUrl.setAttribute("hidden", "true");
|
||||
}
|
||||
return true; // show tooltip
|
||||
var tooltipElement = document.getElementById("btTitleText");
|
||||
tooltipElement.hidden = !title || (title == url);
|
||||
if (!tooltipElement.hidden)
|
||||
tooltipElement.setAttribute("value", title);
|
||||
|
||||
tooltipElement = document.getElementById("btUrlText");
|
||||
tooltipElement.hidden = !url;
|
||||
if (!tooltipElement.hidden)
|
||||
tooltipElement.setAttribute("value", url);
|
||||
|
||||
// Show the tooltip.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -826,13 +826,13 @@ var BookmarksToolbarRDFObserver =
|
|||
onChange: function (aDataSource, aSource, aProperty, aOldTarget, aNewTarget) {},
|
||||
onMove: function (aDataSource, aOldSource, aNewSource, aProperty, aTarget) {},
|
||||
onBeginUpdateBatch: function (aDataSource) {},
|
||||
onEndUpdateBatch: function (aDataSource) {
|
||||
onEndUpdateBatch: function (aDataSource)
|
||||
{
|
||||
if (this._overflowTimerInEffect)
|
||||
return;
|
||||
this._overflowTimerInEffect = true;
|
||||
setTimeout(BookmarksToolbar.resizeFunc, 0, null);
|
||||
},
|
||||
|
||||
_overflowTimerInEffect: false,
|
||||
setOverflowTimeout: function (aSource, aProperty)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче