Skip to content

Commit

Permalink
Renamed startPos as shuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed Feb 17, 2025
1 parent 12e844a commit b61e0b0
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion assets/js/iframes/analysis/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ analysisWebSocket.send('/start', {
settings: {
fen: decodeURIComponent(url[7]),
movetext: decodeURIComponent(url[8]),
startPos: url[9]
shuffle: url[9]
}
});
2 changes: 1 addition & 1 deletion assets/js/iframes/annotations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ analysisWebSocket.send('/play_rav', {
variant: url[6],
fen: decodeURIComponent(url[7]),
movetext: decodeURIComponent(url[8]),
startPos: url[9]
shuffle: url[9]
});
8 changes: 4 additions & 4 deletions assets/js/pages/SanForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export class SanForm extends BaseComponent {
if (this.el) {
this.props.variantSelect.addEventListener('change', event => {
event.target.value === variant.CHESS_960
? this.el.querySelector('.startPos').classList.remove('d-none')
: this.el.querySelector('.startPos').classList.add('d-none');
? this.el.querySelector('.shuffle').classList.remove('d-none')
: this.el.querySelector('.shuffle').classList.add('d-none');
analysisWebSocket.send('/start', {
variant: event.target.value,
mode: mode.ANALYSIS
Expand All @@ -47,7 +47,7 @@ export class SanForm extends BaseComponent {
settings: {
fen: event.target.fen.value,
movetext: Movetext.notation(NOTATION_SAN, event.target.san.value),
...(event.target.startPos.value && {startPos: event.target.startPos.value})
...(event.target.shuffle.value && {shuffle: event.target.shuffle.value})
}
});
});
Expand All @@ -62,7 +62,7 @@ export const sanForm = new SanForm({
variantSelect: this.el.querySelector('select[name="variant"]'),
fenInput: this.el.querySelector('input[name="fen"]'),
chessboardInput: this.el.querySelector('input[name="chessboard"]'),
startPosInput: this.el.querySelector('input[name="startPos"]')
shuffleInput: this.el.querySelector('input[name="shuffle"]')
});
}
});
4 changes: 2 additions & 2 deletions assets/js/pages/annotations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class RavForm extends BaseComponent {
mount() {
this.el.querySelector('select').addEventListener('change', event => {
event.target.value === variant.CHESS_960
? this.el.querySelector('.startPos').classList.remove('d-none')
: this.el.querySelector('.startPos').classList.add('d-none');
? this.el.querySelector('.shuffle').classList.remove('d-none')
: this.el.querySelector('.shuffle').classList.add('d-none');
});
this.el.addEventListener('submit', async event => {
event.preventDefault();
Expand Down
6 changes: 3 additions & 3 deletions assets/js/pages/play/online/PlayFriendModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export class PlayFriendModal extends BaseComponent {
mount() {
this.props.form.querySelector('select[name="variant"]').addEventListener('change', event => {
event.target.value === variant.CHESS_960
? this.props.form.querySelector('.startPos').classList.remove('d-none')
: this.props.form.querySelector('.startPos').classList.add('d-none');
? this.props.form.querySelector('.shuffle').classList.remove('d-none')
: this.props.form.querySelector('.shuffle').classList.add('d-none');
});

this.props.form.addEventListener('submit', event => {
Expand All @@ -26,7 +26,7 @@ export class PlayFriendModal extends BaseComponent {
increment: formData.get('increment'),
color: formData.get('color'),
submode: mode.SUBMODE_FRIEND,
...(formData.get('variant') === variant.CHESS_960) && {startPos: formData.get('startPos')},
...(formData.get('variant') === variant.CHESS_960) && {shuffle: formData.get('shuffle')},
...(formData.get('fen') && {fen: formData.get('fen')}),
username: accessToken ? accessToken.username : null,
elo: accessToken ? accessToken.elo : null
Expand Down
4 changes: 2 additions & 2 deletions assets/js/websockets/game/AnalysisWebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class AnalysisWebSocket extends AbstractGameWebSocket {
this.chessboard.enableMoveInput(event => this.inputHandler(event));
this.chessboard.setPosition(data.fen[data.fen.length - 1], true);
this.chessboard.props.variant = data.variant;
this.chessboard.props.startPos = data.startPos;
this.chessboard.props.shuffle = data.shuffle;
analysisPanel.props.movesBrowser.current = data.fen.length - 1;
analysisPanel.props.movesBrowser.props.movetext
= Movetext.notation(localStorage.getItem('notation'), data.movetext);
Expand All @@ -24,7 +24,7 @@ export class AnalysisWebSocket extends AbstractGameWebSocket {
analysisPanel.props.openingTable.mount();
if (sanForm.el) {
sanForm.props.fenInput.value = data.fen[0];
sanForm.props.startPosInput.value = data?.startPos ?? '';
sanForm.props.shuffleInput.value = data?.shuffle ?? '';
}
} else {
this.infoModal.props.msg = "This game could not be started, please try again";
Expand Down
2 changes: 1 addition & 1 deletion assets/js/websockets/game/PlayWebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class PlayWebSocket extends AbstractGameWebSocket {
this.chessboard.setPosition(data.fen, true);
this.chessboard.setOrientation(startToken.color);
this.chessboard.props.variant = data.variant;
this.chessboard.props.startPos = data.startPos;
this.chessboard.props.shuffle = data.shuffle;
createGameModal.props.modal.hide();
this.send('/online_games');
sessionStorage.setItem('start_token', data.jwt);
Expand Down
4 changes: 2 additions & 2 deletions config/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ pages_about:
# Iframe routes

iframe_analysis:
path: /{_locale}/iframe/analysis/{variant}/{fen}/{movetext}/{startPos}
path: /{_locale}/iframe/analysis/{variant}/{fen}/{movetext}/{shuffle}
controller: App\Controller\Iframes\AnalysisController::index
methods: GET
requirements:
fen: .+
_locale: en|es|fr|ru|tr|de|hi|zh_CN

iframe_annotations:
path: /{_locale}/iframe/annotations/{variant}/{fen}/{movetext}/{startPos}
path: /{_locale}/iframe/annotations/{variant}/{fen}/{movetext}/{shuffle}
controller: App\Controller\Iframes\AnnotationsController::index
methods: GET
requirements:
Expand Down
4 changes: 2 additions & 2 deletions docs/html-iframes.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ An URL-encoded FEN string.

An URL-encoded movetext in SAN format.

#### `startPos` (optional)
#### `shuffle` (optional)

The start position in a Chess960 game; for example `BRNNKBRQ`.

Expand Down Expand Up @@ -82,6 +82,6 @@ An URL-encoded FEN string.

An URL-encoded movetext in RAV format.

#### `startPos` (optional)
#### `shuffle` (optional)

The start position in a Chess960 game; for example `BRNNKBRQ`.
4 changes: 2 additions & 2 deletions templates/pages/annotations/rav_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<option value="960">{{ 'Fischer Random'|trans }}</option>
</select>
</div>
<div class="mb-3 startPos d-none">
<div class="mb-3 shuffle d-none">
<label class="form-label">Start position</label>
<input type="text" name="startPos" placeholder="Enter a start position" class="form-control">
<input type="text" name="shuffle" placeholder="Enter a start position" class="form-control">
<small class="form-text text-muted">Example: RNBQKBNR</small>
</div>
<div class="mb-3">
Expand Down
4 changes: 2 additions & 2 deletions templates/pages/home/san_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<option value="racing-kings">{{ 'Racing Kings'|trans }}</option>
</select>
</div>
<div class="mb-3 startPos d-none">
<input type="text" name="startPos" placeholder="Enter a start position" class="form-control">
<div class="mb-3 shuffle d-none">
<input type="text" name="shuffle" placeholder="Enter a start position" class="form-control">
<small class="form-text text-muted">Example: RNBQKBNR</small>
</div>
<div class="input-group mb-1">
Expand Down
4 changes: 2 additions & 2 deletions templates/pages/play/online/friend_modal.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<option value="racing-kings">{{ 'Racing Kings'|trans }}</option>
</select>
</div>
<div class="mb-3 startPos d-none">
<input type="text" name="startPos" placeholder="Enter a start position" class="form-control">
<div class="mb-3 shuffle d-none">
<input type="text" name="shuffle" placeholder="Enter a start position" class="form-control">
<small class="form-text text-muted">Example: RNBQKBNR</small>
</div>
<div class="mb-3">
Expand Down

0 comments on commit b61e0b0

Please sign in to comment.