|
9 | 9 | const patchesInput = OO.ui.infuse( $( '.form-patches' ) );
|
10 | 10 | const patchesLayout = OO.ui.infuse( $( '.form-patches-layout' ) );
|
11 | 11 |
|
12 |
| - form.addEventListener( 'submit', function ( e ) { |
| 12 | + form.addEventListener( 'submit', ( e ) => { |
13 | 13 | // Blur is not fired on patchesInput, so call manually
|
14 | 14 | patchesInput.doInputEnter();
|
15 | 15 |
|
16 | 16 | if ( !patchesInput.getValue().length ) {
|
17 | 17 | OO.ui.confirm(
|
18 | 18 | 'Are you sure you want to create a demo with no patches applied?'
|
19 |
| - ).then( function ( confirmed ) { |
| 19 | + ).then( ( confirmed ) => { |
20 | 20 | if ( confirmed ) {
|
21 | 21 | form.submit();
|
22 | 22 | }
|
|
29 | 29 | return false;
|
30 | 30 | } );
|
31 | 31 |
|
32 |
| - patchesInput.on( 'matchWikis', function ( wikis ) { |
| 32 | + patchesInput.on( 'matchWikis', ( wikis ) => { |
33 | 33 | patchesLayout.setWarnings(
|
34 |
| - ( wikis || [] ).map( function ( wiki ) { |
| 34 | + ( wikis || [] ).map( ( wiki ) => { |
35 | 35 | wiki = wiki.slice( 0, 10 );
|
36 | 36 | return $( '<span>' ).append(
|
37 | 37 | document.createTextNode( 'A wiki with these patches already exists: ' ),
|
|
48 | 48 | const taskLabel = new OO.ui.LabelWidget( { classes: [ 'form-announce-taskList' ] } );
|
49 | 49 | announceLayout.$field.append( taskLabel.$element );
|
50 | 50 |
|
51 |
| - // eslint-disable-next-line no-inner-declarations |
52 |
| - function updateLinkedTasks( linkedTasks ) { |
| 51 | + const updateLinkedTasks = ( linkedTasks ) => { |
53 | 52 | let $label = $( [] );
|
54 | 53 | if ( !linkedTasks.length ) {
|
55 | 54 | $label = $( '<em>' ).text( 'No linked tasks found.' );
|
56 | 55 | } else {
|
57 |
| - linkedTasks.forEach( function ( task ) { |
| 56 | + linkedTasks.forEach( ( task ) => { |
58 | 57 | const id = 'T' + task;
|
59 | 58 | if ( $label.length ) {
|
60 | 59 | $label = $label.add( document.createTextNode( ', ' ) );
|
|
70 | 69 | } );
|
71 | 70 | }
|
72 | 71 | taskLabel.setLabel( $label );
|
73 |
| - } |
| 72 | + }; |
74 | 73 |
|
75 | 74 | patchesInput.on( 'linkedTasks', updateLinkedTasks );
|
76 | 75 | updateLinkedTasks( [] );
|
|
89 | 88 |
|
90 | 89 | if ( $( '.showClosedButton' ).length ) {
|
91 | 90 | const showClosedButton = OO.ui.infuse( $( '.showClosedButton' ) );
|
92 |
| - showClosedButton.on( 'click', function () { |
| 91 | + showClosedButton.on( 'click', () => { |
93 | 92 | closedWikis.setSelected( true );
|
94 | 93 | updateTableClasses();
|
95 | 94 | } );
|
|
101 | 100 | const reposField = OO.ui.infuse( $( '.form-repos-field' ) );
|
102 | 101 | const branchSelect = OO.ui.infuse( $( '.form-branch' ) );
|
103 | 102 |
|
104 |
| - branchSelect.on( 'change', function () { |
| 103 | + branchSelect.on( 'change', () => { |
105 | 104 | const branch = branchSelect.value;
|
106 | 105 | for ( const repo in window.repoBranches ) {
|
107 | 106 | const validBranch = window.repoBranches[ repo ].indexOf( branch ) !== -1;
|
|
114 | 113 |
|
115 | 114 | const reposFieldLabel = reposField.getLabel();
|
116 | 115 |
|
117 |
| - presetInput.on( 'change', OO.ui.debounce( function () { |
| 116 | + presetInput.on( 'change', OO.ui.debounce( () => { |
118 | 117 | const val = presetInput.getValue();
|
119 | 118 | if ( val === 'custom' ) {
|
120 | 119 | reposField.$body[ 0 ].open = true;
|
|
123 | 122 | reposInput.setValue( window.presets[ val ] );
|
124 | 123 | }
|
125 | 124 | } ) );
|
126 |
| - reposInput.on( 'change', OO.ui.debounce( function () { |
| 125 | + reposInput.on( 'change', OO.ui.debounce( () => { |
127 | 126 | const val = reposInput.getValue();
|
128 | 127 | let matchingPresetName = 'custom';
|
129 | 128 | for ( const presetName in window.presets ) {
|
|
137 | 136 | }
|
138 | 137 |
|
139 | 138 | let selected = 0, enabled = 0;
|
140 |
| - reposInput.checkboxMultiselectWidget.items.forEach( function ( option ) { |
| 139 | + reposInput.checkboxMultiselectWidget.items.forEach( ( option ) => { |
141 | 140 | if ( !option.isDisabled() ) {
|
142 | 141 | enabled++;
|
143 | 142 | if ( option.isSelected() ) {
|
|
154 | 153 | const instantCommonsCheckbox = OO.ui.infuse( $( '.form-instantCommons' ) );
|
155 | 154 | const instantCommonsMethodDropdown = OO.ui.infuse( $( '.form-instantCommonsMethod' ) );
|
156 | 155 |
|
157 |
| - instantCommonsCheckbox.on( 'change', function ( value ) { |
| 156 | + instantCommonsCheckbox.on( 'change', ( value ) => { |
158 | 157 | instantCommonsMethodDropdown.setDisabled( !value );
|
159 | 158 | } );
|
160 | 159 |
|
161 | 160 | const languageInput = OO.ui.infuse( $( '.form-language' ) );
|
162 | 161 | languageInput.setValidation( /^[a-z-]{2,}$/ );
|
163 | 162 |
|
164 |
| - $( '.copyWiki' ).on( 'click', function ( e ) { |
| 163 | + $( '.copyWiki' ).on( 'click', ( e ) => { |
165 | 164 | const params = new URL( this.href ).searchParams;
|
166 | 165 | patchesInput.setValue( params.get( 'patches' ) ? params.get( 'patches' ).split( ',' ) : [] );
|
167 | 166 | branchSelect.setValue( 'origin/' + params.get( 'branch' ) );
|
|
180 | 179 | icon: 'bellOutline'
|
181 | 180 | } );
|
182 | 181 |
|
183 |
| - const onRequestPermission = function ( permission ) { |
| 182 | + const onRequestPermission = ( permission ) => { |
184 | 183 | notifToggle.setValue( permission === 'granted' );
|
185 | 184 | if ( permission === 'granted' ) {
|
186 | 185 | notifField.setLabel( 'You will get a browser notification when your wiki is ready' );
|
|
190 | 189 | }
|
191 | 190 | };
|
192 | 191 |
|
193 |
| - const onNotifChange = function ( value ) { |
| 192 | + const onNotifChange = ( value ) => { |
194 | 193 | if ( !value ) {
|
195 | 194 | localStorage.setItem( 'patchdemo-notifications', '0' );
|
196 | 195 | notifField.setLabel( notifFieldLabel );
|
|
210 | 209 | }
|
211 | 210 |
|
212 | 211 | let $lastMatch = $( [] );
|
213 |
| - $( window ).on( 'hashchange', function () { |
| 212 | + $( window ).on( 'hashchange', () => { |
214 | 213 | if ( location.hash.match( /^#[0-9a-f]{10}$/ ) ) {
|
215 | 214 | $lastMatch.removeClass( 'highlight' );
|
216 | 215 | $lastMatch = $( location.hash ).closest( 'tr' );
|
|
0 commit comments