Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js |
— | — | @@ -460,28 +460,45 @@ |
461 | 461 | * @param selector jquery-compatible selector, for a single element |
462 | 462 | */ |
463 | 463 | moveFileInputToCover: function( selector ) { |
464 | | - var $covered = $j( selector ); |
| 464 | + var _this = this; |
| 465 | + var update = function() { |
| 466 | + var $covered = $j( selector ); |
465 | 467 | |
466 | | - this.fileCtrlContainer |
467 | | - .css( $covered.position() ) |
468 | | - .css( 'marginTop', $covered.css( 'marginTop' ) ) |
469 | | - .css( 'marginRight', $covered.css( 'marginRight' ) ) |
470 | | - .css( 'marginBottom', $covered.css( 'marginBottom' ) ) |
471 | | - .css( 'marginLeft', $covered.css( 'marginLeft' ) ) |
472 | | - .width( $covered.outerWidth() ) |
473 | | - .height( $covered.outerHeight() ); |
| 468 | + _this.fileCtrlContainer |
| 469 | + .css( $covered.position() ) |
| 470 | + .css( 'marginTop', $covered.css( 'marginTop' ) ) |
| 471 | + .css( 'marginRight', $covered.css( 'marginRight' ) ) |
| 472 | + .css( 'marginBottom', $covered.css( 'marginBottom' ) ) |
| 473 | + .css( 'marginLeft', $covered.css( 'marginLeft' ) ) |
| 474 | + .width( $covered.outerWidth() ) |
| 475 | + .height( $covered.outerHeight() ); |
474 | 476 | |
475 | | - this.fileCtrlContainer.css( { 'z-index': 1 } ); |
| 477 | + _this.fileCtrlContainer.css( { 'z-index': 1 } ); |
476 | 478 | |
477 | | - // shift the file input over with negative margins, |
478 | | - // internal to the overflow-containing div, so the div shows all button |
479 | | - // and none of the textfield-like input |
480 | | - this.$fileInputCtrl.css( { |
481 | | - 'margin-left': '-' + ~~( this.$fileInputCtrl.width() - $covered.outerWidth() - 10 ) + 'px', |
482 | | - 'margin-top' : '-' + ~~( this.$fileInputCtrl.height() - $covered.outerHeight() - 10 ) + 'px' |
483 | | - } ); |
| 479 | + // shift the file input over with negative margins, |
| 480 | + // internal to the overflow-containing div, so the div shows all button |
| 481 | + // and none of the textfield-like input |
| 482 | + _this.$fileInputCtrl.css( { |
| 483 | + 'margin-left': '-' + ~~( _this.$fileInputCtrl.width() - $covered.outerWidth() - 10 ) + 'px', |
| 484 | + 'margin-top' : '-' + ~~( _this.$fileInputCtrl.height() - $covered.outerHeight() - 10 ) + 'px' |
| 485 | + } ); |
| 486 | + } |
484 | 487 | |
| 488 | + if (this.moveFileInputInterval) { |
| 489 | + window.clearInterval(this.moveFileInputInterval); |
| 490 | + } |
| 491 | + this.moveFileInputInterval = window.setInterval(function() { |
| 492 | + update(); |
| 493 | + }, 500); |
| 494 | + update(); |
| 495 | + }, |
485 | 496 | |
| 497 | + hideFileInput: function() { |
| 498 | + if (this.moveFileInputInterval) { |
| 499 | + window.clearInterval(this.moveFileInputInterval); |
| 500 | + } |
| 501 | + this.moveFileInputInterval = null; |
| 502 | + // Should we actually hide it? |
486 | 503 | }, |
487 | 504 | |
488 | 505 | /** |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -414,10 +414,6 @@ |
415 | 415 | |
416 | 416 | // we explicitly move the file input to cover the upload button |
417 | 417 | upload.ui.moveFileInputToCover( '#mwe-upwiz-add-file' ); |
418 | | - // do it again in case the layout didn't update immediately |
419 | | - setTimeout(function() { |
420 | | - upload.ui.moveFileInputToCover( '#mwe-upwiz-add-file' ); |
421 | | - }, 50); |
422 | 418 | |
423 | 419 | // we bind to the ui div since unbind doesn't work for non-DOM objects |
424 | 420 | |
— | — | @@ -750,6 +746,7 @@ |
751 | 747 | } else { |
752 | 748 | $j( '#mwe-upwiz-add-file' ).button( 'option', 'disabled', true ); |
753 | 749 | $j( _this.uploadToAdd.ui.div ).hide(); |
| 750 | + _this.uploadToAdd.ui.hideFileInput(); |
754 | 751 | } |
755 | 752 | |
756 | 753 | |