mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 21:29:59 +02:00
refactor: Update ZenSidebarManager to use updated default mobile user agent
This commit is contained in:
parent
1f01cdac79
commit
c05abd76b2
3 changed files with 11 additions and 30 deletions
|
@ -73,7 +73,7 @@ var gZenBrowserManagerSidebar = {
|
|||
const parent = sidebar.parentElement;
|
||||
// relative to avoid the top margin
|
||||
// 20px is the padding
|
||||
let parentRelativeHeight = parent.getBoundingClientRect().height - parent.getBoundingClientRect().top + 20;
|
||||
let parentRelativeHeight = parent.getBoundingClientRect().height - parent.getBoundingClientRect().top + 30;
|
||||
let minHeight = parseInt(computedStyle.getPropertyValue("min-height").replace("px", ""));
|
||||
if (!this._isDragging) { // Prevent multiple resizes
|
||||
this._isDragging = true;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
const kZenThemesPreference = "zen.themes.data";
|
||||
export class ZenThemeMarketplaceChild extends JSWindowActorChild {
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -17,41 +16,23 @@ export class ZenThemeMarketplaceChild extends JSWindowActorChild {
|
|||
initiateThemeMarketplace() {
|
||||
this.contentWindow.setTimeout(() => {
|
||||
this.addIntallButtons();
|
||||
}, 1000);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
async addIntallButtons() {
|
||||
const actionButtons = this.contentWindow.document.querySelectorAll(".install-theme");
|
||||
const errorMessages = this.contentWindow.document.querySelectorAll(".install-theme-error");
|
||||
if (actionButtons.length !== 0) {
|
||||
const actionButton = this.contentWindow.document.getElementById("install-theme");
|
||||
const errorMessage = this.contentWindow.document.getElementById("install-theme-error");
|
||||
if (actionButton) {
|
||||
console.info("ZenThemeMarketplaceChild: Initiating theme marketplace");
|
||||
}
|
||||
|
||||
for (let error of errorMessages) {
|
||||
error.remove();
|
||||
}
|
||||
|
||||
for (let button of actionButtons) {
|
||||
button.classList.remove("hidden");
|
||||
button.addEventListener("click", this.installTheme.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
get themes() {
|
||||
if (!this._themes) {
|
||||
this._themes = JSON.parse(Services.prefs.getStringPref(kZenThemesPreference, "{}"));
|
||||
}
|
||||
return this._themes;
|
||||
}
|
||||
|
||||
set themes(themes) {
|
||||
this._themes = themes;
|
||||
this.sendAsyncMessage("ZenThemeMarketplace:UpdateThemes", { themes });
|
||||
errorMessage.classList.add("hidden");
|
||||
actionButton.classList.remove("hidden");
|
||||
actionButton.addEventListener("click", this.installTheme.bind(this));
|
||||
}
|
||||
|
||||
addTheme(theme) {
|
||||
this.themes[theme.id] = theme;
|
||||
this.themes = this.themes;
|
||||
this.sendAsyncMessage("ZenThemeMarketplace:InstallTheme", { theme });
|
||||
}
|
||||
|
||||
async getThemeInfo(themeId) {
|
||||
|
@ -84,4 +65,4 @@ export class ZenThemeMarketplaceChild extends JSWindowActorChild {
|
|||
}
|
||||
this.addTheme(theme);
|
||||
}
|
||||
};
|
||||
};
|
|
@ -88,4 +88,4 @@ export class ZenThemeMarketplaceParent extends JSWindowActorParent {
|
|||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue