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

MediaWiki:Gadget-database-util.js: Difference between revisions

MediaWiki interface page
Content added Content deleted
mNo edit summary
Tag: Reverted
mNo edit summary
Tag: Manual revert
Line 1: Line 1:
mw.loader.using( ['gadget.ext.polyfill-set', 'oojs-ui-core', 'oojs-ui-widgets'] ).done( function() {
mw.loader.using( ['oojs-ui-core', 'oojs-ui-widgets'] ).done( function() {
function QueryOptions() {
function QueryOptions() {
this.queryParams = {};
this.queryParams = {};

Revision as of 05:58, 21 December 2021

mw.loader.using( ['oojs-ui-core', 'oojs-ui-widgets'] ).done( function() {
	function QueryOptions() {
		this.queryParams = {};
		
		this.fieldset = new OO.ui.FieldsetLayout( {
		    label: 'Query options',
		    items: []
		} );
	}
	
	QueryOptions.prototype.addMultioption = function(param, options, fieldOptions) {
		this.queryParams[param] = new PrimitiveSet();
		
		var toggleButtons = Object.keys( options ).map( function( optionName ) {
			var btn = new OO.ui.ToggleButtonWidget( {
				label: optionName,
				value: options[optionName]
			} );
			btn.on( 'change', function( selected ) {
				if ( selected ) {
					this.queryParams.add(param);
				} else {
					this.queryParams.delete(param);
				}
			} );
			
			return btn;
		} );
		
		this.fieldset.addItems( [
			new OO.ui.FieldLayout( toggleButtons, {
				label: fieldOptions.label,
				align: fieldOptions.align
			} ),
		] );	
	};
	
	QueryOptions.prototype.getFieldset = function() {
		return this.fieldset;
	};
	
	QueryOptions.prototype.getOptions = function() {
		
	};
	
	
	function DisplayOptions() {
		this.displayOptions = {};
	}
	
	DisplayOptions.prototype.getOptions = function() {
		
	};
	
	Object.preventExtensions(QueryOptions);
} );
Cookies help us deliver our services. By using our services, you agree to our use of cookies.