Skip to content

Commit

Permalink
Merge pull request #551 from chesslablab/issue/550-Chess960-board-ini…
Browse files Browse the repository at this point in the history
…tialization

Deleted shuffle
  • Loading branch information
programarivm authored Feb 17, 2025
2 parents b61e0b0 + 2bbfa6b commit d0e04c9
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 49 deletions.
3 changes: 1 addition & 2 deletions assets/js/iframes/analysis/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ analysisWebSocket.send('/start', {
mode: mode.ANALYSIS,
settings: {
fen: decodeURIComponent(url[7]),
movetext: decodeURIComponent(url[8]),
shuffle: url[9]
movetext: decodeURIComponent(url[8])
}
});
3 changes: 1 addition & 2 deletions assets/js/iframes/annotations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ const url = window.location.href.split('/');
analysisWebSocket.send('/play_rav', {
variant: url[6],
fen: decodeURIComponent(url[7]),
movetext: decodeURIComponent(url[8]),
shuffle: url[9]
movetext: decodeURIComponent(url[8])
});
9 changes: 2 additions & 7 deletions assets/js/pages/SanForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ export class SanForm extends BaseComponent {
mount() {
if (this.el) {
this.props.variantSelect.addEventListener('change', event => {
event.target.value === variant.CHESS_960
? 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 @@ -46,8 +43,7 @@ export class SanForm extends BaseComponent {
mode: mode.ANALYSIS,
settings: {
fen: event.target.fen.value,
movetext: Movetext.notation(NOTATION_SAN, event.target.san.value),
...(event.target.shuffle.value && {shuffle: event.target.shuffle.value})
movetext: Movetext.notation(NOTATION_SAN, event.target.san.value)
}
});
});
Expand All @@ -61,8 +57,7 @@ export const sanForm = new SanForm({
return({
variantSelect: this.el.querySelector('select[name="variant"]'),
fenInput: this.el.querySelector('input[name="fen"]'),
chessboardInput: this.el.querySelector('input[name="chessboard"]'),
shuffleInput: this.el.querySelector('input[name="shuffle"]')
chessboardInput: this.el.querySelector('input[name="chessboard"]')
});
}
});
5 changes: 0 additions & 5 deletions assets/js/pages/annotations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import * as variant from '../../../variant.js';

class RavForm extends BaseComponent {
mount() {
this.el.querySelector('select').addEventListener('change', event => {
event.target.value === variant.CHESS_960
? this.el.querySelector('.shuffle').classList.remove('d-none')
: this.el.querySelector('.shuffle').classList.add('d-none');
});
this.el.addEventListener('submit', async event => {
event.preventDefault();
this.progressModal.props.modal.show();
Expand Down
7 changes: 0 additions & 7 deletions assets/js/pages/play/online/PlayFriendModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import * as variant from '../../../../variant.js';

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('.shuffle').classList.remove('d-none')
: this.props.form.querySelector('.shuffle').classList.add('d-none');
});

this.props.form.addEventListener('submit', event => {
event.preventDefault();
const accessToken = jsCookie.get('access_token') ? jwtDecode(jsCookie.get('access_token')) : null;
Expand All @@ -26,7 +20,6 @@ export class PlayFriendModal extends BaseComponent {
increment: formData.get('increment'),
color: formData.get('color'),
submode: mode.SUBMODE_FRIEND,
...(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
2 changes: 0 additions & 2 deletions assets/js/websockets/game/AnalysisWebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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.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 +23,6 @@ export class AnalysisWebSocket extends AbstractGameWebSocket {
analysisPanel.props.openingTable.mount();
if (sanForm.el) {
sanForm.props.fenInput.value = data.fen[0];
sanForm.props.shuffleInput.value = data?.shuffle ?? '';
}
} else {
this.infoModal.props.msg = "This game could not be started, please try again";
Expand Down
1 change: 0 additions & 1 deletion assets/js/websockets/game/PlayWebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ 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.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}/{shuffle}
path: /{_locale}/iframe/analysis/{variant}/{fen}/{movetext}
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}/{shuffle}
path: /{_locale}/iframe/annotations/{variant}/{fen}/{movetext}
controller: App\Controller\Iframes\AnnotationsController::index
methods: GET
requirements:
Expand Down
8 changes: 0 additions & 8 deletions docs/html-iframes.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ An URL-encoded FEN string.

An URL-encoded movetext in SAN format.

#### `shuffle` (optional)

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

## Annotations Board

Add the following sample HTML code to your blog post:
Expand Down Expand Up @@ -81,7 +77,3 @@ An URL-encoded FEN string.
#### `movetext`

An URL-encoded movetext in RAV format.

#### `shuffle` (optional)

The start position in a Chess960 game; for example `BRNNKBRQ`.
5 changes: 0 additions & 5 deletions templates/pages/annotations/rav_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
<option value="960">{{ 'Fischer Random'|trans }}</option>
</select>
</div>
<div class="mb-3 shuffle d-none">
<label class="form-label">Start position</label>
<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">
<input type="text" name="fen" placeholder="{{ 'FEN String'|trans }}" class="form-control">
</div>
Expand Down
4 changes: 0 additions & 4 deletions templates/pages/home/san_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
<option value="racing-kings">{{ 'Racing Kings'|trans }}</option>
</select>
</div>
<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">
<input type="text" name="fen" placeholder="{{ 'FEN String'|trans }}" class="form-control" required>
</div>
Expand Down
4 changes: 0 additions & 4 deletions templates/pages/play/online/friend_modal.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
<option value="racing-kings">{{ 'Racing Kings'|trans }}</option>
</select>
</div>
<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">
<input type="text" name="fen" placeholder="{{ 'FEN String'|trans }}" class="form-control">
</div>
Expand Down

0 comments on commit d0e04c9

Please sign in to comment.