mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 16:46:26 +00:00
toolbar landing 44756
This commit is contained in:
parent
a5fca72c45
commit
3d53d6c3c8
@ -73,6 +73,7 @@ catch (ex)
|
|||||||
|
|
||||||
// focused frame URL
|
// focused frame URL
|
||||||
var gFocusedURL = null;
|
var gFocusedURL = null;
|
||||||
|
var gNavigated = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the document at a given location to disk
|
* Save the document at a given location to disk
|
||||||
@ -100,6 +101,7 @@ function savePage( url )
|
|||||||
**/
|
**/
|
||||||
function getContentAreaFrameCount()
|
function getContentAreaFrameCount()
|
||||||
{
|
{
|
||||||
|
gNavigated++;
|
||||||
var saveFrameItem = document.getElementById("savepage");
|
var saveFrameItem = document.getElementById("savepage");
|
||||||
if (!window._content.frames.length ||
|
if (!window._content.frames.length ||
|
||||||
!isDocumentFrame(document.commandDispatcher.focusedWindow))
|
!isDocumentFrame(document.commandDispatcher.focusedWindow))
|
||||||
@ -479,6 +481,7 @@ function Startup()
|
|||||||
initConsoleListener();
|
initConsoleListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function Shutdown()
|
function Shutdown()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -933,7 +936,8 @@ function RevealSearchPanel()
|
|||||||
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText |
|
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText |
|
||||||
nsIFilePicker.filterAll | nsIFilePicker.filterImages | nsIFilePicker.filterXML);
|
nsIFilePicker.filterAll | nsIFilePicker.filterImages | nsIFilePicker.filterXML);
|
||||||
if (fp.show() == nsIFilePicker.returnOK) {
|
if (fp.show() == nsIFilePicker.returnOK) {
|
||||||
openTopWin(fp.fileURL.spec);
|
var fn = !gNavigated ? openTopWin : openNewWindowWith;
|
||||||
|
fn(fp.fileURL.spec);
|
||||||
}
|
}
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
}
|
}
|
||||||
|
@ -243,12 +243,12 @@ Contributor(s): ______________________________________. -->
|
|||||||
var gBookmarkPopup = null;
|
var gBookmarkPopup = null;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<toolbox class="toolbox-top">
|
<toolbox id="navigator-toolbox" class="toolbox-top" deferattached="true">
|
||||||
<!-- Menu -->
|
<!-- Menu -->
|
||||||
<menubar id="main-menubar"/>
|
<menubar id="main-menubar" persist="collapsed" grippytooltip="aTooltip" grippytooltiptext="&menuBar.tooltip;"/>
|
||||||
|
|
||||||
<toolbar class="toolbar-primary chromeclass-toolbar" id="nav-bar"
|
<toolbar class="toolbar-primary chromeclass-toolbar" id="nav-bar" persist="collapsed"
|
||||||
persist="collapsed" grippytooltip="aTooltip" grippytooltiptext="&navigationBar.tooltip;">
|
grippytooltip="aTooltip" grippytooltiptext="&navigationBar.tooltip;">
|
||||||
<menubutton class="menubutton-dual toolbar top" id="back-button" value="&backButton.label;"
|
<menubutton class="menubutton-dual toolbar top" id="back-button" value="&backButton.label;"
|
||||||
crop="right" observes="canGoBack" oncommand="gotoHistoryIndex(event);"
|
crop="right" observes="canGoBack" oncommand="gotoHistoryIndex(event);"
|
||||||
tooltip="aTooltip"
|
tooltip="aTooltip"
|
||||||
@ -296,8 +296,9 @@ Contributor(s): ______________________________________. -->
|
|||||||
ondragover="nsDragAndDrop.dragOver(event, personalToolbarObserver);"
|
ondragover="nsDragAndDrop.dragOver(event, personalToolbarObserver);"
|
||||||
ondragdrop="nsDragAndDrop.drop(event, personalToolbarObserver);"
|
ondragdrop="nsDragAndDrop.drop(event, personalToolbarObserver);"
|
||||||
ondraggesture="nsDragAndDrop.startDrag(event, personalToolbarObserver);"
|
ondraggesture="nsDragAndDrop.startDrag(event, personalToolbarObserver);"
|
||||||
|
ondragexit="nsDragAndDrop.dragExit(event, personalToolbarObserver);"
|
||||||
grippytooltip="aTooltip" grippytooltiptext="&personalBar.tooltip;"
|
grippytooltip="aTooltip" grippytooltiptext="&personalBar.tooltip;"
|
||||||
last-toolbar="true">
|
last-toolbar="true" persist="collapsed">
|
||||||
|
|
||||||
<!-- Personal toolbar items -->
|
<!-- Personal toolbar items -->
|
||||||
<box id="innermostBox" flex="1" style="min-width: 1px;" context="contextual"
|
<box id="innermostBox" flex="1" style="min-width: 1px;" context="contextual"
|
||||||
@ -341,7 +342,7 @@ Contributor(s): ______________________________________. -->
|
|||||||
</rule>
|
</rule>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<button class="button-toolbar" id="homebutton" value="&homeButton.label;"
|
<button class="button-toolbar bookmarkitem" id="homebutton" value="&homeButton.label;"
|
||||||
tooltip="aTooltip"
|
tooltip="aTooltip"
|
||||||
ondraggesture="nsDragAndDrop.startDrag(event, homeButtonObserver);"
|
ondraggesture="nsDragAndDrop.startDrag(event, homeButtonObserver);"
|
||||||
ondragover="nsDragAndDrop.dragOver(event, homeButtonObserver);"
|
ondragover="nsDragAndDrop.dragOver(event, homeButtonObserver);"
|
||||||
|
@ -96,13 +96,12 @@ var personalToolbarObserver = {
|
|||||||
//if (!isBookmark(uri))
|
//if (!isBookmark(uri))
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
|
|
||||||
var title = aEvent.target.value;
|
var title = aEvent.target.value;
|
||||||
var htmlString = "<A HREF='" + uri + "'>" + title + "</A>";
|
var htmlString = "<A HREF='" + uri + "'>" + title + "</A>";
|
||||||
|
|
||||||
var flavourList = { };
|
var flavourList = { };
|
||||||
flavourList["moz/toolbaritem"] = { width: 2, data: uri };
|
flavourList["moz/toolbaritem"] = { width: 2, data: uri };
|
||||||
flavourList["text/x-moz-url"] = { width: 2, data: homepage + " " + "[ TEMP TITLE ]" };
|
flavourList["text/x-moz-url"] = { width: 2, data: uri + " " + "[ TEMP TITLE ]" };
|
||||||
flavourList["text/html"] = { width: 2, data: htmlString };
|
flavourList["text/html"] = { width: 2, data: htmlString };
|
||||||
flavourList["text/unicode"] = { width: 2, data: uri };
|
flavourList["text/unicode"] = { width: 2, data: uri };
|
||||||
return flavourList;
|
return flavourList;
|
||||||
@ -115,7 +114,9 @@ var personalToolbarObserver = {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
var element = aData.data.data;
|
var element = aData.data.data;
|
||||||
|
var dropElement = aEvent.target.id;
|
||||||
var elementRes = RDFUtils.getResource(element);
|
var elementRes = RDFUtils.getResource(element);
|
||||||
|
var dropElementRes = RDFUtils.getResource(dropElement);
|
||||||
var personalToolbarRes = RDFUtils.getResource("NC:PersonalToolbarFolder");
|
var personalToolbarRes = RDFUtils.getResource("NC:PersonalToolbarFolder");
|
||||||
|
|
||||||
var childDB = document.getElementById("innermostBox").database;
|
var childDB = document.getElementById("innermostBox").database;
|
||||||
@ -123,9 +124,8 @@ var personalToolbarObserver = {
|
|||||||
"nsIRDFContainer");
|
"nsIRDFContainer");
|
||||||
rdfContainer.Init(childDB, personalToolbarRes);
|
rdfContainer.Init(childDB, personalToolbarRes);
|
||||||
|
|
||||||
var newIndex = 1; // XXX need .offset* to figure out where to drop element
|
var elementIsOnToolbar = rdfContainer.IndexOf(elementRes);
|
||||||
var dropIndex = rdfContainer.IndexOf(elementRes);
|
if (elementIsOnToolbar > 0)
|
||||||
if (dropIndex > 0)
|
|
||||||
rdfContainer.RemoveElement(elementRes, true);
|
rdfContainer.RemoveElement(elementRes, true);
|
||||||
else if (dropIndex == -1)
|
else if (dropIndex == -1)
|
||||||
{
|
{
|
||||||
@ -145,7 +145,39 @@ var personalToolbarObserver = {
|
|||||||
gRDFService.GetLiteral(linkTitle),
|
gRDFService.GetLiteral(linkTitle),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
rdfContainer.InsertElementAt(elementRes, newIndex, true);
|
var dropIndex = rdfContainer.IndexOf(dropElementRes);
|
||||||
|
// determine the drop position
|
||||||
|
var dropPosition = this.determineDropPosition(aEvent);
|
||||||
|
switch (dropPosition) {
|
||||||
|
case -1:
|
||||||
|
rdfContainer.InsertElementAt(elementRes, dropIndex, true);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
// do something here to drop into subfolders
|
||||||
|
var childContainer = nsJSComponentManager.createInstance("component://netscape/rdf/container",
|
||||||
|
"nsIRDFContainer");
|
||||||
|
childContainer.Init(childDB, dropElementRes);
|
||||||
|
childContainer.AppendElement(elementRes);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
rdfContainer.InsertElementAt(elementRes, dropIndex+1, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mCurrentDragOverButton: null,
|
||||||
|
mCurrentDragPosition: null,
|
||||||
|
|
||||||
|
onDragExit: function (aEvent, aDragSession)
|
||||||
|
{
|
||||||
|
if (this.mCurrentDragOverButton)
|
||||||
|
{
|
||||||
|
this.mCurrentDragOverButton.removeAttribute("dragover-left");
|
||||||
|
this.mCurrentDragOverButton.removeAttribute("dragover-right");
|
||||||
|
this.mCurrentDragOverButton.removeAttribute("dragover-top");
|
||||||
|
this.mCurrentDragOverButton.removeAttribute("open");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDragOver: function (aEvent, aFlavour, aDragSession)
|
onDragOver: function (aEvent, aFlavour, aDragSession)
|
||||||
@ -153,9 +185,41 @@ var personalToolbarObserver = {
|
|||||||
// temporary
|
// temporary
|
||||||
if (!isPToolbarDNDEnabled())
|
if (!isPToolbarDNDEnabled())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var toolbar = document.getElementById("PersonalToolbar");
|
var dropPosition = this.determineDropPosition(aEvent);
|
||||||
toolbar.setAttribute("dd-triggerrepaint", 0);
|
|
||||||
|
if (this.mCurrentDragOverButton != aEvent.target ||
|
||||||
|
(this.mCurrentDragOverButton == aEvent.target &&
|
||||||
|
this.mCurrentDragPosition != dropPosition))
|
||||||
|
{
|
||||||
|
if (this.mCurrentDragOverButton)
|
||||||
|
{
|
||||||
|
this.mCurrentDragOverButton.removeAttribute("dragover-left");
|
||||||
|
this.mCurrentDragOverButton.removeAttribute("dragover-right");
|
||||||
|
this.mCurrentDragOverButton.removeAttribute("dragover-top");
|
||||||
|
this.mCurrentDragOverButton.removeAttribute("open");
|
||||||
|
}
|
||||||
|
this.mCurrentDragOverButton = aEvent.target;
|
||||||
|
this.mCurrentDragPosition = dropPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (dropPosition)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
aEvent.target.setAttribute("dragover-left", "true");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
aEvent.target.setAttribute("dragover-right", "true");
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
if (aEvent.target.getAttribute("container") == "true") {
|
||||||
|
aEvent.target.setAttribute("dragover-top", "true");
|
||||||
|
//cant open a menu during a drag! suck!
|
||||||
|
//aEvent.target.setAttribute("open", "true");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getSupportedFlavours: function ()
|
getSupportedFlavours: function ()
|
||||||
@ -169,6 +233,32 @@ var personalToolbarObserver = {
|
|||||||
flavourList["text/unicode"] = { width: 2, iid: "nsISupportsWString" };
|
flavourList["text/unicode"] = { width: 2, iid: "nsISupportsWString" };
|
||||||
return flavourList;
|
return flavourList;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
determineDropPosition: function (aEvent)
|
||||||
|
{
|
||||||
|
var overButton = aEvent.target;
|
||||||
|
var overButtonBoxObject = overButton.boxObject.QueryInterface(Components.interfaces.nsIBoxObject);
|
||||||
|
|
||||||
|
if (aEvent.clientX < (overButtonBoxObject.x + overButtonBoxObject.width/3))
|
||||||
|
{
|
||||||
|
if (aEvent.clientY > overButtonBoxObject.y &&
|
||||||
|
aEvent.clientY < overButtonBoxObject.y + overButtonBoxObject.height)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else if (aEvent.clientX > (overButtonBoxObject.x + 2*(overButtonBoxObject.width/3)))
|
||||||
|
{
|
||||||
|
if (aEvent.clientY > overButtonBoxObject.y &&
|
||||||
|
aEvent.clientY < overButtonBoxObject.y + overButtonBoxObject.height)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (aEvent.clientX > (overButtonBoxObject.x + overButtonBoxObject.width/3) &&
|
||||||
|
aEvent.clientX < ((overButtonBoxObject.x + 2*(overButtonBoxObject.width/3))))
|
||||||
|
{
|
||||||
|
if (aEvent.clientY > overButtonBoxObject.y &&
|
||||||
|
aEvent.clientY < overButtonBoxObject.y + overButtonBoxObject.height)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var contentAreaDNDObserver = {
|
var contentAreaDNDObserver = {
|
||||||
|
@ -121,6 +121,10 @@ Contributor(s): Blake Ross <BlakeR1234@aol.com>. -->
|
|||||||
<broadcaster id="cmd_viewpersonaltoolbar" type="checkbox" oncommand="goToggleToolbar('PersonalToolbar','cmd_viewpersonaltoolbar');" checked="true"/>
|
<broadcaster id="cmd_viewpersonaltoolbar" type="checkbox" oncommand="goToggleToolbar('PersonalToolbar','cmd_viewpersonaltoolbar');" checked="true"/>
|
||||||
<broadcaster id="cmd_viewtaskbar" type="checkbox" oncommand="goToggleToolbar('taskbar','cmd_viewtaskbar');" checked="true"/>
|
<broadcaster id="cmd_viewtaskbar" type="checkbox" oncommand="goToggleToolbar('taskbar','cmd_viewtaskbar');" checked="true"/>
|
||||||
|
|
||||||
|
<broadcaster id="cmd_viewnavbar" class="menuitem-iconic" type="checkbox" oncommand="goToggleToolbar( 'nav-bar','cmd_viewnavbar');" checked="true"/>
|
||||||
|
<broadcaster id="cmd_viewpersonaltoolbar" class="menuitem-iconic" type="checkbox" oncommand="goToggleToolbar('PersonalToolbar','cmd_viewpersonaltoolbar');" checked="true"/>
|
||||||
|
<broadcaster id="cmd_viewtaskbar" class="menuitem-iconic" type="checkbox" oncommand="goToggleToolbar('taskbar','cmd_viewtaskbar');" checked="true"/>
|
||||||
|
|
||||||
<broadcaster id="Browser:Open" value="&openCmd.label;" oncommand="BrowserOpenWindow();"/>
|
<broadcaster id="Browser:Open" value="&openCmd.label;" oncommand="BrowserOpenWindow();"/>
|
||||||
<broadcaster id="Browser:OpenFile" value="&openFileCmd.label;" oncommand="BrowserOpenFileWindow();"/>
|
<broadcaster id="Browser:OpenFile" value="&openFileCmd.label;" oncommand="BrowserOpenFileWindow();"/>
|
||||||
|
|
||||||
|
@ -316,6 +316,7 @@
|
|||||||
<!ENTITY locationBar.tooltip "Location and search field">
|
<!ENTITY locationBar.tooltip "Location and search field">
|
||||||
<!ENTITY internetKeyword.tooltip "Return to previously viewed page or choose keyword">
|
<!ENTITY internetKeyword.tooltip "Return to previously viewed page or choose keyword">
|
||||||
|
|
||||||
|
<!ENTITY menuBar.tooltip "Menu bar">
|
||||||
<!ENTITY personalBar.tooltip "Personal toolbar">
|
<!ENTITY personalBar.tooltip "Personal toolbar">
|
||||||
<!ENTITY navigationBar.tooltip "Navigation toolbar">
|
<!ENTITY navigationBar.tooltip "Navigation toolbar">
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user