зеркало из https://github.com/mozilla/pjs.git
Bug 232399: dragging links to the bookmarks button should open the 'Add Bookmark' dialog. r=mconnor
This commit is contained in:
Родитель
850138b30d
Коммит
afe0046421
|
@ -1931,6 +1931,41 @@ function openHomeDialog(aURL)
|
|||
}
|
||||
}
|
||||
|
||||
var bookmarksButtonObserver = {
|
||||
onDrop: function (aEvent, aXferData, aDragSession)
|
||||
{
|
||||
var split = aXferData.data.split("\n");
|
||||
var url = split[0];
|
||||
if (url != aXferData.data) { //do nothing if it's not a valid URL
|
||||
var name = split[1];
|
||||
openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "",
|
||||
"centerscreen,chrome,dialog,resizable,dependent", name, url);
|
||||
}
|
||||
},
|
||||
|
||||
onDragOver: function (aEvent, aFlavour, aDragSession)
|
||||
{
|
||||
var statusTextFld = document.getElementById("statusbar-display");
|
||||
statusTextFld.label = gNavigatorBundle.getString("droponbookmarksbutton");
|
||||
aDragSession.dragAction = Components.interfaces.nsIDragService.DRAGDROP_ACTION_LINK;
|
||||
},
|
||||
|
||||
onDragExit: function (aEvent, aDragSession)
|
||||
{
|
||||
var statusTextFld = document.getElementById("statusbar-display");
|
||||
statusTextFld.label = "";
|
||||
},
|
||||
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
var flavourSet = new FlavourSet();
|
||||
flavourSet.appendFlavour("application/x-moz-file", "nsIFile");
|
||||
flavourSet.appendFlavour("text/x-moz-url");
|
||||
flavourSet.appendFlavour("text/unicode");
|
||||
return flavourSet;
|
||||
}
|
||||
}
|
||||
|
||||
var goButtonObserver = {
|
||||
onDragOver: function(aEvent, aFlavour, aDragSession)
|
||||
{
|
||||
|
|
|
@ -340,8 +340,11 @@
|
|||
|
||||
<toolbarbutton id="bookmarks-button" class="toolbarbutton-1"
|
||||
observes="viewBookmarksSidebar"
|
||||
tooltiptext="&bookmarksButton.tooltip;"/>
|
||||
|
||||
tooltiptext="&bookmarksButton.tooltip;"
|
||||
ondragover="nsDragAndDrop.dragOver(event, bookmarksButtonObserver);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, bookmarksButtonObserver);"
|
||||
ondragexit="nsDragAndDrop.dragExit(event, bookmarksButtonObserver);"/>
|
||||
|
||||
<toolbarbutton id="new-tab-button" class="toolbarbutton-1"
|
||||
label="&tabCmd.label;"
|
||||
command="cmd_newNavigatorTab"
|
||||
|
|
|
@ -4,6 +4,7 @@ nv_stopped=Stopped
|
|||
openFile=Open File
|
||||
defaultStatus=
|
||||
|
||||
droponbookmarksbutton=Drop a link to bookmark it
|
||||
dropondownloadsbutton=Drop a link or file to download it
|
||||
dropongobutton=Drop a link or file to open it
|
||||
droponhomebutton=Drop a link or file to make it your home page
|
||||
|
|
Загрузка…
Ссылка в новой задаче