mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 04:58:00 +00:00
*** empty log message ***
This commit is contained in:
parent
affd9fbf49
commit
139c30a706
@ -35,3 +35,7 @@
|
||||
overflow:auto;
|
||||
margin:0px 15px 10px 15px;
|
||||
}
|
||||
|
||||
toolbarbutton[dragactive], toolbaritem[dragactive] {
|
||||
-moz-border-left-colors: black !important;
|
||||
}
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
*/
|
||||
|
||||
var gCurrentDragOverItem;
|
||||
|
||||
function buildDialog()
|
||||
{
|
||||
var toolbar = window.opener.document.getElementById("nav-bar");
|
||||
@ -97,6 +99,7 @@ function buildDialog()
|
||||
enclosure.setAttribute("width", "0");
|
||||
enclosure.setAttribute("minheight", "0");
|
||||
enclosure.setAttribute("minwidth", "0");
|
||||
enclosure.setAttribute("ondraggesture", "nsDragAndDrop.startDrag(event, dragObserver)");
|
||||
|
||||
enclosure.appendChild(paletteItem);
|
||||
currentRow.appendChild(enclosure);
|
||||
@ -118,3 +121,58 @@ function buildDialog()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var dragObserver = {
|
||||
onDragStart: function (aEvent, aXferData, aDragAction) {
|
||||
aXferData.data = new TransferDataSet();
|
||||
var data = new TransferData();
|
||||
data.addDataForFlavour("text/unicode", aEvent.target.firstChild.id);
|
||||
aXferData.data.push(data);
|
||||
}
|
||||
}
|
||||
|
||||
var dropObserver = {
|
||||
onDragOver: function (aEvent, aFlavour, aDragSession)
|
||||
{
|
||||
if (gCurrentDragOverItem)
|
||||
gCurrentDragOverItem.removeAttribute("dragactive");
|
||||
|
||||
var dropTargetWidth = aEvent.target.boxObject.width;
|
||||
var dropTargetX = aEvent.target.boxObject.x;
|
||||
if (aEvent.clientX > (dropTargetX + (dropTargetWidth / 2)))
|
||||
gCurrentDragOverItem = aEvent.target.nextSibling;
|
||||
else
|
||||
gCurrentDragOverItem = aEvent.target;
|
||||
|
||||
gCurrentDragOverItem.setAttribute("dragactive", "true");
|
||||
|
||||
aDragSession.canDrop = true;
|
||||
},
|
||||
onDrop: function (aEvent, aXferData, aDragSession)
|
||||
{
|
||||
var newButtonId = transferUtils.retrieveURLFromData(aXferData.data, aXferData.flavour.contentType);
|
||||
var palette = window.opener.document.getElementById("nav-bar").palette;
|
||||
var paletteItem = palette.firstChild;
|
||||
while (paletteItem) {
|
||||
if (paletteItem.id == newButtonId)
|
||||
break;
|
||||
paletteItem = paletteItem.nextSibling;
|
||||
}
|
||||
if (!paletteItem)
|
||||
return;
|
||||
|
||||
paletteItem = paletteItem.cloneNode(paletteItem);
|
||||
var toolbar = document.getElementById("nav-bar");
|
||||
toolbar.insertBefore(paletteItem, gCurrentDragOverItem);
|
||||
},
|
||||
_flavourSet: null,
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
if (!this._flavourSet) {
|
||||
this._flavourSet = new FlavourSet();
|
||||
this._flavourSet.appendFlavour("text/unicode");
|
||||
}
|
||||
return this._flavourSet;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,13 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://browser/content/customizeToolbar.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
|
||||
|
||||
<toolbox id="cloned-bar-container"/>
|
||||
<toolbox id="cloned-bar-container"
|
||||
ondragover="nsDragAndDrop.dragOver(event, dropObserver)"
|
||||
ondragdrop="nsDragAndDrop.drop(event, dropObserver);"
|
||||
ondragexit="gCurrentDragOverItem.removeAttribute('dragactive');"/>
|
||||
|
||||
<separator class="groove"/>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user