r36789 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36788‎ | r36789 | r36790 >
Date:22:18, 29 June 2008
Author:stipe
Status:old
Tags:
Comment:
plugin selection offers default player as well as player selection
Modified paths:
  • /branches/MetavidWiki-exp/MetavidWiki/skins/mv_embed/mv_embed.css (modified) (history)
  • /branches/MetavidWiki-exp/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)

Diff [purge]

Index: branches/MetavidWiki-exp/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -241,13 +241,13 @@
242242
243243 var vlcMozillaPlayer = new mediaPlayer(
244244 'vlc-mozilla',
245 - ['video/ogg'],
 245+ ['video/ogg', 'video/x-flv'],
246246 'vlc'
247247 );
248248
249249 var vlcActiveXPlayer = new mediaPlayer(
250250 'vlc-activex',
251 - ['video/ogg'],
 251+ ['video/ogg', 'video/x-flv'],
252252 'vlc'
253253 );
254254
@@ -309,16 +309,26 @@
310310
311311 return mime_players;
312312 },
313 - autoSelectPlayer : function(mime_type)
 313+ defaultPlayer : function(mime_type)
314314 {
315 - js_log('autoselecting player for ' + mime_type);
316315 var mime_players = this.getMIMETypePlayers(mime_type);
 316+ var to_return = null;
317317 if(mime_players.length)
318318 {
319 - this.selected_player = mime_players[0];
 319+ to_return = mime_players[0];
320320 for(var i in mime_players)
321321 if(mime_players[i].id==this.preference[mime_type])
322 - this.selected_player = mime_players[i];
 322+ to_return = mime_players[i];
 323+ }
 324+ return to_return;
 325+ },
 326+ autoSelectPlayer : function(mime_type)
 327+ {
 328+ js_log('autoselecting player for ' + mime_type);
 329+ var player = this.defaultPlayer(mime_type);
 330+ if(player)
 331+ {
 332+ this.selected_player = player;
323333 js_log('selected ' + this.selected_player.getName());
324334 }
325335 else
@@ -426,10 +436,10 @@
427437 for (var i in this.players.players)
428438 mvEmbed.lib_plugins[this.players.players[i].getLibraryObject()]=this.players.players[i].getLibraryFile();
429439 },
430 - getPlayerSelectList:function(mime_type, file_select_code){
 440+ getPlayerSelectList:function(mime_type, index, file_select_code){
431441 var supporting_players = this.players.getMIMETypePlayers(mime_type);
432442
433 - var select_html='<ul style="color:white">';
 443+ var select_html='<div id="player_select_list_' + index + '" class="player_select_list"><ul>';
434444 for(i in supporting_players){
435445 /* //list if its the current put a colored plugin icon than name
436446 if(this.playerType==this.players[i]){
@@ -440,14 +450,14 @@
441451 }else{*/
442452 //else gray plugin and the plugin with link to select
443453 select_html+='<li>'+
444 - '<a style="color:white" href="#" onClick="'+ file_select_code + 'embedTypes.players.selectPlayer(\''+supporting_players[i].id+'\',\''+mime_type+'\');return false;">'+
 454+ '<a href="#" onClick="'+ file_select_code + 'embedTypes.players.selectPlayer(\''+supporting_players[i].id+'\',\''+mime_type+'\');return false;">'+
445455 '<img border="0" width="16" height="16" src="'+mv_embed_path+'images/plugin_disabled.png">'+
446456 supporting_players[i].getName() +
447457 '</a>'+
448458 '</li>';
449459 // }
450460 }
451 - select_html+='</ul>';
 461+ select_html+='</ul></div>';
452462 js_log(select_html);
453463 return select_html;
454464 },
@@ -1704,13 +1714,17 @@
17051715 if(height<240)height=240;
17061716
17071717 var sel_id = (this.pc!=null)?this.pc.pp.id:this.id;
 1718+ var close_link ='<a href="#" style="color:white" onClick="document.getElementById(\''+this.id+'\').closeDisplayedHTML();return false;">close</a>';
 1719+
17081720 //fade in a black bg div ontop of everything
17091721 var div_code = '<div id="blackbg_'+sel_id+'" ' +
17101722 'style="overflow:auto;position:absolute;display:none;z-index:2;background:black;top:0px;left:0px;' +
17111723 'height:'+parseInt(height)+'px;width:'+parseInt(width)+'px;">'+
 1724+ '<span id="close_vl'+this.id+'" style="position:absolute:top:2px;left:2px;color:white;">'+close_link+'</span>'+
 1725+ '<span class="displayHTML" id="con_vl_'+this.id+'" style="position:absolute;top:20px;left:20px;color:white;">' +
17121726 html_code +
 1727+ close_link+'</span>'
17131728 '</div>';
1714 -
17151729 $j('#'+sel_id).append(div_code);
17161730 $j('#blackbg_'+sel_id).fadeIn("slow");
17171731 return false; //onclick action return false
@@ -1726,33 +1740,24 @@
17271741 return false;//onclick action return false
17281742 },
17291743 selectPlaybackMethod:function(){
1730 - var close_link ='<a href="#" style="color:white" onClick="document.getElementById(\''+this.id+'\').closeDisplayedHTML();return false;">close</a>';
1731 - var select_code =
1732 - '<span id="close_vl'+this.id+'" style="position:absolute:top:2px;left:2px;color:white;">'+close_link+'</span>'+
1733 - '<span id="con_vl_'+this.id+'" style="position:absolute;top:20px;left:20px;color:white;">';
1734 - var dl_list='';
17351744 var _this=this;
1736 - select_code+=this.getDLlist(function(index, source)
 1745+ var select_code=this.getDLlist(function(index, source)
17371746 {
1738 - var player_code = embedTypes.getPlayerSelectList(source.getMIMEType(), 'document.getElementById(\''+_this.id+'\').closeDisplayedHTML(); document.getElementById(\''+_this.id+'\').media_element.selectSource(\''+index+'\');');
1739 - return '<a href="#" style="color:white" onClick="document.getElementById(\''+_this.id+'\').closeDisplayedHTML(); document.getElementById(\''+_this.id+'\').media_element.selectSource(\''+index+'\'); return false;">'
1740 - + source.getTitle()+'</a>' + player_code;
 1747+ var default_player = embedTypes.players.defaultPlayer(source.getMIMEType());
 1748+ var source_select_code = 'document.getElementById(\''+_this.id+'\').closeDisplayedHTML(); document.getElementById(\''+_this.id+'\').media_element.selectSource(\''+index+'\');';
 1749+ var player_code = embedTypes.getPlayerSelectList(source.getMIMEType(), index, source_select_code);
 1750+ return '<a href="#" onClick="' + source_select_code + 'embedTypes.players.selectPlayer(\''+default_player.id+'\',\''+source.getMIMEType()+'\'); return false;">'
 1751+ + source.getTitle()+' - ' + default_player.getName() + '</a> '
 1752+ + '(<a href="#" onClick=\'$j("#player_select_list_'+index+'").fadeIn("slow");\'>choose player</a>)' + player_code;
17411753 });
1742 - select_code+=close_link+'</span>';
17431754 this.displayHTML(select_code);
17441755 },
17451756 showVideoDownload:function(){
1746 - var close_link ='<a href="#" style="color:white" onClick="document.getElementById(\''+this.id+'\').closeDisplayedHTML();return false;">close</a>';
1747 - var select_code =
1748 - '<span id="close_vl'+this.id+'" style="position:absolute:top:2px;left:2px;color:white;">'+close_link+'</span>'+
1749 - '<span id="con_vl_'+this.id+'" style="position:absolute;top:20px;left:20px;color:white;">';
1750 - var dl_list='';
1751 - select_code+=this.getDLlist(function(index, source)
 1757+ var select_code=this.getDLlist(function(index, source)
17521758 {
17531759 return '<a style="color:white" href="' + source.getURI() +'"> '
17541760 + source.getTitle()+'</a>';
17551761 });
1756 - select_code+=close_link+'</span>';
17571762 this.displayHTML(select_code);
17581763 },
17591764 getDLlist:function(transform_function){
Index: branches/MetavidWiki-exp/MetavidWiki/skins/mv_embed/mv_embed.css
@@ -2,6 +2,17 @@
33 margin-bottom:20px;
44 position:relative;
55 }
 6+.player_select_list {
 7+ color:white;
 8+ font-size:10pt;
 9+ display:none;
 10+}
 11+.player_select_list a:visited {
 12+ color:white;
 13+}
 14+.displayHTML a:visited {
 15+ color:white;
 16+}
617 .mv_playhead {
718 position:absolute;
819 top:0;

Status & tagging log