Автор: Vitaliy977
Дата сообщения: 19.08.2016 11:43
momo2000
Просто стилем так не сделать, там даже скрыть пункты нельзя. Стилем с биндингом можно, но проще кнопкой CB если пользуетесь, в инициализацию [more]
Код: var overlay = "chrome://browser/content/bookmarks/bookmarksPanel.xul";
function sidebar_change(sidebar) {
if (sidebar.currentURI.spec !== overlay) {
return false;
}
var bookmarks = sidebar.contentDocument.getElementById("bookmarks-view"), place;
if (!bookmarks || !(place = bookmarks.getAttribute("place"))) {
return false;
}
bookmarks.setAttribute("place-default", place);
bookmarks.place = "place:queryType=1&folder=BOOKMARKS_MENU";
return true;
}
function sidebar_restore(sidebar) {
if (sidebar.currentURI.spec !== overlay) {
return false;
}
var bookmarks = sidebar.contentDocument.getElementById("bookmarks-view"), place;
if (!bookmarks || !(place = bookmarks.getAttribute("place-default"))) {
return false;
}
bookmarks.place = place;
bookmarks.removeAttribute("place-default");
return true;
}
(function () {
var sidebar = document.getElementById("sidebar");
if (!sidebar) {
return false;
}
var stop = Components.interfaces.nsIWebProgressListener.STATE_STOP, win = Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW;
sidebar.addProgressListener(sidebar.old_bookmarks_sidebar = {
QueryInterface: function (id)
{
if (id.equals(Components.interfaces.nsIWebProgressListener) || id.equals(Components.interfaces.nsISupportsWeakReference) || id.equals(Components.interfaces.nsISupports)) {
return this;
}
throw Components.results.NS_NOINTERFACE;
},
onStateChange: function (progress, request, flag) {
return flag & stop && flag & win ? sidebar_change(sidebar) : false;
},
onLocationChange: function () {},
onProgressChange: function () {},
onStatusChange: function () {},
onSecurityChange: function () {}
});
return sidebar_change(sidebar);
})();
function window_unload() {
var sidebar = document.getElementById("sidebar");
if (!sidebar) {
return false;
}
try {
sidebar.removeProgressListener(sidebar.old_bookmarks_sidebar);
} catch (ex) {}
return sidebar_restore(sidebar);
}
this.onDestroy = function() {
window_unload();
}