'mediawiki.hlist',
),
),
+ 'mediawiki.template' => array(
+ 'scripts' => 'resources/src/mediawiki/mediawiki.template.js',
+ 'targets' => array( 'desktop', 'mobile' ),
+ ),
'mediawiki.apipretty' => array(
'styles' => 'resources/src/mediawiki/mediawiki.apipretty.css',
'targets' => array( 'desktop', 'mobile' ),
'position' => 'bottom',
),
'mediawiki.feedback' => array(
+ 'templates' => array(
+ 'dialog.html' => 'resources/src/mediawiki/templates/dialog.html',
+ ),
'scripts' => 'resources/src/mediawiki/mediawiki.feedback.js',
'styles' => 'resources/src/mediawiki/mediawiki.feedback.css',
'dependencies' => array(
'scripts' => 'resources/src/mediawiki/mediawiki.htmlform.js',
'dependencies' => array(
'jquery.mwExtension',
+ 'jquery.byteLimit',
+ ),
+ 'messages' => array(
+ 'htmlform-chosen-placeholder',
+ // @todo Load this message in content language
+ 'colon-separator',
),
- 'messages' => array( 'htmlform-chosen-placeholder' ),
),
'mediawiki.icon' => array(
'styles' => 'resources/src/mediawiki/mediawiki.icon.less',
'dependencies' => array(
'jquery.cookie',
),
+ 'targets' => array( 'desktop', 'mobile' ),
),
'mediawiki.toolbar' => array(
'class' => 'ResourceLoaderEditToolbarModule',
),
),
'mediawiki.action.view.postEdit' => array(
+ 'templates' => array(
+ 'postEdit.html' => 'resources/src/mediawiki.action/templates/postEdit.html',
+ ),
'scripts' => 'resources/src/mediawiki.action/mediawiki.action.view.postEdit.js',
'styles' => 'resources/src/mediawiki.action/mediawiki.action.view.postEdit.css',
'dependencies' => array(
'scripts' => 'resources/src/mediawiki.special/mediawiki.special.undelete.js',
),
'mediawiki.special.upload' => array(
+ 'templates' => array(
+ 'thumbnail.html' => 'resources/src/mediawiki.special/templates/thumbnail.html',
+ ),
'scripts' => 'resources/src/mediawiki.special/mediawiki.special.upload.js',
'messages' => array(
'widthheight',
'minerva' => 'resources/lib/oojs-ui/oojs-ui-mediawiki.svg.css',
),
'messages' => array(
+ 'ooui-dialog-message-accept',
+ 'ooui-dialog-message-reject',
+ 'ooui-dialog-process-continue',
+ 'ooui-dialog-process-dismiss',
+ 'ooui-dialog-process-error',
+ 'ooui-dialog-process-retry',
'ooui-outline-control-move-down',
'ooui-outline-control-move-up',
'ooui-outline-control-remove',
'ooui-toolbar-more',
'ooui-toolgroup-collapse',
'ooui-toolgroup-expand',
- 'ooui-dialog-message-accept',
- 'ooui-dialog-message-reject',
- 'ooui-dialog-process-dismiss',
- 'ooui-dialog-process-error',
- 'ooui-dialog-process-retry',
),
'dependencies' => array(
'es5-shim',
} );
function enhance( $root ) {
- var $matrixTooltips, $autocomplete;
+ var $matrixTooltips, $autocomplete,
+ // cache the separator to avoid object creation on each keypress
+ colonSeparator = mw.message( 'colon-separator' ).text();
/**
* @ignore
handleSelectOrOther.call( this, true );
} );
+ // Add a dynamic max length to the reason field of SelectAndOther
+ // This checks the length together with the value from the select field
+ // When the reason list is changed and the bytelimit is longer than the allowed,
+ // nothing is done
+ $root
+ .find( '.mw-htmlform-select-and-other-field' )
+ .each( function () {
+ var $this = $( this ),
+ // find the reason list
+ $reasonList = $root.find( '#' + $this.data( 'id-select' ) ),
+ // cache the current selection to avoid expensive lookup
+ currentValReasonList = $reasonList.val();
+
+ $reasonList.change( function () {
+ currentValReasonList = $reasonList.val();
+ } );
+
+ $this.byteLimit( function ( input ) {
+ // Should be built the same as in HTMLSelectAndOtherField::loadDataFromRequest
+ var comment = currentValReasonList;
+ if ( comment === 'other' ) {
+ comment = input;
+ } else if ( input !== '' ) {
+ // Entry from drop down menu + additional comment
+ comment += colonSeparator + input;
+ }
+ return comment;
+ } );
+ } );
+
// Set up hide-if elements
$root.find( '.mw-htmlform-hide-if' ).each( function () {
var v, $fields, test, func,
}
// Add/remove cloner clones without having to resubmit the form
- $root.find( '.mw-htmlform-cloner-delete-button' ).click( function ( ev ) {
+ $root.find( '.mw-htmlform-cloner-delete-button' ).filter( ':input' ).click( function ( ev ) {
ev.preventDefault();
$( this ).closest( 'li.mw-htmlform-cloner-li' ).remove();
} );
- $root.find( '.mw-htmlform-cloner-create-button' ).click( function ( ev ) {
+ $root.find( '.mw-htmlform-cloner-create-button' ).filter( ':input' ).click( function ( ev ) {
var $ul, $li, html;
ev.preventDefault();