MediaWiki:Gadget-calculator-patients-patientInput.js
From WikiAnesthesia
Revision as of 18:04, 22 July 2021 by Chris Rishel (talk | contribs) (Chris.Rishel moved page MediaWiki:Gadget-calculator-patientinput.js to MediaWiki:Gadget-calculator-patientInput.js without leaving a redirect)
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/** * @author Chris Rishel */ ( function() { mw.calculators.addVariables( { age: { name: 'Age', type: 'number', defaultValue: '40 yr', maxLength: 3, units: [ 'yr', 'mo', 'wk' ] }, gender: { name: 'Gender', type: 'string', defaultValue: 'F', options: [ 'F', 'M' ] }, height: { name: 'Height', type: 'number', abbreviation: 'Ht', defaultValue: '175 cm', maxLength: 3, units: [ 'cm', 'm', 'in', 'ft' ] }, weight: { name: 'Weight', type: 'number', abbreviation: 'Wt', defaultValue: '75 kgwt', maxLength: 3, renderUnits: function( units ) { return units.replace( 'wt', '' ); }, units: [ 'kgwt', 'lbwt', 'gwt' ] } } ); var containerId = 'calculator-patientinput'; if( !$( '#' + containerId ).length ) { var $container = $( '<div>', { id: containerId } ); $container.addClass( 'container border-bottom px-0 py-1' ); var $containerRow = $( '<div>', { class: 'form-row align-items-center' } ); var inputOptions = { size: 'compact' }; $containerRow.append( mw.calculators.getVariable( 'weight' ).createInput( inputOptions ) ); $containerRow.append( mw.calculators.getVariable( 'height' ).createInput( inputOptions ) ); $containerRow.append( mw.calculators.getVariable( 'age' ).createInput( inputOptions ) ); $containerRow.append( mw.calculators.getVariable( 'gender' ).createInput( inputOptions ) ); $container.appendTo( $( '#contentHeader' ) ); $container.append( $containerRow ); } }() );