summaryrefslogtreecommitdiffstats
path: root/browser/components/customizableui/CustomizableWidgets.jsm
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-05-25 22:46:40 +0200
committerGitHub <noreply@github.com>2018-05-25 22:46:40 +0200
commit8f354e52d09d1bf2fadfbbfc141d4f32241599a4 (patch)
treeca3fcaa2a72700b85221b2fe75bb7d46d5d424ce /browser/components/customizableui/CustomizableWidgets.jsm
parentd5459982f0d1bab08b751dc140c4cbe047032617 (diff)
parent72bab89cf6c77c9ee95a977c306e6ce317b84835 (diff)
downloadUXP-8f354e52d09d1bf2fadfbbfc141d4f32241599a4.tar
UXP-8f354e52d09d1bf2fadfbbfc141d4f32241599a4.tar.gz
UXP-8f354e52d09d1bf2fadfbbfc141d4f32241599a4.tar.lz
UXP-8f354e52d09d1bf2fadfbbfc141d4f32241599a4.tar.xz
UXP-8f354e52d09d1bf2fadfbbfc141d4f32241599a4.zip
Merge pull request #386 from MoonchildProductions/revert-381-masterPM28.0.0a2_Unstable
Revert "Remove the Social API"
Diffstat (limited to 'browser/components/customizableui/CustomizableWidgets.jsm')
-rw-r--r--browser/components/customizableui/CustomizableWidgets.jsm41
1 files changed, 41 insertions, 0 deletions
diff --git a/browser/components/customizableui/CustomizableWidgets.jsm b/browser/components/customizableui/CustomizableWidgets.jsm
index 3e00d385f..3e83b081c 100644
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -557,6 +557,47 @@ const CustomizableWidgets = [
fillSubviewFromMenuItems([...menu.children], sidebarItems);
}
}, {
+ id: "social-share-button",
+ // custom build our button so we can attach to the share command
+ type: "custom",
+ onBuild: function(aDocument) {
+ let node = aDocument.createElementNS(kNSXUL, "toolbarbutton");
+ node.setAttribute("id", this.id);
+ node.classList.add("toolbarbutton-1");
+ node.classList.add("chromeclass-toolbar-additional");
+ node.setAttribute("label", CustomizableUI.getLocalizedProperty(this, "label"));
+ node.setAttribute("tooltiptext", CustomizableUI.getLocalizedProperty(this, "tooltiptext"));
+ node.setAttribute("removable", "true");
+ node.setAttribute("observes", "Social:PageShareable");
+ node.setAttribute("command", "Social:SharePage");
+
+ let listener = {
+ onWidgetAdded: (aWidgetId) => {
+ if (aWidgetId != this.id)
+ return;
+
+ Services.obs.notifyObservers(null, "social:" + this.id + "-added", null);
+ },
+
+ onWidgetRemoved: aWidgetId => {
+ if (aWidgetId != this.id)
+ return;
+
+ Services.obs.notifyObservers(null, "social:" + this.id + "-removed", null);
+ },
+
+ onWidgetInstanceRemoved: (aWidgetId, aDoc) => {
+ if (aWidgetId != this.id || aDoc != aDocument)
+ return;
+
+ CustomizableUI.removeListener(listener);
+ }
+ };
+ CustomizableUI.addListener(listener);
+
+ return node;
+ }
+ }, {
id: "add-ons-button",
shortcutId: "key_openAddons",
tooltiptext: "add-ons-button.tooltiptext3",