mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
Merge pull request #7846 from Pdzly/main
Homepage button on Zen Mods settings page.
This commit is contained in:
@@ -170,7 +170,6 @@ var gZenMarketplaceManager = {
|
||||
for (const theme of Object.values(themes).sort((a, b) => a.name.localeCompare(b.name))) {
|
||||
const sanitizedName = `theme-${theme.name?.replaceAll(/\s/g, '-')?.replaceAll(/[^A-z_-]+/g, '')}`;
|
||||
const isThemeEnabled = theme.enabled === undefined || theme.enabled;
|
||||
|
||||
const fragment = window.MozXULElement.parseXULToFragment(`
|
||||
<vbox class="zenThemeMarketplaceItem">
|
||||
<vbox class="zenThemeMarketplaceItemContent">
|
||||
@@ -181,6 +180,7 @@ var gZenMarketplaceManager = {
|
||||
</vbox>
|
||||
<hbox class="zenThemeMarketplaceItemActions">
|
||||
${theme.preferences ? `<button id="zenThemeMarketplaceItemConfigureButton-${sanitizedName}" class="zenThemeMarketplaceItemConfigureButton" hidden="true"></button>` : ''}
|
||||
${theme.homepage ? `<button id="zenThemeMarketplaceItemHomePageLink-${sanitizedName}" class="zenThemeMarketplaceItemHomepageButton" zen-theme-id="${theme.id}"></button>` : ''}
|
||||
<button class="zenThemeMarketplaceItemUninstallButton" data-l10n-id="zen-theme-marketplace-remove-button" zen-theme-id="${theme.id}"></button>
|
||||
</hbox>
|
||||
</vbox>
|
||||
@@ -274,6 +274,16 @@ var gZenMarketplaceManager = {
|
||||
await this.removeTheme(event.target.getAttribute('zen-theme-id'));
|
||||
});
|
||||
|
||||
if (theme.homepage) {
|
||||
const homepageButton = fragment.querySelector('.zenThemeMarketplaceItemHomepageButton');
|
||||
homepageButton.addEventListener('click', () => {
|
||||
// open the homepage url in a new tab
|
||||
const url = theme.homepage;
|
||||
|
||||
window.open(url, '_blank');
|
||||
});
|
||||
}
|
||||
|
||||
if (theme.preferences) {
|
||||
fragment.querySelector('.zenThemeMarketplaceItemConfigureButton').addEventListener('click', () => {
|
||||
dialog.showModal();
|
||||
|
@@ -470,10 +470,33 @@ groupbox h2 {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.zenThemeMarketplaceItemHomepageButton {
|
||||
width: 30px;
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-image: url('chrome://browser/skin/home.svg');
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
fill: currentColor;
|
||||
-moz-context-properties: fill, fill-opacity;
|
||||
}
|
||||
}
|
||||
|
||||
.zenThemeMarketplaceItemConfigureButton {
|
||||
width: 30px;
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
|
Reference in New Issue
Block a user