mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-08 14:03:49 +00:00
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
var AwesomePanel = function(aElementId, aCommandId) {
|
|
let command = document.getElementById(aCommandId);
|
|
|
|
this.panel = document.getElementById(aElementId),
|
|
|
|
this.open = function aw_open() {
|
|
command.setAttribute("checked", "true");
|
|
this.panel.hidden = false;
|
|
|
|
if (this.panel.hasAttribute("onshow")) {
|
|
let func = new Function("panel", this.panel.getAttribute("onshow"));
|
|
func.call(this.panel);
|
|
}
|
|
|
|
if (this.panel.open)
|
|
this.panel.open();
|
|
},
|
|
|
|
this.close = function aw_close() {
|
|
if (this.panel.hasAttribute("onhide")) {
|
|
let func = new Function("panel", this.panel.getAttribute("onhide"));
|
|
func.call(this.panel);
|
|
}
|
|
|
|
if (this.panel.close)
|
|
this.panel.close();
|
|
|
|
this.panel.hidden = true;
|
|
command.removeAttribute("checked");
|
|
},
|
|
|
|
this.doCommand = function aw_doCommand() {
|
|
BrowserUI.doCommand(aCommandId);
|
|
},
|
|
|
|
this.openLink = function aw_openLink(aEvent) {
|
|
let item = aEvent.originalTarget;
|
|
let uri = item.getAttribute("url") || item.getAttribute("uri");
|
|
if (uri != "") {
|
|
Browser.selectedBrowser.userTypedValue = uri;
|
|
BrowserUI.goToURI(uri);
|
|
}
|
|
}
|
|
};
|