Difference between revisions of "MediaWiki:Gadget-calculator-patients-patientInput.js"
From WikiAnesthesia
				Chris Rishel (talk | contribs)  | 
				Chris Rishel (talk | contribs)   | 
				||
| (7 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
  */  |   */  | ||
( function() {  | ( function() {  | ||
     mw.calculators.renderPatientInput = function() {  | |||
     mw.calculators.  |          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 );  | |||
}() );  | }() );  | ||
Latest revision as of 20: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 );
}() );