diff --git a/manifest.json b/manifest.json index 0dccec4..d2d53f4 100644 --- a/manifest.json +++ b/manifest.json @@ -6,6 +6,6 @@ "description": "Allows you to easily display chessboards and play games in PGN format directly in your notes", "author": "Riffaells", "authorUrl": "https://gihub.com/Riffaells", - "fundingUrl": "https://gihub.com/Riffaells", + "fundingUrl": "", "isDesktopOnly": false } diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index 3e17919..c0e53db 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -2,6 +2,10 @@ export default { 'settings.title': 'ChessMate Settings', + 'settings.boardColor': 'Board Color', + 'settings.boardColorDesc': 'Choose the color for the chess board', + 'settings.maxBoardSize': 'Max Board Size', + 'settings.maxBoardSizeDesc': 'Set the maximum size of the chess board (in pixels)', 'settings.boardTheme': 'Board Theme', 'settings.boardThemeDesc': 'Choose the color theme for the chess board', 'settings.themeBrown': 'Brown', diff --git a/src/lang/locale/ru.ts b/src/lang/locale/ru.ts index c868a20..cf32097 100644 --- a/src/lang/locale/ru.ts +++ b/src/lang/locale/ru.ts @@ -1,4 +1,9 @@ // Russian export default { + 'settings.title': 'Настройки ChessMate', + 'settings.boardColor': 'Цвет доски', + 'settings.boardColorDesc': 'Выберите цвет для шахматной доски', + 'settings.maxBoardSize': 'Максимальный размер доски', + 'settings.maxBoardSizeDesc': 'Установите максимальный размер шахматной доски (в пикселях)', }; \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 71c152b..8af10c3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -25,7 +25,6 @@ export default class ChessMatePlugin extends Plugin { pgn: options.pgn, orientation: (options.orientation as 'white' | 'black') || 'white', fen: options.fen || undefined, - // showMoves: options.showMoves === 'true' || this.settings.showMoves, chessground: { movable: { free: true, @@ -42,16 +41,13 @@ export default class ChessMatePlugin extends Plugin { red: { key: 'red', color: 'rgba(255,154,28,0.91)', opacity: 0.6 }, }, }, - menu: { - - } - - + menu: {}, }; PgnViewer(boardElement, viewerConfig); - boardElement.style.setProperty('--board-color', this.settings.accentColor); + container.style.setProperty('--max-board-size', `${this.settings.maxBoardSize}px`); + container.style.setProperty('--board-color', this.settings.boardColor); }); } diff --git a/src/settings.ts b/src/settings.ts index 2f99625..32ba128 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -3,19 +3,13 @@ import ChessMatePlugin from "./main"; import { t } from "./lang/helper"; export interface ChessMateSettings { - boardTheme: string; - pieceTheme: string; - showMoves: boolean; - accentColor: string; - boardSize: number; + boardColor: string; + maxBoardSize: number; } export const DEFAULT_SETTINGS: ChessMateSettings = { - boardTheme: 'brown', - pieceTheme: 'cburnett', - showMoves: true, - accentColor: "#ffeac3", - boardSize: 600 + boardColor: '#f0d9b5', + maxBoardSize: 800 }; export class ChessMateSettingTab extends PluginSettingTab { @@ -33,49 +27,24 @@ export class ChessMateSettingTab extends PluginSettingTab { containerEl.createEl('h2', { text: t('settings.title') }); new Setting(containerEl) - .setName(t('settings.boardTheme')) - .setDesc(t('settings.boardThemeDesc')) + .setName(t('settings.boardColor')) + .setDesc(t('settings.boardColorDesc')) .addText(text => text - .setValue(this.plugin.settings.boardTheme) + .setValue(this.plugin.settings.boardColor) .onChange(async (value) => { - this.plugin.settings.boardTheme = value; + this.plugin.settings.boardColor = value; await this.plugin.saveSettings(); })); new Setting(containerEl) - .setName(t('settings.pieceTheme')) - .setDesc(t('settings.pieceThemeDesc')) - .addDropdown(dropdown => dropdown - .addOptions({ - cburnett: 'Cburnett', - alpha: 'Alpha', - classic: 'Classic' - }) - .setValue(this.plugin.settings.pieceTheme) - .onChange(async (value) => { - this.plugin.settings.pieceTheme = value; - await this.plugin.saveSettings(); - })); - - new Setting(containerEl) - .setName(t('settings.showMoves')) - .setDesc(t('settings.showMovesDesc')) - .addToggle(toggle => toggle - .setValue(this.plugin.settings.showMoves) - .onChange(async (value) => { - this.plugin.settings.showMoves = value; - await this.plugin.saveSettings(); - })); - - new Setting(containerEl) - .setName(t('settings.boardSize')) - .setDesc(t('settings.boardSizeDesc')) + .setName(t('settings.maxBoardSize')) + .setDesc(t('settings.maxBoardSizeDesc')) .addSlider(slider => slider .setLimits(200, 800, 50) - .setValue(this.plugin.settings.boardSize) + .setValue(this.plugin.settings.maxBoardSize) .setDynamicTooltip() .onChange(async (value) => { - this.plugin.settings.boardSize = value; + this.plugin.settings.maxBoardSize = value; await this.plugin.saveSettings(); })); } diff --git a/styles.css b/styles.css index 703f3f3..8218af0 100644 --- a/styles.css +++ b/styles.css @@ -397,7 +397,12 @@ cg-board square.current-premove { } .lpv__board { - grid-area: board + grid-area: board; + width: 100%; /* Или установите фиксированное значение */ + height: auto; + max-width: var(--max-board-size, 1200); /* Установите максимальную ширину */ + max-height: var(--max-board-size, 900); /* Установите максимальную высоту */ + } .lpv__side { @@ -417,7 +422,8 @@ cg-board square.current-premove { } .lpv__controls { - grid-area: controls + grid-area: controls; + max-width: var(--max-board-size, 1200); } .lpv__menu, .lpv__pgn { @@ -447,7 +453,7 @@ cg-board square.current-premove { /*}*/ .lpv__moves > index { - flex: 0 0 15%; + flex: 0 0 10%; margin-right: 3%; display: flex; justify-content: flex-end