Skip to content

Commit abbcfa9

Browse files
committed
Fix style for ground-class mask (sheepzh#241)
1 parent c66fd10 commit abbcfa9

File tree

3 files changed

+33
-13
lines changed

3 files changed

+33
-13
lines changed

src/content-script/limit/delay/confirm.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VerificationPair } from "@service/limit-service/verification/common"
22
import verificationProcessor from "@service/limit-service/verification/processor"
3-
import { LINK_STYLE } from "../modal-style"
3+
import { FILTER_STYLES, LINK_STYLE } from "../modal-style"
44
import { t as t_, locale, I18nKey, tN as tN_, I18nResultItem } from "@i18n"
55
import { LimitMessage, verificationMessages } from "@i18n/message/app/limit"
66

@@ -49,10 +49,16 @@ const CONFIRM_STYLE: Partial<CSSStyleDeclaration> = {
4949
padding: "50px 20px 20px 20px",
5050
position: "absolute",
5151
textAlign: "center",
52-
background: "#111",
5352
borderRadius: "8px",
5453
}
5554

55+
const computeConfirmStyle = (limitFilter: timer.limit.FilterType): Partial<CSSStyleDeclaration> => {
56+
return {
57+
...CONFIRM_STYLE,
58+
...FILTER_STYLES[limitFilter || "translucent"]?.delayConfirm || {}
59+
}
60+
}
61+
5662
const INPUT_STYLE: Partial<CSSStyleDeclaration> = {
5763
color: "#000",
5864
padding: "2px 6px",
@@ -94,7 +100,7 @@ export class DelayConfirm {
94100
private onError: (msg: string) => void
95101

96102
constructor(option: timer.option.DailyLimitOption) {
97-
const { limitLevel = "nothing", limitPassword, limitVerifyDifficulty } = option || {}
103+
const { limitLevel = "nothing", limitPassword, limitVerifyDifficulty, limitFilter } = option || {}
98104
let tips: I18nResultItem<HTMLElement>[] = []
99105
if (limitLevel === "password" && limitPassword) {
100106
this.answerValue = limitPassword
@@ -121,9 +127,8 @@ export class DelayConfirm {
121127
return
122128
}
123129
this.dom = document.createElement("div")
124-
Object.assign(this.dom.style || {}, CONFIRM_STYLE)
130+
Object.assign(this.dom.style || {}, computeConfirmStyle(limitFilter))
125131
this.dom.style.display = 'none'
126-
// tips
127132
const tipContainer = document.createElement('div')
128133
tipContainer.append(...tips)
129134
this.dom.append(tipContainer)

src/content-script/limit/modal-style.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,29 @@ export const MASK_STYLE: Partial<CSSStyleDeclaration> = {
1616
paddingTop: '120px'
1717
}
1818

19-
export const FILTER_STYLES: Record<timer.limit.FilterType, Partial<CSSStyleDeclaration & { backdropFilter: string }>> = {
19+
export type FilterStyle = {
20+
mask: Partial<CSSStyleDeclaration>
21+
delayConfirm: Partial<CSSStyleDeclaration>
22+
}
23+
24+
export const FILTER_STYLES: Record<timer.limit.FilterType, FilterStyle> = {
2025
translucent: {
21-
backgroundColor: '#444',
22-
opacity: '0.9',
23-
color: '#EEE',
26+
mask: {
27+
backgroundColor: '#444',
28+
opacity: '0.9',
29+
color: '#EEE',
30+
},
31+
delayConfirm: {
32+
background: "#111",
33+
},
2434
},
2535
groundGlass: {
26-
backdropFilter: 'blur(5px)',
27-
color: '#111',
36+
mask: {
37+
color: '#111',
38+
backdropFilter: 'blur(5px)',
39+
},
40+
delayConfirm: {
41+
background: "#dedede",
42+
},
2843
}
2944
}

src/content-script/limit/modal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { sendMsg2Runtime } from "@api/chrome/runtime"
55
import optionService from "@service/option-service"
66
import { FILTER_STYLES, LINK_STYLE, MASK_STYLE } from "./modal-style"
77
import { DelayConfirm } from "./delay/confirm"
8-
import { DelayButton } from "./delay/Button"
8+
import { DelayButton } from "./delay/button"
99

1010
const TYPE_SORT: { [reason in LimitType]: number } = {
1111
PERIOD: 0,
@@ -100,7 +100,7 @@ class ModalInstance implements MaskModal {
100100
const filterType = (await optionService.getAllOption())?.limitFilter
101101
const realMaskStyle = {
102102
...MASK_STYLE,
103-
...FILTER_STYLES[filterType || 'translucent']
103+
...FILTER_STYLES[filterType || 'translucent']?.mask || {}
104104
}
105105
Object.assign(this.mask.style || {}, realMaskStyle)
106106
}

0 commit comments

Comments
 (0)