Skip to content

Commit c0df297

Browse files
committed
chore: improve popup compatibility for firefox
1 parent 79a06c8 commit c0df297

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

src/manifest.v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
]
2424
},
2525
"browser_action": {
26-
"default_popup": "popup.html"
26+
"default_popup": "popup.html?popup=true"
2727
},
2828
"options_ui": {
2929
"page": "popup.html",

src/popup/Popup.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import wechatpay from './donation/wechatpay.jpg'
2424
import bugmeacoffee from './donation/bugmeacoffee.png'
2525
import { useWindowTheme } from '../hooks/use-window-theme.mjs'
2626
import { languageList } from '../config/language.mjs'
27-
import { isFirefox, isSafari } from '../utils/index.mjs'
27+
import { isSafari } from '../utils/index.mjs'
2828
import { useTranslation } from 'react-i18next'
2929

3030
function GeneralPart({ config, updateConfig }) {
@@ -307,9 +307,7 @@ function AdvancedPart({ config, updateConfig }) {
307307
updateConfig({ userSiteRegexOnly: checked })
308308
}}
309309
/>
310-
{`${t('Exclusively use Custom Site Regex for website matching,')}${
311-
isFirefox() ? <br /> : ' '
312-
}${t('ignoring built-in rules')}`}
310+
{t('Exclusively use Custom Site Regex for website matching, ignoring built-in rules')}
313311
</label>
314312
<br />
315313
<label>
@@ -500,8 +498,11 @@ function Popup() {
500498
document.documentElement.dataset.theme = config.themeMode === 'auto' ? theme : config.themeMode
501499
}, [config.themeMode, theme])
502500

501+
const search = new URLSearchParams(window.location.search)
502+
const popup = search.get('popup') // manifest v2
503+
503504
return (
504-
<div className="container">
505+
<div className={popup === 'true' ? 'container-popup-mode' : 'container-page-mode'}>
505506
<form style="width:100%;">
506507
<Tabs selectedTabClassName="popup-tab--selected">
507508
<TabList>

src/popup/styles.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
--active-color: #eaecf0;
2424
}
2525

26-
.container {
26+
.container-page-mode {
2727
display: flex;
2828
flex-direction: column;
2929
align-items: center;
@@ -35,6 +35,16 @@
3535
overflow-y: auto;
3636
}
3737

38+
.container-popup-mode {
39+
display: flex;
40+
flex-direction: column;
41+
align-items: center;
42+
width: 440px;
43+
height: 560px;
44+
padding: 20px;
45+
overflow-y: auto;
46+
}
47+
3848
.container legend {
3949
font-weight: bold;
4050
}

0 commit comments

Comments
 (0)