r82405 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82404‎ | r82405 | r82406 >
Date:16:02, 18 February 2011
Author:dale
Status:deferred
Tags:
Comment:
fixed some mergeConfig issues
minor code cleanup for TimedMediaTransformOutput
Modified paths:
  • /trunk/extensions/MwEmbedSupport/MwEmbedModules/MwEmbedSupport/jquery/jquery.mwEmbedUtil.js (modified) (history)
  • /trunk/extensions/MwEmbedSupport/MwEmbedModules/MwEmbedSupport/mwEmbedSupport.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/EmbedPlayer.i18n.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/players/mw.EmbedPlayer.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MwEmbedSupport/MwEmbedModules/MwEmbedSupport/jquery/jquery.mwEmbedUtil.js
@@ -8,13 +8,11 @@
99 * Extend Unique to work with strings and number values
1010 * http://paulirish.com/2010/duck-punching-with-jquery/
1111 */
12 - var _old = $.unique;
13 -
 12+ var _oldUnique = $.unique;
1413 $.unique = function(arr){
15 -
16 - // do the default behavior only if we got an array of elements
 14+ // Do the default behavior only if we got an array of elements
1715 if (!!arr[0].nodeType){
18 - return _old.apply(this,arguments);
 16+ return _oldUnique.apply(this,arguments);
1917 } else {
2018 // reduce the array to contain no dupes via grep/inArray
2119 return $.grep(arr,function(v,k){
Index: trunk/extensions/MwEmbedSupport/MwEmbedModules/MwEmbedSupport/mwEmbedSupport.js
@@ -119,13 +119,22 @@
120120 });
121121 return ;
122122 }
123 - if( !mediaWiki.config.get( name )){
 123+ var existingValue = mediaWiki.config.get( name );
 124+ if( !existingValue || typeof existingValue == 'string'){
124125 mw.setConfig( name, value );
125126 return ;
126127 }
127128 if( typeof mediaWiki.config.get( name ) == 'object' ){
128 - mw.setConfig( name, $.extend( mediaWiki.config.get( name ), value ) );
129 - }
 129+ if( $.isArray( existingValue) && $.isArray( value ) ){
 130+ for( var i =0; i < value.length ; i ++ ){
 131+ existingValue.push( value[i] );
 132+ }
 133+ mw.setConfig( name, $.unique( existingValue ) );
 134+ } else {
 135+ mw.setConfig( name, $.extend( {}, existingValue, value) );
 136+ }
 137+ return ;
 138+ }
130139 };
131140
132141 /**
Index: trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php
@@ -171,7 +171,7 @@
172172
173173 if( $data['query'] && $data['query']['allpages'] ){
174174 foreach( $data['query']['allpages'] as $na => $page ){
175 - $pageTitle = Title::newFromText( $page['title'] ) ;
 175+ $subTitle = Title::newFromText( $page['title'] ) ;
176176 $tileParts = explode( '.', $page['title'] );
177177 if( count( $tileParts) >= 3 ){
178178 $subtitle_extension = array_pop( $tileParts );
@@ -185,11 +185,11 @@
186186 }
187187 $this->textTracks[] = array(
188188 'kind' => 'subtitles',
189 - 'data-mwtitle' => $pageTitle->getNsText() . ':' . $pageTitle->getDBkey(),
 189+ 'data-mwtitle' => $subTitle->getNsText() . ':' . $subTitle->getDBkey(),
190190 'type' => 'text/mw-srt',
191191 // TODO Should add a special entry point and output proper WebVTT format:
192192 // http://www.whatwg.org/specs/web-apps/current-work/webvtt.html
193 - 'src' => $pageTitle->getFullURL( array(
 193+ 'src' => $subTitle->getFullURL( array(
194194 'action' => 'raw',
195195 'ctype' => 'text/plain'
196196 )),
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/players/mw.EmbedPlayer.js
@@ -518,7 +518,6 @@
519519 }
520520
521521 var sourceAttr = mw.getConfig( 'EmbedPlayer.SourceAttributes' );
522 -
523522 for ( var i = 0; i < sourceAttr.length; i++ ) { // array loop:
524523 var attr = sourceAttr[ i ];
525524 var attr_value = element.getAttribute( attr );
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/EmbedPlayer.i18n.php
@@ -70,9 +70,10 @@
7171 'mwe-embedplayer-buffering' => 'buffering',
7272 'mwe-embedplayer-copy-code' => 'Copy code',
7373 'mwe-embedplayer-video-h264' => 'H.264 video',
 74+ 'mwe-embedplayer-video-webm' => 'WebM video',
7475 'mwe-embedplayer-video-flv' => 'Flash video',
7576 'mwe-embedplayer-video-ogg' => 'Ogg video',
76 - 'mwe-embedplayer-video-audio' => 'Ogg audio',
 77+ 'mwe-embedplayer-video-audio' => 'Ogg audio',
7778 'mwe-embedplayer-missing-source' => 'No source video was found',
7879 );
7980

Status & tagging log