wikimedia/mediawiki-core

View on GitHub
resources/src/mediawiki.misc-authed-ooui/special.mute.js

Summary

Maintainability
A
0 mins
Test Coverage
( function () {
    'use strict';

    $( function () {
        const $inputs = $( '#mw-specialmute-form input[type="checkbox"]' ),
            $saveButton = $( '#save' );

        function isFormChanged() {
            return $inputs.is( function () {
                return this.checked !== this.defaultChecked;
            } );
        }

        if ( $saveButton.length ) {
            const saveButton = OO.ui.infuse( $saveButton );
            saveButton.setDisabled( !isFormChanged() );

            $inputs.on( 'change', function () {
                saveButton.setDisabled( !isFormChanged() );
            } );
        }
    } );
}() );