Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js |
— | — | @@ -251,6 +251,8 @@ |
252 | 252 | |
253 | 253 | }); |
254 | 254 | |
255 | | - ac.init(); |
| 255 | + $(document).ready( function() { |
| 256 | + ac.init(); |
| 257 | + } ); |
256 | 258 | |
257 | 259 | })( jQuery, window.mw ); |
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.init/ext.articleCreation.init.js |
— | — | @@ -1,9 +1,9 @@ |
2 | | -(function($,mw) { |
| 2 | +jQuery( document ).ready( function() { |
3 | 3 | var newTitle = 'Special:ArticleCreationLanding' + '/' + |
4 | 4 | encodeURIComponent(wgPageName); |
5 | 5 | var landingURL = mw.config.get('wgArticlePath').replace( '$1', newTitle ); |
6 | 6 | // change the link to point to the new special page |
7 | | - $("div.noarticletext") |
| 7 | + jQuery("div.noarticletext") |
8 | 8 | .find('a[href*="action=edit"]') |
9 | 9 | .attr( 'href', landingURL ); |
10 | | -})( jQuery, window.mediaWiki ); |
| 10 | +} ); |
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.searchResult/ext.articleCreation.searchResult.js |
— | — | @@ -1,9 +1,9 @@ |
2 | | -(function($,mw) { |
| 2 | +jQuery( document ).ready( function() { |
3 | 3 | var newTitle = 'Special:ArticleCreationLanding' + '/' + |
4 | 4 | encodeURIComponent(mw.config.get('acSearch')); |
5 | 5 | var landingURL = mw.config.get('wgArticlePath').replace( '$1', newTitle ); |
6 | 6 | // change the link to point to the new special page |
7 | | - $("div.searchresults") |
| 7 | + jQuery("div.searchresults") |
8 | 8 | .find('a[href*="action=edit"]') |
9 | 9 | .attr( 'href', landingURL ); |
10 | | -})( jQuery, window.mediaWiki ); |
| 10 | +} ); |
Index: trunk/extensions/Configure/Configure.js |
— | — | @@ -3,547 +3,548 @@ |
4 | 4 | * create JavaScript buttons to allow to modify the form to have more |
5 | 5 | * flexibility |
6 | 6 | */ |
| 7 | +jQuery( document ).ready( function ( $ ) { |
| 8 | + // Tabs and TOC |
| 9 | + // ------------ |
7 | 10 | |
8 | | -// Tabs and TOC |
9 | | -// ------------ |
| 11 | + $( '#configure' ) |
| 12 | + .addClass( 'jsprefs' ) |
| 13 | + .wrap( '<table><tbody><tr><td class="config-col-form"></td></tr></tbody></table>' ) |
| 14 | + .parent() |
| 15 | + .before( '<td class="config-col-toc"><ul class="configtoc" id="configtoc"></ul></td>' ); |
10 | 16 | |
11 | | -$( '#configure' ) |
12 | | - .addClass( 'jsprefs' ) |
13 | | - .wrap( '<table><tbody><tr><td class="config-col-form"></td></tr></tbody></table>' ) |
14 | | - .parent() |
15 | | - .before( '<td class="config-col-toc"><ul class="configtoc" id="configtoc"></ul></td>' ); |
| 17 | + $( '#configure' ) |
| 18 | + .children( 'fieldset' ) |
| 19 | + .addClass( 'configsection' ) |
| 20 | + .hide() |
| 21 | + .children( 'legend' ) |
| 22 | + .each( function( i ) { |
| 23 | + $( this ).parent().attr( 'id', 'config-section-' + i ); |
| 24 | + if ( i === 0 ) { |
| 25 | + $( this ).parent().show(); |
| 26 | + } |
16 | 27 | |
17 | | -$( '#configure' ) |
18 | | - .children( 'fieldset' ) |
19 | | - .addClass( 'configsection' ) |
20 | | - .hide() |
21 | | - .children( 'legend' ) |
22 | | - .each( function( i ) { |
23 | | - $( this ).parent().attr( 'id', 'config-section-' + i ); |
24 | | - if ( i === 0 ) { |
25 | | - $( this ).parent().show(); |
26 | | - } |
| 28 | + var item = $( '<li></li>' ) |
| 29 | + .addClass( i === 0 ? 'selected' : null ) |
| 30 | + .append( |
| 31 | + $( '<a></a>' ) |
| 32 | + .text( $( this ).text() ) |
| 33 | + .attr( 'href', '#config-section-' + i ) |
| 34 | + .mousedown( function( e ) { |
| 35 | + $( this ).parent().parent().find( 'li' ).removeClass( 'selected' ); |
| 36 | + $( this ).parent().addClass( 'selected' ); |
| 37 | + e.preventDefault(); |
| 38 | + return false; |
| 39 | + } ) |
| 40 | + .click( function( e ) { |
| 41 | + $( '#configure > fieldset' ).hide(); |
| 42 | + $( '#config-section-' + i ).show(); |
| 43 | + $( '#config-section-' + i + ' h2' ).show(); |
| 44 | + $( '#config-section-' + i + ' .configure-table' ).show(); |
| 45 | + e.preventDefault(); |
| 46 | + return false; |
| 47 | + } ) |
| 48 | + ); |
27 | 49 | |
28 | | - var item = $( '<li></li>' ) |
29 | | - .addClass( i === 0 ? 'selected' : null ) |
30 | | - .append( |
31 | | - $( '<a></a>' ) |
32 | | - .text( $( this ).text() ) |
33 | | - .attr( 'href', '#config-section-' + i ) |
| 50 | + $( this ).parent().find( 'table.configure-table' ).each( function( j ) { |
| 51 | + $( this ).attr( 'id', 'config-table-' + i + '-' + j ); |
| 52 | + } ); |
| 53 | + |
| 54 | + var heads = $( this ).parent().find( 'h2' ) |
| 55 | + if ( heads.length > 1 ) { |
| 56 | + var sub = $( '<ul></ul>' ).hide(); |
| 57 | + |
| 58 | + heads.each( function( j ) { |
| 59 | + $( this ).attr( 'id', 'config-head-' + i + '-' + j ); |
| 60 | + sub.append( |
| 61 | + $( '<li></li>' ) |
| 62 | + .addClass( i === 0 ? 'selected' : null ) |
| 63 | + .append( |
| 64 | + $( '<a></a>' ) |
| 65 | + .text( $( this ).text() ) |
| 66 | + .attr( 'href', '#config-table-' + i + '-' + j ) |
| 67 | + .mousedown( function( e ) { |
| 68 | + $( this ).parent().parent().find( 'li' ).removeClass( 'selected' ); |
| 69 | + $( this ).parent().addClass( 'selected' ); |
| 70 | + $( this ).parent().parent().parent().parent().find( 'li' ).removeClass( 'selected' ); |
| 71 | + $( this ).parent().parent().parent().addClass( 'selected' ); |
| 72 | + e.preventDefault(); |
| 73 | + return false; |
| 74 | + } ) |
| 75 | + .click( function( e ) { |
| 76 | + $( '#configure > fieldset' ).hide(); |
| 77 | + $( '#config-section-' + i ).show(); |
| 78 | + $( '#config-section-' + i + ' h2' ).hide(); |
| 79 | + $( '#config-section-' + i + ' .configure-table' ).hide(); |
| 80 | + $( '#config-head-' + i + '-' + j ).show(); |
| 81 | + $( '#config-table-' + i + '-' + j ).show(); |
| 82 | + e.preventDefault(); |
| 83 | + return false; |
| 84 | + } ) |
| 85 | + ) ); |
| 86 | + } ); |
| 87 | + |
| 88 | + item.append( sub ); |
| 89 | + item.prepend( $( '<a></a>' ) |
| 90 | + .text( '[+]' ) |
| 91 | + .attr( 'href', 'javascript:' ) |
34 | 92 | .mousedown( function( e ) { |
35 | | - $( this ).parent().parent().find( 'li' ).removeClass( 'selected' ); |
36 | | - $( this ).parent().addClass( 'selected' ); |
37 | 93 | e.preventDefault(); |
38 | 94 | return false; |
39 | 95 | } ) |
40 | 96 | .click( function( e ) { |
41 | | - $( '#configure > fieldset' ).hide(); |
42 | | - $( '#config-section-' + i ).show(); |
43 | | - $( '#config-section-' + i + ' h2' ).show(); |
44 | | - $( '#config-section-' + i + ' .configure-table' ).show(); |
45 | | - e.preventDefault(); |
46 | | - return false; |
47 | | - } ) |
48 | | - ); |
| 97 | + if ( sub.css( 'display' ) == 'none' ) { |
| 98 | + sub.show(); |
| 99 | + $(this).text( '[-]' ); |
| 100 | + } else { |
| 101 | + sub.hide(); |
| 102 | + $(this).text( '[+]' ); |
| 103 | + } |
| 104 | + } ) ); |
| 105 | + } |
49 | 106 | |
50 | | - $( this ).parent().find( 'table.configure-table' ).each( function( j ) { |
51 | | - $( this ).attr( 'id', 'config-table-' + i + '-' + j ); |
| 107 | + $( '#configtoc' ).append( item ); |
52 | 108 | } ); |
53 | 109 | |
54 | | - var heads = $( this ).parent().find( 'h2' ) |
55 | | - if ( heads.length > 1 ) { |
56 | | - var sub = $( '<ul></ul>' ).hide(); |
| 110 | + $( '.config-col-toc' ).append( |
| 111 | + $( '<a></a>' ) |
| 112 | + .css( 'align', 'right' ) |
| 113 | + .attr( 'href', 'javascript:;' ) |
| 114 | + .append( $( '<img />' ) |
| 115 | + .attr( 'src', stylepath + '/common/images/Arr_l.png' ) |
| 116 | + ) |
| 117 | + .mousedown( function( e ) { |
| 118 | + e.preventDefault(); |
| 119 | + return false; |
| 120 | + } ) |
| 121 | + .click( function( e ) { |
| 122 | + if ( $( '#configtoc' ).css( 'display' ) == 'none' ) { |
| 123 | + $( '#configtoc' ).show(); |
| 124 | + $( this ).children( 'img' ).remove(); |
| 125 | + $( this ).append( $( '<img />' ) |
| 126 | + .attr( 'src', stylepath + '/common/images/Arr_l.png' ) |
| 127 | + ); |
| 128 | + } else { |
| 129 | + $( '#configtoc' ).hide(); |
| 130 | + $( this ).children( 'img' ).remove(); |
| 131 | + $( this ).append( $( '<img />' ) |
| 132 | + .attr( 'src', stylepath + '/common/images/Arr_r.png' ) |
| 133 | + ); |
| 134 | + } |
| 135 | + e.preventDefault(); |
| 136 | + return false; |
| 137 | + } |
| 138 | + ) |
| 139 | + ); |
57 | 140 | |
58 | | - heads.each( function( j ) { |
59 | | - $( this ).attr( 'id', 'config-head-' + i + '-' + j ); |
60 | | - sub.append( |
61 | | - $( '<li></li>' ) |
62 | | - .addClass( i === 0 ? 'selected' : null ) |
63 | | - .append( |
64 | | - $( '<a></a>' ) |
65 | | - .text( $( this ).text() ) |
66 | | - .attr( 'href', '#config-table-' + i + '-' + j ) |
67 | | - .mousedown( function( e ) { |
68 | | - $( this ).parent().parent().find( 'li' ).removeClass( 'selected' ); |
69 | | - $( this ).parent().addClass( 'selected' ); |
70 | | - $( this ).parent().parent().parent().parent().find( 'li' ).removeClass( 'selected' ); |
71 | | - $( this ).parent().parent().parent().addClass( 'selected' ); |
72 | | - e.preventDefault(); |
73 | | - return false; |
74 | | - } ) |
75 | | - .click( function( e ) { |
76 | | - $( '#configure > fieldset' ).hide(); |
77 | | - $( '#config-section-' + i ).show(); |
78 | | - $( '#config-section-' + i + ' h2' ).hide(); |
79 | | - $( '#config-section-' + i + ' .configure-table' ).hide(); |
80 | | - $( '#config-head-' + i + '-' + j ).show(); |
81 | | - $( '#config-table-' + i + '-' + j ).show(); |
82 | | - e.preventDefault(); |
83 | | - return false; |
84 | | - } ) |
85 | | - ) ); |
86 | | - } ); |
| 141 | + // Associative tables |
| 142 | + // ------------------ |
87 | 143 | |
88 | | - item.append( sub ); |
89 | | - item.prepend( $( '<a></a>' ) |
90 | | - .text( '[+]' ) |
91 | | - .attr( 'href', 'javascript:' ) |
92 | | - .mousedown( function( e ) { |
93 | | - e.preventDefault(); |
94 | | - return false; |
95 | | - } ) |
96 | | - .click( function( e ) { |
97 | | - if ( sub.css( 'display' ) == 'none' ) { |
98 | | - sub.show(); |
99 | | - $(this).text( '[-]' ); |
100 | | - } else { |
101 | | - sub.hide(); |
102 | | - $(this).text( '[+]' ); |
103 | | - } |
104 | | - } ) ); |
105 | | - } |
106 | | - |
107 | | - $( '#configtoc' ).append( item ); |
108 | | - } ); |
109 | | - |
110 | | -$( '.config-col-toc' ).append( |
111 | | - $( '<a></a>' ) |
112 | | - .css( 'align', 'right' ) |
113 | | - .attr( 'href', 'javascript:;' ) |
114 | | - .append( $( '<img />' ) |
115 | | - .attr( 'src', stylepath + '/common/images/Arr_l.png' ) |
116 | | - ) |
117 | | - .mousedown( function( e ) { |
118 | | - e.preventDefault(); |
119 | | - return false; |
120 | | - } ) |
121 | | - .click( function( e ) { |
122 | | - if ( $( '#configtoc' ).css( 'display' ) == 'none' ) { |
123 | | - $( '#configtoc' ).show(); |
124 | | - $( this ).children( 'img' ).remove(); |
125 | | - $( this ).append( $( '<img />' ) |
126 | | - .attr( 'src', stylepath + '/common/images/Arr_l.png' ) |
127 | | - ); |
128 | | - } else { |
129 | | - $( '#configtoc' ).hide(); |
130 | | - $( this ).children( 'img' ).remove(); |
131 | | - $( this ).append( $( '<img />' ) |
132 | | - .attr( 'src', stylepath + '/common/images/Arr_r.png' ) |
133 | | - ); |
| 144 | + /** |
| 145 | + * Fix an associative table |
| 146 | + */ |
| 147 | + window.fixAssocTable = function( table ){ |
| 148 | + var startName = 'wp' + table.attr( 'id' ); |
| 149 | + table.chidren( 'tr' ).each( function( i ) { |
| 150 | + if ( i == 0 ) { |
| 151 | + return; |
134 | 152 | } |
135 | | - e.preventDefault(); |
136 | | - return false; |
137 | | - } |
138 | | - ) |
139 | | -); |
| 153 | + var inputs = $( this ).chidren( 'input' ); |
| 154 | + inputs[0].attr( 'name', startName + '-key-' + (i - 1) ); |
| 155 | + inputs[1].attr( 'name', startName + '-val-' + (i - 1) ); |
| 156 | + } ); |
| 157 | + } |
140 | 158 | |
141 | | -// Associative tables |
142 | | -// ------------------ |
| 159 | + $( '#configure table.assoc' ).each( function() { |
| 160 | + var table = $( this ); |
143 | 161 | |
144 | | -/** |
145 | | - * Fix an associative table |
146 | | - */ |
147 | | -window.fixAssocTable = function( table ){ |
148 | | - var startName = 'wp' + table.attr( 'id' ); |
149 | | - table.chidren( 'tr' ).each( function( i ) { |
150 | | - if ( i == 0 ) { |
| 162 | + if ( table.hasClass( 'disabled' ) ) { |
151 | 163 | return; |
152 | 164 | } |
153 | | - var inputs = $( this ).chidren( 'input' ); |
154 | | - inputs[0].attr( 'name', startName + '-key-' + (i - 1) ); |
155 | | - inputs[1].attr( 'name', startName + '-val-' + (i - 1) ); |
156 | | - } ); |
157 | | -} |
158 | | - |
159 | | -$( '#configure table.assoc' ).each( function() { |
160 | | - var table = $( this ); |
161 | | - |
162 | | - if ( table.hasClass( 'disabled' ) ) { |
163 | | - return; |
164 | | - } |
165 | | - table.children( 'tr' ).each( function( i ) { |
166 | | - if ( i == 0 ) { |
167 | | - $( this ).append( $( '<th></th>' ).text( mediaWiki.msg( 'configure-js-remove-row' ) ) ); |
168 | | - } else { |
169 | | - $( this ).append( |
170 | | - $( '<td></td>' ) |
171 | | - .addClass( 'button' ) |
172 | | - .append( |
173 | | - $( '<input></input>' ) |
174 | | - .attr( 'type', 'button' ) |
175 | | - .attr( 'value', mediaWiki.msg( 'configure-js-remove-row' ) ) |
176 | | - .click( function() { |
177 | | - $( this ).parent().parent().remove(); |
178 | | - fixAssocTable( table ); |
179 | | - } ) |
180 | | - ) |
181 | | - ); |
182 | | - } |
183 | | - } ); |
184 | | - table.parent().append( |
185 | | - $( '<input></input>' ) |
186 | | - .attr( 'type', 'button' ) |
187 | | - .attr( 'value', mediaWiki.msg( 'configure-js-add' ) ) |
188 | | - .addClass( 'button' ) |
189 | | - .click( function() { |
190 | | - table.append( |
191 | | - $( '<tr></tr>' ) |
| 165 | + table.children( 'tr' ).each( function( i ) { |
| 166 | + if ( i == 0 ) { |
| 167 | + $( this ).append( $( '<th></th>' ).text( mediaWiki.msg( 'configure-js-remove-row' ) ) ); |
| 168 | + } else { |
| 169 | + $( this ).append( |
| 170 | + $( '<td></td>' ) |
| 171 | + .addClass( 'button' ) |
192 | 172 | .append( |
193 | | - $( '<td></td>' ) |
194 | | - .append( |
195 | | - $( '<input></input>' ) |
196 | | - .attr( 'type', 'text' ) |
197 | | - ) |
| 173 | + $( '<input></input>' ) |
| 174 | + .attr( 'type', 'button' ) |
| 175 | + .attr( 'value', mediaWiki.msg( 'configure-js-remove-row' ) ) |
| 176 | + .click( function() { |
| 177 | + $( this ).parent().parent().remove(); |
| 178 | + fixAssocTable( table ); |
| 179 | + } ) |
198 | 180 | ) |
199 | | - .append( |
200 | | - $( '<td></td>' ) |
201 | | - .append( |
202 | | - $( '<input></input>' ) |
203 | | - .attr( 'type', 'text' ) |
204 | | - ) |
205 | | - ) |
206 | | - .append( |
207 | | - $( '<td></td>' ) |
208 | | - .append( |
209 | | - $( '<input></input>' ) |
210 | | - .attr( 'type', 'button' ) |
211 | | - .attr( 'value', mediaWiki.msg( 'configure-js-remove-row' ) ) |
212 | | - .click( function() { |
213 | | - $( this ).parent().parent().remove(); |
214 | | - fixAssocTable( table ); |
215 | | - } ) |
216 | | - ) |
217 | | - ) |
218 | 181 | ); |
219 | | - fixAssocTable( table ); |
220 | | - } ) |
221 | | - ); |
222 | | -} ); |
| 182 | + } |
| 183 | + } ); |
| 184 | + table.parent().append( |
| 185 | + $( '<input></input>' ) |
| 186 | + .attr( 'type', 'button' ) |
| 187 | + .attr( 'value', mediaWiki.msg( 'configure-js-add' ) ) |
| 188 | + .addClass( 'button' ) |
| 189 | + .click( function() { |
| 190 | + table.append( |
| 191 | + $( '<tr></tr>' ) |
| 192 | + .append( |
| 193 | + $( '<td></td>' ) |
| 194 | + .append( |
| 195 | + $( '<input></input>' ) |
| 196 | + .attr( 'type', 'text' ) |
| 197 | + ) |
| 198 | + ) |
| 199 | + .append( |
| 200 | + $( '<td></td>' ) |
| 201 | + .append( |
| 202 | + $( '<input></input>' ) |
| 203 | + .attr( 'type', 'text' ) |
| 204 | + ) |
| 205 | + ) |
| 206 | + .append( |
| 207 | + $( '<td></td>' ) |
| 208 | + .append( |
| 209 | + $( '<input></input>' ) |
| 210 | + .attr( 'type', 'button' ) |
| 211 | + .attr( 'value', mediaWiki.msg( 'configure-js-remove-row' ) ) |
| 212 | + .click( function() { |
| 213 | + $( this ).parent().parent().remove(); |
| 214 | + fixAssocTable( table ); |
| 215 | + } ) |
| 216 | + ) |
| 217 | + ) |
| 218 | + ); |
| 219 | + fixAssocTable( table ); |
| 220 | + } ) |
| 221 | + ); |
| 222 | + } ); |
223 | 223 | |
224 | | -// Images |
225 | | -// ------ |
| 224 | + // Images |
| 225 | + // ------ |
226 | 226 | |
227 | | -$( '.image-selector' ).blur( function() { |
228 | | - var data = { |
229 | | - 'action': 'query', |
230 | | - 'titles': $( this ).attr( 'value' ), |
231 | | - 'prop': 'imageinfo', |
232 | | - 'iiprop': 'url', |
233 | | - 'format': 'json' |
234 | | - }; |
235 | | - var input = $( this ); |
236 | | - $.getJSON( |
237 | | - mw.config.get( 'wgScriptPath' ) + '/api' + mw.config.get( 'wgScriptExtension' ), |
238 | | - data, |
239 | | - function( obj ) { |
240 | | - var found = false; |
241 | | - for ( var i in obj.query.pages ) { |
242 | | - if( obj.query.pages[i].imageinfo && obj.query.pages[i].imageinfo[0].url ) { |
243 | | - $( '#image-url-preview-' + input.attr( 'id' ).substr( 18 ) ).attr( 'src', obj.query.pages[i].imageinfo[0].url ); |
244 | | - found = true; |
| 227 | + $( '.image-selector' ).blur( function() { |
| 228 | + var data = { |
| 229 | + 'action': 'query', |
| 230 | + 'titles': $( this ).attr( 'value' ), |
| 231 | + 'prop': 'imageinfo', |
| 232 | + 'iiprop': 'url', |
| 233 | + 'format': 'json' |
| 234 | + }; |
| 235 | + var input = $( this ); |
| 236 | + $.getJSON( |
| 237 | + mw.config.get( 'wgScriptPath' ) + '/api' + mw.config.get( 'wgScriptExtension' ), |
| 238 | + data, |
| 239 | + function( obj ) { |
| 240 | + var found = false; |
| 241 | + for ( var i in obj.query.pages ) { |
| 242 | + if( obj.query.pages[i].imageinfo && obj.query.pages[i].imageinfo[0].url ) { |
| 243 | + $( '#image-url-preview-' + input.attr( 'id' ).substr( 18 ) ).attr( 'src', obj.query.pages[i].imageinfo[0].url ); |
| 244 | + found = true; |
| 245 | + } |
245 | 246 | } |
| 247 | + if ( !found ) { |
| 248 | + $( '#image-url-preview-' + input.attr( 'id' ).substr( 18 ) ).attr( 'src', input.attr( 'value' ) ); |
| 249 | + } |
246 | 250 | } |
247 | | - if ( !found ) { |
248 | | - $( '#image-url-preview-' + input.attr( 'id' ).substr( 18 ) ).attr( 'src', input.attr( 'value' ) ); |
249 | | - } |
250 | | - } |
251 | | - ); |
252 | | -} ); |
253 | | - |
254 | | -// $wgGroupPermissions and $wgAutopromote stuff, only if ajax is enabled |
255 | | -// --------------------------------------------------------------------- |
256 | | - |
257 | | -$( '.ajax-group' ).each( function() { |
258 | | - var table = $( this ); |
259 | | - // Button "remove this row" |
260 | | - table.children( 'tr' ).each( function( i ) { |
261 | | - if ( i == 0 ) { |
262 | | - $( this ).append( $( '<th></th>' ).text( mediaWiki.msg( 'configure-js-remove' ) ) ); |
263 | | - } else { |
264 | | - $( this ).append( |
265 | | - $( '<td></td>' ) |
266 | | - .addClass( 'button' ) |
267 | | - .append( |
268 | | - $( '<input></input>' ) |
269 | | - .attr( 'type', 'button' ) |
270 | | - .attr( 'value', mediaWiki.msg( 'configure-js-remove-row' ) ) |
271 | | - .click( function() { |
272 | | - $( this ).parent().parent().remove(); |
273 | | - } ) |
274 | | - ) |
275 | | - ); |
276 | | - } |
| 251 | + ); |
277 | 252 | } ); |
278 | | - // Button "add a new row" |
279 | | - table.parent().append( |
280 | | - $( '<input></input>' ) |
281 | | - .addClass( 'button-add' ) |
282 | | - .attr( 'type', 'button' ) |
283 | | - .attr( 'value', mediaWiki.msg( 'configure-js-add' ) ) |
284 | | - .click( function() { |
285 | | - var groupname = prompt( mediaWiki.msg( 'configure-js-prompt-group' ) ); |
286 | | - if( groupname == null ) |
287 | | - return; |
288 | 253 | |
289 | | - var data = { |
290 | | - 'action': 'configure', |
291 | | - 'prop': 'ajax', |
292 | | - 'format': 'json', |
293 | | - 'ajaxgroup': groupname, |
294 | | - 'ajaxsetting': table.attr( 'id' ) |
295 | | - }; |
| 254 | + // $wgGroupPermissions and $wgAutopromote stuff, only if ajax is enabled |
| 255 | + // --------------------------------------------------------------------- |
296 | 256 | |
297 | | - $.getJSON( |
298 | | - mw.config.get( 'wgScriptPath' ) + '/api' + mw.config.get( 'wgScriptExtension' ), |
299 | | - data, |
300 | | - function( obj ) { |
301 | | - if ( obj.configure.ajax ) { |
302 | | - var resp = obj.configure.ajax; |
303 | | - error = false; |
304 | | - table.append( |
305 | | - $( '<tr></tr>' ) |
306 | | - .addClass( 'configure-maintable-row' ) |
307 | | - .attr( 'id', 'wp' + table.attr( 'id' ) + groupname ) |
308 | | - .append( $( '<td></td>' ).text( groupname ) ) |
309 | | - .append( $( '<td></td>' ).html( resp ) ) |
310 | | - .append( |
311 | | - $( '<td></td>' ) |
312 | | - .append( |
313 | | - $( '<input></input>' ) |
314 | | - .attr( 'type', 'button' ) |
315 | | - .attr( 'value', mediaWiki.msg( 'configure-js-remove-row' ) ) |
316 | | - .click( function() { |
317 | | - $( this ).parent().parent().remove(); |
318 | | - } ) |
319 | | - ) |
320 | | - ) |
321 | | - ); |
322 | | - } else { |
323 | | - alert( mediaWiki.msg( 'configure-js-group-exists' ) ); |
324 | | - } |
325 | | - } |
326 | | - ); |
327 | | - } ) |
328 | | - ); |
329 | | -} ); |
330 | | - |
331 | | -$( '#configure-form' ).submit( function(){ |
332 | 257 | $( '.ajax-group' ).each( function() { |
333 | 258 | var table = $( this ); |
334 | | - var cont = ''; |
335 | | - table.children( 'tr.configure-maintable-row' ).each( function() { |
336 | | - if( cont != '' ) cont += "\n"; |
337 | | - cont += $( this ).attr( 'id' ); |
| 259 | + // Button "remove this row" |
| 260 | + table.children( 'tr' ).each( function( i ) { |
| 261 | + if ( i == 0 ) { |
| 262 | + $( this ).append( $( '<th></th>' ).text( mediaWiki.msg( 'configure-js-remove' ) ) ); |
| 263 | + } else { |
| 264 | + $( this ).append( |
| 265 | + $( '<td></td>' ) |
| 266 | + .addClass( 'button' ) |
| 267 | + .append( |
| 268 | + $( '<input></input>' ) |
| 269 | + .attr( 'type', 'button' ) |
| 270 | + .attr( 'value', mediaWiki.msg( 'configure-js-remove-row' ) ) |
| 271 | + .click( function() { |
| 272 | + $( this ).parent().parent().remove(); |
| 273 | + } ) |
| 274 | + ) |
| 275 | + ); |
| 276 | + } |
338 | 277 | } ); |
| 278 | + // Button "add a new row" |
339 | 279 | table.parent().append( |
340 | 280 | $( '<input></input>' ) |
341 | | - .attr( 'type', 'hidden' ) |
342 | | - .attr( 'name', 'wp' + table.attr( 'id' ) + '-vals' ) |
343 | | - .attr( 'value', cont ) |
| 281 | + .addClass( 'button-add' ) |
| 282 | + .attr( 'type', 'button' ) |
| 283 | + .attr( 'value', mediaWiki.msg( 'configure-js-add' ) ) |
| 284 | + .click( function() { |
| 285 | + var groupname = prompt( mediaWiki.msg( 'configure-js-prompt-group' ) ); |
| 286 | + if( groupname == null ) |
| 287 | + return; |
| 288 | + |
| 289 | + var data = { |
| 290 | + 'action': 'configure', |
| 291 | + 'prop': 'ajax', |
| 292 | + 'format': 'json', |
| 293 | + 'ajaxgroup': groupname, |
| 294 | + 'ajaxsetting': table.attr( 'id' ) |
| 295 | + }; |
| 296 | + |
| 297 | + $.getJSON( |
| 298 | + mw.config.get( 'wgScriptPath' ) + '/api' + mw.config.get( 'wgScriptExtension' ), |
| 299 | + data, |
| 300 | + function( obj ) { |
| 301 | + if ( obj.configure.ajax ) { |
| 302 | + var resp = obj.configure.ajax; |
| 303 | + error = false; |
| 304 | + table.append( |
| 305 | + $( '<tr></tr>' ) |
| 306 | + .addClass( 'configure-maintable-row' ) |
| 307 | + .attr( 'id', 'wp' + table.attr( 'id' ) + groupname ) |
| 308 | + .append( $( '<td></td>' ).text( groupname ) ) |
| 309 | + .append( $( '<td></td>' ).html( resp ) ) |
| 310 | + .append( |
| 311 | + $( '<td></td>' ) |
| 312 | + .append( |
| 313 | + $( '<input></input>' ) |
| 314 | + .attr( 'type', 'button' ) |
| 315 | + .attr( 'value', mediaWiki.msg( 'configure-js-remove-row' ) ) |
| 316 | + .click( function() { |
| 317 | + $( this ).parent().parent().remove(); |
| 318 | + } ) |
| 319 | + ) |
| 320 | + ) |
| 321 | + ); |
| 322 | + } else { |
| 323 | + alert( mediaWiki.msg( 'configure-js-group-exists' ) ); |
| 324 | + } |
| 325 | + } |
| 326 | + ); |
| 327 | + } ) |
344 | 328 | ); |
345 | 329 | } ); |
346 | | -} ); |
347 | 330 | |
348 | | -// Big lists |
349 | | -// --------- |
350 | | - |
351 | | -// Summarise the setting contained in 'div' to the summary field 'summary'. |
352 | | -window.summariseSetting = function( div ) { |
353 | | - |
354 | | - if ( div.hasClass( 'assoc' ) ) { |
355 | | - // If it's too big to display as an associative array, it's too big to display as a summary. |
356 | | - return ''; |
357 | | - } else if ( div.hasClass( 'ns-bool' ) || div.hasClass( 'ns-simple' ) || div.hasClass( 'group-bool-element' ) || div.hasClass( 'group-array-element' ) ) { |
358 | | - var matches = []; |
359 | | - div.find( 'label' ).each( function() { |
360 | | - if ( $( '#' + $( this ).attr( 'for' ) ).attr( 'checked' ) ) { |
361 | | - matches.push( $( this ).text() ); |
362 | | - } |
| 331 | + $( '#configure-form' ).submit( function(){ |
| 332 | + $( '.ajax-group' ).each( function() { |
| 333 | + var table = $( this ); |
| 334 | + var cont = ''; |
| 335 | + table.children( 'tr.configure-maintable-row' ).each( function() { |
| 336 | + if( cont != '' ) cont += "\n"; |
| 337 | + cont += $( this ).attr( 'id' ); |
| 338 | + } ); |
| 339 | + table.parent().append( |
| 340 | + $( '<input></input>' ) |
| 341 | + .attr( 'type', 'hidden' ) |
| 342 | + .attr( 'name', 'wp' + table.attr( 'id' ) + '-vals' ) |
| 343 | + .attr( 'value', cont ) |
| 344 | + ); |
363 | 345 | } ); |
364 | | - return matches.join( ', ' ); |
365 | | - } else if ( div.hasClass( 'ns-array' ) || div.hasClass( 'ns-text' ) || div.hasClass( 'configure-rate-limits-action' ) ) { |
366 | | - // Basic strategy: find all labels, and list the values of their corresponding inputs, if those inputs have a value |
| 346 | + } ); |
367 | 347 | |
368 | | - var body = $( '<tbody></tbody>' ) |
369 | | - .append( $( '<tr></tr>' ) |
370 | | - .append( $( '<th></th>' ).text( div.find( 'th:first' ).text() ) ) |
371 | | - .append( $( '<th></th>' ).text( div.find( 'th:last' ).text() ) ) |
372 | | - ); |
| 348 | + // Big lists |
| 349 | + // --------- |
373 | 350 | |
374 | | - var rows = false; |
| 351 | + // Summarise the setting contained in 'div' to the summary field 'summary'. |
| 352 | + window.summariseSetting = function( div ) { |
375 | 353 | |
376 | | - if ( div.hasClass( 'configure-rate-limits-action' ) ) { |
377 | | - div.find( 'tr' ).each( function( i ) { |
378 | | - if ( i == 0 ) { |
379 | | - return; |
| 354 | + if ( div.hasClass( 'assoc' ) ) { |
| 355 | + // If it's too big to display as an associative array, it's too big to display as a summary. |
| 356 | + return ''; |
| 357 | + } else if ( div.hasClass( 'ns-bool' ) || div.hasClass( 'ns-simple' ) || div.hasClass( 'group-bool-element' ) || div.hasClass( 'group-array-element' ) ) { |
| 358 | + var matches = []; |
| 359 | + div.find( 'label' ).each( function() { |
| 360 | + if ( $( '#' + $( this ).attr( 'for' ) ).attr( 'checked' ) ) { |
| 361 | + matches.push( $( this ).text() ); |
380 | 362 | } |
381 | | - var typeDesc = $( this ).find( 'td:first' ).text(); |
382 | | - var periodField = $( '#' + $( this ).attr( 'id' ) + '-period' ); |
383 | | - var countField = $( '#' + $( this ).attr( 'id' ) + '-count' ); |
| 363 | + } ); |
| 364 | + return matches.join( ', ' ); |
| 365 | + } else if ( div.hasClass( 'ns-array' ) || div.hasClass( 'ns-text' ) || div.hasClass( 'configure-rate-limits-action' ) ) { |
| 366 | + // Basic strategy: find all labels, and list the values of their corresponding inputs, if those inputs have a value |
384 | 367 | |
385 | | - if ( periodField.attr( 'value' ) > 0 ) { |
386 | | - rows = true; |
| 368 | + var body = $( '<tbody></tbody>' ) |
| 369 | + .append( $( '<tr></tr>' ) |
| 370 | + .append( $( '<th></th>' ).text( div.find( 'th:first' ).text() ) ) |
| 371 | + .append( $( '<th></th>' ).text( div.find( 'th:last' ).text() ) ) |
| 372 | + ); |
387 | 373 | |
388 | | - body.append( $( '<tr></tr>' ) |
389 | | - .append( $( '<td></td>' ).text( typeDesc ) ) |
390 | | - .append( $( '<td></td>' ).text( mediaWiki.msg( |
391 | | - 'configure-throttle-summary', countField.attr( 'value' ), periodField.attr( 'value' ) ) ) ) |
392 | | - ); |
393 | | - } |
394 | | - } ); |
395 | | - } else { |
396 | | - div.find( 'label' ).each( function( i ) { |
397 | | - if ( i == 0 ) { |
398 | | - return; |
399 | | - } |
400 | | - var arrayfield = $( '#' + $( this ).attr( 'for' ) ); |
401 | | - if ( arrayfield.attr( 'value' ) > 0 ) { |
402 | | - rows = true; |
| 374 | + var rows = false; |
403 | 375 | |
404 | | - body.append( $( '<tr></tr>' ) |
405 | | - .append( $( '<td></td>' ).text( $( this ).text() ) ) |
406 | | - .append( $( '<td></td>' ).text( arrayfield.attr( 'value' ) ) ) |
407 | | - ); |
408 | | - } |
409 | | - } ); |
410 | | - } |
| 376 | + if ( div.hasClass( 'configure-rate-limits-action' ) ) { |
| 377 | + div.find( 'tr' ).each( function( i ) { |
| 378 | + if ( i == 0 ) { |
| 379 | + return; |
| 380 | + } |
| 381 | + var typeDesc = $( this ).find( 'td:first' ).text(); |
| 382 | + var periodField = $( '#' + $( this ).attr( 'id' ) + '-period' ); |
| 383 | + var countField = $( '#' + $( this ).attr( 'id' ) + '-count' ); |
411 | 384 | |
412 | | - if ( !rows ) { |
413 | | - body.append( $( '<tr></tr>' ) |
414 | | - .append( $( '<th></th>' ) |
415 | | - .attr( 'colspan', 2 ) |
416 | | - .text( mediaWiki.msg( 'configure-js-summary-none' ) ) |
417 | | - ) |
418 | | - ); |
419 | | - } |
| 385 | + if ( periodField.attr( 'value' ) > 0 ) { |
| 386 | + rows = true; |
420 | 387 | |
421 | | - return $( '<table></table>' ).addClass( 'assoc' ).append( body ).html(); |
422 | | - } else if ( div.hasClass( 'promotion-conds-element' ) || div.hasClass( 'configure-rate-limits-action' ) ) { |
423 | | - return ''; |
424 | | - } else { |
425 | | - return 'Useless type'; |
426 | | - } |
427 | | -} |
| 388 | + body.append( $( '<tr></tr>' ) |
| 389 | + .append( $( '<td></td>' ).text( typeDesc ) ) |
| 390 | + .append( $( '<td></td>' ).text( mediaWiki.msg( |
| 391 | + 'configure-throttle-summary', countField.attr( 'value' ), periodField.attr( 'value' ) ) ) ) |
| 392 | + ); |
| 393 | + } |
| 394 | + } ); |
| 395 | + } else { |
| 396 | + div.find( 'label' ).each( function( i ) { |
| 397 | + if ( i == 0 ) { |
| 398 | + return; |
| 399 | + } |
| 400 | + var arrayfield = $( '#' + $( this ).attr( 'for' ) ); |
| 401 | + if ( arrayfield.attr( 'value' ) > 0 ) { |
| 402 | + rows = true; |
428 | 403 | |
429 | | -$( '.configure-biglist' ).each( function( l ) { |
430 | | - var list = $( this ); |
431 | | - var summary = $( '<div></div>' ) |
432 | | - .addClass( 'configure-biglist-summary' ) |
433 | | - .html( summariseSetting( list ) ); |
434 | | - var header = $( '<span></span>' ).text( mediaWiki.msg( 'configure-js-biglist-hidden' ) ); |
435 | | - var toogle = $( '<a></a>' ) |
436 | | - .addClass( 'configure-biglist-toggle-link' ) |
437 | | - .attr( 'href', 'javascript:' ) |
438 | | - .text( mediaWiki.msg( 'configure-js-biglist-show' ) ) |
439 | | - .click( function() { |
440 | | - if ( list.css( 'display' ) == 'none' ) { |
441 | | - toogle.text( mediaWiki.msg( 'configure-js-biglist-hide' ) ); |
442 | | - header.text( mediaWiki.msg( 'configure-js-biglist-shown' ) ); |
443 | | - list.show(); |
444 | | - summary.hide(); |
445 | | - } else { |
446 | | - toogle.text( mediaWiki.msg( 'configure-js-biglist-show' ) ); |
447 | | - header.text( mediaWiki.msg( 'configure-js-biglist-hidden' ) ); |
448 | | - list.hide(); |
449 | | - summary.html( summariseSetting( list ) ).show(); |
| 404 | + body.append( $( '<tr></tr>' ) |
| 405 | + .append( $( '<td></td>' ).text( $( this ).text() ) ) |
| 406 | + .append( $( '<td></td>' ).text( arrayfield.attr( 'value' ) ) ) |
| 407 | + ); |
| 408 | + } |
| 409 | + } ); |
450 | 410 | } |
451 | | - } ); |
452 | 411 | |
453 | | - list.hide(); |
454 | | - list.before( |
455 | | - $( '<div></div>' ) |
456 | | - .addClass( 'configure-biglist-placeholder' ) |
457 | | - .append( toogle ) |
458 | | - .append( header ) |
459 | | - ); |
460 | | - list.before( |
461 | | - summary |
462 | | - ); |
463 | | -} ); |
| 412 | + if ( !rows ) { |
| 413 | + body.append( $( '<tr></tr>' ) |
| 414 | + .append( $( '<th></th>' ) |
| 415 | + .attr( 'colspan', 2 ) |
| 416 | + .text( mediaWiki.msg( 'configure-js-summary-none' ) ) |
| 417 | + ) |
| 418 | + ); |
| 419 | + } |
464 | 420 | |
465 | | -// Search |
466 | | -// ------ |
| 421 | + return $( '<table></table>' ).addClass( 'assoc' ).append( body ).html(); |
| 422 | + } else if ( div.hasClass( 'promotion-conds-element' ) || div.hasClass( 'configure-rate-limits-action' ) ) { |
| 423 | + return ''; |
| 424 | + } else { |
| 425 | + return 'Useless type'; |
| 426 | + } |
| 427 | + } |
467 | 428 | |
468 | | -window.allSettings = undefined; |
| 429 | + $( '.configure-biglist' ).each( function( l ) { |
| 430 | + var list = $( this ); |
| 431 | + var summary = $( '<div></div>' ) |
| 432 | + .addClass( 'configure-biglist-summary' ) |
| 433 | + .html( summariseSetting( list ) ); |
| 434 | + var header = $( '<span></span>' ).text( mediaWiki.msg( 'configure-js-biglist-hidden' ) ); |
| 435 | + var toogle = $( '<a></a>' ) |
| 436 | + .addClass( 'configure-biglist-toggle-link' ) |
| 437 | + .attr( 'href', 'javascript:' ) |
| 438 | + .text( mediaWiki.msg( 'configure-js-biglist-show' ) ) |
| 439 | + .click( function() { |
| 440 | + if ( list.css( 'display' ) == 'none' ) { |
| 441 | + toogle.text( mediaWiki.msg( 'configure-js-biglist-hide' ) ); |
| 442 | + header.text( mediaWiki.msg( 'configure-js-biglist-shown' ) ); |
| 443 | + list.show(); |
| 444 | + summary.hide(); |
| 445 | + } else { |
| 446 | + toogle.text( mediaWiki.msg( 'configure-js-biglist-show' ) ); |
| 447 | + header.text( mediaWiki.msg( 'configure-js-biglist-hidden' ) ); |
| 448 | + list.hide(); |
| 449 | + summary.html( summariseSetting( list ) ).show(); |
| 450 | + } |
| 451 | + } ); |
469 | 452 | |
470 | | -( function() { |
471 | | - allSettings = []; |
| 453 | + list.hide(); |
| 454 | + list.before( |
| 455 | + $( '<div></div>' ) |
| 456 | + .addClass( 'configure-biglist-placeholder' ) |
| 457 | + .append( toogle ) |
| 458 | + .append( header ) |
| 459 | + ); |
| 460 | + list.before( |
| 461 | + summary |
| 462 | + ); |
| 463 | + } ); |
472 | 464 | |
473 | | - // For each section... |
474 | | - var rootElement = document.getElementById( 'configure' ); |
475 | | - var fieldsets = rootElement.getElementsByTagName( 'fieldset' ); |
476 | | - for( var fid=0; fid<fieldsets.length; ++fid ) { |
477 | | - // For each subsection... |
478 | | - var fieldset = fieldsets[fid]; |
479 | | - var fieldset_title = window.getInnerText( fieldset.getElementsByTagName( 'legend' )[0] ); |
480 | | - var subsections = getElementsByClassName( fieldset, 'table', 'configure-table' ); |
481 | | - for( var sid=0; sid<subsections.length; ++sid ) { |
482 | | - var subsection; |
483 | | - if (subsections[sid].getElementsByTagName( 'tbody' ).length > 0) { |
484 | | - subsection = subsections[sid].getElementsByTagName( 'tbody' )[0]; |
485 | | - } else { |
486 | | - subsection = subsections[sid]; |
487 | | - } |
488 | | - var heading = document.getElementById( subsection.parentNode.id.replace( 'config-table', 'config-head' ) ); |
| 465 | + // Search |
| 466 | + // ------ |
489 | 467 | |
490 | | - // For each setting... |
491 | | - for( var i=0; i<subsection.childNodes.length;++i ) { |
492 | | - var row = subsection.childNodes[i]; |
493 | | - if( typeof row.ELEMENT_NODE == "undefined" ){ |
494 | | - var wantedType = 1; // ELEMENT_NODE |
| 468 | + window.allSettings = undefined; |
| 469 | + |
| 470 | + ( function() { |
| 471 | + allSettings = []; |
| 472 | + |
| 473 | + // For each section... |
| 474 | + var rootElement = document.getElementById( 'configure' ); |
| 475 | + var fieldsets = rootElement.getElementsByTagName( 'fieldset' ); |
| 476 | + for( var fid=0; fid<fieldsets.length; ++fid ) { |
| 477 | + // For each subsection... |
| 478 | + var fieldset = fieldsets[fid]; |
| 479 | + var fieldset_title = window.getInnerText( fieldset.getElementsByTagName( 'legend' )[0] ); |
| 480 | + var subsections = getElementsByClassName( fieldset, 'table', 'configure-table' ); |
| 481 | + for( var sid=0; sid<subsections.length; ++sid ) { |
| 482 | + var subsection; |
| 483 | + if (subsections[sid].getElementsByTagName( 'tbody' ).length > 0) { |
| 484 | + subsection = subsections[sid].getElementsByTagName( 'tbody' )[0]; |
495 | 485 | } else { |
496 | | - var wantedType = row.ELEMENT_NODE; |
| 486 | + subsection = subsections[sid]; |
497 | 487 | } |
498 | | - if ( row.nodeType != wantedType || ( row.tagName != 'tr' && row.tagName != 'TR' ) ) { |
499 | | - continue; |
500 | | - } |
| 488 | + var heading = document.getElementById( subsection.parentNode.id.replace( 'config-table', 'config-head' ) ); |
501 | 489 | |
502 | | - var desc_cell = getElementsByClassName( row, 'td', 'configure-left-column' )[0]; |
503 | | - if( typeof desc_cell == "undefined" ){ |
504 | | - continue; |
505 | | - } |
| 490 | + // For each setting... |
| 491 | + for( var i=0; i<subsection.childNodes.length;++i ) { |
| 492 | + var row = subsection.childNodes[i]; |
| 493 | + if( typeof row.ELEMENT_NODE == "undefined" ){ |
| 494 | + var wantedType = 1; // ELEMENT_NODE |
| 495 | + } else { |
| 496 | + var wantedType = row.ELEMENT_NODE; |
| 497 | + } |
| 498 | + if ( row.nodeType != wantedType || ( row.tagName != 'tr' && row.tagName != 'TR' ) ) { |
| 499 | + continue; |
| 500 | + } |
506 | 501 | |
507 | | - var description; |
| 502 | + var desc_cell = getElementsByClassName( row, 'td', 'configure-left-column' )[0]; |
| 503 | + if( typeof desc_cell == "undefined" ){ |
| 504 | + continue; |
| 505 | + } |
508 | 506 | |
509 | | - if ( desc_cell.getElementsByTagName( 'p' ).length ) { // Ward off comments like "This setting has been customised" |
510 | | - description = window.getInnerText( desc_cell.getElementsByTagName( 'p' )[0] ); |
511 | | - } else { |
512 | | - description = window.getInnerText( desc_cell ); |
| 507 | + var description; |
| 508 | + |
| 509 | + if ( desc_cell.getElementsByTagName( 'p' ).length ) { // Ward off comments like "This setting has been customised" |
| 510 | + description = window.getInnerText( desc_cell.getElementsByTagName( 'p' )[0] ); |
| 511 | + } else { |
| 512 | + description = window.getInnerText( desc_cell ); |
| 513 | + } |
| 514 | + |
| 515 | + allSettings.push( { 'description': description.toLowerCase(), 'fid':fid+1, 'sid':sid, 'displayDescription': description } ); |
513 | 516 | } |
514 | | - |
515 | | - allSettings.push( { 'description': description.toLowerCase(), 'fid':fid+1, 'sid':sid, 'displayDescription': description } ); |
516 | 517 | } |
517 | 518 | } |
518 | | - } |
519 | | -} )(); |
| 519 | + } )(); |
520 | 520 | |
521 | | -$( '#configure-search-form' ).show(); |
522 | | -$( '#configure-search-input' ).keyup( function() { |
523 | | - var query = $( '#configure-search-input' ).attr( 'value' ).toLowerCase(); |
| 521 | + $( '#configure-search-form' ).show(); |
| 522 | + $( '#configure-search-input' ).keyup( function() { |
| 523 | + var query = $( '#configure-search-input' ).attr( 'value' ).toLowerCase(); |
524 | 524 | |
525 | | - $( '#configure-search-results' ).children( 'li' ).remove(); |
| 525 | + $( '#configure-search-results' ).children( 'li' ).remove(); |
526 | 526 | |
527 | | - if ( query == '' ) { |
528 | | - return; |
529 | | - } |
| 527 | + if ( query == '' ) { |
| 528 | + return; |
| 529 | + } |
530 | 530 | |
531 | | - var isMatch = function( element ) { return element.description.indexOf( query ) !== -1; } |
532 | | - for( var i=0; i<allSettings.length; ++i ) { |
533 | | - var data = allSettings[i]; |
534 | | - if ( isMatch( data ) ) { |
535 | | - $( '#configure-search-results' ).append( |
536 | | - $( '<li></li>' ).append( |
537 | | - $( '<a></a>' ) |
538 | | - .attr( 'href', '#config-head-'+data.fid+'-'+data.sid ) |
539 | | - .text( data.displayDescription ) |
540 | | - .click( function() { |
541 | | - $( '#configure > fieldset' ).hide(); |
542 | | - $( '#config-section-' + data.fid ).show(); |
543 | | - $( '#config-section-' + data.fid + ' h2' ).show(); |
544 | | - $( '#config-section-' + data.fid + ' .configure-table' ).show(); |
545 | | - } ) |
546 | | - ) |
547 | | - ); |
| 531 | + var isMatch = function( element ) { return element.description.indexOf( query ) !== -1; } |
| 532 | + for( var i=0; i<allSettings.length; ++i ) { |
| 533 | + var data = allSettings[i]; |
| 534 | + if ( isMatch( data ) ) { |
| 535 | + $( '#configure-search-results' ).append( |
| 536 | + $( '<li></li>' ).append( |
| 537 | + $( '<a></a>' ) |
| 538 | + .attr( 'href', '#config-head-'+data.fid+'-'+data.sid ) |
| 539 | + .text( data.displayDescription ) |
| 540 | + .click( function() { |
| 541 | + $( '#configure > fieldset' ).hide(); |
| 542 | + $( '#config-section-' + data.fid ).show(); |
| 543 | + $( '#config-section-' + data.fid + ' h2' ).show(); |
| 544 | + $( '#config-section-' + data.fid + ' .configure-table' ).show(); |
| 545 | + } ) |
| 546 | + ) |
| 547 | + ); |
| 548 | + } |
548 | 549 | } |
549 | | - } |
| 550 | + } ); |
550 | 551 | } ); |
Index: trunk/extensions/Math/modules/ext.math.mathjax.enabler.js |
— | — | @@ -83,4 +83,6 @@ |
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | | -mathJax.Init(); |
| 87 | +jQuery( document ).ready( function() { |
| 88 | + mathJax.Init(); |
| 89 | +} ); |
Index: trunk/extensions/FlaggedRevs/frontend/modules/ext.flaggedRevs.review.js |
— | — | @@ -412,7 +412,9 @@ |
413 | 413 | } |
414 | 414 | }; |
415 | 415 | |
416 | | -// Perform some onload (which is when this script is included) events: |
417 | | -fr.init(); |
| 416 | +// Perform some onload events: |
| 417 | +$(document).ready( function() { |
| 418 | + fr.init(); |
| 419 | +} ); |
418 | 420 | |
419 | 421 | })( jQuery ); |
Index: trunk/extensions/FlaggedRevs/frontend/modules/ext.flaggedRevs.advanced.js |
— | — | @@ -203,7 +203,9 @@ |
204 | 204 | } |
205 | 205 | }; |
206 | 206 | |
207 | | -// Perform some onload (which is when this script is included) events: |
208 | | -fr.init(); |
| 207 | +// Perform some onload events: |
| 208 | +$(document).ready( function() { |
| 209 | + fr.init(); |
| 210 | +} ); |
209 | 211 | |
210 | 212 | })( jQuery ); |
Index: trunk/extensions/FundraiserPortal/Templates/donateScripts.js |
— | — | @@ -38,9 +38,11 @@ |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | | -var wgDonateButton = getDonateButton(); |
| 42 | +jQuery( document ).ready( function() { |
| 43 | + var wgDonateButton = getDonateButton(); |
43 | 44 | |
44 | | -if ( ! wgDonateButton ) { |
45 | | - var wgDonateButton = pickDonateButton(); |
46 | | - setDonateButton( wgDonateButton ); |
47 | | -} |
| 45 | + if ( ! wgDonateButton ) { |
| 46 | + var wgDonateButton = pickDonateButton(); |
| 47 | + setDonateButton( wgDonateButton ); |
| 48 | + } |
| 49 | +} ); |
Index: trunk/extensions/ContributionTracking/modules/jquery.contributionTracking.js |
— | — | @@ -112,4 +112,6 @@ |
113 | 113 | |
114 | 114 | } )( jQuery ); |
115 | 115 | |
116 | | -$.bindAjaxControls(); |
\ No newline at end of file |
| 116 | +jQuery(document).ready( function() { |
| 117 | + $.bindAjaxControls(); |
| 118 | +} ); |
Index: trunk/extensions/InlineCategorizer/modules/ext.inlineCategorizer.init.js |
— | — | @@ -1,8 +1,8 @@ |
2 | | -/** |
3 | | - * Initialize an instance of InlineCategorizer into mw.page |
4 | | - */ |
5 | | -mw.page.inlineCategorizer = new mw.InlineCategorizer(); |
6 | 2 | jQuery( document ).ready( function(){ |
| 3 | + /** |
| 4 | + * Initialize an instance of InlineCategorizer into mw.page |
| 5 | + */ |
| 6 | + mw.page.inlineCategorizer = new mw.InlineCategorizer(); |
7 | 7 | // Separate function for call to prevent jQuery |
8 | 8 | // from executing it in the document context. |
9 | 9 | mw.page.inlineCategorizer.setup(); |
Index: trunk/extensions/InlineCategorizer/modules/ext.inlineCategorizer.core.js |
— | — | @@ -8,20 +8,23 @@ |
9 | 9 | * Relies on: mw.config (wgFormattedNamespaces, wgNamespaceIds, |
10 | 10 | * wgCaseSensitiveNamespaces, wgUserGroups), mw.util.wikiGetlink |
11 | 11 | */ |
12 | | -( function( $ ) { |
| 12 | +( function ($) { |
13 | 13 | |
14 | 14 | /* Local scope */ |
15 | 15 | |
16 | 16 | var catNsId = mw.config.get( 'wgNamespaceIds' ).category, |
17 | | - defaultOptions = { |
| 17 | + isCatNsSensitive = $.inArray( 14, mw.config.get( 'wgCaseSensitiveNamespaces' ) ) !== -1; |
| 18 | + |
| 19 | + function getDefaultOptions() { |
| 20 | + return { |
18 | 21 | catLinkWrapper: '<li>', |
19 | 22 | $container: $( '.catlinks' ), |
20 | 23 | $containerNormal: $( '#mw-normal-catlinks' ), |
21 | 24 | categoryLinkSelector: 'li a:not(.icon)', |
22 | 25 | multiEdit: $.inArray( 'user', mw.config.get( 'wgUserGroups' ) ) !== -1, |
23 | 26 | resolveRedirects: true |
24 | | - }, |
25 | | - isCatNsSensitive = $.inArray( 14, mw.config.get( 'wgCaseSensitiveNamespaces' ) ) !== -1; |
| 27 | + }; |
| 28 | + } |
26 | 29 | |
27 | 30 | /** |
28 | 31 | * @return {String} |
— | — | @@ -195,7 +198,7 @@ |
196 | 199 | */ |
197 | 200 | mw.InlineCategorizer = function( options ) { |
198 | 201 | |
199 | | - this.options = options = $.extend( defaultOptions, options ); |
| 202 | + this.options = options = $.extend( getDefaultOptions(), options ); |
200 | 203 | |
201 | 204 | // Save scope in shortcut |
202 | 205 | var ajaxcat = this; |
— | — | @@ -1149,4 +1152,4 @@ |
1150 | 1153 | } |
1151 | 1154 | }; |
1152 | 1155 | |
1153 | | -} )( jQuery ); |
| 1156 | +})(jQuery); |
Index: trunk/extensions/LiveTranslate/includes/ext.livetranslate.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /** |
3 | | - * JavasSript for the Live Translate extension. |
| 3 | + * JavaScript for the Live Translate extension. |
4 | 4 | * @see https://www.mediawiki.org/wiki/Extension:Live_Translate |
5 | 5 | * |
6 | 6 | * @licence GNU GPL v3 or later |
— | — | @@ -40,4 +40,4 @@ |
41 | 41 | |
42 | 42 | window.liveTranslate = lt; |
43 | 43 | |
44 | | -}() ); |
\ No newline at end of file |
| 44 | +}() ); |
Index: trunk/extensions/AbuseFilter/modules/ext.abuseFilter.edit.js |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | * |
9 | 9 | * @var {jQuery} |
10 | 10 | */ |
11 | | - var $filterBox = $( '#' + mw.config.get( 'abuseFilterBoxName' ) ); |
| 11 | + var $filterBox = []; |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Reference to this |
— | — | @@ -178,6 +178,7 @@ |
179 | 179 | * On ready initialization |
180 | 180 | */ |
181 | 181 | $( function( $ ) { |
| 182 | + $filterBox = $( '#' + mw.config.get( 'abuseFilterBoxName' ) ); |
182 | 183 | // Hide the syntax ok message when the text changes |
183 | 184 | $filterBox.keyup( function() { |
184 | 185 | var $el = $( '#mw-abusefilter-syntaxresult' ); |
Index: trunk/extensions/AbuseFilter/modules/ext.abuseFilter.examine.js |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | * |
14 | 14 | * @type {jQuery} |
15 | 15 | */ |
16 | | - var $syntaxResult = $( '#mw-abusefilter-syntaxresult' ); |
| 16 | + var $syntaxResult = []; |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Tests the filter against an rc event or abuse log entry |
— | — | @@ -84,6 +84,7 @@ |
85 | 85 | }; |
86 | 86 | |
87 | 87 | $( function( $ ) { |
| 88 | + $syntaxResult = $( '#mw-abusefilter-syntaxresult' ); |
88 | 89 | $( '#mw-abusefilter-examine-test' ).click( that.examinerTestFilter ); |
89 | 90 | } ); |
90 | | -} )( jQuery, mediaWiki ); |
\ No newline at end of file |
| 91 | +} )( jQuery, mediaWiki ); |
Index: trunk/extensions/MarkAsHelpful/modules/ext.markAsHelpful/ext.markAsHelpful.js |
— | — | @@ -105,20 +105,22 @@ |
106 | 106 | |
107 | 107 | // Some live events for the different modes |
108 | 108 | |
109 | | - /* |
110 | | - * Click Event for marking an item as helpful. |
111 | | - */ |
112 | | - $( '.markashelpful-mark' ).live( 'click', function() { |
113 | | - mah.markItem( $(this), 'mark' ); |
114 | | - } ); |
| 109 | + $(document).ready( function() { |
| 110 | + /* |
| 111 | + * Click Event for marking an item as helpful. |
| 112 | + */ |
| 113 | + $( '.markashelpful-mark' ).live( 'click', function() { |
| 114 | + mah.markItem( $(this), 'mark' ); |
| 115 | + } ); |
115 | 116 | |
116 | | - /* |
117 | | - * Click Event for removing helpful status from an item. |
118 | | - */ |
119 | | - $( '.markashelpful-undo' ).live( 'click', function() { |
120 | | - mah.markItem( $(this), 'unmark' ); |
| 117 | + /* |
| 118 | + * Click Event for removing helpful status from an item. |
| 119 | + */ |
| 120 | + $( '.markashelpful-undo' ).live( 'click', function() { |
| 121 | + mah.markItem( $(this), 'unmark' ); |
| 122 | + } ); |
| 123 | + |
| 124 | + // Initialize MarkAsHelpful |
| 125 | + mah.init(); |
121 | 126 | } ); |
122 | | - |
123 | | - // Initialize MarkAsHelpful |
124 | | - $( mah.init ); |
125 | | -} ) ( jQuery ); |
\ No newline at end of file |
| 127 | +} ) ( jQuery ); |