Index: trunk/extensions/Translate/resources/ext.translate.special.aggregategroups.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | jQuery( document ).ready( function ( $ ) { |
3 | 3 | "use strict"; |
4 | | - |
| 4 | + |
5 | 5 | function getApiParams( $target ) { |
6 | 6 | return { |
7 | 7 | action: 'aggregategroups', |
— | — | @@ -17,8 +17,6 @@ |
18 | 18 | $selected = $( '#mw-tpa-groupselect-' + parentId + ' option:selected' ), |
19 | 19 | subgroupId = $selected.val(), |
20 | 20 | subgroupName = $selected.text(); |
21 | | - |
22 | | - |
23 | 21 | |
24 | 22 | var successFunction = function( data, textStatus ) { |
25 | 23 | if ( data.error ) { |
— | — | @@ -45,7 +43,7 @@ |
46 | 44 | $span.click( dissociate ); |
47 | 45 | } |
48 | 46 | }; |
49 | | - |
| 47 | + |
50 | 48 | var params = $.extend( getApiParams( $target ), { |
51 | 49 | 'do' : 'associate', |
52 | 50 | group: subgroupId, |
— | — | @@ -64,7 +62,7 @@ |
65 | 63 | alert( data.error.info ); |
66 | 64 | } else { |
67 | 65 | $( '<option>', { value: $target.data( 'groupid' ) } ) |
68 | | - .text( $target.parent( 'a' ).text() ) |
| 66 | + .text( $target.siblings( 'a' ).text() ) |
69 | 67 | .appendTo( $select ); |
70 | 68 | $target.parent( 'li' ).remove(); |
71 | 69 | } |
— | — | @@ -91,7 +89,7 @@ |
92 | 90 | }; |
93 | 91 | |
94 | 92 | var params = $.extend( getApiParams( $target ), {'do' : 'remove' } ); |
95 | | - $.post( mw.util.wikiScript( "api" ), params, successFunction ); |
| 93 | + $.post( mw.util.wikiScript( 'api' ), params, successFunction ); |
96 | 94 | } |
97 | 95 | |
98 | 96 | $( '.tp-aggregate-add-button' ).click( associate ); |
— | — | @@ -120,14 +118,14 @@ |
121 | 119 | .append ( $('<ol id=\'mw-tpa-grouplist-'+aggregateGroup+'\'>') ); |
122 | 120 | |
123 | 121 | if ( $select.length > 0 ){ |
124 | | - var $groupSelector = $( $( 'select.tp-aggregate-group-chooser')[0] ).clone(); |
| 122 | + var $groupSelector = $( $( 'select.tp-aggregate-group-chooser' )[0] ).clone(); |
125 | 123 | $groupSelector.attr('id', 'tp-aggregate-groups-select-' + aggregateGroup); |
126 | | - var $addButton = $( $( 'input.tp-aggregate-add-button')[0]).clone(); |
| 124 | + var $addButton = $( $( 'input.tp-aggregate-add-button' )[0]).clone(); |
127 | 125 | $addButton.attr( 'id', aggregateGroup); |
128 | 126 | $div.append( $groupSelector ).append( $addButton ); |
129 | | - $addButton.on ( "click", function( event ){ associate(event); } ); |
130 | | - $removeSpan.on ( "click", function( event ){ removeGroup(event); } ); |
131 | | - $( 'div.tpt-add-new-group' ).addClass('hidden'); |
| 127 | + $addButton.click( associate ); |
| 128 | + $removeSpan.click( removeGroup ); |
| 129 | + $( 'div.tpt-add-new-group' ).addClass( 'hidden' ); |
132 | 130 | }else{ |
133 | 131 | // First group in the wiki. Cannot clone the group selector, just reload this time. |
134 | 132 | location.reload(); |
— | — | @@ -145,6 +143,6 @@ |
146 | 144 | groupdescription: aggregateGroupDesc, |
147 | 145 | format: "json" |
148 | 146 | }; |
149 | | - $.post( mw.util.wikiScript( "api" ), params, successFunction ); |
| 147 | + $.post( mw.util.wikiScript( 'api' ), params, successFunction ); |
150 | 148 | } ) |
151 | 149 | } ); |