| 1 | ( function () { |
| 2 | 'use strict'; |
| 3 | |
| 4 | $( () => { |
| 5 | const $inputs = $( '#mw-specialmute-form input[type="checkbox"]' ), |
| 6 | $saveButton = $( '#save' ); |
| 7 | |
| 8 | function isFormChanged() { |
| 9 | return $inputs.is( function () { |
| 10 | return this.checked !== this.defaultChecked; |
| 11 | } ); |
| 12 | } |
| 13 | |
| 14 | if ( $saveButton.length ) { |
| 15 | const saveButton = OO.ui.infuse( $saveButton ); |
| 16 | saveButton.setDisabled( !isFormChanged() ); |
| 17 | |
| 18 | $inputs.on( 'change', () => { |
| 19 | saveButton.setDisabled( !isFormChanged() ); |
| 20 | } ); |
| 21 | } |
| 22 | } ); |
| 23 | }() ); |