diff --git a/README.md b/README.md index 42e0599..9f14e6b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![ubuntuve-logo](https://raw.github.com/ajsb85/firefox-addon-ubuntuve/master/press/logo/ubuntuve_logo.png "ubuntuve") +![ubuntuve-logo](https://raw.github.com/ajsb85/firefox-addon-ubuntuve/master/press/logo/ubuntuve_logo.png "ubuntuve") # Ubuntu VE Quick navigation menu through all the resources of the Venezuelan community of the Linux distribution Ubuntu (www.ubuntu.org.ve). Allow also a quick navigation through some resources of other Ubuntu communities including the international one. @@ -13,9 +13,11 @@ https://addons.mozilla.org/addon/ubuntu-venezuela/ Filing a bug at https://github.com/ajsb85/firefox-addon-ubuntuve/issues ### Preview Screenshots -![ubuntuve-gif](https://raw.github.com/ajsb85/firefox-addon-ubuntuve/master/press/screens/fx.gif "ubuntuve") -![ubuntuve-gif](https://raw.github.com/ajsb85/firefox-addon-ubuntuve/master/press/screens/dev.gif "ubuntuve") - +![ubuntuve-gif](https://raw.github.com/ajsb85/firefox-addon-ubuntuve/master/press/screens/screen0.gif "ubuntuve") +![ubuntuve-gif](https://raw.github.com/ajsb85/firefox-addon-ubuntuve/master/press/screens/screen1.gif "ubuntuve") +![ubuntuve-png](https://raw.github.com/ajsb85/firefox-addon-ubuntuve/master/press/screens/screen2.png "ubuntuve") +![ubuntuve-png](https://raw.github.com/ajsb85/firefox-addon-ubuntuve/master/press/screens/screen3.png "ubuntuve") +![ubuntuve-png](https://raw.github.com/ajsb85/firefox-addon-ubuntuve/master/press/screens/screen4.png "ubuntuve") ### Works with: diff --git a/lib/main.js b/lib/main.js index 89a6e66..7519aba 100644 --- a/lib/main.js +++ b/lib/main.js @@ -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 === "firefox-devedition@mozilla.org" ? - "./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 === "firefox-devedition@mozilla.org" ? + "./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); diff --git a/package.json b/package.json index b17a7f0..ffb9be5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "title": "Ubuntu VE", "name": "ubuntu-venezuela", - "version": "0.1.0", + "version": "0.1.2", "id": "{ef65f6de-fa25-45fd-8038-4a340bea4d55}", "description": "Quick navigation menu through all the resources of the Venezuelan community of the Linux distribution Ubuntu (www.ubuntu.org.ve). Allow also a quick navigation through some resources of other Ubuntu communities including the international one.", "main": "lib/main.js", diff --git a/press/screens/dev.gif b/press/screens/screen0.gif similarity index 100% rename from press/screens/dev.gif rename to press/screens/screen0.gif diff --git a/press/screens/fx.gif b/press/screens/screen1.gif similarity index 100% rename from press/screens/fx.gif rename to press/screens/screen1.gif diff --git a/press/screens/screen2.png b/press/screens/screen2.png new file mode 100644 index 0000000..ec08f5e Binary files /dev/null and b/press/screens/screen2.png differ diff --git a/press/screens/screen3.png b/press/screens/screen3.png new file mode 100644 index 0000000..b0c5029 Binary files /dev/null and b/press/screens/screen3.png differ diff --git a/press/screens/screen4.png b/press/screens/screen4.png new file mode 100644 index 0000000..e17a7ad Binary files /dev/null and b/press/screens/screen4.png differ