r52848 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52847‎ | r52848 | r52849 >
Date:17:46, 7 July 2009
Author:dale
Status:deferred
Tags:
Comment:
native warning update
style updates for volume control
Modified paths:
  • /branches/new-upload/phase3/js2/mwEmbed/example_usage/Player_Simple_Video_Tag.html (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/mv_embed.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/skins/mvpcf/styles.css (modified) (history)

Diff [purge]

Index: branches/new-upload/phase3/js2/mwEmbed/mv_embed.js
@@ -414,10 +414,12 @@
415415 //do many requests:
416416 for(var i=0; i< loadLibs.length; i++){
417417 var curLib = loadLibs[i];
418 - var libLoc = mvGetClassPath(curLib);
419 - // do a direct load of the file (pass along unique request id from request or mv_embed Version )
420 - var qmark = (libLoc.indexOf('?')!==true)?'?':'&';
421 - this.libs[curLib] = mv_embed_path + libLoc + qmark + 'urid='+ getMvUniqueReqId();
 418+ if(curLib){
 419+ var libLoc = mvGetClassPath(curLib);
 420+ // do a direct load of the file (pass along unique request id from request or mv_embed Version )
 421+ var qmark = (libLoc.indexOf('?')!==true)?'?':'&';
 422+ this.libs[curLib] = mv_embed_path + libLoc + qmark + 'urid='+ getMvUniqueReqId();
 423+ }
422424 }
423425 }
424426 }
@@ -478,13 +480,12 @@
479481 callback();
480482 }
481483 });
482 - }
483 - },
 484+ } },
484485 checkLoading:function(){
485486 var loading=0;
486487 var i=null;
487 - for(var i in this.libs){ //for in loop oky on object
488 - if( ! this.checkObjPath( i ) ){
 488+ for(var i in this.libs){ //for in loop oky on object
 489+ if( !this.checkObjPath( i ) ){
489490 if(!this.libreq[i]){
490491 loadExternalJs( this.libs[i] );
491492 }
@@ -497,18 +498,20 @@
498499 return loading;
499500 },
500501 checkObjPath:function( libVar ){
501 - var objPath = libVar.split('.')
502 - var cur_path ='';
503 - for(var p=0; p < objPath.length; p++){
 502+ if(!libVar)
 503+ return false;
 504+ var objPath = libVar.split('.')
 505+ var cur_path ='';
 506+ for(var p=0; p < objPath.length; p++){
504507 cur_path = (cur_path=='')?cur_path+objPath[p]:cur_path+'.'+objPath[p];
505508 eval( 'var ptest = typeof ( '+ cur_path + ' ); ');
506509 if( ptest == 'undefined'){
507510 this.missing_path = cur_path;
508511 return false;
509512 }
510 - }
511 - this.cur_path = cur_path;
512 - return true;
 513+ }
 514+ this.cur_path = cur_path;
 515+ return true;
513516 },
514517 /**
515518 * checks for jQuery and adds the $j noConflict var
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -40,7 +40,8 @@
4141 "mv_ogg-player-omtkplayer" : "OMTK Flash Vorbis",
4242 "mv_generic_missing_plugin" : "You browser does not appear to support playback type: <b>$1</b><br> visit the <a href=\"http://commons.wikimedia.org/wiki/Commons:Media_help\">Playback Methods</a> page to download a player<br>",
4343
44 - "mv_for_best_experience": "For best video playback experience we recomend <a href=\"http://www.mozilla.com/en-US/firefox/upgrade.html?from=mv_embed\">Firefox 3.5</a><br><input type=\"checkbox\">Do not warn me again."
 44+ "mv_for_best_experience": "For best video playback experience we recomend <a href=\"http://www.mozilla.com/en-US/firefox/upgrade.html?from=mv_embed\">Firefox 3.5</a>",
 45+ "mv_do_not_warn_again": "Do not warn me again."
4546
4647 });
4748
@@ -324,30 +325,47 @@
325326 $j('#' + embedObj.id).get(0).play();
326327 });
327328
328 - //add recomend firefox if non-native playback:
329 - var doGetFFWarning = true;
330 - for(var i in embedObj.media_players){
331 - if(embedObj.media_players[i].id == 'videoElement'){
332 - doGetFFWarning=false;
333 - }
334 - }
335 - for(var source=0; source < playable_sources.length; source++){
336 - var mime_type =playable_sources[source].mime_type;
337 - if( mime_type=='video/h264' || mime_type=='video/x-flv'){
338 - //they have flash / h.264 fallback no need to push firefox :(
339 - doGetFFWarning = false;
340 - }
341 - }
342 - if(doGetFFWarning){
 329+ //add recomend firefox if non-native playback:
 330+ var doGetNativeWarning = true;
 331+ if( $j.cookie('dismissNativeWarn') && $j.cookie('dismissNativeWarn')===true){
 332+ doGetNativeWarning = false;
 333+ }else{
 334+ for(var i in embedObj.media_players){
 335+ if(embedObj.media_players[i].id == 'videoElement'){
 336+ doGetNativeWarning=false;
 337+ }
 338+ }
 339+ var playable_sources = embedObj.media_element.getPlayableSources();
 340+ for(var source=0; source <playable_sources.length; source++){
 341+ var mime_type = playable_sources[source].mime_type;
 342+ if( mime_type=='video/h264' || mime_type=='video/x-flv'){
 343+ //they have flash / h.264 fallback no need to push firefox :(
 344+ doGetNativeWarning = false;
 345+ }
 346+ }
 347+ }
 348+ if( doGetNativeWarning ){
343349 $j('#dc_'+ embedObj.id).hover(
344 - function(){
 350+ function(){
345351 if($j('gnp_' + embedObj.id).length==0){
346352 $j(this).append('<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' +
347353 'style="position:absolute;display:none;background:#FFF;top:10px;left:10px;right:10px;height:60px;">' +
348 - gM('mv_for_best_experience') +
349 - '</div>');
 354+ gM('mv_for_best_experience') +
 355+ '<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' +
 356+ gM('mv_do_not_warn_again') +
 357+ '</div>');
 358+ $j('#ffwarn_'+embedObj.id).click(function(){
 359+ if( $j(this).checked ){
 360+ $j.cookie('dismissNativeWarn', true);
 361+ }else{
 362+ $j.cookie('dismissNativeWarn', false);
 363+ }
 364+
 365+ });
350366 }
351 - $j('#gnp_' + embedObj.id).fadeIn('slow');
 367+ if( $j.cookie('dismissNativeWarn')!== true){
 368+ $j('#gnp_' + embedObj.id).fadeIn('slow');
 369+ }
352370 },
353371 function(){
354372 $j('#gnp_' + embedObj.id).fadeOut('slow');
@@ -2192,15 +2210,19 @@
21932211 }
21942212 },
21952213 toggleMute:function(){
2196 - var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
2197 - js_log('f:toggleMute');
 2214+ var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
21982215 if(this.muted){
21992216 this.muted=false;
22002217 $j('#volume_control_'+this_id + ' span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on');
 2218+ $j('#volume_bar_'+this_id).slider('value', 100);
 2219+ this.updateVolumen(1);
22012220 }else{
22022221 this.muted=true;
22032222 $j('#volume_control_'+this_id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');
 2223+ $j('#volume_bar_'+this_id).slider('value', 0);
 2224+ this.updateVolumen(0);
22042225 }
 2226+ js_log('f:toggleMute::' + this.muted);
22052227 },
22062228 updateVolumen:function(perc){
22072229 js_log('update volume not supported with current playback type');
Index: branches/new-upload/phase3/js2/mwEmbed/example_usage/Player_Simple_Video_Tag.html
@@ -3,7 +3,7 @@
44 <html>
55 <head>
66 <title>Simple Video Tag Usage</title>
7 - <script type="text/javascript" src="../mv_embed.js"></script>
 7+ <script type="text/javascript" src="../mv_embed.js?debug=true"></script>
88 </head>
99 <body>
1010 <h3> Simple Video Tag Usage </h3>
Index: branches/new-upload/phase3/js2/mwEmbed/skins/mvpcf/styles.css
@@ -784,5 +784,5 @@
785785 cursor : pointer;
786786 width:10px;
787787 height:10px;
788 - margin-left:5px;
 788+ margin-left:3px;
789789 }
\ No newline at end of file

Status & tagging log