diff options
Diffstat (limited to 'MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js')
-rw-r--r-- | MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js b/MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js index 11a34a12..24b2079d 100644 --- a/MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js +++ b/MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js @@ -18,7 +18,7 @@ } params = $.extend( getApiParams( $target ), { - 'do': 'dissociate', + do: 'dissociate', group: $target.data( 'groupid' ) } ); @@ -49,7 +49,7 @@ $a = $( '<a>', aAttr ).text( subgroupName ); spanAttr = { - 'class': 'tp-aggregate-remove-button', + class: 'tp-aggregate-remove-button', 'data-groupid': subgroupId }; @@ -57,7 +57,7 @@ $ol = $( '#mw-tpa-grouplist-' + parentId ); $ol.append( $( '<li>' ).append( $a, $span ) ); - $span.click( dissociate ); + $span.on( 'click', dissociate ); $parent.children( '.tp-group-input' ).val( '' ); }; @@ -71,7 +71,7 @@ if ( subgroupId ) { params = $.extend( getApiParams( $target ), { - 'do': 'associate', + do: 'associate', group: subgroupId } ); @@ -97,11 +97,11 @@ } // XXX: 'confirm' is nonstandard. - if ( $.isFunction( window.confirm ) && + if ( typeof window.confirm === 'function' && // eslint-disable-next-line no-alert window.confirm( mw.msg( 'tpt-aggregategroup-remove-confirm' ) ) ) { params = $.extend( getApiParams( $target ), { - 'do': 'remove' + do: 'remove' } ); api.postWithToken( 'csrf', params ) @@ -121,10 +121,10 @@ $editGroup = $parent.children( '.tp-edit-group' ), successFunction, params, - aggGroupNameInputName = $editGroup.children( 'input.tp-aggregategroup-edit-name' ), - aggGroupNameInputDesc = $editGroup.children( 'input.tp-aggregategroup-edit-description' ), - aggregateGroupName = aggGroupNameInputName.val(), - aggregateGroupDesc = aggGroupNameInputDesc.val(), + $aggGroupNameInputName = $editGroup.children( 'input.tp-aggregategroup-edit-name' ), + $aggGroupNameInputDesc = $editGroup.children( 'input.tp-aggregategroup-edit-description' ), + aggregateGroupName = $aggGroupNameInputName.val(), + aggregateGroupDesc = $aggGroupNameInputDesc.val(), api = new mw.Api(); successFunction = function () { @@ -139,7 +139,7 @@ params = { action: 'aggregategroups', - 'do': 'update', + do: 'update', groupname: aggregateGroupName, groupdescription: aggregateGroupDesc, aggregategroup: aggregateGroupId @@ -209,7 +209,7 @@ response( resp ); }; - $input.focus( excludeFunction ); + $input.on( 'focus', excludeFunction ); $input.autocomplete( { source: autocompleteFunction, minLength: 0 @@ -218,13 +218,13 @@ $( this ).autocomplete( 'search', $( this ).val() ); } ); - $( '.tp-aggregate-add-button' ).click( function ( event ) { + $( '.tp-aggregate-add-button' ).on( 'click', function ( event ) { associate( event, resp ); } ); - $( '.tp-aggregate-remove-button' ).click( dissociate ); - $( '.tp-aggregate-remove-ag-button' ).click( removeGroup ); - $( '.tp-aggregategroup-update' ).click( editGroup ); - $( '.tp-aggregategroup-update-cancel' ).click( cancelEditGroup ); + $( '.tp-aggregate-remove-button' ).on( 'click', dissociate ); + $( '.tp-aggregate-remove-ag-button' ).on( 'click', removeGroup ); + $( '.tp-aggregategroup-update' ).on( 'click', editGroup ); + $( '.tp-aggregategroup-update-cancel' ).on( 'click', cancelEditGroup ); $( 'a.tpt-add-new-group' ).on( 'click', function ( event ) { $( 'div.tpt-add-new-group' ).removeClass( 'hidden' ); @@ -241,16 +241,15 @@ $( '#tpt-aggregategroups-save' ).on( 'click', function () { var successFunction, params, - aggGroupNameInputName = $( 'input.tp-aggregategroup-add-name' ), - aggGroupNameInputDesc = $( 'input.tp-aggregategroup-add-description' ), - aggregateGroupName = aggGroupNameInputName.val(), - aggregateGroupDesc = aggGroupNameInputDesc.val(), - api = new mw.Api(); + $aggGroupNameInputName = $( 'input.tp-aggregategroup-add-name' ), + $aggGroupNameInputDesc = $( 'input.tp-aggregategroup-add-description' ), + aggregateGroupName = $aggGroupNameInputName.val(), + aggregateGroupDesc = $aggGroupNameInputDesc.val(); // Empty the fields. If they are not emptied, then when another group // is added, the values will appear again. - aggGroupNameInputName.val( '' ); - aggGroupNameInputDesc.val( '' ); + $aggGroupNameInputName.val( '' ); + $aggGroupNameInputDesc.val( '' ); successFunction = function ( data ) { var $removeSpan, $editSpan, $displayHeader, $div, $groupSelector, $addButton, @@ -272,13 +271,13 @@ $saveButton = $( '<input>' ) .attr( { type: 'button', - 'class': 'tp-aggregategroup-update' + class: 'tp-aggregategroup-update' } ) .val( mw.msg( 'tpt-aggregategroup-update' ) ); $cancelButton = $( '<input>' ) .attr( { type: 'button', - 'class': 'tp-aggregategroup-update-cancel' + class: 'tp-aggregategroup-update-cancel' } ) .val( mw.msg( 'tpt-aggregategroup-update-cancel' ) ); $divEdit = $( '<div>' ) @@ -287,16 +286,19 @@ .text( mw.msg( 'tpt-aggregategroup-edit-name' ) ) ) .append( $( '<input>' ) .attr( { - 'class': 'tp-aggregategroup-edit-name', + class: 'tp-aggregategroup-edit-name', id: 'tp-agg-name' } ) .val( aggregateGroupName ) ) - .append( $( '<br /><label>' ) - .text( mw.msg( 'tpt-aggregategroup-edit-description' ) ) ) + .append( + $( '<br>' ), + $( '<label>' ) + .text( mw.msg( 'tpt-aggregategroup-edit-description' ) ) + ) .append( $( '<input>' ) .attr( { - 'class': 'tp-aggregategroup-edit-description', + class: 'tp-aggregategroup-edit-description', id: 'tp-agg-desc' } ) .val( aggregateGroupDesc ) @@ -312,9 +314,9 @@ $groupSelector = $( '<input>' ).attr( { type: 'text', - 'class': 'tp-group-input' + class: 'tp-group-input' } ); - $groupSelector.focus( excludeFunction ); + $groupSelector.on( 'focus', excludeFunction ); $groupSelector.autocomplete( { source: autocompleteFunction, minLength: 0 @@ -325,12 +327,12 @@ $addButton = $( '<input>' ) .attr( { type: 'button', - 'class': 'tp-aggregate-add-button', + class: 'tp-aggregate-add-button', id: aggregateGroupId } ) .val( mw.msg( 'tpt-aggregategroup-add' ) ); $div.append( $groupSelector, $addButton ); - $addButton.click( function ( event ) { + $addButton.on( 'click', function ( event ) { associate( event, resp ); } ); $editSpan.on( 'click', function ( event ) { @@ -339,16 +341,16 @@ $parent.children( '.tp-edit-group' ).removeClass( 'hidden' ); } ); - $saveButton.click( editGroup ); - $cancelButton.click( cancelEditGroup ); - $removeSpan.click( removeGroup ); + $saveButton.on( 'click', editGroup ); + $cancelButton.on( 'click', cancelEditGroup ); + $removeSpan.on( 'click', removeGroup ); $( 'div.tpt-add-new-group' ).addClass( 'hidden' ); $( 'a.tpt-add-new-group' ).before( $div ); }; params = { action: 'aggregategroups', - 'do': 'add', + do: 'add', groupname: aggregateGroupName, groupdescription: aggregateGroupDesc }; |