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
(added default date)
No edit summary
Line 1: Line 1:
( function ( $, mw ) {
( function ( $, mw ) {
/***************************************************************************
/*
* Date range
* Date range
*/
*/
var startDateWidget = new mw.widgets.DateInputWidget( {
var startDateWidget = new mw.widgets.DateInputWidget( {
type: 'date',
type: 'date',
value: new Date().toISOString().split('T')[0]
value: new Date().toISOString().split('T')[0]
} );
} );
var endDateWidget = new mw.widgets.DateInputWidget( {
var endDateWidget = new mw.widgets.DateInputWidget( {
type: 'date'
type: 'date'
} )
} );
var dateFieldset = new OO.ui.FieldsetLayout( {
var dateFieldset = new OO.ui.FieldsetLayout( {
Line 33: Line 33:
} );
} );
/***************************************************************************
/*
* Event
* Event
*/
*/
Line 39: Line 39:
'T2000-5000', 'T10000-50000', 'T100000', 'T200000', 'T300000',
'T2000-5000', 'T10000-50000', 'T100000', 'T200000', 'T300000',
'T500000', 'T1000000' ];
'T500000', 'T1000000' ];
var eventTierWidget = new OO.ui.FieldLayout(
var eventTierWidget = new OO.ui.ButtonSelectWidget( {
items: eventTierOptions.map( function( tier ) {
new OO.ui.ButtonSelectWidget( {
return new OO.ui.ButtonOptionWidget( {
items: eventTierOptions.map( function( tier ) {
data: tier,
return new OO.ui.ButtonOptionWidget( {
data: tier,
label: tier
label: tier
} );
} );
} ),
} ),
} ),
} );
{
label: 'Average tier',
align: 'inline'
}
);
var eventFieldset = new OO.ui.FieldsetLayout( {
var eventFieldset = new OO.ui.FieldsetLayout( {
label: 'Events',
label: 'Events',
items: [
items: [
eventTierWidget
new OO.ui.FieldLayout(
eventTierWidget,
{
label: 'Average tier',
align: 'inline'
}
)
]
]
} );
} );
/***************************************************************************
/*
* Song
* Song
*/
*/
var songRankOptions = [ 'S', 'A', 'B', 'C' ];
var songRankOptions = [ 'S', 'A', 'B', 'C' ];
var songRankWidget = new OO.ui.FieldLayout(
var songRankWidget = new OO.ui.ButtonSelectWidget( {
items: songRankOptions.map( function( rank ) {
new OO.ui.ButtonSelectWidget( {
return new OO.ui.ButtonOptionWidget( {
items: songRankOptions.map( function( rank ) {
data: rank,
return new OO.ui.ButtonOptionWidget( {
data: rank,
label: rank
label: rank
} );
} );
} ),
} ),
} ),
} );
{
label: 'Average song score rank',
align: 'inline'
}
);
var songComboOptions = [ 'Combo 4 (full combo)', 'Combo 3', 'Combo 2',
var songComboOptions = [ 'Combo 4 (full combo)', 'Combo 3', 'Combo 2',
'Combo 1' ];
'Combo 1' ];
var songComboHardWidget = new OO.ui.FieldLayout(
var songComboHardWidget = new OO.ui.ButtonSelectWidget( {
items: songComboOptions.map( function( combo ) {
new OO.ui.ButtonSelectWidget( {
return new OO.ui.ButtonOptionWidget( {
items: songComboOptions.map( function( combo ) {
data: combo,
return new OO.ui.ButtonOptionWidget( {
data: combo,
label: combo
label: combo
} );
} );
} )
} )
} );
} ),
{
label: 'Average song combo milestone (on hard)',
align: 'inline'
}
);
var songComboExpertWidget = new OO.ui.FieldLayout(
var songComboExpertWidget = new OO.ui.ButtonSelectWidget( {
items: songComboOptions.map( function( combo ) {
new OO.ui.ButtonSelectWidget( {
return new OO.ui.ButtonOptionWidget( {
items: songComboOptions.map( function( combo ) {
data: combo,
return new OO.ui.ButtonOptionWidget( {
data: combo,
label: combo
label: combo
} );
} );
} )
} )
} );
} ),
{
label: 'Average song combo milestone (on expert)',
align: 'inline'
}
);
var songComboMasterWidget = new OO.ui.FieldLayout(
var songComboMasterWidget = new OO.ui.ButtonSelectWidget( {
items: songComboOptions.map( function( combo ) {
new OO.ui.ButtonSelectWidget( {
return new OO.ui.ButtonOptionWidget( {
items: songComboOptions.map( function( combo ) {
data: combo,
return new OO.ui.ButtonOptionWidget( {
data: combo,
label: combo
label: combo
} );
} );
} )
} )
} );
} ),
{
label: 'Average song combo milestone (on master)',
align: 'inline'
}
);
var songFieldset = new OO.ui.FieldsetLayout( {
var songFieldset = new OO.ui.FieldsetLayout( {
label: 'Songs',
label: 'Songs',
items: [
items: [
songRankWidget,
new OO.ui.FieldLayout(
songComboHardWidget,
songRankWidget,
{
songComboExpertWidget,
label: 'Average song score rank',
songComboMasterWidget
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
* Challenge Stamp
*/
*/
Line 149: Line 149:
var clFieldset = new OO.ui.FieldsetLayout( {
var clFieldset = new OO.ui.FieldsetLayout( {
label: 'Crystals selected as Challenge Stamp reward?',
label: 'Challenge Live',
items: [
items: [
clStampWidget
new OO.ui.FieldLayout(
clStampWidget,
{
label: 'Crystals selected as Challenge Stamp reward?',
align: 'inline'
}
)
]
]
} );
} );
/***************************************************************************
/*
* Intermediate values
* Intermediate values
*/
*/
var ivEvents = new OO.ui.NumberInputWidget( {
var ivEventsWidgets = new OO.ui.NumberInputWidget( {
label: 'Number of events',
min: 0
min: 0
} );
} );
var ivSongs = new OO.ui.NumberInputWidget( {
var ivSongsWidgets = new OO.ui.NumberInputWidget( {
label: 'Number of songs',
min: 0
min: 0
} );
} );
Line 169: Line 173:
label: 'Intermediate values',
label: 'Intermediate values',
items: [
items: [
new OO.ui.FieldLayout(
ivEvents,
ivEventsWidgets,
ivSongs
{
label: 'Number of events',
align: 'inline'
}
),
new OO.ui.FieldLayout(
ivSongsWidgets,
{
label: 'Number of songs',
align: 'inline'
}
)
]
]
} );
} );
/***************************************************************************
/*
* Everything
* Everything
*/
*/
var submitButton = new OO.ui.FieldLayout(
var submitButton = new OO.ui.ButtonInputWidget( {
label: 'Calculate',
new OO.ui.ButtonInputWidget( {
flags: [ 'primary', 'progressive' ],
label: 'Calculate',
align: 'left',
flags: [ 'primary', 'progressive' ],
align: 'left',
icon: 'mathematics'
} );
icon: 'mathematics'
} )
);
var fieldset = new OO.ui.FieldsetLayout( {
var fieldset = new OO.ui.FieldsetLayout( {
Line 193: Line 207:
clFieldset,
clFieldset,
intermediateFieldset,
intermediateFieldset,
new OO.ui.FieldLayout(
submitButton
submitButton
)
]
]
} );
} );

Revision as of 15:13, 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 = [ 'Combo 4 (full combo)', 'Combo 3', 'Combo 2',
		'Combo 1' ];
	var songComboHardWidget = new OO.ui.ButtonSelectWidget( {
		items: songComboOptions.map( function( combo ) {
			return new OO.ui.ButtonOptionWidget( {
				data: combo,
				label: combo
			} );
		} )
	} );
	
	var songComboExpertWidget = new OO.ui.ButtonSelectWidget( {
		items: songComboOptions.map( function( combo ) {
			return new OO.ui.ButtonOptionWidget( {
				data: combo,
				label: combo
			} );
		} )
	} );
	
	var songComboMasterWidget = new OO.ui.ButtonSelectWidget( {
		items: songComboOptions.map( function( combo ) {
			return new OO.ui.ButtonOptionWidget( {
				data: combo,
				label: combo
			} );
		} )
	} );
	
    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'
	} );
	
	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.