MediaWiki:Common.js: verschil tussen versies

Uit Mad Pride Nederland
Ga naar:navigatie, zoeken
(Add support for date fields in Visual Editor)
 
Geen bewerkingssamenvatting
 
Regel 2: Regel 2:


/* Add support for date fields in Visual Editor */
/* Add support for date fields in Visual Editor */
OO.ui.TextInputWidget.prototype.getSaneType = function (config) {
mw.hook( 've.activationComplete' ).add( function () {
var allowedTypes = [
'text',
OO.ui.TextInputWidget.prototype.getSaneType = function (config) {
'password',
var allowedTypes = [
'email',
'text',
'url',
'password',
'number',
'email',
'datetime-local'
'url',
];
'number',
return allowedTypes.indexOf(config.type) !== - 1 ? config.type : 'text';
'datetime-local'
};
];
 
return allowedTypes.indexOf(config.type) !== - 1 ? config.type : 'text';
ve.ui.MWParameterPage.prototype.createValueInput = function() {  
};
var type = this.parameter.getType();
if (type === 'date'){
var oldCreateValueInput = ve.ui.MWParameterPage.prototype.createValueInput;
var valueInputConfig = this.getDefaultInputConfig();
ve.ui.MWParameterPage.prototype.createValueInput = function() {  
valueInputConfig.type = 'datetime-local';
var type = this.parameter.getType();
return new OO.ui.TextInputWidget( valueInputConfig );
if (type === 'date'){
}
var valueInputConfig = this.getDefaultInputConfig();
return x.call(this);  
valueInputConfig.type = 'datetime-local';
};
return new OO.ui.TextInputWidget( valueInputConfig );
}
return oldCreateValueInput.call(this);  
};
} );

Huidige versie van 11 mrt 2024 om 22:58

/* JavaScript die hier wordt geplaatst heeft invloed op alle pagina's voor alle gebruikers */

/* Add support for date fields in Visual Editor */
mw.hook( 've.activationComplete' ).add( function () {
	
	OO.ui.TextInputWidget.prototype.getSaneType = function (config) {
		var allowedTypes = [
			'text',
			'password',
			'email',
			'url',
			'number',
			'datetime-local'
		];
		return allowedTypes.indexOf(config.type) !== - 1 ? config.type : 'text';
	};
	
	var oldCreateValueInput = ve.ui.MWParameterPage.prototype.createValueInput;
	ve.ui.MWParameterPage.prototype.createValueInput = function() { 
	var type = this.parameter.getType();
		if (type === 'date'){
			var valueInputConfig = this.getDefaultInputConfig();
			valueInputConfig.type = 'datetime-local';
			return new OO.ui.TextInputWidget( valueInputConfig );
		}
		return oldCreateValueInput.call(this); 
	};
} );