r73675 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73674‎ | r73675 | r73676 >
Date:19:17, 24 September 2010
Author:dale
Status:deferred
Tags:
Comment:
* fixed player preference cookie
* use swam transport by default if no preference exists and add-on is installed
* fixed a for( var {var} in {array} ) loop that was missed in the mw.Parser ( thanks neilk )
Modified paths:
  • /branches/MwEmbedStandAlone/components/mw.Parser.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/TimedText/mw.TimedText.js (modified) (history)
  • /branches/MwEmbedStandAlone/mwEmbed.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/components/mw.Parser.js
@@ -134,7 +134,7 @@
135135 paramSet.splice( 0, 1 );
136136 if ( paramSet.length ) {
137137 templateObject.param = new Array();
138 - for ( var pInx in paramSet ) {
 138+ for ( var pInx =0; pInx < paramSet.length; pInx++ ) {
139139 var paramString = paramSet[ pInx ];
140140 // check for empty param
141141 if ( paramString == '' ) {
Index: branches/MwEmbedStandAlone/mwEmbed.js
@@ -60,7 +60,7 @@
6161 var mwConfig = { };
6262 }
6363
64 - // Local scope mwUserConfig var. Stores user configuration
 64+ // mw scope mwUserConfig var. Stores user configuration
6565 var mwUserConfig = { };
6666
6767 /**
@@ -1957,66 +1957,68 @@
19581958 if ( ! window[ '$j' ] ) {
19591959 window[ '$j' ] = jQuery.noConflict();
19601960 }
1961 -
1962 - // Get module loader.js, and language files
1963 - // ( will hit callback directly if set via resource loader )
1964 - mw.checkModuleLoaderFiles( function() {
1965 -
1966 - // Set the User language
1967 - if( typeof wgUserLanguage != 'undefined' && mw.isValidLang( wgUserLanguage) ) {
1968 - mw.setConfig( 'userLanguage', wgUserLanguage );
1969 - }else{
1970 - // Grab it from the included url
1971 - var langKey = mw.parseUri( mw.getMwEmbedSrc() ).queryKey['uselang'];
1972 - if ( langKey && mw.isValidLang( langKey ) ) {
1973 - mw.setConfig( 'userLanguage', langKey);
1974 - }
1975 - }
1976 -
1977 - // Update the image path
1978 - mw.setConfig( 'imagesPath', mw.getMwEmbedPath() + 'skins/common/images/' );
1979 -
1980 - // Set up AJAX to not send dynamic URLs for loading scripts
1981 - $j.ajaxSetup( {
1982 - cache: true
1983 - } );
1984 -
1985 - // Update the magic keywords
1986 - mw.Language.magicSetup();
1987 -
1988 - // Set up mvEmbed utility jQuery bindings
1989 - mw.dojQueryBindings();
1990 -
1991 -
1992 - // Special Hack for conditional jquery ui inclusion ( once
1993 - // Usability extension
1994 - // registers the jquery.ui skin in mw.style
1995 - if( mw.hasJQueryUiCss() ){
1996 - mw.style[ 'ui_' + mw.getConfig( 'jQueryUISkin' ) ] = true;
1997 - }
1998 -
1999 -
2000 - // Make sure style sheets are loaded:
2001 - mw.load( ['mw.style.mwCommon'] , function(){
2002 - // Run all the setup function hooks
2003 - // NOTE: setup functions are added via addSetupHook
2004 - // calls
2005 - // and must include a callback.
2006 - //
2007 - // Once complete we can run .ready() queued functions
2008 - function runSetupFunctions() {
2009 - if( mwSetupFunctions.length ) {
2010 - mwSetupFunctions.shift()( function() {
2011 - runSetupFunctions();
2012 - } );
2013 - }else{
2014 - mw.runReadyFunctions();
 1961+ // Setup user config:
 1962+ mw.setupUserConfig( function(){
 1963+ // Get module loader.js, and language files
 1964+ // ( will hit callback directly if set via resource loader )
 1965+ mw.checkModuleLoaderFiles( function() {
 1966+
 1967+ // Set the User language
 1968+ if( typeof wgUserLanguage != 'undefined' && mw.isValidLang( wgUserLanguage) ) {
 1969+ mw.setConfig( 'userLanguage', wgUserLanguage );
 1970+ }else{
 1971+ // Grab it from the included url
 1972+ var langKey = mw.parseUri( mw.getMwEmbedSrc() ).queryKey['uselang'];
 1973+ if ( langKey && mw.isValidLang( langKey ) ) {
 1974+ mw.setConfig( 'userLanguage', langKey);
20151975 }
2016 - }
2017 - runSetupFunctions();
2018 - } );
2019 -
2020 - } );
 1976+ }
 1977+
 1978+ // Update the image path
 1979+ mw.setConfig( 'imagesPath', mw.getMwEmbedPath() + 'skins/common/images/' );
 1980+
 1981+ // Set up AJAX to not send dynamic URLs for loading scripts
 1982+ $j.ajaxSetup( {
 1983+ cache: true
 1984+ } );
 1985+
 1986+ // Update the magic keywords
 1987+ mw.Language.magicSetup();
 1988+
 1989+ // Set up mvEmbed utility jQuery bindings
 1990+ mw.dojQueryBindings();
 1991+
 1992+
 1993+ // Special Hack for conditional jquery ui inclusion ( once
 1994+ // Usability extension
 1995+ // registers the jquery.ui skin in mw.style
 1996+ if( mw.hasJQueryUiCss() ){
 1997+ mw.style[ 'ui_' + mw.getConfig( 'jQueryUISkin' ) ] = true;
 1998+ }
 1999+
 2000+
 2001+ // Make sure style sheets are loaded:
 2002+ mw.load( ['mw.style.mwCommon'] , function(){
 2003+ // Run all the setup function hooks
 2004+ // NOTE: setup functions are added via addSetupHook
 2005+ // calls
 2006+ // and must include a callback.
 2007+ //
 2008+ // Once complete we can run .ready() queued functions
 2009+ function runSetupFunctions() {
 2010+ if( mwSetupFunctions.length ) {
 2011+ mwSetupFunctions.shift()( function() {
 2012+ runSetupFunctions();
 2013+ } );
 2014+ }else{
 2015+ mw.runReadyFunctions();
 2016+ }
 2017+ }
 2018+ runSetupFunctions();
 2019+ } );
 2020+
 2021+ } );
 2022+ });
20212023 });
20222024 });
20232025 };
Index: branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js
@@ -22,7 +22,12 @@
2323 if( typeof window['swarmTransport'] != 'undefined' ){
2424 // Add the swarm source
2525 mw.log(" SwarmTransport :: checkPlayerSourcesEvent " + swapedPlayerId);
26 - _this.addSwarmSource( embedPlayer, callback );
 26+ _this.addSwarmSource( embedPlayer, function(){
 27+ // Update the source if paused
 28+ if( embedPlayer.paused ) {
 29+ embedPlayer.mediaElement.autoSelectSource();
 30+ }
 31+ });
2732 }
2833 // Don't block on swarm request, directly do the callback
2934 callback();
@@ -87,13 +92,14 @@
8893 return ;
8994 }
9095 mw.log( 'SwarmTransport: addSwarmSource for: ' + source.getSrc() + "\n\nGot:" + data.torrent );
91 - // XXX need to update prefrence
 96+ // XXX need to update preference
9297 embedPlayer.mediaElement.tryAddSource(
9398 $j('<source />')
9499 .attr( {
95100 'type' : 'video/swarmTransport',
96101 'title': gM('mwe-swarmtransport-stream-ogg'),
97 - 'src': 'tribe://' + data.torrent
 102+ 'src': 'tribe://' + data.torrent,
 103+ 'default' : true
98104 } )
99105 .get( 0 )
100106 );
Index: branches/MwEmbedStandAlone/modules/TimedText/mw.TimedText.js
@@ -22,7 +22,7 @@
2323 */
2424 mw.TimedText = function( embedPlayer, options ) {
2525 return this.init( embedPlayer, options);
26 - }
 26+ };
2727 mw.TimedText.prototype = {
2828
2929 /**
@@ -102,7 +102,7 @@
103103 */
104104 init: function( embedPlayer, options ) {
105105 var _this = this;
106 - mw.log("TimedText: init() ")
 106+ mw.log("TimedText: init() ");
107107 this.embedPlayer = embedPlayer;
108108 this.options = options;
109109
@@ -463,7 +463,7 @@
464464 // Close the loader:
465465 mw.closeLoaderDialog();
466466 _this.editText.showUI();
467 - })
 467+ });
468468 },
469469
470470 /**
@@ -480,7 +480,7 @@
481481 var _this = this;
482482 return $j.getLineItem( gM( 'mwe-timedtext-add-timed-text'), 'script', function() {
483483 _this.showTimedTextEditUI( 'add' );
484 - } )
 484+ } );
485485 },
486486
487487 /**
@@ -521,7 +521,7 @@
522522 if( mw.Language.names[ lang_key ]) {
523523 return mw.Language.names[ lang_key ];
524524 }
525 - return false
 525+ return false;
526526 },
527527
528528 /**
@@ -551,7 +551,7 @@
552552 function() {
553553 _this.selectLayout( layoutMode );
554554 } )
555 - )
 555+ );
556556 });
557557 return $ul;
558558 },
@@ -614,7 +614,7 @@
615615 source.load( function() {
616616 // Refresh the interface:
617617 _this.refreshDisplay();
618 - })
 618+ });
619619 },
620620
621621 /**
@@ -626,7 +626,7 @@
627627 // Refresh the Menu (if it has a target to refresh)
628628 if( this.menuTarget ) {
629629 mw.log('bind menu refresh display');
630 - this.bindMenu( this.menuTarget, false )
 630+ this.bindMenu( this.menuTarget, false );
631631 }
632632 // Issues a "monitor" command to update the timed text for the new layout
633633 this.monitor();
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
@@ -613,6 +613,8 @@
614614 */
615615 showControlBar: function(){
616616 var animateDuration = 'slow';
 617+ if(! this.embedPlayer )
 618+ return ;
617619 $j( this.embedPlayer.getPlayerElement() ).css( 'z-index', '1' )
618620 mw.log( 'showControlBar' );
619621 // Move up text track if present
Index: branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
@@ -7,7 +7,6 @@
88
99 // Wrap in mw to not pollute global namespace
1010 ( function( mw ) {
11 -
1211
1312 mw.addMessageKeys( [
1413 "mwe-sequencer-no-sequence-create",

Status & tagging log