r55319 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55318‎ | r55319 | r55320 >
Date:11:42, 19 August 2009
Author:dale
Status:deferred
Tags:
Comment:
* playhead width and player select fixes
Modified paths:
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -29,7 +29,7 @@
3030 "share" : "Share",
3131 "credits" : "Credits",
3232 "clip_linkback" : "Clip source page",
33 - "chose_player" : "Choose video player",
 33+ "chose_player" : "Choose Video Player",
3434 "share_this_video" : "Share this video",
3535 "video_credits" : "Video credits",
3636 "menu_btn" : "Menu",
@@ -139,11 +139,21 @@
140140 this.supports['closed_captions']=true;
141141
142142 var o='';
 143+ //get the length of the scruber
 144+ this.player_head_length = embedObj.playerPixelWidth();
143145 for( var i in this.components ){
144146 if( this.supports[i] ){
 147+ if( i != 'play_head'){
 148+ js_log(this.player_head_length + ' - ph: ' + this.components[i].w );
 149+ this.player_head_length -= this.components[i].w;
 150+ }
 151+ }
 152+ }
 153+ for(var i in this.components){
 154+ if( this.supports[i] ){
145155 if( this.available_width > this.components[i].w ){
146156 //special case with playhead don't add unless we have 60px
147 - if( i == 'play_head' && ctrlBuilder.available_width < 60 )
 157+ if( i == 'play_head' && this.player_head_length < 60 )
148158 continue;
149159 o+=this.components[i].o();
150160 this.available_width -= this.components[i].w;
@@ -151,7 +161,7 @@
152162 js_log('not enough space for control component:' + i);
153163 }
154164 }
155 - }
 165+ }
156166 return o;
157167 },
158168 /*
@@ -227,7 +237,7 @@
228238 });
229239
230240 //fullscreen binding:
231 - $j('#fullscreen_'+embedObj.id).unbind().btnBind().click(function(){
 241+ $j('#fullscreen_' + embedObj.id).unbind().btnBind().click(function(){
232242 $j('#' +embedObj.id).get(0).fullscreen();
233243 });
234244
@@ -454,7 +464,7 @@
455465 }
456466 },
457467 'pause':{
458 - 'w':147, //28 147
 468+ 'w':28, //28 147
459469 'o':function(){
460470 return '<button class="play-btn ui-state-default ui-corner-all" title="' +
461471 gM('play_clip') + '" ><span class="ui-icon ui-icon-play"></span></button>'
@@ -464,7 +474,7 @@
465475 'w':0, //special case (takes up remaining space)
466476 'o':function(){
467477 return '<div class="ui-slider ui-slider-horizontal ui-corner-all j-scrubber"' +
468 - ' style="width:' + ( ctrlBuilder.available_width - 30 ) + 'px;"></div>'
 478+ ' style="width:' + ( ctrlBuilder.player_head_length - 30 ) + 'px;"></div>'
469479 }
470480 },
471481 'time_display':{
@@ -474,7 +484,7 @@
475485 }
476486 },
477487 'volume_control':{
478 - 'w':47,
 488+ 'w':40,
479489 'o':function(){
480490 return '<button class="ui-state-default ui-corner-all k-volume">' +
481491 '<span class="ui-icon ui-icon-volume-on"></span>' +
@@ -1748,7 +1758,7 @@
17491759 html_code +='</div>';
17501760 //block out some space by encapulating the top level div
17511761 $j(this).wrap('<div style="width:'+parseInt(this.width)+'px;height:'
1752 - + (parseInt(this.height) + ctrlBuilder.height )+'px" id="k-player_' + this.id + '" class="k-player"></div>');
 1762+ + (parseInt(this.height) + ctrlBuilder.height )+'px" id="k-player_' + this.id + '" class="k-player ui-widget"></div>');
17531763 }
17541764
17551765 //js_log('should set: '+this.id);
@@ -2106,11 +2116,10 @@
21072117 showPlayerselect:function( target ){
21082118 //get id (in case where we have a parent container)
21092119 var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
2110 -
21112120 var _this=this;
21122121 // var out= '<span style="color:#FFF;background-color:black;"><blockquote style="background-color:black;">';
2113 - var out= '';
2114 - out+='<h2>' + gM('chose_player') + '</h2>';
 2122+ var o= '';
 2123+ o+='<h2>' + gM('chose_player') + '</h2>';
21152124 var _this=this;
21162125 //js_log('selected src'+ _this.media_element.selected_source.url);
21172126 $j.each( this.media_element.getPlayableSources(), function(source_id, source){
@@ -2120,7 +2129,7 @@
21212130 var image_src = mv_skin_img_path ;
21222131
21232132 //set the Playable source type:
2124 - if( source.mime_type == 'video/x-flv' ){
 2133+ /*if( source.mime_type == 'video/x-flv' ){
21252134 image_src += 'flash_icon_';
21262135 }else if( source.mime_type == 'video/h264'){
21272136 //for now all mp4 content is pulled from archive.org (so use archive.org icon)
@@ -2130,37 +2139,40 @@
21312140 }
21322141 image_src += is_selected ? 'color':'bw';
21332142 image_src += '.png';
2134 -
2135 - if (default_player)
2136 - {
2137 - out+=' <ul>';
 2143+ */
 2144+ if (default_player){
 2145+ o+='<ul>';
21382146 //output the player select code:
21392147 var supporting_players = embedTypes.players.getMIMETypePlayers( source.getMIMEType() );
21402148
21412149 for(var i=0; i < supporting_players.length ; i++){
21422150 if( _this.selected_player.id == supporting_players[i].id && is_selected ){
2143 - out+='<li>' + supporting_players[i].getName() +'</li>';
 2151+ o+='<li>' +
 2152+ '<a href="#" class="active" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">' +
 2153+ supporting_players[i].getName() +
 2154+ '</li>';
21442155 }else{
21452156 //else gray plugin and the plugin with link to select
2146 -// out+='<li style="margin-left:20px;">'+
2147 -// '<a href="#" class="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">'+
2148 -// '<img border="0" width="16" height="16" src="' + mv_skin_img_path + 'plugin_disabled.png">'+
2149 -// supporting_players[i].getName() +
2150 -// '</a>'+
2151 - out+='<li>' +
2152 - '<a href="#" id="dc_' + source_id + '_' + supporting_players[i].id +'">' +
2153 - supporting_players[i].getName() + '</a><li>';
 2157+ /*out+='<li style="margin-left:20px;">'+
 2158+ '<a href="#" class="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">'+
 2159+ '<img border="0" width="16" height="16" src="' + mv_skin_img_path + 'plugin_disabled.png">'+
 2160+ supporting_players[i].getName() +
 2161+ '</a>'+*/
 2162+ o+='<li>' +
 2163+ '<a href="#" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">' +
 2164+ supporting_players[i].getName() + '</a>' +
 2165+ '</li>';
21542166 }
21552167 }
2156 - out+='</ul></div>';
2157 - }else
2158 - out+= source.getTitle() + ' - no player available';
 2168+ o+='</ul>';
 2169+ }else{
 2170+ o+= source.getTitle() + ' - no player available';
 2171+ }
21592172 });
2160 -// out+='</blockquote></span>';
2161 - $j(target).html(out);
 2173+ $j(target).html(o);
21622174
21632175 //set up the click bindings:
2164 - $j('.sel_source').each(function(){
 2176+ $j(target).find("[rel='sel_source']").each(function(){
21652177 $j(this).click(function(){
21662178 var iparts = $j(this).attr( 'id' ).replace(/sc_/,'').split('_');
21672179 var source_id = iparts[0];

Status & tagging log