зеркало из https://github.com/mozilla/pjs.git
315940 - hook up dummy personal toolbar NPOB
This commit is contained in:
Родитель
a0f1f99090
Коммит
2ca5affcb2
|
@ -0,0 +1,4 @@
|
|||
#bookmarksBarContent {
|
||||
-moz-binding: url("chrome://browser/content/places/toolbar.xml#places-bar");
|
||||
}
|
||||
|
|
@ -35,10 +35,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
|
||||
var PlacesBrowserShim = {
|
||||
_bookmarks: null,
|
||||
_history: null,
|
||||
|
@ -60,6 +56,12 @@ PlacesBrowserShim.init = function PBS_init() {
|
|||
PlacesBrowserShim._bookmarks =
|
||||
Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
var bms = PlacesBrowserShim._bookmarks;
|
||||
|
||||
var bookmarksBarContent = document.getElementById("bookmarksBarContent");
|
||||
var kids = bms.getFolderChildren(bms.toolbarRoot, bms.ALL_CHILDREN);
|
||||
bookmarksBarContent._result = kids;
|
||||
bookmarksBarContent._rebuild();
|
||||
};
|
||||
|
||||
PlacesBrowserShim.addBookmark = function PBS_addBookmark() {
|
||||
|
|
|
@ -1,10 +1,133 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/content/places/browserShim.css"?>
|
||||
|
||||
<!DOCTYPE overlay SYSTEM "chrome://browser/locale/places/places.dtd">
|
||||
|
||||
<overlay id="placesBrowserShim"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://browser/content/places/controller.js"/>
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://browser/content/places/browserShim.js"/>
|
||||
|
||||
<commandset id="mainCommandSet">
|
||||
<commandset id="placesCommands"
|
||||
commandupdater="true" events="focus,select"
|
||||
oncommandupdate="PlacesController.onCommandUpdate()">
|
||||
<command id="placesCmd_find" label="&cmd.find.label;" accesskey="&cmd.find.accesskey;"/>
|
||||
<command id="placesCmd_export" label="&cmd.export.label;" accesskey="&cmd.export.accesskey;"/>
|
||||
<command id="placesCmd_import"/>
|
||||
<command id="placesCmd_select:all"
|
||||
label="&cmd.select_all.label;" accesskey="&cmd.select_all.accesskey;"
|
||||
oncommand="PlacesController.selectAll();"/>
|
||||
<commandset readonly="true">
|
||||
<command id="placesCmd_edit:copy"
|
||||
label="&cmd.edit_copy.label;" accesskey="&cmd.edit_copy.accesskey;"
|
||||
oncommand="PlacesController.copy();"/>
|
||||
<command id="placesCmd_show:info"
|
||||
#ifdef XP_WIN
|
||||
label="&cmd.show_infoWin.label;" accesskey="&cmd.show_infoWin.accesskey;"/>
|
||||
#else
|
||||
label="&cmd.show_infoMac.label;" accesskey="&cmd.show_infoMac.accesskey;"/>
|
||||
#endif
|
||||
</commandset>
|
||||
<commandset>
|
||||
<command id="placesCmd_edit:cut"
|
||||
label="&cmd.edit_cut.label;" accesskey="&cmd.edit_cut.accesskey;"
|
||||
oncommand="PlacesController.cut();"/>
|
||||
<command id="placesCmd_edit:paste"
|
||||
label="&cmd.edit_paste.label;" accesskey="&cmd.edit_paste.accesskey;"
|
||||
oncommand="PlacesController.paste();"/>
|
||||
<command id="placesCmd_edit:delete"
|
||||
label="&cmd.edit_delete.label;" accesskey="&cmd.edit_delete.accesskey;"
|
||||
oncommand="PlacesController.remove();"/>
|
||||
<command id="placesCmd_rename" label="&cmd.rename.label;" accesskey="&cmd.rename.accesskey;"/>
|
||||
</commandset>
|
||||
<commandset type="link" readonly="true">
|
||||
<command id="placesCmd_open" label="&cmd.open.label;" accesskey="&cmd.open.accesskey;"
|
||||
oncommand="PlacesController.openLinkInCurrentWindow();"/>
|
||||
<command id="placesCmd_open:window" label="&cmd.open_window.label;" accesskey="&cmd.open_window.accesskey;"
|
||||
oncommand="PlacesController.openLinkInNewWindow();"/>
|
||||
<command id="placesCmd_open:tab" label="&cmd.open_tab.label;" accesskey="&cmd.open_tab.accesskey;"
|
||||
oncommand="PlacesController.openLinkInNewTab();"/>
|
||||
</commandset>
|
||||
<commandset type="link">
|
||||
</commandset>
|
||||
<commandset type="container" readonly="true">
|
||||
<command id="placesCmd_open:tabs" label="&cmd.open_tabs.label;" accesskey="&cmd.open_tabs.accesskey;"
|
||||
oncommand="PlacesController.openLinksInTabs();"/>
|
||||
<command id="placesCmd_groupby:site"
|
||||
label="&cmd.groupby_site.label;" accesskey="&cmd.groupby_site.accesskey;"
|
||||
oncommand="PlacesController.groupBySite();"/>
|
||||
<command id="placesCmd_groupby:page"
|
||||
label="&cmd.groupby_page.label;" accesskey="&cmd.groupby_page.accesskey;"
|
||||
oncommand="PlacesController.groupByPage();"/>
|
||||
<command id="placesCmd_groupby:feed" label="&cmd.groupby_feed.label;" accesskey="&cmd.groupby_feed.accesskey;"/>
|
||||
<command id="placesCmd_groupby:post" label="&cmd.groupby_post.label;" accesskey="&cmd.groupby_post.accesskey;"/>
|
||||
</commandset>
|
||||
<commandset type="container">
|
||||
<command id="placesCmd_sortby:name" label="&cmd.sortby_name.label;" accesskey="&cmd.sortby_name.accesskey;"/>
|
||||
<command id="placesCmd_new:folder"
|
||||
label="&cmd.new_folder.label;" accesskey="&cmd.new_folder.accesskey;"
|
||||
oncommand="PlacesController.newFolder()"/>
|
||||
<command id="placesCmd_new:separator" label="&cmd.new_separator.label;" accesskey="&cmd.new_separator.accesskey;"/>
|
||||
</commandset>
|
||||
<commandset type="container|feed" readonly="true">
|
||||
<command id="placesCmd_reload" label="&cmd.reload.label;" accesskey="&cmd.reload.accesskey;"/>
|
||||
</commandset>
|
||||
</commandset>
|
||||
</commandset>
|
||||
|
||||
<popupset id="mainPopupSet">
|
||||
<popup id="placesContext"
|
||||
onpopupshowing="return PlacesController.buildContextMenu(this);">
|
||||
<menuitem id="placesContext_open" command="placesCmd_open" default="true"
|
||||
selection="link"/>
|
||||
<menuitem id="placesContext_open:tabs" command="placesCmd_open:tabs"
|
||||
selection="folder|links"/>
|
||||
<menuitem id="placesContext_open:newwindow" command="placesCmd_open:window"
|
||||
selection="link"/>
|
||||
<menuitem id="placesContext_open:newtab" command="placesCmd_open:tab"
|
||||
selection="link"/>
|
||||
<menuseparator id="placesContext_openSeparator"
|
||||
selection="link|links|folder"/>
|
||||
<menuitem id="placesContext_new:folder" command="placesCmd_new:folder"
|
||||
selection="mutable"/>
|
||||
<menuseparator id="placesContext_newSeparator"
|
||||
selection="mutable"/>
|
||||
<menuitem id="placesContext_edit:cut" command="placesCmd_edit:cut"
|
||||
selection="mixed"/>
|
||||
<menuitem id="placesContext_edit:copy" command="placesCmd_edit:copy"
|
||||
selection="mixed"/>
|
||||
<menuitem id="placesContext_edit:paste" command="placesCmd_edit:paste"
|
||||
selection="mixed"/>
|
||||
<menuitem id="placesContext_edit:delete" command="placesCmd_edit:delete"
|
||||
selection="mixed"/>
|
||||
<menuseparator id="placesContext_editSeparator"
|
||||
selection="mixed"/>
|
||||
<menuitem id="placesContext_select:all" command="placesCmd_select:all"
|
||||
selection="multiselect"/>
|
||||
<menuseparator id="placesContext_selectSeparator"
|
||||
selection="multiselect"/>
|
||||
<menuitem id="placesContext_reload" command="placesCmd_reload"
|
||||
selection="livemark"/>
|
||||
<menuitem id="placesContext_sortby:name" command="placesCmd_sortby:name"
|
||||
selection="mutable"/>
|
||||
<menuseparator id="placesContext_sortSeparator"
|
||||
selection="mutable|livemark"/>
|
||||
<menuitem id="placesContext_show:info" command="placesCmd_show:info"
|
||||
selection="link|folder"/>
|
||||
</popup>
|
||||
</popupset>
|
||||
|
||||
<toolbox id="navigator-toolbox">
|
||||
<toolbar id="bookmarksToolbar">
|
||||
<toolbarbutton label="Show Places" oncommand="PlacesBrowserShim.showPlaces()"/>
|
||||
<hbox id="bookmarksBarContent" flex="1" context="placesContext"/>
|
||||
</toolbar>
|
||||
</toolbox>
|
||||
|
||||
</overlay>
|
||||
|
||||
|
|
|
@ -366,7 +366,9 @@ var PlacesController = {
|
|||
* preferred destination window or tab.
|
||||
*/
|
||||
mouseLoadURI: function PC_mouseLoadURI(event) {
|
||||
this._getLoadFunctionForEvent(event)();
|
||||
var fn = this._getLoadFunctionForEvent(event);
|
||||
if (fn)
|
||||
this._getLoadFunctionForEvent(event)();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -416,7 +418,6 @@ var PlacesController = {
|
|||
this._activeView.browserWindow.openNewTabWith(nodes[i].url, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="placesBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="places-bar">
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
this._places =
|
||||
Cc["@mozilla.org/browser/nav-history;1"].
|
||||
getService(Ci.nsINavHistory);
|
||||
|
||||
var self = this;
|
||||
function onClick(event) {
|
||||
if (event.target.localName != "toolbarbutton")
|
||||
return;
|
||||
self._selection = event.target.node;
|
||||
PlacesController.activeView = self;
|
||||
PlacesController.mouseLoadURI(event);
|
||||
}
|
||||
this.addEventListener("click", onClick, false);
|
||||
]]></constructor>
|
||||
|
||||
<field name="_selection">null</field>
|
||||
|
||||
<field name="_result">null</field>
|
||||
<method name="getResult">
|
||||
<body><![CDATA[
|
||||
return this._result;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_rebuild">
|
||||
<body><![CDATA[
|
||||
while (this.hasChildNodes())
|
||||
this.removeChild(this.firstChild);
|
||||
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var cc = this._result.childCount;
|
||||
for (var i = 0; i < cc; ++i) {
|
||||
var child = this._result.getChild(i);
|
||||
var button = document.createElementNS(XULNS, "toolbarbutton");
|
||||
button.setAttribute("label", child.title);
|
||||
if (PlacesController.nodeIsURL(child))
|
||||
button.setAttribute("url", child.url)
|
||||
else if (PlacesController.nodeIsFolder(child)) {
|
||||
button.setAttribute("folder-id", child.folderId);
|
||||
button.setAttribute("type", "menu");
|
||||
}
|
||||
button.className = "bookmark-item";
|
||||
button.node = child;
|
||||
this.appendChild(button);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="load">
|
||||
<parameter name="queries"/>
|
||||
<parameter name="options"/>
|
||||
<body><![CDATA[
|
||||
this._result = this._places.executeQueries(queries, queries.length,
|
||||
options);
|
||||
this._rebuild();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<property name="hasSelection">
|
||||
<getter><![CDATA[
|
||||
return this._selection != null;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="hasSingleSelection">
|
||||
<getter><![CDATA[
|
||||
return this.hasSelection;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="getSelectionNodes">
|
||||
<body><![CDATA[
|
||||
return this.hasSelection ? [this.selectedNode] : [];
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="getCopyableSelection">
|
||||
<body><![CDATA[
|
||||
return this.getSelectionNodes();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<property name="selectedNode">
|
||||
<getter><![CDATA[
|
||||
return this.hasSelection ? this._selection : null;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="selectedURLNode">
|
||||
<getter><![CDATA[
|
||||
var node = this.selectedNode;
|
||||
return node && PlacesController.nodeIsURL(node) ? node : null;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="insertionPoint">
|
||||
<getter><![CDATA[
|
||||
if (!this.hasSelection)
|
||||
var index = -1;
|
||||
else
|
||||
index = PlacesController.getIndexOfNode(this.selectedNode)
|
||||
return { container: this._result.folderId, index: index };
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="browserWindow" onget="return window;"/>
|
||||
|
||||
<property name="supportedDropTypes">["text/x-moz-place", "text/x-moz-url"]</property>
|
||||
|
||||
<method name="selectAll">
|
||||
<body><![CDATA[
|
||||
// Nothing
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="mousedown">
|
||||
dump("ET: " + event.target.localName);
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -4,10 +4,11 @@ browser.jar:
|
|||
content/browser/places/places.js (content/places.js)
|
||||
content/browser/places/places.xml (content/places.xml)
|
||||
content/browser/places/places.css (content/places.css)
|
||||
content/browser/places/toolbar.xml (content/toolbar.xml)
|
||||
content/browser/places/controller.js (content/controller.js)
|
||||
content/browser/places/draghelper.xml (content/draghelper.xml)
|
||||
content/browser/places/browserShim.js (content-shim/browserShim.js)
|
||||
content/browser/places/browserShim.xul (content-shim/browserShim.xul)
|
||||
* content/browser/places/browserShim.xul (content-shim/browserShim.xul)
|
||||
content/browser/places/browserShim.css (content-shim/browserShim.css)
|
||||
|
||||
classic.jar:
|
||||
skin/classic/browser/places/places.css (skin-win/places.css)
|
||||
|
|
Загрузка…
Ссылка в новой задаче