Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108472


Change subject: Make sure jquery.ui.dialog is loaded if there are pop up videos
......................................................................

Make sure jquery.ui.dialog is loaded if there are pop up videos

Follow up d20058ed77. If jquery.ui.dialog isn't loaded at
the beginning, then when someone clicks on a pop up video, the
pop up dialog has the wrong dimensions. This issue has not
appeared on Wikimedia, as other scripts are loading jquery.ui.dialog.

Not entirely sure if I took the right approach for loading it, but
this seemed like the most straightforward way to do it and have it
only on pages where needed.

Change-Id: Ia903cded423a8505528425e15abb1c87513f1c49
---
M resources/mw.PopUpThumbVideo.js
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/72/108472/1

diff --git a/resources/mw.PopUpThumbVideo.js b/resources/mw.PopUpThumbVideo.js
index 8d9a802..944c9a1 100644
--- a/resources/mw.PopUpThumbVideo.js
+++ b/resources/mw.PopUpThumbVideo.js
@@ -3,7 +3,13 @@
 */
 ( function( mw, $ ) {
        $(document).ready(function(){
-               $('.PopUpMediaTransform a').each( function(){
+               var $popUp = $('.PopUpMediaTransform a');
+               if ( $popUp.length ) {
+                       // If there is actually a pop-up media on this page, 
need to
+                       // make sure jquery.dialog is loaded, or pop-up has 
wrong dimensions
+                       mw.loader.load( 'jquery.ui.dialog', 'text/javascript', 
true );
+               }
+               $popUp.each( function(){
                        var parent = $(this).parent();
                        if ( parent.attr( 'videopayload' ) ) {
                                $( this ).click( function( event ){

-- 
To view, visit https://gerrit.wikimedia.org/r/108472
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia903cded423a8505528425e15abb1c87513f1c49
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <bawolff...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to