r98521 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98520‎ | r98521 | r98522 >
Date:14:47, 30 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
push files first, then page. This way Media:file links will point to the correct location
Modified paths:
  • /trunk/extensions/Push/includes/ext.push.tab.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Push/includes/ext.push.tab.js
@@ -34,7 +34,6 @@
3535
3636 $('.push-button').click(function() {
3737 this.disabled = true;
38 - this.innerHTML = mw.msg( 'push-button-pushing' );
3938
4039 var errorDiv = $( '#targeterrors' + $(this).attr( 'targetid' ) );
4140 errorDiv.fadeOut( 'fast' );
@@ -47,7 +46,7 @@
4847 pages = [$('#pageName').attr('value')];
4948 }
5049
51 - initiatePush(
 50+ setButtonToImgPush(
5251 this,
5352 pages,
5453 $(this).attr( 'pushtarget' ),
@@ -256,6 +255,8 @@
257256 }
258257
259258 function initiatePush( sender, pages, targetUrl, targetName ) {
 259+ sender.innerHTML = mw.msg( 'push-button-pushing' );
 260+
260261 $.getJSON(
261262 wgScriptPath + '/api.php',
262263 {
@@ -273,7 +274,7 @@
274275 }
275276 else {
276277 if ( $('#checkIncFiles').length != 0 && $('#checkIncFiles').attr('checked') ) {
277 - setButtonToImgPush( sender, targetUrl, targetName );
 278+ handlePushingCompletion( sender, targetUrl, targetName );
278279 }
279280 else {
280281 sender.innerHTML = mw.msg( 'push-button-completed' );
@@ -284,7 +285,7 @@
285286 );
286287 }
287288
288 - function handleFilePushingCompletion( sender, targetUrl, targetName ) {
 289+ function handlePushingCompletion( sender, targetUrl, targetName ) {
289290 sender.innerHTML = mw.msg( 'push-button-completed' );
290291
291292 setTimeout( function() {
@@ -292,16 +293,16 @@
293294 }, 1000 );
294295 }
295296
296 - function setButtonToImgPush( button, targetUrl, targetName ) {
 297+ function setButtonToImgPush( button, pages, targetUrl, targetName ) {
297298 button.innerHTML = mw.msg( 'push-button-pushing-files' );
298299
299300 var images = window.wgPushPageFiles.concat( window.wgPushTemplateFiles );
300301 var currentFile = images.pop();
301302
302 - initiateImagePush( button, targetUrl, targetName, images, currentFile, handleFilePushingCompletion );
 303+ initiateImagePush( button, pages, targetUrl, targetName, images, currentFile );
303304 }
304305
305 - function initiateImagePush( sender, targetUrl, targetName, images, fileName, callback ) {
 306+ function initiateImagePush( sender, pages, targetUrl, targetName, images, fileName ) {
306307 $.getJSON(
307308 wgScriptPath + '/api.php',
308309 {
@@ -338,10 +339,10 @@
339340 if ( !fail ) {
340341 if ( images.length > 0 ) {
341342 var currentFile = images.pop();
342 - initiateImagePush( sender, targetUrl, targetName, images, currentFile, callback );
 343+ initiateImagePush( sender, pages, targetUrl, targetName, images, currentFile );
343344 }
344345 else {
345 - callback( sender, targetUrl, targetName );
 346+ initiatePush( sender, pages, targetUrl, targetName );
346347 }
347348 }
348349 }

Status & tagging log