Index: branches/js2-work/phase3/js/mwEmbed/tests/testLang.html |
— | — | @@ -217,7 +217,7 @@ |
218 | 218 | o+='<tr>'+ |
219 | 219 | '<td>' + numVal + '</td>' + |
220 | 220 | '<td>' + mKey + '</td>' + |
221 | | - '<td>' + mw.lang.gMsgNoTrans( mKey ) + '</td>' + |
| 221 | + '<td>' + mw.lang.msgNoTrans( mKey ) + '</td>' + |
222 | 222 | '<td id="' + tkey + '_js">' + gM( mKey, numVal ) + '</td>'; |
223 | 223 | //show mw col: |
224 | 224 | if( mKey.substr(0, 5) == 'test_' ){ |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js |
— | — | @@ -25,17 +25,18 @@ |
26 | 26 | setTimeout(function(){ |
27 | 27 | _this.postEmbedJS(); |
28 | 28 | }, 50); |
| 29 | + var embed_code = this.getEmbedObj(); |
29 | 30 | mw.log( "return embed html: " + embed_code ); |
30 | | - return this.getEmbedObj(); |
| 31 | + return embed_code; |
31 | 32 | }, |
32 | 33 | |
33 | 34 | /** |
34 | 35 | * Get the plugin embed html |
35 | 36 | */ |
36 | 37 | getEmbedObj:function() { |
37 | | - var player_path = mw.getMwEmbedPath() + 'libEmbedPlayer/binPlayers/kaltura-player'; |
| 38 | + var playerPath = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/kaltura-player'; |
38 | 39 | return '<object width="' + this.width + '" height="' + this.height + '" '+ |
39 | | - 'data="' + player_path + '/wrapper.swf" allowfullscreen="true" '+ |
| 40 | + 'data="' + playerPath + '/wrapper.swf" allowfullscreen="true" '+ |
40 | 41 | 'allownetworking="all" allowscriptaccess="always" '+ |
41 | 42 | 'type="application/x-shockwave-flash" '+ |
42 | 43 | 'id="' + this.pid + '" name="' + this.pid + '">'+ |
— | — | @@ -45,7 +46,7 @@ |
46 | 47 | '<param value="#000000" name="bgcolor"/>'+ |
47 | 48 | '<param value="wrapper.swf" name="movie"/>'+ |
48 | 49 | '<param value="' + |
49 | | - 'kdpUrl=' + player_path + '/kdp.swf' + |
| 50 | + 'kdpUrl=' + playerPath + '/kdp.swf' + |
50 | 51 | '&ks=dummy&partner_id=0&subp_id=0' + |
51 | 52 | '&uid=0&emptyF=onKdpEmpty&readyF=onKdpReady' + |
52 | 53 | '" ' + |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/omtkEmbed.js |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | * Get the embed object html |
34 | 34 | */ |
35 | 35 | 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'; |
37 | 37 | // player_path = 'omtkp.swf'; |
38 | 38 | mw.log( "player path: " + player_path ); |
39 | 39 | 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 @@ |
2392 | 2392 | }, |
2393 | 2393 | |
2394 | 2394 | /** |
2395 | | - * Generic function to display custom HTML inside the mwEmbed element. |
| 2395 | + * Generic function to display custom HTML inside the mwEmbedPlayer |
2396 | 2396 | * Should call the closeDisplayedHTML function to close the |
2397 | 2397 | * display of the custom HTML and restore the regular player display. |
2398 | 2398 | * |
— | — | @@ -2461,8 +2461,11 @@ |
2462 | 2462 | * |
2463 | 2463 | * @param {Object} $target jQuery target to output to |
2464 | 2464 | */ |
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 | + } |
2467 | 2470 | // Get id (in case where we have a parent container) |
2468 | 2471 | var _this = this; |
2469 | 2472 | var o = ''; |
— | — | @@ -2522,7 +2525,7 @@ |
2523 | 2526 | // Don't follow the empty # link: |
2524 | 2527 | return false; |
2525 | 2528 | } ); |
2526 | | - } ); |
| 2529 | + } ); |
2527 | 2530 | }, |
2528 | 2531 | |
2529 | 2532 | /** |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/javaEmbed.js |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | } |
59 | 59 | } else { |
60 | 60 | // 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'; |
62 | 62 | } |
63 | 63 | // load directly in the page.. |
64 | 64 | // (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 @@ |
29 | 29 | /* |
30 | 30 | * Set the mwEmbedVersion ( not set by stopgap ) |
31 | 31 | */ |
32 | | -var MW_EMBED_VERSION = '1.1'; |
| 32 | +var MW_EMBED_VERSION = '1.1a'; |
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Default global config values. Configuration values are set via mw.setConfig |
— | — | @@ -201,7 +201,6 @@ |
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Save a user configuration var to a cookie & local global variable |
205 | | - * Loads the cookie plugin if not already loaded |
206 | 205 | * |
207 | 206 | * @param {String} name Name of user configuration value |
208 | 207 | * @return |
— | — | @@ -260,63 +259,58 @@ |
261 | 260 | * $1, $2 and does relevant msgkey transformation returning |
262 | 261 | * the user msg. |
263 | 262 | * |
264 | | - * @param {String} key The msg key as set by mw.addMessages |
| 263 | + * @param {String} msgKey The msg key as set by mw.addMessages |
265 | 264 | * @param {Array} args An array of replacement strings |
266 | 265 | * @return string |
267 | 266 | */ |
268 | | - mw.getMsg = function( key , args ) { |
| 267 | + mw.getMsg = function( msgKey , args ) { |
269 | 268 | |
270 | 269 | // Check for missing message key |
271 | | - if ( ! messageCache[ key ] ) |
272 | | - return '<' + key + '>'; |
| 270 | + if ( ! messageCache[ msgKey ] ) |
| 271 | + return '<' + msgKey + '>'; |
273 | 272 | |
274 | 273 | // swap in the arg values |
275 | | - var ms = mw.lang.gMsgSwap( key, args ); |
| 274 | + var ms = mw.lang.msgReplaceArgs( messageCache[ msgKey ], args ); |
276 | 275 | |
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' |
278 | 277 | // (we can add more detailed check once we support more wiki syntax) |
279 | 278 | if ( ms.indexOf( '{{' ) === -1 && ms.indexOf( '[' ) === -1 ) { |
280 | 279 | return ms; |
281 | 280 | } |
282 | 281 | |
283 | | - // send the msg key through the parser |
| 282 | + // Send the msg key through the parser |
284 | 283 | var pObj = mw.parser( ms ); |
285 | 284 | // return the transformed msg |
286 | 285 | return pObj.getHTML(); |
287 | 286 | } |
288 | 287 | |
289 | 288 | /** |
290 | | - * gMsgSwap |
| 289 | + * Swap in an array of values for $1, $2, $n for a given msg key |
291 | 290 | * |
292 | | - * @param string key The msg key as set by mw.addMessages |
| 291 | + * @param string msgKey The msg key to lookup |
293 | 292 | * @param [mixed] args An array or string to be replaced |
294 | 293 | * @return string |
295 | 294 | */ |
296 | | - mw.lang.gMsgSwap = function( key , args ) { |
297 | | - if ( ! messageCache[ key ] ) |
298 | | - return '<' + key + '>';// Missing key placeholder |
299 | | - // get the message string: |
300 | | - var ms = messageCache[ key ]; |
301 | | - |
| 295 | + mw.lang.msgReplaceArgs = function( message , args ) { |
302 | 296 | // replace values |
303 | 297 | if ( typeof args == 'object' || typeof args == 'array' ) { |
304 | 298 | for ( var v in args ) { |
305 | 299 | // Message test replace arguments start at 1 instead of zero: |
306 | 300 | var rep = new RegExp( '\\$' + ( parseInt( v ) + 1 ), 'g' ); |
307 | | - ms = ms.replace( rep, args[v] ); |
| 301 | + message = message.replace( rep, args[v] ); |
308 | 302 | } |
309 | 303 | } else if ( typeof args == 'string' || typeof args == 'number' ) { |
310 | | - ms = ms.replace( /\$1/g, args ); |
| 304 | + message = message.replace( /\$1/g, args ); |
311 | 305 | } |
312 | | - return ms; |
| 306 | + return message; |
313 | 307 | } |
314 | 308 | |
315 | 309 | /** |
316 | | - * gMsgNoTrans |
| 310 | + * Get msg content without transformation |
317 | 311 | * |
318 | 312 | * @returns string The msg key without transforming it |
319 | 313 | */ |
320 | | - mw.lang.gMsgNoTrans = function( key ) { |
| 314 | + mw.lang.msgNoTrans = function( key ) { |
321 | 315 | if ( messageCache[ key ] ) |
322 | 316 | return messageCache[ key ] |
323 | 317 | |
— | — | @@ -508,7 +502,10 @@ |
509 | 503 | size = Math.round( size * p ) / p; |
510 | 504 | return gM( msg , size ); |
511 | 505 | }; |
512 | | - |
| 506 | + /** |
| 507 | + * Format a number |
| 508 | + * @param {Number} num Number to be formated |
| 509 | + */ |
513 | 510 | mw.lang.formatNumber = function( num ) { |
514 | 511 | /* |
515 | 512 | * addSeparatorsNF |
— | — | @@ -560,7 +557,7 @@ |
561 | 558 | // (we are already running white-space issues ie php parse strips whitespace differently) |
562 | 559 | // or at least expose something similar to: http://www.mediawiki.org/wiki/Extension:Page_Object_Model |
563 | 560 | |
564 | | - // ... but I am having fun with recursion so here it is... |
| 561 | + // ... but here is a quick hack that solves my current problem: |
565 | 562 | function rdpp ( txt , cn ) { |
566 | 563 | var node = { }; |
567 | 564 | // inspect each char |
— | — | @@ -589,7 +586,7 @@ |
590 | 587 | return node; |
591 | 588 | } |
592 | 589 | /** |
593 | | - * parse template text as template name and named params |
| 590 | + * Parse template text as template name and named params |
594 | 591 | * @param {String} ts Template String to be parsed |
595 | 592 | */ |
596 | 593 | function parseTmplTxt( ts ) { |
— | — | @@ -631,6 +628,9 @@ |
632 | 629 | } |
633 | 630 | return tObj; |
634 | 631 | } |
| 632 | + /* |
| 633 | + * Get the Magic text from a template node |
| 634 | + */ |
635 | 635 | function getMagicTxtFromTempNode( node ) { |
636 | 636 | node.tObj = parseTmplTxt ( node.t ); |
637 | 637 | // do magic swap if template key found in pMagicSet |
— | — | @@ -645,7 +645,7 @@ |
646 | 646 | /** |
647 | 647 | * recurse_magic_swap |
648 | 648 | * |
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) |
650 | 650 | */ |
651 | 651 | var pNode = null; |
652 | 652 | function recurse_magic_swap( node ) { |
— | — | @@ -691,7 +691,7 @@ |
692 | 692 | * templates |
693 | 693 | * |
694 | 694 | * Get a requested template from the wikitext (if available) |
695 | | - * |
| 695 | + * @param templateName |
696 | 696 | */ |
697 | 697 | templates: function( tname ) { |
698 | 698 | this.parse(); |
— | — | @@ -843,7 +843,7 @@ |
844 | 844 | |
845 | 845 | |
846 | 846 | /** |
847 | | - * The loader prototype: |
| 847 | + * Top level loader prototype: |
848 | 848 | */ |
849 | 849 | mw.loader = { |
850 | 850 | /* |
— | — | @@ -1439,7 +1439,8 @@ |
1440 | 1440 | /** |
1441 | 1441 | * Metavid specific roe request helper function |
1442 | 1442 | * |
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 |
1444 | 1445 | * |
1445 | 1446 | * @param roe_url to be updated |
1446 | 1447 | */ |
— | — | @@ -1549,9 +1550,15 @@ |
1550 | 1551 | mw.addDialog = function ( title, msg_txt, buttons ) { |
1551 | 1552 | $j( '#mwe_tmp_loader' ).remove(); |
1552 | 1553 | // 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 | + ); |
1556 | 1563 | // Special buttons == ok gives empty give a single "oky" -> "close" |
1557 | 1564 | if ( buttons == 'ok' ) { |
1558 | 1565 | buttons = { }; |
— | — | @@ -1559,8 +1566,8 @@ |
1560 | 1567 | $j( '#mwe_tmp_loader' ).close(); |
1561 | 1568 | } |
1562 | 1569 | } |
1563 | | - // turn the loader into a real dialog loader: |
1564 | | - mw.load( [ |
| 1570 | + // Load the dialog classes |
| 1571 | + mw.load([ |
1565 | 1572 | [ |
1566 | 1573 | '$j.ui' |
1567 | 1574 | ], |
— | — | @@ -1711,7 +1718,7 @@ |
1712 | 1719 | /** |
1713 | 1720 | * Get a loading spinner html |
1714 | 1721 | * NOTE: this is depreciated use jQuery binding "loadingSpinner" instead |
1715 | | - |
| 1722 | + * |
1716 | 1723 | * @param {String} [Optional] style Style string to apply to the spinner |
1717 | 1724 | */ |
1718 | 1725 | mw.loading_spinner = function( style ) { |
Index: branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php |
— | — | @@ -460,7 +460,7 @@ |
461 | 461 | $urid = htmlspecialchars( $_GET['urid'] ); |
462 | 462 | }else{ |
463 | 463 | // 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.) |
465 | 465 | $urid = 'cache'; |
466 | 466 | } |
467 | 467 | |
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | */ |
6 | 6 | var urlparts = getRemoteEmbedPath(); |
7 | 7 | var mwEmbedHostPath = urlparts[0]; |
8 | | -var mwRemoteVersion = 'r85'; |
| 8 | +var mwRemoteVersion = 'r86'; |
9 | 9 | var mwUseScriptLoader = true; |
10 | 10 | |
11 | 11 | //Log the mwRemote version ( will determin what version of js we get ) |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | // Use wikibits onLoad hook: ( since we don't have js2 / mw object loaded ) |
26 | 26 | addOnloadHook( function() { |
27 | 27 | // Only do rewrites if mwEmbed / js2 is "off" |
28 | | - if ( typeof mwEmbed_VERSION == 'undefined' ) { |
| 28 | + if ( typeof MW_EMBED_VERSION == 'undefined' ) { |
29 | 29 | doPageSpecificRewrite(); |
30 | 30 | } |
31 | 31 | } ); |
— | — | @@ -426,7 +426,7 @@ |
427 | 427 | '$1', 'Special:UserLogin?returnto=' + wgPageName ) ) |
428 | 428 | ) |
429 | 429 | .remove(); |
430 | | - return ; |
| 430 | + return false; |
431 | 431 | } |
432 | 432 | |
433 | 433 | // Else Add loader |
— | — | @@ -439,6 +439,9 @@ |
440 | 440 | .remove(); |
441 | 441 | // Load gadgets form: |
442 | 442 | mwSubmitgadgetPref( 'mwEmbed' ); |
| 443 | + |
| 444 | + // return false to not follow link |
| 445 | + return false; |
443 | 446 | } ); |
444 | 447 | |
445 | 448 | // Add the $gadgetBtn before the first heading: |