r73763 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73762‎ | r73763 | r73764 >
Date:23:51, 25 September 2010
Author:dale
Status:deferred
Tags:
Comment:
fixed $rootLayout not defined error
Modified paths:
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SwarmTransport/loader.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SwarmTransport/mw.EmbedPlayerSwamVlc.js (added) (history)
  • /branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js (modified) (history)
  • /branches/MwEmbedStandAlone/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
@@ -41,10 +41,11 @@
4242 /**
4343 * Setup the layout if not already setup
4444 */
45 - setupLayout: function( $renderTarget ){
 45+ setupLayout: function( $renderTarget ){
4646 if( ! $renderTarget.find( '.smilRootLayout').length ) {
4747 $renderTarget.append( this.getRootLayout() );
4848 }
 49+ this.$rootLayout =$renderTarget.find( '.smilRootLayout');
4950 },
5051
5152 getTargetAspectRatio:function(){
@@ -56,8 +57,8 @@
5758 */
5859 getRootLayout: function(){
5960 var _this = this;
60 - mw.log( "SmilLayout::getRootLayout:" );
61 - if( !this.$rootLayout ){
 61+ mw.log( "SmilLayout::getRootLayout:" );
 62+ if( !this.$rootLayout ) {
6263 // Setup target Size:
6364 this.targetWidth = this.smil.embedPlayer.getWidth();
6465 this.targetHeight = this.smil.embedPlayer.getHeight();
@@ -336,14 +337,13 @@
337338 /**
338339 * Hide a smilElement in the layout
339340 */
340 - hideElement: function( smilElement ){
341 - if( this.$rootLayout ){
342 - // Check that the element is already in the dom
343 - var $targetElement = this.$rootLayout.find( '#' + this.smil.getSmilElementPlayerID( smilElement ) );
344 - if( $targetElement.length ){
345 - // Issue a quick hide request
346 - $targetElement.hide();
347 - }
 341+ hideElement: function( smilElement ){
 342+ mw.log(" hide: " + this.smil.getSmilElementPlayerID( smilElement ));
 343+ // Check that the element is already in the dom
 344+ var $targetElement = this.$rootLayout.find( '#' + this.smil.getSmilElementPlayerID( smilElement ) );
 345+ if( $targetElement.length ){
 346+ // Issue a quick hide request
 347+ $targetElement.hide();
348348 }
349349 },
350350
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
@@ -236,8 +236,10 @@
237237 transformMediaForTime: function( smilElement, animateTime, callback ){
238238 // Get the video element
239239 var assetId = this.smil.getSmilElementPlayerID( smilElement );
240 - var vid = $j ( '#' + assetId ).get( 0 );
241 - mw.log( "SmilAnimate::transformMediaForTime:" + assetId + " ct:" +vid.currentTime + ' should be: ' + mediaSeekTime );
 240+ var media = $j ( '#' + assetId ).get( 0 );
 241+ if( !media ){
 242+ mw.log("Error: transformMediaForTime could not find media asest: " +assetId );
 243+ }
242244
243245
244246 var mediaSeekTime = animateTime;
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
@@ -158,9 +158,9 @@
159159 /**
160160 * Render a specific time
161161 */
162 - renderTime : function(time, callback) {
 162+ renderTime : function(time, callback) {
163163 // Setup the layout if not already setup:
164 - this.getLayout().setupLayout(this.embedPlayer.getRenderTarget());
 164+ this.getLayout().setupLayout( this.embedPlayer.getRenderTarget() );
165165
166166 // Update the render target with bodyElements for the requested time
167167 this.getBody().renderTime( time );
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js
@@ -311,7 +311,7 @@
312312 callback( _this.smil );
313313 });
314314 } else {
315 - callback( _this.smil );
 315+ callback( this.smil );
316316 }
317317 },
318318
Index: branches/MwEmbedStandAlone/modules/SwarmTransport/loader.js
@@ -8,12 +8,14 @@
99 ( function( mw ) {
1010
1111 mw.addResourcePaths( {
12 - "mw.SwarmTransport" : "mw.SwarmTransport.js"
 12+ "mw.SwarmTransport" : "mw.SwarmTransport.js",
 13+ "mw.EmbedPlayerSwamVlc" : "mw.EmbedPlayerSwamVlc.js"
1314 });
1415
1516 mw.setDefaultConfig({
1617 /**
17 - * If SwarmTransport should be enabled by default as video transport mechanism
 18+ * If SwarmTransport should be enabled as video transport mechanism
 19+ * Enabling SwarmTransport loads mw.SwarmTransport, vlc and swarmvlc embed if in IE.
1820 */
1921 'SwarmTransport.Enable': false,
2022
@@ -34,6 +36,13 @@
3537 if( mw.getConfig( 'SwarmTransport.Enable' ) ) {
3638 if( $j.inArray( 'mw.SwarmTransport', classRequest ) == -1 ) {
3739 classRequest.push( [ 'mw.SwarmTransport' ]);
 40+ // if IE / ActiveX
 41+ // Look for swarm player:
 42+ if( mw.EmbedTypes.testActiveX( 'P2PNext.SwarmPlayer' ) ){
 43+ // Add vlc and swarmVlc to request
 44+ classRequest.push( 'mw.EmbedPlayerVlc' );
 45+ classRequest.push( 'mw.EmbedPlayerSwarmVlc' );
 46+ }
3847 }
3948 }
4049 });
Index: branches/MwEmbedStandAlone/modules/SwarmTransport/mw.EmbedPlayerSwamVlc.js
@@ -0,0 +1,37 @@
 2+/*
 3+* Swarm VLC embed
 4+* inherits EmbedPlayerVlc
 5+*/
 6+mw.EmbedPlayerSwarmVlc = {
 7+
 8+ //Instance Name:
 9+ instanceOf : 'SwarmVlc',
 10+
 11+ doEmbedHTML: function() {
 12+ var _this = this;
 13+ var oggHttpSource = this.mediaElement.getSources( 'video/ogg' )[0];
 14+ $j( this ).html(
 15+ '<object classid="clsid:98FF91C0-A3B8-11DF-8555-0002A5D5C51B" ' +
 16+ 'id="' + this.pid + '" events="True" height="' + this.getHeight() + '" width="' + this.getWidth() + '"' +
 17+ '>' +
 18+ '<param name="ShowDisplay" value="True" />' +
 19+ '<param name="AutoLoop" value="False" />' +
 20+ '<param name="AutoPlay" value="True" />' +
 21+ '<param name="Volume" value="'+ this.volume * 100 + '" />' +
 22+ '<param name="Src" value="' + this.getSrc() +'" />' +
 23+ '<param name="AltSrc" value="' + mw.absoluteUrl( oggHttpSource.getSrc() ) + '" />' +
 24+ '</object>'
 25+ );
 26+ setTimeout( function() {
 27+ _this.monitor();
 28+ }, 100 );
 29+ }
 30+};
 31+// Inherit the vlc object
 32+if( typeof mw.EmbedPlayerVlc == 'undefined' ){
 33+ mw.log("Error:: EmbedPLayerVlc not defefined ");
 34+} else {
 35+ for(var i in mw.EmbedPlayerVlc.prototype ){
 36+ mw.EmbedPlayerSwarmVlc
 37+ };
 38+}
Index: branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js
@@ -19,7 +19,7 @@
2020 // Setup the "embedCode" binding to swap in an updated url
2121 $j( embedPlayer ).bind( 'checkPlayerSourcesEvent', function( event, callback ) {
2222 // Confirm SwarmTransport add-on is available ( defines swarmTransport var )
23 - if( _this.getPluginLibrary() ){
 23+ if( _this.getPluginLibrary() ){
2424 // Add the swarm source
2525 mw.log(" SwarmTransport :: checkPlayerSourcesEvent " + swapedPlayerId);
2626 _this.addSwarmSource( embedPlayer, function(){
@@ -69,7 +69,7 @@
7070 }
7171 // Look for swarm player:
7272 if( mw.EmbedTypes.testActiveX( 'P2PNext.SwarmPlayer' ) ){
73 - return 'Vlc';
 73+ return 'SwarmVlc';
7474 }
7575 return false;
7676 },
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
@@ -120,7 +120,7 @@
121121
122122 // Cache the pre / post bits
123123 callback( _this.serverSmilXml );
124 - })
 124+ });
125125 },
126126 wrapSequencerWikiText : function( xmlString ){
127127 var _this = this;
@@ -205,7 +205,7 @@
206206 mw.log("SequenceServer::Save: " + saveSummary );
207207 this.getSaveToken( function( token ){
208208 if( !token ){
209 - callback( false, 'could not get edit token')
 209+ callback( false, 'could not get edit token');
210210 return ;
211211 }
212212 var request = {
@@ -218,7 +218,7 @@
219219 mw.getJSON( _this.getApiUrl(), request, function( data ) {
220220 if( data.edit && data.edit.result == 'Success' ) {
221221 // Update the latest local variables
222 - _this.saveSummary = saveSummary
 222+ _this.saveSummary = saveSummary;
223223 _this.sequenceSaved = true;
224224 _this.serverSmilXml = sequenceXML;
225225 callback( true );
@@ -226,8 +226,8 @@
227227 // xxx Should have more error handling ( conflict version save etc )
228228 callback( false, 'failed to save to server');
229229 }
230 - })
231 - })
 230+ });
 231+ });
232232 },
233233
234234 /**
@@ -299,9 +299,9 @@
300300 var pageText = '';
301301 // Check if we should use commons asset description template:
302302 if( mw.parseUri( _this.getApiUrl() ).host == 'commons.wikimedia.org' ){
303 - pageText = _this.getCommonsDescriptionText()
 303+ pageText = _this.getCommonsDescriptionText();
304304 } else {
305 - pageText = _this.getBaseFileDescription()
 305+ pageText = _this.getBaseFileDescription();
306306 }
307307 var request = {
308308 'action': 'edit',
@@ -318,7 +318,7 @@
319319 callback( false );
320320 }
321321 });
322 - })
 322+ });
323323 },
324324
325325 getBaseFileDescription: function(){
@@ -351,12 +351,12 @@
352352 return '0' + num;
353353 }
354354 return num;
355 - }
 355+ };
356356 var dt = new Date();
357357 descText+='|Date=' + dt.getFullYear() + '-' +
358358 pad2(dt.getMonth()+1) + '-' +
359359 pad2(dt.getDate()) + "\n" +
360 - "|Author=Last edit by [[User:" + _this.getUserName() + "]]\n" +
 360+ "|Author=Published by [[User:" + _this.getUserName() + "]]\n" +
361361 "For full editor list see history page of [[" + _this.getTitleKey() + "]] \n" +
362362 "|Permission={{Cc-by-sa-3.0}} and {{GFDL|migration=redundant}}" + "\n" +
363363 "}}";
@@ -418,7 +418,7 @@
419419 'filename': _this.getVideoFileName(),
420420 'comment': 'Published [[' + _this.getTitleKey() + ']] : ' + saveSummary,
421421 'ignorewarnings' : true
422 - }
 422+ };
423423 // Return the apiUrl and request
424424 callback( _this.getApiUrl(), request );
425425 });
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js
@@ -36,7 +36,7 @@
3737 }
3838
3939 //mwReqParam['debug'] = false;
40 -//mwUseScriptLoader = true;
 40+mwUseScriptLoader = true;
4141 //mwRemoteVersion = Math.random();
4242
4343 // Setup up some globals to wrap mwEmbed mw.ready and mw.setConfig functions

Status & tagging log