Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit c156225

Browse files
committed
✨ Sidebar Enable Extensions Preference
1 parent 3953597 commit c156225

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/browser/app/profile/pulse-browser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pref('pulse.welcome.seen', false);
1515

1616
// Sidebar pref
1717
pref('pulse.sidebar.enabled', true);
18+
pref('pulse.sidebar.extensions.enabled', true);
1819

1920
//PIP pref
2021
pref('media.videocontrols.picture-in-picture.audio-toggle.enabled', true);

src/browser/base/content/browser-sidebar-js.patch

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/browser/base/content/browser-sidebar.js b/browser/base/content/browser-sidebar.js
2-
index 88f7ed1afbb0f25130ae9b2c6d5058da1fc3a21e..99148b161abb29cb27968339dcb1628baeae0e50 100644
2+
index 88f7ed1afbb0f25130ae9b2c6d5058da1fc3a21e..f59c0ac6d468430fc5d0d116b0b488a322aa35bf 100644
33
--- a/browser/base/content/browser-sidebar.js
44
+++ b/browser/base/content/browser-sidebar.js
55
@@ -2,6 +2,7 @@
@@ -37,17 +37,18 @@ index 88f7ed1afbb0f25130ae9b2c6d5058da1fc3a21e..99148b161abb29cb27968339dcb1628b
3737
},
3838
],
3939
]));
40-
@@ -53,7 +60,9 @@ var SidebarUI = {
40+
@@ -53,7 +60,10 @@ var SidebarUI = {
4141
}
4242
return (this._browser = document.getElementById("sidebar"));
4343
},
4444
+
4545
POSITION_START_PREF: "sidebar.position_start",
4646
+ SIDEBAR_TABS_PREF: "pulse.sidebar.enabled",
47+
+ SIDEBAR_EXTENSIONS_PREF: "pulse.sidebar.extensions.enabled",
4748
DEFAULT_SIDEBAR_ID: "viewBookmarksSidebar",
4849

4950
// lastOpenedId is set in show() but unlike currentID it's not cleared out on hide
50-
@@ -71,6 +80,8 @@ var SidebarUI = {
51+
@@ -71,6 +81,8 @@ var SidebarUI = {
5152
},
5253
_splitter: null,
5354
_icon: null,
@@ -56,7 +57,7 @@ index 88f7ed1afbb0f25130ae9b2c6d5058da1fc3a21e..99148b161abb29cb27968339dcb1628b
5657
_reversePositionButton: null,
5758
_switcherPanel: null,
5859
_switcherTarget: null,
59-
@@ -91,6 +102,10 @@ var SidebarUI = {
60+
@@ -91,6 +103,10 @@ var SidebarUI = {
6061
this._box = document.getElementById("sidebar-box");
6162
this._splitter = document.getElementById("sidebar-splitter");
6263
this._icon = document.getElementById("sidebar-icon");
@@ -67,12 +68,16 @@ index 88f7ed1afbb0f25130ae9b2c6d5058da1fc3a21e..99148b161abb29cb27968339dcb1628b
6768
this._reversePositionButton = document.getElementById(
6869
"sidebar-reverse-position"
6970
);
70-
@@ -102,9 +117,49 @@ var SidebarUI = {
71+
@@ -102,9 +118,53 @@ var SidebarUI = {
7172
this.toggleSwitcherPanel();
7273
});
7374

7475
+ const sidebaritems = this.sidebars.keys();
76+
+ const sidebarExtensionVis = Services.prefs.getBoolPref(this.SIDEBAR_EXTENSIONS_PREF);
7577
+ for (const sidebaritem of sidebaritems) {
78+
+ if(this.sidebars.get(sidebaritem).extensionId && !sidebarExtensionVis) {
79+
+ return;
80+
+ }
7681
+ this.createSidebarItem(sidebaritem, this.sidebars.get(sidebaritem).iconurl, this.sidebars.get(sidebaritem));
7782
+ }
7883
+
@@ -117,12 +122,11 @@ index 88f7ed1afbb0f25130ae9b2c6d5058da1fc3a21e..99148b161abb29cb27968339dcb1628b
117122
},
118123

119124
uninit() {
120-
@@ -135,6 +190,27 @@ var SidebarUI = {
125+
@@ -135,6 +195,26 @@ var SidebarUI = {
121126
}
122127
},
123128

124129
+ createSidebarItem(id, icon, config) {
125-
+ console.log(id, icon)
126130
+ var toolbar = document.createElement("img");
127131
+ toolbar.setAttribute("id", `sidebar-icon-${id}`);
128132
+ toolbar.setAttribute("src", `${icon}`);
@@ -145,7 +149,7 @@ index 88f7ed1afbb0f25130ae9b2c6d5058da1fc3a21e..99148b161abb29cb27968339dcb1628b
145149
/**
146150
* Opens the switcher panel if it's closed, or closes it if it's open.
147151
*/
148-
@@ -208,14 +284,14 @@ var SidebarUI = {
152+
@@ -208,14 +288,14 @@ var SidebarUI = {
149153
},
150154

151155
/**
@@ -163,7 +167,7 @@ index 88f7ed1afbb0f25130ae9b2c6d5058da1fc3a21e..99148b161abb29cb27968339dcb1628b
163167
* appropriately within the browser container.
164168
*/
165169
setPosition() {
166-
@@ -569,10 +645,9 @@ var SidebarUI = {
170+
@@ -569,10 +649,9 @@ var SidebarUI = {
167171
* none if the argument is an empty string.
168172
*/
169173
selectMenuItem(commandID) {
@@ -176,7 +180,7 @@ index 88f7ed1afbb0f25130ae9b2c6d5058da1fc3a21e..99148b161abb29cb27968339dcb1628b
176180
if (id == commandID) {
177181
menu.setAttribute("checked", "true");
178182
if (triggerbutton) {
179-
@@ -599,3 +674,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
183+
@@ -599,3 +678,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
180184
true,
181185
SidebarUI.setPosition.bind(SidebarUI)
182186
);

0 commit comments

Comments
 (0)