TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/196883
Change subject: Improve TMH styling ...................................................................... Improve TMH styling * Add a new RL module for styling media containers when there is no JS. This makes sure that media inside category pages are correctly align for instance. * Remove some overly specific CSS for play-btn-large Change-Id: I44b7443c48193c16f725ff9d9364b0b76c902fef --- M MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js M TimedMediaHandler.hooks.php M TimedMediaHandler_body.php M TimedMediaTransformOutput.php M resources/PopUpThumbVideo.css A resources/ext.tmh.thumbnail.css 6 files changed, 16 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler refs/changes/83/196883/1 diff --git a/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js b/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js index 0fa24bc..cc2507e 100644 --- a/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js +++ b/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js @@ -370,7 +370,6 @@ getPlayButtonPosition: function() { var _this = this; return { - 'position' : 'absolute', 'left' : '50%', 'top' : '50%', 'margin-left' : - .5 * this.getComponentWidth( 'playButtonLarge' ), diff --git a/TimedMediaHandler.hooks.php b/TimedMediaHandler.hooks.php index 9be9fc9..aefa973 100644 --- a/TimedMediaHandler.hooks.php +++ b/TimedMediaHandler.hooks.php @@ -62,6 +62,9 @@ // Add the PopUpMediaTransform module ( specific to timedMedia handler ( no support in mwEmbed modules ) $wgResourceModules+= array( + 'ext.tmh.thumbnail.styles' => $baseExtensionResource + array( + 'styles' => 'resources/ext.tmh.thumbnail.css', + ), 'mw.PopUpMediaTransform' => $baseExtensionResource + array( 'scripts' => 'resources/mw.PopUpThumbVideo.js', 'styles' => 'resources/PopUpThumbVideo.css', @@ -170,6 +173,7 @@ public static function onImageOpenShowImageInlineBefore( $imagePage, $out ) { $handler = $imagePage->getDisplayedFile()->getHandler(); if ( $handler !== false && $handler instanceof TimedMediaHandler ) { + $out->addModuleStyles( 'ext.tmh.thumbnail.styles' ); $out->addModules( array( 'mw.TimedText.loader', 'mw.MediaWikiPlayer.loader', @@ -409,6 +413,7 @@ } if ( $addModules ) { + $out->addModuleStyles( 'ext.tmh.thumbnail.styles' ); $out->addModules( array( 'mw.TimedText.loader', 'mw.MediaWikiPlayer.loader', diff --git a/TimedMediaHandler_body.php b/TimedMediaHandler_body.php index 6af6b51..e2e0486 100644 --- a/TimedMediaHandler_body.php +++ b/TimedMediaHandler_body.php @@ -201,6 +201,7 @@ return ; } $parserOutput->hasTimedMediaTransform = true; + $parserOutput->addModuleStyles( 'ext.tmh.thumbnail.styles' ); $parserOutput->addModules( array( 'mw.TimedText.loader', 'mw.MediaWikiPlayer.loader', diff --git a/TimedMediaTransformOutput.php b/TimedMediaTransformOutput.php index 3653209..e743aa1 100644 --- a/TimedMediaTransformOutput.php +++ b/TimedMediaTransformOutput.php @@ -321,7 +321,7 @@ // Build the video tag output: $s = Xml::tags( 'div' , array( 'class' => 'mediaContainer', - 'style' => 'position:relative;display:block;width:'. $width + 'style' => 'width:'. $width ), Html::rawElement( $this->getTagName(), $this->getMediaAttr( $sizeOverride, $autoPlay ), // The set of media sources: diff --git a/resources/PopUpThumbVideo.css b/resources/PopUpThumbVideo.css index 3ba0572..f6bc34b 100644 --- a/resources/PopUpThumbVideo.css +++ b/resources/PopUpThumbVideo.css @@ -1,5 +1,4 @@ .PopUpMediaTransform a .play-btn-large{ - position : absolute; top: 50%; left : 50%; width: 70px; @@ -13,17 +12,9 @@ /* @embed */ background-image:url('player_big_play_button_hover.png'); } -.PopUpMediaTransform { - position : relative; - display: inline-block; -} /* Should hopefully be only visible to screen readers */ .mw-tmh-playtext { display: block; height: 0; overflow: hidden; -} - -li.gallerybox div.thumb div.PopUpMediaTransform { - margin: 0 auto; } diff --git a/resources/ext.tmh.thumbnail.css b/resources/ext.tmh.thumbnail.css new file mode 100644 index 0000000..9464e5e --- /dev/null +++ b/resources/ext.tmh.thumbnail.css @@ -0,0 +1,9 @@ +.mediaContainer, +.PopUpMediaTransform { + position : relative; + display: block; +} +.thumb .mediaContainer, +.thumb .PopUpMediaTransform { + margin: 0 auto; +} -- To view, visit https://gerrit.wikimedia.org/r/196883 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I44b7443c48193c16f725ff9d9364b0b76c902fef Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TimedMediaHandler Gerrit-Branch: master Gerrit-Owner: TheDJ <hartman.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits