Index: trunk/extensions/Push/includes/ext.push.tab.js |
— | — | @@ -34,7 +34,6 @@ |
35 | 35 | |
36 | 36 | $('.push-button').click(function() { |
37 | 37 | this.disabled = true; |
38 | | - this.innerHTML = mw.msg( 'push-button-pushing' ); |
39 | 38 | |
40 | 39 | var errorDiv = $( '#targeterrors' + $(this).attr( 'targetid' ) ); |
41 | 40 | errorDiv.fadeOut( 'fast' ); |
— | — | @@ -47,7 +46,7 @@ |
48 | 47 | pages = [$('#pageName').attr('value')]; |
49 | 48 | } |
50 | 49 | |
51 | | - initiatePush( |
| 50 | + setButtonToImgPush( |
52 | 51 | this, |
53 | 52 | pages, |
54 | 53 | $(this).attr( 'pushtarget' ), |
— | — | @@ -256,6 +255,8 @@ |
257 | 256 | } |
258 | 257 | |
259 | 258 | function initiatePush( sender, pages, targetUrl, targetName ) { |
| 259 | + sender.innerHTML = mw.msg( 'push-button-pushing' ); |
| 260 | + |
260 | 261 | $.getJSON( |
261 | 262 | wgScriptPath + '/api.php', |
262 | 263 | { |
— | — | @@ -273,7 +274,7 @@ |
274 | 275 | } |
275 | 276 | else { |
276 | 277 | if ( $('#checkIncFiles').length != 0 && $('#checkIncFiles').attr('checked') ) { |
277 | | - setButtonToImgPush( sender, targetUrl, targetName ); |
| 278 | + handlePushingCompletion( sender, targetUrl, targetName ); |
278 | 279 | } |
279 | 280 | else { |
280 | 281 | sender.innerHTML = mw.msg( 'push-button-completed' ); |
— | — | @@ -284,7 +285,7 @@ |
285 | 286 | ); |
286 | 287 | } |
287 | 288 | |
288 | | - function handleFilePushingCompletion( sender, targetUrl, targetName ) { |
| 289 | + function handlePushingCompletion( sender, targetUrl, targetName ) { |
289 | 290 | sender.innerHTML = mw.msg( 'push-button-completed' ); |
290 | 291 | |
291 | 292 | setTimeout( function() { |
— | — | @@ -292,16 +293,16 @@ |
293 | 294 | }, 1000 ); |
294 | 295 | } |
295 | 296 | |
296 | | - function setButtonToImgPush( button, targetUrl, targetName ) { |
| 297 | + function setButtonToImgPush( button, pages, targetUrl, targetName ) { |
297 | 298 | button.innerHTML = mw.msg( 'push-button-pushing-files' ); |
298 | 299 | |
299 | 300 | var images = window.wgPushPageFiles.concat( window.wgPushTemplateFiles ); |
300 | 301 | var currentFile = images.pop(); |
301 | 302 | |
302 | | - initiateImagePush( button, targetUrl, targetName, images, currentFile, handleFilePushingCompletion ); |
| 303 | + initiateImagePush( button, pages, targetUrl, targetName, images, currentFile ); |
303 | 304 | } |
304 | 305 | |
305 | | - function initiateImagePush( sender, targetUrl, targetName, images, fileName, callback ) { |
| 306 | + function initiateImagePush( sender, pages, targetUrl, targetName, images, fileName ) { |
306 | 307 | $.getJSON( |
307 | 308 | wgScriptPath + '/api.php', |
308 | 309 | { |
— | — | @@ -338,10 +339,10 @@ |
339 | 340 | if ( !fail ) { |
340 | 341 | if ( images.length > 0 ) { |
341 | 342 | var currentFile = images.pop(); |
342 | | - initiateImagePush( sender, targetUrl, targetName, images, currentFile, callback ); |
| 343 | + initiateImagePush( sender, pages, targetUrl, targetName, images, currentFile ); |
343 | 344 | } |
344 | 345 | else { |
345 | | - callback( sender, targetUrl, targetName ); |
| 346 | + initiatePush( sender, pages, targetUrl, targetName ); |
346 | 347 | } |
347 | 348 | } |
348 | 349 | } |