forked from ajsb85/firefox-addon-ubuntuve
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ajsb85/master
Panel in the main menu of Fx
- Loading branch information
Showing
8 changed files
with
34 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
var { PanelView } = require("jetpack-panelview"); | ||
var buttons = require('sdk/ui/button/action'); | ||
const { PanelView } = require("jetpack-panelview"); | ||
const { ToggleButton } = require('sdk/ui'); | ||
const workaround = require("jetpack-panelview/lib/panelview/workaround"); | ||
var tabs = require("sdk/tabs"); | ||
const name = "lightweightThemes.selectedThemeID"; | ||
const selectedThemeID = require("sdk/preferences/service").get(name); | ||
|
||
var pv = PanelView({ | ||
id: 'demo-panelview', | ||
title: 'Demo', | ||
id: 'ubuntuve-panelview', | ||
title: 'Ubuntu Venezuela', | ||
content: [ | ||
{ | ||
type: 'button', | ||
|
@@ -110,16 +111,27 @@ var pv = PanelView({ | |
} | ||
}); | ||
|
||
var button = buttons.ActionButton({ | ||
id: "ubuntu-button", | ||
label: "Ubuntu Venezuela", | ||
icon: { | ||
"16": selectedThemeID === "[email protected]" ? | ||
"./icon-16.dev.svg" : "./icon-16.svg", | ||
"32": "./icon-32.svg", | ||
"64": "./icon-64.svg" | ||
}, | ||
onClick: function(state){ | ||
|
||
const button = ToggleButton({ | ||
id: "ubuntuve-button", | ||
label: "Ubuntu Venezuela", | ||
icon: { | ||
"16": selectedThemeID === "[email protected]" ? | ||
"./icon-16.dev.svg" : "./icon-16.svg", | ||
"32": "./icon-32.svg", | ||
"64": "./icon-64.svg" | ||
}, | ||
onClick(state){ | ||
if(state.checked) { | ||
pv.show(button); | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
// Uncheck the button if the panel is hidden by loosing focus | ||
pv.on("hide", () => { | ||
button.state("window", {checked: false}); | ||
}); | ||
|
||
// Don't close the menu panel or overflow panel when the button is clicked. | ||
workaround.applyButtonFix(button); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.