Skip to content

Commit 18bb944

Browse files
o_wangxianqiaomantou132
authored andcommitted
Add sponsor
1 parent 0061792 commit 18bb944

7 files changed

Lines changed: 62 additions & 9 deletions

File tree

public/_locales/en/messages.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2+
"sponsorsText": {
3+
"message": "If this extension is helpful to you, please support the author:"
4+
},
5+
26
"extensionName": {
37
"message": "SLyrics",
48
"description": "Name of the extension"
@@ -29,12 +33,12 @@
2933
"description": "Request confirmation from the user"
3034
},
3135

32-
"popupConfirmSave" : {
36+
"popupConfirmSave": {
3337
"message": "Save",
3438
"description": "Save user selection"
3539
},
3640

37-
"popupConfirmCancel" : {
41+
"popupConfirmCancel": {
3842
"message": "Cancel",
3943
"description": "Cancel manually set lyrics"
4044
},
@@ -74,7 +78,6 @@
7478
"description": "Specify font size detail"
7579
},
7680

77-
7881
"optionsFontFamily": {
7982
"message": "Lyrics font family",
8083
"description": "Specify lyrics font family"
@@ -210,23 +213,22 @@
210213
"message": "Playback rate",
211214
"description": "Audio playback rate"
212215
},
213-
216+
214217
"pageEditorOffset": {
215218
"message": "Global offset",
216219
"description": "Lyrics offset lable"
217220
},
218-
221+
219222
"pageEditorOffsetDetail": {
220223
"message": "Offset 0.1s",
221224
"description": "Lyrics offset button title"
222225
},
223-
226+
224227
"pageEditorClearAll": {
225228
"message": "Clear all",
226229
"description": "Cleaer all lyrics"
227230
},
228231

229-
230232
"pageEditorSeek": {
231233
"message": "Jump",
232234
"description": "Track seek tip"
@@ -276,4 +278,4 @@
276278
"message": "Please add a timestamp to each line of text",
277279
"description": "Save lyrics valid tip"
278280
}
279-
}
281+
}

public/_locales/zh/messages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2+
"sponsorsText": {
3+
"message": "如果这个扩展对你有帮助,欢迎支持作者:"
4+
},
5+
26
"extensionName": {
37
"message": "SLyrics"
48
},

src/options.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
<title>Spotify Lyrics Options</title>
2-
<script type="module" src="./options/index.ts"></script>
2+
<script type="module" src="./options/index.ts"></script>
3+
<style>
4+
body {
5+
min-width: 620px;
6+
}
7+
</style>

src/options/app.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import './elements/form';
2020
import './elements/form-item';
2121
import './elements/select';
2222
import './elements/switch';
23+
import './elements/sponsor';
2324

2425
import { getOptions, updateOptions } from './store';
2526

@@ -75,6 +76,7 @@ export class OptionsApp extends GemElement<State> {
7576
if (!options) return null;
7677

7778
return html`
79+
<ele-sponsor></ele-sponsor>
7880
<style>
7981
:host {
8082
display: block;

src/options/elements/form-item.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { customElement, attribute, boolattribute } from '@mantou/gem/lib/decorators';
22
import { GemElement, html } from '@mantou/gem/lib/element';
33

4+
import { theme } from '../../common/theme';
5+
46
@customElement('ele-form-item')
57
export class FormItem extends GemElement {
68
@attribute label: string;
@@ -22,6 +24,9 @@ export class FormItem extends GemElement {
2224
pointer-events: none;
2325
opacity: 0.3;
2426
}
27+
:host(:not(:disabled):hover) {
28+
background: rgba(${theme.backgroundRGB}, 0.02);
29+
}
2530
.text {
2631
display: flex;
2732
flex-direction: column;

src/options/elements/sponsor.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { GemElement, html } from '@mantou/gem/lib/element';
2+
import { customElement } from '@mantou/gem/lib/decorators';
3+
4+
import { theme } from '../../common/theme';
5+
import { i18n } from '../../i18n';
6+
7+
@customElement('ele-sponsor')
8+
export class Sponsor extends GemElement {
9+
render() {
10+
return html`
11+
<style>
12+
:host {
13+
display: flex;
14+
gap: 1em;
15+
color: rgb(${theme.blackRGB});
16+
font-size: 1.2em;
17+
margin-block: 0.5em;
18+
}
19+
a {
20+
color: rgb(${theme.primaryRGB});
21+
}
22+
</style>
23+
${i18n.sponsorsText()}
24+
<a href="https://github.com/sponsors/mantou132" target="_blank" rel="noopener noreferrer">
25+
GitHub Sponsors
26+
</a>
27+
<a href="https://www.buymeacoffee.com/mantou132" target="_blank" rel="noopener noreferrer">
28+
Buy Me a Coffee
29+
</a>
30+
`;
31+
}
32+
}

src/page/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ export const localConfig: LocalConfig = (() => {
8686
transform: rotate(90deg) scale(1.1);
8787
-webkit-mask: url(${iconUrl}) center / 100% no-repeat;
8888
mask: url(${iconUrl}) center / 100% no-repeat;
89+
& > * {
90+
display: none;
91+
}
8992
}
9093
.${LYRICS_CLASSNAME}.${LYRICS_ACTIVE_CLASSNAME} .yt-spec-button-shape-next__icon {
9194
background: var(--ytmusic-text-primary);

0 commit comments

Comments
 (0)