Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler_body.php |
— | — | @@ -83,9 +83,25 @@ |
84 | 84 | |
85 | 85 | return true; |
86 | 86 | } |
87 | | - |
88 | | - |
| 87 | + function parserTransformHook( $parser, $file ) { |
| 88 | + if ( isset( $parser->mOutput->hasTimedMediaTransform ) ) { |
| 89 | + return; |
| 90 | + } |
| 91 | + $parser->mOutput->hasTimedMediaTransform = true; |
| 92 | + $parser->mOutput->addOutputHook( 'TimedMediaHandler' ); |
| 93 | + } |
89 | 94 | /** |
| 95 | + * Output hook only adds the PopUpMediaTransform |
| 96 | + * |
| 97 | + * The core embedPlayer module is part of a "loaderScript" so it does not need to |
| 98 | + * be registered here. |
| 99 | + */ |
| 100 | + static function outputHook( $outputPage, $parserOutput, $data ) { |
| 101 | + // Add the PopUpMediaTransform code |
| 102 | + $outputPage->addModules( 'PopUpMediaTransform' ); |
| 103 | + $outputPage->addModuleStyles( 'PopUpMediaTransform' ); |
| 104 | + } |
| 105 | + /** |
90 | 106 | * Utility functions |
91 | 107 | */ |
92 | 108 | public static function parseTimeString( $seekString, $length = false ) { |
Index: trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php |
— | — | @@ -51,9 +51,6 @@ |
52 | 52 | |
53 | 53 | // Check if the video is too small to play inline ( instead do a pop-up dialog ) |
54 | 54 | if( $this->width <= $wgMinimumVideoPlayerSize && $this->isVideo ){ |
55 | | - // Make sure we add the popUpThum module |
56 | | - $wgOut->addModules( 'PopUpMediaTransform' ); |
57 | | - $wgOut->addModuleStyles( 'PopUpMediaTransform' ); |
58 | 55 | return $this->getImagePopUp(); |
59 | 56 | } else { |
60 | 57 | return $this->getXmlMediaTagOutput(); |
Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | static function register(){ |
14 | 14 | global $wgParserOutputHooks, $wgHooks, $wgJobClasses, $wgJobExplitRequestTypes, |
15 | 15 | $wgMediaHandlers, $wgResourceModules, $wgExcludeFromThumbnailPurge, |
16 | | - $wgTimedMediaHandlerFileExtensions; |
| 16 | + $wgTimedMediaHandlerFileExtensions, $wgParserOutputHooks; |
17 | 17 | |
18 | 18 | // Setup media Handlers: |
19 | 19 | $wgMediaHandlers['application/ogg'] = 'OggHandler'; |
— | — | @@ -21,6 +21,9 @@ |
22 | 22 | // Setup a hook for iframe embed handling: |
23 | 23 | $wgHooks['ArticleFromTitle'][] = 'TimedMediaIframeOutput::iframeHook'; |
24 | 24 | |
| 25 | + // Add parser hook |
| 26 | + $wgParserOutputHooks['TimedMediaHandler'] = array( 'TimedMediaHandler', 'outputHook' ); |
| 27 | + |
25 | 28 | // Add transcode job class: |
26 | 29 | $wgJobClasses+= array( |
27 | 30 | 'webVideoTranscode' => 'WebVideoTranscodeJob' |
Index: trunk/extensions/TimedMediaHandler/resources/PopUpThumbVideo.js |
— | — | @@ -18,7 +18,6 @@ |
19 | 19 | // don't follow file link |
20 | 20 | return false; |
21 | 21 | }); |
22 | | - |
23 | 22 | }); |
24 | 23 | }); |
25 | 24 | |