我正在开发一个Firefox扩展,在这个扩展中,我在browser.xul中做了各种修改,以定制火狐的UI。默认情况下,Firefox的菜单栏被禁用/不可见。我希望它总是显示菜单栏工具栏。FYI,我已经禁用了在工具栏上的右键单击,它通常显示一个上下文菜单,其中一个可以使菜单栏可见或消失。
有什么方法可以做这个设置吗?
发布于 2015-06-04 12:11:09
我试过了,而且效果很好,
我已经编辑了browser.js和gBrowserInit函数中的onLoad函数,在完成整个UI加载之后,我添加了以下代码片段。
let toolbar = window.document.getElementById("toolbar-menubar");
if (toolbar) {
window.setToolbarVisibility(toolbar, true, true);
}发布于 2017-01-13 10:18:50
我找到这个条目是因为我在寻找一个显示工具栏的解决方案,它总是被“最小化”,所以我不得不点击“更多的工具”,然后点击工具(例如ublock)。
我的解决方案是转到about:config并将值browser.chrome.toolbar_style (即"2")更改为"1“。重新启动firefox之后,所有工具都再次可见。将其更改为"2“并重新启动firefox仍然会显示所有工具。奇怪的行为。
发布于 2015-06-04 11:54:00
这不是一个解决方案,而是一个开始。
备选案文1
找出如何设置一个比这里的样式表更重要的样式表:
看起来,当inactive=true属性设置在它的chrome://global/content/xul.css行289上时,它会得到高度为0的css。我试着用自己的身高注册一个样式表。
This is whats applied when `inactive=true` attribute is on it:
toolbar[type="menubar"][autohide="true"][inactive="true"]:not([customizing="true"]) {
min-height: 0 !important;
height: 0 !important;
-moz-appearance: none !important;
border-style: none !important;
}我试过了,但是我的重要性并不是覆盖这个,这个页面可能值得一读,它是关于css顺序优先级的,我认为可以用它来完成:http://hungred.com/useful-information/css-priority-order-tips-tricks/。
我尝试过这段代码,但它不会变得更重要:
// globals
Cu.import('resource://gre/modules/Services.jsm');
var sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService);
try {
sss.unregisterSheet(cssUri, sss.AUTHOR_SHEET);
} catch (ignore) {}
var cssUri;
var css = 'toolbar[type="menubar"][autohide="true"][inactive="true"]:not([customizing="true"]) { height: 50px !important; min-height: 50px !important;';
var newURIParam = {
aURL: 'data:text/css,' + encodeURIComponent(css),
aOriginCharset: null,
aBaseURI: null
};
var cssUri = Services.io.newURI(newURIParam.aURL, newURIParam.aOriginCharset, newURIParam.aBaseURI);
sss.loadAndRegisterSheet(cssUri, sss.AUTHOR_SHEET);我也尝试过var css = '#toolbar-menubar[type="menubar"][autohide="true"][inactive="true"]:not([customizing="true"]) { height: 50px !important; min-height: 50px !important;'; notoice我如何使用#toolbar-menubar id而不是标签选择器,id是最重要的,但是它没有工作,即使我保持了它的选择性。
选项2
变异观察者,每当inactive=true被附加,删除它。这无疑是一场没有思考的火。然而,我认为CSS选项将是首选的,因为它提供了更好的性能。
https://stackoverflow.com/questions/30640201
复制相似问题