Difference between revisions of "MediaWiki:Gadget-calculator-patients-patientInput.js"

From WikiAnesthesia
(Add support for option to force patient input to render inline)
Line 3: Line 3:
  */
  */
( function() {
( function() {
     var containerId = 'calculator-patients-patientInput';
     mw.calculators.renderPatientInput = function() {
        if( mw.calculators.getOptionValue( 'patientinputinline' ) ) {
            return;
        }


    if( !$( '#' + containerId ).length ) {
         var containerId = 'calculator-patients-patientInput';
         var $container = $( '<div>', {
            id: containerId
        } );


         $container.addClass( 'container border-bottom px-0 py-1' );
         if( !$( '#' + containerId ).length ) {
            var $container = $( '<div>', {
                id: containerId
            } );


        $container.append( mw.calculators.createInputGroup( [
            $container.addClass( 'container border-bottom px-0 py-1' );
            'weight',
            'height',
            'age',
            'gender'
        ], true ) );


        $container.appendTo( $( '#contentHeader' ) );
            $container.append( mw.calculators.createInputGroup( [
     }
                'weight',
                'height',
                'age',
                'gender'
            ], true ) );
 
            $container.appendTo( $( '#contentHeader' ) );
        }
     };
 
    mw.hook( 'calculators.initialized' ).add( mw.calculators.renderPatientInput );
}() );
}() );

Revision as of 21:12, 29 March 2022

/**
 * @author Chris Rishel
 */
( function() {
    mw.calculators.renderPatientInput = function() {
        if( mw.calculators.getOptionValue( 'patientinputinline' ) ) {
            return;
        }

        var containerId = 'calculator-patients-patientInput';

        if( !$( '#' + containerId ).length ) {
            var $container = $( '<div>', {
                id: containerId
            } );

            $container.addClass( 'container border-bottom px-0 py-1' );

            $container.append( mw.calculators.createInputGroup( [
                'weight',
                'height',
                'age',
                'gender'
            ], true ) );

            $container.appendTo( $( '#contentHeader' ) );
        }
    };

    mw.hook( 'calculators.initialized' ).add( mw.calculators.renderPatientInput );
}() );