r61659 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61658‎ | r61659 | r61660 >
Date:11:55, 29 January 2010
Author:dale
Status:deferred
Tags:
Comment:
* fixed binPlayers path
* other clean up
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/javaEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/omtkEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/tests/testLang.html (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/tests/testLang.html
@@ -217,7 +217,7 @@
218218 o+='<tr>'+
219219 '<td>' + numVal + '</td>' +
220220 '<td>' + mKey + '</td>' +
221 - '<td>' + mw.lang.gMsgNoTrans( mKey ) + '</td>' +
 221+ '<td>' + mw.lang.msgNoTrans( mKey ) + '</td>' +
222222 '<td id="' + tkey + '_js">' + gM( mKey, numVal ) + '</td>';
223223 //show mw col:
224224 if( mKey.substr(0, 5) == 'test_' ){
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js
@@ -25,17 +25,18 @@
2626 setTimeout(function(){
2727 _this.postEmbedJS();
2828 }, 50);
 29+ var embed_code = this.getEmbedObj();
2930 mw.log( "return embed html: " + embed_code );
30 - return this.getEmbedObj();
 31+ return embed_code;
3132 },
3233
3334 /**
3435 * Get the plugin embed html
3536 */
3637 getEmbedObj:function() {
37 - var player_path = mw.getMwEmbedPath() + 'libEmbedPlayer/binPlayers/kaltura-player';
 38+ var playerPath = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/kaltura-player';
3839 return '<object width="' + this.width + '" height="' + this.height + '" '+
39 - 'data="' + player_path + '/wrapper.swf" allowfullscreen="true" '+
 40+ 'data="' + playerPath + '/wrapper.swf" allowfullscreen="true" '+
4041 'allownetworking="all" allowscriptaccess="always" '+
4142 'type="application/x-shockwave-flash" '+
4243 'id="' + this.pid + '" name="' + this.pid + '">'+
@@ -45,7 +46,7 @@
4647 '<param value="#000000" name="bgcolor"/>'+
4748 '<param value="wrapper.swf" name="movie"/>'+
4849 '<param value="' +
49 - 'kdpUrl=' + player_path + '/kdp.swf' +
 50+ 'kdpUrl=' + playerPath + '/kdp.swf' +
5051 '&ks=dummy&partner_id=0&subp_id=0' +
5152 '&uid=0&emptyF=onKdpEmpty&readyF=onKdpReady' +
5253 '" ' +
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/omtkEmbed.js
@@ -32,7 +32,7 @@
3333 * Get the embed object html
3434 */
3535 getEmbedObj:function() {
36 - var player_path = mw.getMwEmbedPath() + 'libEmbedPlayer/binPlayers/omtk-fx/omtkp.swf';
 36+ var player_path = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/omtk-fx/omtkp.swf';
3737 // player_path = 'omtkp.swf';
3838 mw.log( "player path: " + player_path );
3939 return '<object id="' + this.pid + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1">' +
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -2391,7 +2391,7 @@
23922392 },
23932393
23942394 /**
2395 - * Generic function to display custom HTML inside the mwEmbed element.
 2395+ * Generic function to display custom HTML inside the mwEmbedPlayer
23962396 * Should call the closeDisplayedHTML function to close the
23972397 * display of the custom HTML and restore the regular player display.
23982398 *
@@ -2461,8 +2461,11 @@
24622462 *
24632463 * @param {Object} $target jQuery target to output to
24642464 */
2465 - showPlayerSelect: function( $target ) {
2466 - mw.log('showPlayerSelect');
 2465+ showPlayerSelect: function( $target ) {
 2466+ mw.log('showPlayerSelect');
 2467+ if( ! $target ){
 2468+ $target = this.$interface.find( '.videoOptionsComplete' )
 2469+ }
24672470 // Get id (in case where we have a parent container)
24682471 var _this = this;
24692472 var o = '';
@@ -2522,7 +2525,7 @@
25232526 // Don't follow the empty # link:
25242527 return false;
25252528 } );
2526 - } );
 2529+ } );
25272530 },
25282531
25292532 /**
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/javaEmbed.js
@@ -57,7 +57,7 @@
5858 }
5959 } else {
6060 // should be identical to cortado.jar
61 - applet_loc = mw.getMwEmbedPath() + 'libEmbedPlayer/binPlayers/cortado/cortado-ovt-stripped-0.5.0.jar';
 61+ applet_loc = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/cortado/cortado-ovt-stripped-0.5.0.jar';
6262 }
6363 // load directly in the page..
6464 // (media must be on the same server or applet must be signed)
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -28,7 +28,7 @@
2929 /*
3030 * Set the mwEmbedVersion ( not set by stopgap )
3131 */
32 -var MW_EMBED_VERSION = '1.1';
 32+var MW_EMBED_VERSION = '1.1a';
3333
3434 /**
3535 * Default global config values. Configuration values are set via mw.setConfig
@@ -201,7 +201,6 @@
202202
203203 /**
204204 * Save a user configuration var to a cookie & local global variable
205 - * Loads the cookie plugin if not already loaded
206205 *
207206 * @param {String} name Name of user configuration value
208207 * @return
@@ -260,63 +259,58 @@
261260 * $1, $2 and does relevant msgkey transformation returning
262261 * the user msg.
263262 *
264 - * @param {String} key The msg key as set by mw.addMessages
 263+ * @param {String} msgKey The msg key as set by mw.addMessages
265264 * @param {Array} args An array of replacement strings
266265 * @return string
267266 */
268 - mw.getMsg = function( key , args ) {
 267+ mw.getMsg = function( msgKey , args ) {
269268
270269 // Check for missing message key
271 - if ( ! messageCache[ key ] )
272 - return '&lt;' + key + '&gt;';
 270+ if ( ! messageCache[ msgKey ] )
 271+ return '&lt;' + msgKey + '&gt;';
273272
274273 // swap in the arg values
275 - var ms = mw.lang.gMsgSwap( key, args );
 274+ var ms = mw.lang.msgReplaceArgs( messageCache[ msgKey ], args );
276275
277 - // a quick check to see if we need to send the msg via the 'parser'
 276+ // a quick check to see if we need to send the msg to the 'parser'
278277 // (we can add more detailed check once we support more wiki syntax)
279278 if ( ms.indexOf( '{{' ) === -1 && ms.indexOf( '[' ) === -1 ) {
280279 return ms;
281280 }
282281
283 - // send the msg key through the parser
 282+ // Send the msg key through the parser
284283 var pObj = mw.parser( ms );
285284 // return the transformed msg
286285 return pObj.getHTML();
287286 }
288287
289288 /**
290 - * gMsgSwap
 289+ * Swap in an array of values for $1, $2, $n for a given msg key
291290 *
292 - * @param string key The msg key as set by mw.addMessages
 291+ * @param string msgKey The msg key to lookup
293292 * @param [mixed] args An array or string to be replaced
294293 * @return string
295294 */
296 - mw.lang.gMsgSwap = function( key , args ) {
297 - if ( ! messageCache[ key ] )
298 - return '&lt;' + key + '&gt;';// Missing key placeholder
299 - // get the message string:
300 - var ms = messageCache[ key ];
301 -
 295+ mw.lang.msgReplaceArgs = function( message , args ) {
302296 // replace values
303297 if ( typeof args == 'object' || typeof args == 'array' ) {
304298 for ( var v in args ) {
305299 // Message test replace arguments start at 1 instead of zero:
306300 var rep = new RegExp( '\\$' + ( parseInt( v ) + 1 ), 'g' );
307 - ms = ms.replace( rep, args[v] );
 301+ message = message.replace( rep, args[v] );
308302 }
309303 } else if ( typeof args == 'string' || typeof args == 'number' ) {
310 - ms = ms.replace( /\$1/g, args );
 304+ message = message.replace( /\$1/g, args );
311305 }
312 - return ms;
 306+ return message;
313307 }
314308
315309 /**
316 - * gMsgNoTrans
 310+ * Get msg content without transformation
317311 *
318312 * @returns string The msg key without transforming it
319313 */
320 - mw.lang.gMsgNoTrans = function( key ) {
 314+ mw.lang.msgNoTrans = function( key ) {
321315 if ( messageCache[ key ] )
322316 return messageCache[ key ]
323317
@@ -508,7 +502,10 @@
509503 size = Math.round( size * p ) / p;
510504 return gM( msg , size );
511505 };
512 -
 506+ /**
 507+ * Format a number
 508+ * @param {Number} num Number to be formated
 509+ */
513510 mw.lang.formatNumber = function( num ) {
514511 /*
515512 * addSeparatorsNF
@@ -560,7 +557,7 @@
561558 // (we are already running white-space issues ie php parse strips whitespace differently)
562559 // or at least expose something similar to: http://www.mediawiki.org/wiki/Extension:Page_Object_Model
563560
564 - // ... but I am having fun with recursion so here it is...
 561+ // ... but here is a quick hack that solves my current problem:
565562 function rdpp ( txt , cn ) {
566563 var node = { };
567564 // inspect each char
@@ -589,7 +586,7 @@
590587 return node;
591588 }
592589 /**
593 - * parse template text as template name and named params
 590+ * Parse template text as template name and named params
594591 * @param {String} ts Template String to be parsed
595592 */
596593 function parseTmplTxt( ts ) {
@@ -631,6 +628,9 @@
632629 }
633630 return tObj;
634631 }
 632+ /*
 633+ * Get the Magic text from a template node
 634+ */
635635 function getMagicTxtFromTempNode( node ) {
636636 node.tObj = parseTmplTxt ( node.t );
637637 // do magic swap if template key found in pMagicSet
@@ -645,7 +645,7 @@
646646 /**
647647 * recurse_magic_swap
648648 *
649 - * go last child first swap upward: (could probably be integrated above somehow)
 649+ * Go last child first swap upward: (could probably be integrated above somehow)
650650 */
651651 var pNode = null;
652652 function recurse_magic_swap( node ) {
@@ -691,7 +691,7 @@
692692 * templates
693693 *
694694 * Get a requested template from the wikitext (if available)
695 - *
 695+ * @param templateName
696696 */
697697 templates: function( tname ) {
698698 this.parse();
@@ -843,7 +843,7 @@
844844
845845
846846 /**
847 - * The loader prototype:
 847+ * Top level loader prototype:
848848 */
849849 mw.loader = {
850850 /*
@@ -1439,7 +1439,8 @@
14401440 /**
14411441 * Metavid specific roe request helper function
14421442 *
1443 - * NOTE: depreciated, will be removed once updates are pushed out to metavid.org
 1443+ * NOTE: depreciated, will be removed once standard callback is
 1444+ * pushed out to metavid.org
14441445 *
14451446 * @param roe_url to be updated
14461447 */
@@ -1549,9 +1550,15 @@
15501551 mw.addDialog = function ( title, msg_txt, buttons ) {
15511552 $j( '#mwe_tmp_loader' ).remove();
15521553 // Append the style free loader ontop:
1553 - $j( 'body' ).append( '<div id="mwe_tmp_loader" style="display:none" title="' + title + '" >' +
1554 - msg_txt +
1555 - '</div>' );
 1554+ $j( 'body' ).append(
 1555+ $j('<div />')
 1556+ .attr( {
 1557+ 'id' : "mwe_tmp_loader",
 1558+ 'title' : title
 1559+ })
 1560+ .css('display', 'none')
 1561+ .text( msg_text )
 1562+ );
15561563 // Special buttons == ok gives empty give a single "oky" -> "close"
15571564 if ( buttons == 'ok' ) {
15581565 buttons = { };
@@ -1559,8 +1566,8 @@
15601567 $j( '#mwe_tmp_loader' ).close();
15611568 }
15621569 }
1563 - // turn the loader into a real dialog loader:
1564 - mw.load( [
 1570+ // Load the dialog classes
 1571+ mw.load([
15651572 [
15661573 '$j.ui'
15671574 ],
@@ -1711,7 +1718,7 @@
17121719 /**
17131720 * Get a loading spinner html
17141721 * NOTE: this is depreciated use jQuery binding "loadingSpinner" instead
1715 -
 1722+ *
17161723 * @param {String} [Optional] style Style string to apply to the spinner
17171724 */
17181725 mw.loading_spinner = function( style ) {
Index: branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php
@@ -460,7 +460,7 @@
461461 $urid = htmlspecialchars( $_GET['urid'] );
462462 }else{
463463 // If no urid is set use special "cache" version.
464 - // (this requires that the cache is removed for updates to take effect.)
 464+ // (this requires that the cache files be removed for updates to take effect.)
465465 $urid = 'cache';
466466 }
467467
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js
@@ -4,7 +4,7 @@
55 */
66 var urlparts = getRemoteEmbedPath();
77 var mwEmbedHostPath = urlparts[0];
8 -var mwRemoteVersion = 'r85';
 8+var mwRemoteVersion = 'r86';
99 var mwUseScriptLoader = true;
1010
1111 //Log the mwRemote version ( will determin what version of js we get )
@@ -24,7 +24,7 @@
2525 // Use wikibits onLoad hook: ( since we don't have js2 / mw object loaded )
2626 addOnloadHook( function() {
2727 // Only do rewrites if mwEmbed / js2 is "off"
28 - if ( typeof mwEmbed_VERSION == 'undefined' ) {
 28+ if ( typeof MW_EMBED_VERSION == 'undefined' ) {
2929 doPageSpecificRewrite();
3030 }
3131 } );
@@ -426,7 +426,7 @@
427427 '$1', 'Special:UserLogin?returnto=' + wgPageName ) )
428428 )
429429 .remove();
430 - return ;
 430+ return false;
431431 }
432432
433433 // Else Add loader
@@ -439,6 +439,9 @@
440440 .remove();
441441 // Load gadgets form:
442442 mwSubmitgadgetPref( 'mwEmbed' );
 443+
 444+ // return false to not follow link
 445+ return false;
443446 } );
444447
445448 // Add the $gadgetBtn before the first heading:

Status & tagging log