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

From WikiAnesthesia
 
Line 11: Line 11:


         if( !$( '#' + containerId ).length ) {
         if( !$( '#' + containerId ).length ) {
            var inputs = [
                'weight',
                'height',
                'age',
                'gender'
            ];
             var $container = $( '<div>', {
             var $container = $( '<div>', {
                 id: containerId
                 id: containerId
Line 17: Line 24:
             $container.addClass( 'container border-bottom px-0 py-1' );
             $container.addClass( 'container border-bottom px-0 py-1' );


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


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

Latest revision as of 21:59, 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 inputs = [
                'weight',
                'height',
                'age',
                'gender'
            ];

            var $container = $( '<div>', {
                id: containerId
            } );

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

            $container.append( mw.calculators.createInputGroup( inputs, true, inputs.length ) );

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

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