MediaWiki:Gadget-calculator-drugs-core.js
From WikiAnesthesia
Revision as of 16:29, 22 July 2021 by Chris Rishel (talk | contribs) (Created page with "→* * @author Chris Rishel: ( function() { mw.calculators.drugColors = {}; mw.calculators.addDrugColors = function( drugColorData ) { var drugColors = mw....")
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.drugColors = {}; mw.calculators.addDrugColors = function( drugColorData ) { var drugColors = mw.calculators.createCalculatorObjects( 'DrugColor', drugColorData ); for( var drugColorId in drugColors ) { mw.calculators.drugColors[ drugColorId ] = drugColors[ drugColorId ]; } }; /** * Class DrugColor * @param {Object} propertyValues * @returns {mw.calculators.objectClasses.DrugColor} * @constructor */ mw.calculators.objectClasses.DrugColor = function( propertyValues ) { var properties = { required: [ 'id' ], optional: [ 'highlightColor', 'primaryColor', 'striped' ] }; mw.calculators.objectClasses.CalculatorObject.call( this, properties, propertyValues ); } mw.calculators.objectClasses.DrugColor.prototype = Object.create( mw.calculators.objectClasses.CalculatorObject.prototype ); mw.calculators.addDrugColors( { sedativeHypnotic: { primaryColor: '#ffe800' } } ); var drugs = { propofol: { color: 'sedativeHypnotic', name: 'Propofol', preparations: [ '10 mg/mL' ] } }; }() );