Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js |
— | — | @@ -465,12 +465,7 @@ |
466 | 466 | var dialogHeight = ( pheight == 0 )? 175 : |
467 | 467 | ( pheight + 130 ); |
468 | 468 | var buttons = {}; |
469 | | - buttons[ gM( 'mwe-ok' ) ] = function(){ |
470 | | - var embedPlayer = $j( '#mwe_' + $j( _this ).data( 'playerId' ) ).get(0); |
471 | | - // stop the player ( more healthy way to remove the video from the dom ) |
472 | | - if( embedPlayer ) { |
473 | | - embedPlayer.stop(); |
474 | | - } |
| 469 | + buttons[ gM( 'mwe-ok' ) ] = function(){ |
475 | 470 | // close the dialog |
476 | 471 | $j(this).dialog( 'close' ).remove(); |
477 | 472 | }; |
— | — | @@ -479,8 +474,15 @@ |
480 | 475 | 'content' : html_out, |
481 | 476 | 'buttons' : buttons, |
482 | 477 | 'height' : dialogHeight, |
483 | | - 'width' : 430 |
484 | | - }) |
| 478 | + 'width' : 430, |
| 479 | + 'close': function(event, ui) { |
| 480 | + var embedPlayer = $j( '#mwe_' + vidId ).get(0); |
| 481 | + // stop the player before we close the dialog |
| 482 | + if( embedPlayer ) { |
| 483 | + embedPlayer.stop(); |
| 484 | + } |
| 485 | + } |
| 486 | + }); |
485 | 487 | |
486 | 488 | // Update the embed code to use the mwEmbed player: |
487 | 489 | $j( '#mwe_' + vidId ).embedPlayer( { 'autoplay' : true }, function(){ |