2016-10-28 150 views
0

我想创建一个Firefox扩展(我的第一个扩展,所以我是初学者)。 我想做这个例子:Firefox扩展与工具栏

enter image description here

但是,这是我的结果:

enter image description here

我不明白为什么我的图片无法载入,为什么右边框按钮是空的,如果有可能增加工具栏的高度。

有我的代码:

index.js:

var { ActionButton } = require('sdk/ui/button/action'); 
var { Toolbar } = require("sdk/ui/toolbar"); 
var { Frame } = require("sdk/ui/frame"); 

var previous = ActionButton({ 
    id: "previous", 
    label: "previous", 
    icon: { 
     "16": "./icons/previous.png" 
    }, 
    onClick: function(state) { 
     console.log("button '" + state.label + "' was clicked"); 
    } 
}); 

var next = ActionButton({ 
    id: "next", 
    label: "next", 
    icon: { 
     "16": "./icons/next.png" 
    }, 
    onClick: function(state) { 
     console.log("button '" + state.label + "' was clicked"); 
    } 
}); 

var play = ActionButton({ 
    id: "play", 
    label: "play", 
    icon: { 
     "16": "./icons/play.png" 
    }, 
    onClick: function(state) { 
     console.log("button '" + state.label + "' was clicked"); 
    } 
}); 

var frame = new Frame({ 
    url: "./frame-player.html" 
}); 

var toolbar = Toolbar({ 
    title: "Player", 
    items: [previous, play, next, frame] 
}); 

帧player.html:

<!DOCTYPE html> 
<html> 
    <head> 
    </head> 
    <body> 
    TEST 
    </body> 
</html> 

回答

0

通过将所有文件(图片,脚本解决了,.. )在我的扩展的“数据”文件夹中。