Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Gadget-calculator-crystals-core.js: Difference between revisions

MediaWiki interface page
Content added Content deleted
No edit summary
No edit summary
Line 74: Line 74:
} );
} );
var songComboOptions = [ 'Combo 4 (full combo)', 'Combo 3', 'Combo 2',
var songComboOptions = [
'Combo 1' ];
{ label: 'Combo 4 (full combo)', value: 4 },
{ label: 'Combo 3', value: 3 },
{ label: 'Combo 2', value: 2 },
{ label: 'Combo 1', value: 1 },
{ label: 'None', value: 0 }
];
var songComboHardWidget = new OO.ui.ButtonSelectWidget( {
var songComboHardWidget = new OO.ui.ButtonSelectWidget( {
items: songComboOptions.map( function( combo ) {
items: songComboOptions.map( function( option ) {
return new OO.ui.ButtonOptionWidget( {
return new OO.ui.ButtonOptionWidget( {
data: combo,
data: option.value,
label: combo
label: option.label
} );
} );
} )
} )
Line 86: Line 91:
var songComboExpertWidget = new OO.ui.ButtonSelectWidget( {
var songComboExpertWidget = new OO.ui.ButtonSelectWidget( {
items: songComboOptions.map( function( combo ) {
items: songComboOptions.map( function( option ) {
return new OO.ui.ButtonOptionWidget( {
return new OO.ui.ButtonOptionWidget( {
data: combo,
data: option.value,
label: combo
label: option.label
} );
} );
} )
} )
Line 95: Line 100:
var songComboMasterWidget = new OO.ui.ButtonSelectWidget( {
var songComboMasterWidget = new OO.ui.ButtonSelectWidget( {
items: songComboOptions.map( function( combo ) {
items: songComboOptions.map( function( option ) {
return new OO.ui.ButtonOptionWidget( {
return new OO.ui.ButtonOptionWidget( {
data: combo,
data: option.value,
label: combo
label: option.label
} );
} );
} )
} )
Line 199: Line 204:
icon: 'mathematics'
icon: 'mathematics'
} );
} );
function calculate() {
console.log(startDateWidget.getValue());
console.log(endDateWidget.getValue());
console.log(eventTierWidget.getValue());
console.log(songRankWidget.getValue());
console.log(songComboHardWidget.getValue());
console.log(songComboExpertWidget.getValue());
console.log(songComboMasterWidget.getValue());
console.log(clStampWidget.getValue());
console.log(ivEventsWidgets.getValue());
console.log(ivSongsWidgets.getValue());
}
submitButton.on( 'click', calculate );
var fieldset = new OO.ui.FieldsetLayout( {
var fieldset = new OO.ui.FieldsetLayout( {

Revision as of 18:29, 24 August 2022

( function ( $, mw ) {
	/***************************************************************************
	 * Date range
	 */
	var startDateWidget = new mw.widgets.DateInputWidget( {
		type: 'date',
		value: new Date().toISOString().split('T')[0]
	} );
	
	var endDateWidget = new mw.widgets.DateInputWidget( {
		type: 'date'
	} );
	
	var dateFieldset = new OO.ui.FieldsetLayout( {
	    label: 'Date range',
	    items: [
	    	new OO.ui.FieldLayout(
	    		startDateWidget,
				{
					label: 'Start date',
					align: 'inline',
					help: 'test'
				}
			),
			new OO.ui.FieldLayout(
				endDateWidget,
				{
					label: 'End date',
					align: 'inline'
				}
			)
		]
	} );
	
	/***************************************************************************
	 * Event
	 */
	var eventTierOptions = [ 'T1-10', 'T20-100', 'T200-500', 'T1000', 
		'T2000-5000', 'T10000-50000', 'T100000', 'T200000', 'T300000',
		'T500000', 'T1000000' ];
	var eventTierWidget = new OO.ui.ButtonSelectWidget( {
		items: eventTierOptions.map( function( tier ) {
			return new OO.ui.ButtonOptionWidget( {
				data: tier,
				label: tier
			} );
		} ),
	} );
	 
    var eventFieldset = new OO.ui.FieldsetLayout( {
	    label: 'Events',
	    items: [
	    	new OO.ui.FieldLayout(
	    		eventTierWidget,
				{
					label: 'Average tier',
					align: 'inline'
				}
			)
		]
	} );
	
	/***************************************************************************
	 * Song
	 */
	var songRankOptions = [ 'S', 'A', 'B', 'C' ];
	var songRankWidget = new OO.ui.ButtonSelectWidget( {
		items: songRankOptions.map( function( rank ) {
			return new OO.ui.ButtonOptionWidget( {
				data: rank,
				label: rank
			} );
		} ),
	} );
	
	var songComboOptions = [
		{ label: 'Combo 4 (full combo)', value: 4 },
		{ label: 'Combo 3', value: 3 },
		{ label: 'Combo 2', value: 2 },
		{ label: 'Combo 1', value: 1 },
		{ label: 'None', value: 0 }
	];
	var songComboHardWidget = new OO.ui.ButtonSelectWidget( {
		items: songComboOptions.map( function( option ) {
			return new OO.ui.ButtonOptionWidget( {
				data: option.value,
				label: option.label
			} );
		} )
	} );
	
	var songComboExpertWidget = new OO.ui.ButtonSelectWidget( {
		items: songComboOptions.map( function( option ) {
			return new OO.ui.ButtonOptionWidget( {
				data: option.value,
				label: option.label
			} );
		} )
	} );
	
	var songComboMasterWidget = new OO.ui.ButtonSelectWidget( {
		items: songComboOptions.map( function( option ) {
			return new OO.ui.ButtonOptionWidget( {
				data: option.value,
				label: option.label
			} );
		} )
	} );
	
    var songFieldset = new OO.ui.FieldsetLayout( {
	    label: 'Songs',
	    items: [
	    	new OO.ui.FieldLayout(
	    		songRankWidget,
				{
					label: 'Average song score rank',
					align: 'inline'
				}
			),
	    	new OO.ui.FieldLayout(
	    		songComboHardWidget,
				{
					label: 'Average song combo milestone (on hard)',
					align: 'inline'
				}
			),
	    	new OO.ui.FieldLayout(
	    		songComboExpertWidget,
	    		{
					label: 'Average song combo milestone (on expert)',
					align: 'inline'
				}
			),
	    	new OO.ui.FieldLayout(
	    		songComboMasterWidget,
	    		{
					label: 'Average song combo milestone (on master)',
					align: 'inline'
				}
			)
		]
	} );

	/***************************************************************************
	 * Challenge Stamp
	 */
	var clStampWidget = new OO.ui.RadioSelectInputWidget( {
		options: [
			{ data: 'true', label: 'Yes' },
			{ data: 'false', label: 'No' }
		],
		value: 'true'
	} );
    
    var clFieldset = new OO.ui.FieldsetLayout( {
	    label: 'Challenge Live',
	    items: [
	    	new OO.ui.FieldLayout(
	    		clStampWidget,
	    		{
					label: 'Crystals selected as Challenge Stamp reward?',
					align: 'inline'
				}
			)
		]
	} );
	
	/***************************************************************************
	 * Intermediate values
	 */
	var ivEventsWidgets = new OO.ui.NumberInputWidget( {
    	min: 0
	} );
	var ivSongsWidgets = new OO.ui.NumberInputWidget( {
    	min: 0
	} );
	var intermediateFieldset = new OO.ui.FieldsetLayout( {
		label: 'Intermediate values',
		items: [
			new OO.ui.FieldLayout(
	    		ivEventsWidgets,
	    		{
					label: 'Number of events',
					align: 'inline'
				}
			),
			new OO.ui.FieldLayout(
	    		ivSongsWidgets,
	    		{
					label: 'Number of songs',
					align: 'inline'
				}
			)
		]
	} );
	
	/***************************************************************************
	 * Everything
	 */
	var submitButton = new OO.ui.ButtonInputWidget( { 
		label: 'Calculate',
		flags: [ 'primary', 'progressive' ],
		align: 'left',
		icon: 'mathematics'
	} );
	
	function calculate() {
		console.log(startDateWidget.getValue());
		console.log(endDateWidget.getValue());
		console.log(eventTierWidget.getValue());
		console.log(songRankWidget.getValue());
		console.log(songComboHardWidget.getValue());
		console.log(songComboExpertWidget.getValue());
		console.log(songComboMasterWidget.getValue());
		console.log(clStampWidget.getValue());
		console.log(ivEventsWidgets.getValue());
		console.log(ivSongsWidgets.getValue());
	}
	
	submitButton.on( 'click', calculate );
	
	var fieldset = new OO.ui.FieldsetLayout( {
		items: [
			dateFieldset,
			eventFieldset,
			songFieldset,
			clFieldset,
			intermediateFieldset,
			new OO.ui.FieldLayout(
				submitButton
			)
		]
	} );

	$( '#calculator' ).append( fieldset.$element );
	
} )( jQuery, mediaWiki );
Cookies help us deliver our services. By using our services, you agree to our use of cookies.