如何在Mozilla中像Chrome扩展一样更改面板大小 [英] How to change Panel Size in mozilla like chrome extension
问题描述
面板大小在基于SDK的插件中是固定的 我想像chrome字典扩展名一样自动更改面板大小< href =https://chrome.google.com/webstore/detail/dictionarycom-extension/epkhgmlgiomobdlofllfmoejgjdojknn?utm_source=chrome-ntp-icon =nofollow>这里 如果您要在面板中搜索,则会显示内容需求等大小数据。 您可以在Add-在一些额外的代码SDK上。 在main.js中: 在内容脚本中: 下面是一个可行的例子: https://builder.addons.mozilla.org/package/150225/latest/ Panel Size is fixed in SDK-based Add-on I want to change the size of panel automatically like chrome dictionary extension here If you will search in panel it will show big and small data like content requirement.
In Mozilla panel we can fix only 1 type of size like You can implement this in the Add-on SDK with a little extra code. In main.js: In the content script: Here's a working example of this: https://builder.addons.mozilla.org/package/150225/latest/ 这篇关于如何在Mozilla中像Chrome扩展一样更改面板大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
在Mozilla面板中,我们只能修复一种类型的大小,如 width:400px
和 height:400px
等。但我希望面板的大小应该基于数据大小意味着像铬扩展。
var panel = require(panel)。Panel({
contentURL:https://bugzilla.mozilla.org/enter_bug.cgi?product=Add-on%20SDK,
onShow (){
data.url('windowsize.js')
]
} );
worker.port.on('winsize',function(data){
panel.resize((data.width-120),(data.height-120));
});
worker.port.emit('fetchwinsize');
}
});
<$ p $ (){$ b $ self.port.eon(winsize,{height:window.innerHeight,width:window.innerWidth}) ;
});
width:400px
and height:400px
etc. but i want that panel size should based on data size means like chrome extensions.var panel = require("panel").Panel({
contentURL: "https://bugzilla.mozilla.org/enter_bug.cgi?product=Add-on%20SDK",
onShow: function() {
let worker = tabs.activeTab.attach({
contentScriptFile: [
data.url('windowsize.js')
]
});
worker.port.on('winsize', function(data) {
panel.resize((data.width-120), (data.height-120));
});
worker.port.emit('fetchwinsize');
}
});
self.port.on('fetchwinsize', function() {
self.port.emit("winsize", {height: window.innerHeight, width: window.innerWidth});
});