MediaWiki:Common.js: verschil tussen versies
Uit Mad Pride Nederland
(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 () { | ||
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'; | |||
ve.ui.MWParameterPage.prototype.createValueInput = function() { | }; | ||
var type = this.parameter.getType(); | |||
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); | |||
}; | |||
} ); |
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); }; } );