r44510 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44509‎ | r44510 | r44511 >
Date:22:23, 12 December 2008
Author:dale
Status:deferred
Tags:
Comment:
improved IE weirdness on click bindings for play, pause
improvements on remote_search module
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_javaEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_vlcEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libRemoteMediaSearch/mv_remote_media_search.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/loading_ani.gif (added) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_stream.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_stream.js
@@ -18,7 +18,6 @@
1919 * addLoadEvent()
2020 */
2121 var org_vid_time_req =null; //store the original time req:
22 -var org_thum_src = null; //stores the original thumbnail src
2322 var org_vid_title = null; //stores the original title
2423 //store the original range request:
2524 // @@todo could replace the above 4 globals as they are all org request derived
@@ -101,7 +100,7 @@
102101 return false;
103102 }
104103 org_vid_time_req = $j('#embed_vid').get(0).getTimeReq();
105 - org_thum_src = $j('#embed_vid').get(0).thumbnail;
 104+ $j('#embed_vid').get(0).org_thum_src = $j('#embed_vid').get(0).thumbnail;
106105
107106 //@@TODO override stop function in player:
108107
@@ -304,7 +303,7 @@
305304 if(!vid_elm.onClipDone_disp){
306305 //only restore if the cur_mvd = 'base' and interface updates are not locked
307306 if(this.cur_mvd_id=='base'){
308 - vid_elm.updateThumbnail( org_thum_src );
 307+ vid_elm.updateThumbnail( $j('#embed_vid').get(0).org_thum_src );
309308 vid_elm.updateVideoTimeReq(org_vid_time_req);
310309 //vid_elm.updateVideoSrc(org_vid_src);
311310 $j('#mv_videoPlayerTime').html(org_vid_title);
@@ -970,11 +969,11 @@
971970 });
972971 }
973972 }
974 -function highlight_fd(mvd_id){
975 - $j('#mv_fd_mvd_'+mvd_id).css('border','1px solid #FF0000');
 973+function highlight_fd(mvd_id){
 974+ $j('#mv_fd_mvd_'+mvd_id).css('border','1px solid #F00');
976975 }
977976 function de_highlight_fd(mvd_id){
978 - $j('#mv_fd_mvd_'+mvd_id).css('border', '1px solid #FFFFFF');
 977+ $j('#mv_fd_mvd_'+mvd_id).css('border', '1px solid #FFF');
979978 }
980979
981980 function highlight_tl_ts(mvd_id){
@@ -1033,8 +1032,8 @@
10341033 }
10351034 }
10361035 //else set via org_thum_src
1037 - if(org_thum_src.indexOf('?')!=-1){
1038 - var url = org_thum_src.split('?');
 1036+ if( $j('#embed_vid').get(0).org_thum_src.indexOf('?')!=-1){
 1037+ var url = $j('#embed_vid').get(0).org_thum_src.split('?');
10391038 var args = Array();
10401039 var arg_parts = url[1].split('&');
10411040 for(i in arg_parts){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/loading_ani.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/images/loading_ani.gif
___________________________________________________________________
Added: svn:mime-type
10421041 + application/octet-stream
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -600,6 +600,16 @@
601601 //js_log('looking for: #mv_seeker_slider_'+embedObj.id + "\n " +
602602 // 'start sec: '+embedObj.start_time_sec + ' base offset: '+embedObj.base_seeker_slider_offset);
603603
 604+ //add play hook:
 605+ $j('#mv_play_pause_button_' + embedObj.id).unbind( "click" ).click(function(){
 606+ $j('#' + embedObj.id).get(0).play();
 607+ });
 608+
 609+ //big_play_link_ play binding:
 610+ $j('#big_play_link_' + embedObj.id).unbind('click').click(function(){
 611+ $j('#' + embedObj.id).get(0).play();
 612+ });
 613+
604614 //build draggable hook here:
605615 $j('#mv_seeker_slider_'+embedObj.id).draggable({
606616 containment:'#seeker_bar_'+embedObj.id,
@@ -684,8 +694,7 @@
685695 'pause':{
686696 'w':24,
687697 'o':function(){
688 - return '<div id="mv_play_pause_button_' + ctrlBuilder.id + '" class="play_button"' +
689 - 'onClick="$j(\'#' + ctrlBuilder.id + '\').get(0).play()"></div>';
 698+ return '<div id="mv_play_pause_button_' + ctrlBuilder.id + '" class="play_button"></div>';
690699 }
691700 },
692701 'closed_captions':{
@@ -1926,12 +1935,7 @@
19271936 js_log('performing embed for ' + _this.id);
19281937 var embed_code = _this.getEmbedHTML();
19291938 //js_log(embed_code);
1930 - $j('#mv_embedded_player_'+_this.id).html(embed_code);
1931 - js_log('changed embed code');
1932 - _this.paused = false;
1933 - _this.thumbnail_disp=false;
1934 - $j("#mv_play_pause_button_"+ _this.id).attr('class', 'pause_button');
1935 - $j("#mv_play_pause_button_"+ _this.id).attr('onClick', '$j(\'#'+_this.id+'\').get(0).pause()');
 1939+ $j('#mv_embedded_player_'+_this.id).html(embed_code);
19361940 });
19371941 },
19381942 /* todo abstract out onClipDone chain of functions and merge with textInterface */
@@ -2147,18 +2151,13 @@
21482152 },
21492153 doThumbnailHTML:function()
21502154 {
 2155+ var _this = this;
21512156 js_log('f:doThumbnailHTML'+ this.thumbnail_disp);
21522157 this.closeDisplayedHTML();
21532158 this.thumbnail_disp = true;
21542159
21552160 $j('#mv_embedded_player_'+this.id).html( this.getThumbnailHTML() );
2156 - this.paused = true;
2157 - if(!this.pc) //if not in playlist mode update the play_pause button:
2158 - $j("#mv_play_pause_button_" + this.id).attr({
2159 - 'class':'play_button',
2160 - 'onClick':'$j(\'#' + this.id + '\').get(0).play()'
2161 - });
2162 -
 2161+ this.paused = true;
21632162 },
21642163 refreshControlsHTML:function(){
21652164 js_log('refreshing controls HTML');
@@ -2384,7 +2383,7 @@
23852384 },
23862385 getPlayButton:function(id){
23872386 if(!id)id=this.id;
2388 - return '<div onclick="$j(\'#'+id+'\').get(0).play()" id="big_play_link_'+id+'" class="large_play_button" '+
 2387+ return '<div id="big_play_link_'+id+'" class="large_play_button" '+
23892388 'style="left:'+((this.playerPixelWidth()-130)/2)+'px;'+
23902389 'top:'+((this.playerPixelHeight()-96)/2)+'px;"></div>';
23912390 },
@@ -2635,7 +2634,8 @@
26362635 }else{
26372636 this.doEmbedHTML();
26382637 this.onClipDone_disp=false;
2639 - this.paused=false;
 2638+ this.paused=false;
 2639+ this.thumbnail_disp=false;
26402640 }
26412641 }else{
26422642 //the plugin is already being displayed
@@ -2643,8 +2643,9 @@
26442644 }
26452645 js_log("should update play controL");
26462646 $j("#mv_play_pause_button_"+this.id).attr({
2647 - 'class':'pause_button',
2648 - 'onClick':'$j(\'#'+this_id+'\').get(0).pause()'
 2647+ 'class':'pause_button'
 2648+ }).unbind( "click" ).click(function(){
 2649+ $j('#' + this_id ).get(0).pause();
26492650 });
26502651 },
26512652 /*
@@ -2659,8 +2660,9 @@
26602661 this.paused=true;
26612662 //update the ctrl "paused state"
26622663 $j("#mv_play_pause_button_"+this.id).attr({
2663 - 'class':'play_button',
2664 - 'onClick':'$j(\'#'+this_id+'\').get(0).play()'
 2664+ 'class':'play_button'
 2665+ }).unbind( "click" ).click(function(){
 2666+ $j('#'+this_id).get(0).play();
26652667 });
26662668 },
26672669 /*play_or_pause: function(){
@@ -2676,7 +2678,9 @@
26772679 * base embed stop (can be overwritten by the plugin)
26782680 */
26792681 stop: function(){
2680 - js_log('mvEmbed:stop:'+this.id);
 2682+ js_log('mvEmbed:stop:'+this.id);
 2683+ //first issue pause to update interface
 2684+ this.pause();
26812685 //check if thumbnail is being displayed in which case do nothing
26822686 if(this.thumbnail_disp){
26832687 //already in stooped state
@@ -3117,18 +3121,16 @@
31183122 /*
31193123 * IE and non-firebug debug:
31203124 */
3121 - /*var log_elm = document.getElementById('mv_js_log');
 3125+ /*var log_elm = document.getElementById('mv_js_log');
31223126 if(!log_elm){
31233127 document.write('<div style="position:absolute;z-index:500;top:0px;left:0px;right:0px;height:150px;"><textarea id="mv_js_log" cols="80" rows="6"></textarea></div>');
31243128 var log_elm = document.getElementById('mv_js_log');
31253129 }
31263130 if(log_elm){
31273131 log_elm.value+=string+"\n";
3128 - }*/
3129 -
3130 - }
3131 - //return false
3132 - return false;
 3132+ }*/
 3133+ }
 3134+ //return false;
31333135 }
31343136
31353137 function js_error(string){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js
@@ -1653,26 +1653,24 @@
16541654 }
16551655 },
16561656 monitor : function()
1657 - {
 1657+ {
 1658+ var _this = this;
16581659 //do monitor update:
16591660 if( ! this.monitorTimerId ){
1660 - if(document.getElementById(this.id)){
1661 - this.monitorTimerId = setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 250);
1662 - }
 1661+ if( $j('#'+this.id).length != 0 )
 1662+ this.monitorTimerId = window.setInterval('$j(\'#'+_this.id+'\').get(0).monitor()', 250);
16631663 }
16641664
16651665 var flash_state = this.fla.getStatus();
16661666 if( typeof flash_state == 'undefined' ){
16671667 var flash_state = {
16681668 "time" : this.fla.getTime()
1669 - };
1670 - js_log('got time: ' + flash_state.time);
 1669+ };
16711670 }else{
16721671 //simplification of buffer state ... should move to support returning time rages like:
16731672 //http://www.whatwg.org/specs/web-apps/current-work/#normalized-timeranges-object
16741673 this.bufferedPercent = flash_state.bufferEnd / this.getDuration();
16751674 }
1676 -
16771675 //set the current Time (based on timeFormat)
16781676 if( this.media_element.selected_source.timeFormat =='anx' ){
16791677 this.currentTime = flash_state.time;
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_javaEmbed.js
@@ -1,6 +1,13 @@
22 var javaEmbed = {
33 instanceOf:'javaEmbed',
4 - supports: {'play_head':true, 'pause':true, 'stop':true, 'fullscreen':true, 'time_display':true, 'volume_control':true},
 4+ supports: {
 5+ 'play_head':true,
 6+ 'pause':true,
 7+ 'stop':true,
 8+ 'fullscreen':true,
 9+ 'time_display':true,
 10+ 'volume_control':true
 11+ },
512 getEmbedHTML : function (){
613 if(this.controls)
714 setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150);
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_vlcEmbed.js
@@ -303,7 +303,9 @@
304304 },
305305 pause : function(){
306306 this.parent_pause(); //update the inteface if paused via native control
307 - this.vlc.playlist.togglePause();
 307+ if(this.vlc){
 308+ this.vlc.playlist.togglePause();
 309+ }
308310 },
309311 fullscreen : function(){
310312 if(this.vlc){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libRemoteMediaSearch/mv_remote_media_search.js
@@ -1,7 +1,8 @@
22 /*
33 * a library for doing remote media searches
44 *
5 -* initial targeted archives are:
 5+* initial targeted archives are:
 6+ the local wiki
67 wikimedia commons
78 metavid
89 and archive.org
@@ -32,26 +33,32 @@
3334 }
3435 },
3536 content_providers:{
 37+ //@@todo seed this via the include call (can be exported to seperate library
 38+ // once we get the script loader integrated)
3639 'this_wiki':{
37 - 'enabled':0,
 40+ 'enabled':1,
 41+ 'checked':1,
3842 'title':'The Current Wiki',
3943 'desc': '(should be updated with the proper text)'
4044 },
4145 'wiki_commons':{
4246 'enabled':1,
 47+ 'checked':1,
4348 'title':'Wikipedia Commons',
4449 'desc': 'Wikimedia Commons is a media file repository making available public domain '+
4550 'and freely-licensed educational media content (images, sound and video clips) to all.',
4651 'logo': 'http://upload.wikimedia.org/wikipedia/commons/thumb/7/79/Wiki-commons.png/80px-Wiki-commons.png'
4752 },
4853 'archive_org':{
49 - 'enabled':0,
 54+ 'enabled':1,
 55+ 'checked':1,
5056 'title' : 'Archive.org',
5157 'desc' : 'The Internet Archive, a digital library of cultural artifacts in digital form',
5258 'logo' : 'http://www.archive.org/images/logo.jpg'
5359 },
5460 'metavid':{
55 - 'enabled':0,
 61+ 'enabled':1,
 62+ 'checked':1,
5663 'title':'Metavid.org',
5764 'desc': 'Metavid hosts thousands of hours of US house and senate floor proccedings',
5865 'logo': 'http://metavid.org/w/skins/mvpcf/images/logo.png'
@@ -83,7 +90,7 @@
8491 '</td>'+
8592 '<td style="width:110px">'+
8693 '<input type="submit" value="' + getMsg('mv_media_search') + '" tabindex="2" '+
87 - ' id="search-button"/>'+
 94+ ' id="rms_search_button"/>'+
8895 '</td>'+
8996 '<td>';
9097 for(var i in this.main_search_options){
@@ -101,8 +108,7 @@
102109 for( var i in this.content_providers ){
103110 var cp = this.content_providers[i];
104111
105 - var checked_attr = (this.default_provider_id &&
106 - ( this.default_provider_id == i || this.default_provider_id == 'all' ))?'checked':'';
 112+ var checked_attr = ( cp.checked ) ? 'checked':'';
107113
108114 cpsdiv+='<td '+
109115 ' title="' + cp.title + '" '+
@@ -117,7 +123,8 @@
118124 }
119125 cpsdiv+='</td>';
120126 }
121 - cpsdiv+='</table><a id="mso_selprovider_close" href="#">close</a></div>';
 127+ cpsdiv+='<tr><td><a id="mso_selprovider_close" href="#">'+getMsg('close')+'</a></td></tr></table></div>';
 128+
122129 out+='<div id="rsd_options_bar" style="display:none;width:100%;height:0px;background:#BBB">'+
123130 cpsdiv +
124131 '</div>';
@@ -129,21 +136,34 @@
130137 $j('#'+ this.target_id ).html( out );
131138 },
132139 add_interface_bindings:function(){
 140+ var _this = this;
133141 js_log("add_interface_bindings:");
134142 //setup for this.main_search_options:
135 - $j('#mso_selprovider').(function(){
136 - $j('#rsd_options_bar:visible').animate({
137 - 'height':'100px',
138 - 'opacity':1
139 - }, "normal");
140 - $j('#rsd_options_bar:hidden,#mso_selprovider_close').animate({
141 - 'height':'0px',
142 - 'opacity':0
143 - }, "normal");
 143+ $j('#mso_selprovider,#mso_selprovider_close').click(function(){
 144+ if($j('#rsd_options_bar:hidden').length !=0 ){
 145+ $j('#rsd_options_bar').animate({
 146+ 'height':'110px',
 147+ 'opacity':1
 148+ }, "normal");
 149+ }else{
 150+ $j('#rsd_options_bar').animate({
 151+ 'height':'0px',
 152+ 'opacity':0
 153+ }, "normal", function(){
 154+ $j(this).hide();
 155+ })
 156+ }
144157 });
145158 //setup binding for search provider check box:
146 -
147 - }
 159+ //search button:
 160+ $j('#rms_search_button').click(function(){
 161+ _this.runSearch();
 162+ });
 163+ },
 164+ runSearch:function(){
 165+ //get a remote search object for each search provider:
 166+ for(var i in
 167+ }
148168 }
149169
150170 var mvBaseRemoteSearch = function(initObj) {

Status & tagging log