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