File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
1
window . lichess . load . then ( ( ) => {
2
2
3
3
const form = document . querySelector ( '.search__form' ) as HTMLFormElement ,
4
- $form = $ ( form ) ,
5
- $usernames = $form . find ( ".usernames input" ) ,
6
- $userRows = $form . find ( ".user-row" ) ,
7
- $result = $ ( ".search__result" ) ;
4
+ $form = $ ( form ) ,
5
+ $usernames = $form . find ( ".usernames input" ) ,
6
+ $userRows = $form . find ( ".user-row" ) ,
7
+ $result = $ ( ".search__result" ) ;
8
8
9
9
function getUsernames ( ) {
10
10
const us : string [ ] = [ ] ;
@@ -53,10 +53,9 @@ window.lichess.load.then(() => {
53
53
$form . find ( ".opponent select" ) . change ( toggleAiLevel ) ;
54
54
55
55
function serialize ( ) {
56
- const params = new URLSearchParams ( new FormData ( form ) as any ) ,
57
- keys = Array . from ( params . keys ( ) ) ;
58
- for ( let k of keys ) {
59
- if ( params . get ( k ) == '' ) params . delete ( k ) ;
56
+ const params = new URLSearchParams ( ) ;
57
+ for ( let [ k , v ] of new FormData ( form ) . entries ( ) ) {
58
+ if ( v != '' ) params . set ( k , v as any ) ; // typescript wants v to be a File
60
59
}
61
60
return params . toString ( ) ;
62
61
}
You can’t perform that action at this time.
0 commit comments