fix(buymeacoffee): widget position letter case and default value

This commit is contained in:
ZhenShuo Leo
2025-07-25 04:29:34 +08:00
parent b777d4e59e
commit c330c17215
8 changed files with 19 additions and 19 deletions

View File

@@ -160,7 +160,7 @@ forgejoDefaultServer = "https://v11.next.forgejo.org"
# globalWidget = true
# globalWidgetMessage = "Hello"
# globalWidgetColor = "#FFDD00"
# globalWidgetPosition = "Right"
# globalWidgetPosition = "right"
[verification]
# google = ""

View File

@@ -159,7 +159,7 @@ fingerprintAlgorithm = "sha512" # Valid values are "sha512" (default), "sha384",
globalWidget = true
globalWidgetMessage = ""
globalWidgetColor = "#FFDD00"
globalWidgetPosition = "Right"
globalWidgetPosition = "right"
[verification]
# google = ""

View File

@@ -353,8 +353,8 @@ Many of the article defaults here can be overridden on a per article basis by sp
| `buymeacoffee.identifier` | _Not set_ | The identifier to the target buymeacoffee account. |
| `buymeacoffee.globalWidget` | _Not set_ | Activate the global buymeacoffee widget. |
| `buymeacoffee.globalWidgetMessage` | _Not set_ | Message what will be displayed the first time a new user lands on the site. |
| `buymeacoffee.globalWidgetColor` | _Not set_ | Widget color in hex format. |
| `buymeacoffee.globalWidgetPosition` | _Not set_ | Position of the widget, i.e. "Left" or "Right" |
| `buymeacoffee.globalWidgetColor` | `#FFDD00` | Widget color in hex format. |
| `buymeacoffee.globalWidgetPosition` | _Not set_ | Position of the widget, i.e. "left" or "right" |
### Verifications

View File

@@ -353,8 +353,8 @@ Blowfish は、テーマの機能を制御する多数の設定パラメータ
| `buymeacoffee.identifier` | _未設定_ | ターゲットの buymeacoffee アカウントの識別子。 |
| `buymeacoffee.globalWidget` | _未設定_ | グローバル buymeacoffee ウィジェットを有効にします。 |
| `buymeacoffee.globalWidgetMessage` | _未設定_ | 新しいユーザーが初めてサイトにアクセスしたときに表示されるメッセージ。 |
| `buymeacoffee.globalWidgetColor` | _未設定_ | ウィジェットの色16進数形式。 |
| `buymeacoffee.globalWidgetPosition` | _未設定_ | ウィジェットの位置。例えば "Left" または "Right" |
| `buymeacoffee.globalWidgetColor` | `#FFDD00` | ウィジェットの色16進数形式。 |
| `buymeacoffee.globalWidgetPosition` | _未設定_ | ウィジェットの位置。例えば "left" または "right" |
### verification

View File

@@ -360,8 +360,8 @@ Many of the article defaults here can be overridden on a per article basis by sp
| `buymeacoffee.identifier` | _Not set_ | The identifier to the target buymeacoffee account. |
| `buymeacoffee.globalWidget` | _Not set_ | Activate the global buymeacoffee widget. |
| `buymeacoffee.globalWidgetMessage` | _Not set_ | Message what will be displayed the first time a new user lands on the site. |
| `buymeacoffee.globalWidgetColor` | _Not set_ | Widget color in hex format. |
| `buymeacoffee.globalWidgetPosition` | _Not set_ | Position of the widget, i.e. "Left" or "Right" |
| `buymeacoffee.globalWidgetColor` | `#FFDD00` | Widget color in hex format. |
| `buymeacoffee.globalWidgetPosition` | _Not set_ | Position of the widget, i.e. "left" or "right" |
### Verifications

View File

@@ -352,13 +352,13 @@ Blowfish 提供了大量控制主题功能的配置参数,下面的表格中
### BuyMeACoffee(赞助平台)
| 名称 | 默认值 | 描述 |
| ----------------------------------- | ------ | ---------------------------------- |
| `buymeacoffee.identifier` | 无 | buymeacoffee 账号的用户名。 |
| `buymeacoffee.globalWidget` | 无 | 激活位于全局的 buymeacoffee 组件。 |
| `buymeacoffee.globalWidgetMessage` | 无 | 新用户首次访问网站时显示的消息。 |
| `buymeacoffee.globalWidgetColor` | | 组件颜色,使用 HEX 格式。 |
| `buymeacoffee.globalWidgetPosition` | 无 | 组件位置,例如 "Left" 或 "Right"。 |
| 名称 | 默认值 | 描述 |
| ----------------------------------- | --------- | ---------------------------------- |
| `buymeacoffee.identifier` | 无 | buymeacoffee 账号的用户名。 |
| `buymeacoffee.globalWidget` | 无 | 激活位于全局的 buymeacoffee 组件。 |
| `buymeacoffee.globalWidgetMessage` | 无 | 新用户首次访问网站时显示的消息。 |
| `buymeacoffee.globalWidgetColor` | `#FFDD00` | 组件颜色,使用 HEX 格式。 |
| `buymeacoffee.globalWidgetPosition` | 无 | 组件位置,例如 "left" 或 "right"。 |
### 验证

View File

@@ -48,9 +48,9 @@
src="https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js"
data-id="{{ site.Params.buymeacoffee.identifier }}"
data-description="Support me on Buy me a coffee!"
data-message="{{ site.Params.buymeacoffee.globalWidgetMessage | default "" }}"
data-color="{{ site.Params.buymeacoffee.globalWidgetColor | default "#FFDD00" }}"
data-position="{{ site.Params.buymeacoffee.globalWidgetPosition | default "Left" }}"
{{ with site.Params.buymeacoffee.globalWidgetMessage }}data-message="{{ . }}"{{ end }}
{{ with site.Params.buymeacoffee.globalWidgetColor | default `#FFDD00` }}data-color="{{ . }}"{{ end }}
{{ with site.Params.buymeacoffee.globalWidgetPosition }}data-position="{{ . }}"{{ end }}
data-x_margin="18"
data-y_margin="18"></script>
{{ end }}

View File

@@ -1,4 +1,4 @@
{{ $coffeeIsRight := and site.Params.buymeacoffee.globalWidget (eq site.Params.buymeacoffee.globalWidgetPosition "Right") }}
{{ $coffeeIsRight := and site.Params.buymeacoffee.globalWidget (eq (lower site.Params.buymeacoffee.globalWidgetPosition) "right") }}
{{ $toTopYOffset := cond $coffeeIsRight "bottom-24" "bottom-6" }}
<div
id="scroll-to-top"