Revision: 45991
Author:   dale
Date:     2009-01-22 01:09:51 +0000 (Thu, 22 Jan 2009)

Log Message:
-----------
* fixes for input focus in video editor (that way when editing fields don't you 
don't delete selected clips ;)
* fixes for seek bar (slider is not reset while seeking)

Modified Paths:
--------------
    
trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mv_remote_media_search.js
    trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js
    trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_clipedit.js
    trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_playlist.js
    trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_sequencer.js
    trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js

Modified: 
trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mv_remote_media_search.js
===================================================================
--- 
trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mv_remote_media_search.js
   2009-01-22 01:06:49 UTC (rev 45990)
+++ 
trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mv_remote_media_search.js
   2009-01-22 01:09:51 UTC (rev 45991)
@@ -209,8 +209,7 @@
                        }
                        out +=                  '</td>'+
                                                '</tr>'+
-                                       '</table>';                     
-               js_log('out: ' + out);                                          
                        
+                                       '</table>';                             
                        
                                
                out+='<div id="rsd_options_bar" 
style="display:none;width:100%;height:0px;background:#BBB">';
                        //set up the content provider selection div (do this 
first to get the default cp)
@@ -311,7 +310,7 @@
                        if(typeof cp.sObj != 'undefined'){
                                if(cp.sObj.last_query == $j('#rsd_q').val() && 
cp.sObj.last_offset == cp.offset)
                                        continue;                               
        
-                       }                       
+                       }                                       
                        //else we need to run the search: 
                        var iObj = {'cp':cp, 'rsd':this};                       
                        eval('cp.sObj = new '+cp.lib+'Search(iObj);');
@@ -323,7 +322,7 @@
                        cp.offset = (cp.offset) ? cp.offset : cp.sObj.offset;
                        
                        //do search:
-                       cp.sObj.getSearchResults();                             
                        
+                       cp.sObj.getSearchResults();                             
                }       
                this.checkResultsDone();
        },      
@@ -337,6 +336,7 @@
                                        loading_done=false; 
                        }
                }
+               
                if(loading_done){
                        this.drawOutputResults();
                }else{                  

Modified: 
trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js    
2009-01-22 01:06:49 UTC (rev 45990)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js    
2009-01-22 01:09:51 UTC (rev 45991)
@@ -358,9 +358,13 @@
                                        css[props] = val;
                                        props = css;                            
        
                                }
-                               json = player._api().fp_css(name, props);
-                               extend(self, json);
-                               return self;
+                               try{
+                                       json = player._api().fp_css(name, 
props);
+                                       extend(self, json);
+                                       return self;
+                               }catch(e){
+                                       js_log('flow player could not set css: 
' + json);
+                               }
                        },
                        
                        show: function() {
@@ -693,8 +697,12 @@
                        
                        self[name] = function(arg) {
                                if (!api) { return self; }
-                               var ret = (arg === undefined) ? api["fp_" + 
name]() : api["fp_" + name](arg);
-                               return ret == 'undefined' ? self : ret;
+                               try{
+                                       var ret = (arg === undefined) ? 
api["fp_" + name]() : api["fp_" + name](arg);
+                                       return ret == 'undefined' ? self : ret;
+                               }catch (e){
+                                       js_log('flowplayer could not access fp_ 
'+ name);
+                               }
                        };                       
                }
        );              
@@ -1602,6 +1610,9 @@
                                opacity: 0.2
                        }       
        };
+       //don't have low volume/opacity on seek: 
+       if( this.didSeekJump )
+               flowConfig.screen.opacity = 1.0;        
        
                $f(this.pid,  mv_embed_path + 
'flowplayer/flowplayer-3.0.1.swf', flowConfig);                     
                //get the this.fla value:               
@@ -1614,7 +1625,8 @@
                _this.parent_play();    //update the interface    
        });
        //hide by default (untill its ready) 
-       this.fla.setVolume(0);
+       if( ! this.didSeekJump )        
+               this.fla.setVolume(0);
        
        //start monitor: 
        this.monitor();  
@@ -1693,8 +1705,7 @@
                 };                  
                //we are not getting buffered data restore volume and opacity
                this.fla.setVolume(90);
-               $f().getPlugin('screen').css({'opacity':'1.0'});        
-                       
+               $f().getPlugin('screen').css({'opacity':'1.0'});                
                
         }else{
                //simplification of buffer state ... should move to support 
returning time rages like:
                
//http://www.whatwg.org/specs/web-apps/current-work/#normalized-timeranges-object
               
@@ -1702,7 +1713,7 @@
         }               
         //set the current Time (based on timeFormat)
         if( this.media_element.selected_source.timeFormat =='anx' ){
-               this.currentTime = flash_state.time;
+               this.currentTime = flash_state.time;              
                //js_log('set buffer: ' + flash_state.bufferEnd + ' at time: ' 
+ flash_state.time +' of total dur: ' + this.getDuration()); 
         }else{
                this.currentTime = flash_state.time + 
this.media_element.selected_source.start_offset;                          
@@ -1714,10 +1725,21 @@
         }                  
                
         if(this.currentTime > ntp2seconds(start_ntp) && 
!this.startedTimedPlayback){
-               this.startedTimedPlayback=true;         
-               js_log("time is "+ this.currentTime + " started playback");    
-               this.fla.setVolume(90);
-               $f().getPlugin('screen').css({'opacity':'1.0'});        
+               var fail = false;
+               try
+                       {
+                               js_log("time is "+ this.currentTime + " started 
playback set opacity");                                                         
+                       this.fla.setVolume(90) 
+                       $f().getPlugin('screen').css({'opacity':'1.0'} );  
+                       }
+                       catch(err)
+                       {
+                               js_log('failed to set values');
+                               fail = true;
+                       }
+               if(!fail)
+                       this.startedTimedPlayback=true;     
+                                               
         }
         /* to support local seeks */
                if(this.currentTime > 1 && this.seek_time_sec != 0 && 
!this.supportsURLTimeEncoding() )
@@ -1749,7 +1771,7 @@
                        ( this.currentTime > (ntp2seconds(end_ntp)-1) 
                                && this.prevTime == this.currentTime) )
                ){                                      
-               js_log('probbaly reached end of stream: '+this.currentTime);
+               js_log('probally reached end of stream: '+this.currentTime);
                this.onClipDone();                   
         }          
            this.prevTime = this.currentTime;    

Modified: 
trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_clipedit.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_clipedit.js     
2009-01-22 01:06:49 UTC (rev 45990)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_clipedit.js     
2009-01-22 01:09:51 UTC (rev 45991)
@@ -145,7 +145,11 @@
                                        o+='</table>'; 
                                        
                                        $j('#sub_cliplib_ic').html ( o );
-                                       //add update bindings                   
+                                       //add update bindings   
+                                                       
+                                       //update doFocusBindings
+                                       if( _this.p_seqObj )
+                                               
_this.p_seqObj.doFocusBindings();
                                }       
                                //if media type is template we have to query to 
get its URI to get its paramaters
                                if(_this.media_type == 'template' && 
!_this.rObj.tVars){                

Modified: 
trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_playlist.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_playlist.js     
2009-01-22 01:06:49 UTC (rev 45990)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_playlist.js     
2009-01-22 01:09:51 UTC (rev 45991)
@@ -461,8 +461,8 @@
                        this.getClipCount()+' clips, <i>'+
                        seconds2ntp( this.getDuration() ) + '</i>');
                        
-               //only show the inline edit button if mediaWiki write API is 
enabled:
-               if(wgEnableWriteAPI==true)
+               //only show the inline edit button if mediaWiki write API is 
enabled:           
+               if(wgEnableWriteAPI)
                        $j('#ptitle_'+this.id).append(
                                '<a href="#" 
onclick="$j(\'#'+this.id+'\').get(0).doEditor();"'+ 
                                
'style="position:absolute;top:0px;right:0px">edit</a>'

Modified: 
trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_sequencer.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_sequencer.js    
2009-01-22 01:06:49 UTC (rev 45990)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_sequencer.js    
2009-01-22 01:09:51 UTC (rev 45991)
@@ -174,6 +174,7 @@
        //set up initial key states: 
        key_shift_down:false, 
        key_ctrl_down:false,
+       inputFocus:false,
        
        init:function( initObj ){       
                //set up pointer to this_seq for current scope:          
@@ -466,7 +467,7 @@
                                                this_seq.clipboardEditToken = 
data.query.pages[j]['edittoken'];
                                }
                        });
-                       //also grab permisions for sending clipboard commands 
to the server
+                       //also grab permissions for sending clipboard commands 
to the server
                        
                        //(calling the sequencer inline) try and get edit token 
via api call:                   
                        //(somewhat fragile way to get at the api... should 
move to config 
@@ -528,8 +529,9 @@
                //render the timeline                                   
                this.renderTimeLine();                  
                this.do_refresh_timeline();
+                               
                
-               var this_seq = this;
+               this.doFocusBindings();         
                
                //set up key bidnings
                $j().keydown(function(e){
@@ -540,13 +542,14 @@
                        if( e.which == 17)
                                this_seq.key_ctrl_down = true;
                                
-                       if( e.which == 67 && this_seq.key_ctrl_down)
+                       if( e.which == 67 && this_seq.key_ctrl_down && 
!this_seq.inputFocus)
                                this_seq.copySelectedClips();
                                
-                       if( e.which == 88 && this_seq.key_ctrl_down)
+                       if( e.which == 88 && this_seq.key_ctrl_down && 
!this_seq.inputFocus)
                                this_seq.cutSelectedClips();
                        
-                       if( e.which == 86 && this_seq.key_ctrl_down)
+                       //paste cips on v + ctrl while not focused on a text 
area: 
+                       if( e.which == 86 && this_seq.key_ctrl_down && 
!this_seq.inputFocus)                            
                                this_seq.pasteClipBoardClips();
                                
                });
@@ -559,12 +562,24 @@
                        if( e.which == 17)
                                this_seq.key_ctrl_down = false;                 
                                
                        
-                       //backspace or delete key:   
-                       if( e.which == 8 || e.which == 46 ){                    
                                
+                       //backspace or delete key while not focused on a text 
area: 
+                       if( e.which == 8 || e.which == 46 && 
!this_seq.inputFocus){                                                     
                                this_seq.removeSelectedClips(); 
                        }               
                });
        },
+       //check all nodes for focus 
+       //@@todo it would probably be faster to search a given subnode instead 
of all text
+       doFocusBindings:function(){
+               var _this = this;
+               //if an input or text area has focus disable delete key binding
+               $("input,textarea").focus(function () {
+               _this.inputFocus = true;        
+           });
+           $("input,textarea").blur( function () {
+               _this.inputFocus = false;
+           })
+       }
        update_tl_hook:function(jh_time_ms){                    
                //put into seconds scale: 
                var jh_time_sec_float = jh_time_ms/1000;
@@ -682,7 +697,7 @@
                js_log('f:pasteClipBoardClips');
                //@@todo query the server for updated clipboard         
                //paste before the "current clip" 
-               this.addClips(this.clipboard, this.plObj.cur_clip.order );      
        
+               this.addClips( this.clipboard, this.plObj.cur_clip.order );     
        
        },
        copySelectedClips:function(){
                var this_seq = this;
@@ -960,10 +975,8 @@
                                        
$j(this).removeClass("clip_edit_base").addClass("clip_edit_over");
                                },function(){
                                        
$j(this).removeClass("clip_edit_over").addClass("clip_edit_base");
-                               });
+                               });                                             
                
                                
-                               
-                               
                                //apply onClick edit controls: 
                                $j('.mv_clip_thumb').click(function(){          
                                                
                                        var cur_clip_click = this;
@@ -1016,10 +1029,8 @@
                                                                $j('#track_' + 
track_id + '_clip_' + i + ' > .mv_clip_thumb' ).addClass('mv_selected_clip');   
 
                                                        }                       
                
                                                }
-                                       }
-                                                                       
-                                       this_seq.doEditSelectedClip();
-                                                                       
+                                       }                                       
                                
+                                       this_seq.doEditSelectedClip();          
                                                        
                                });                                             
                                                
                                //add in control for time based display         
                                                                                
                                //debugger;                     

Modified: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
===================================================================
--- trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js     2009-01-22 
01:06:49 UTC (rev 45990)
+++ trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js     2009-01-22 
01:09:51 UTC (rev 45991)
@@ -614,7 +614,7 @@
         
         //build draggable hook here:        
            $j('#mv_seeker_slider_'+embedObj.id).draggable({
-               containment:'#seeker_bar_'+embedObj.id,
+               containment:$j('#seeker_bar_'+embedObj.id),
                axis:'x',
                opacity:.6,
                start:function(e, ui){
@@ -638,7 +638,9 @@
                                //js_log('perc:' + perc + ' * ' + 
embedObj.getDuration() + ' jt:'+  this.jump_time);
                                embedObj.setStatus( getMsg('seek_to')+' 
'+embedObj.jump_time );    
                                //update the thumbnail / frame 
-                               embedObj.updateThumbPerc( perc );               
                        
+                               if(embedObj.isPlaying==false){
+                                       embedObj.updateThumbPerc( perc );
+                               }                                       
                },
                stop:function(e, ui){
                        embedObj.userSlide=false;
@@ -1930,7 +1932,7 @@
        },      
        getEmbedHTML : function(){
                //return this.wrapEmebedContainer( this.getEmbedObj() );
-               return 'function getEmbedHTML should be overiten by embedLib ';
+               return 'function getEmbedHTML should be overitten by embedLib ';
        },
        //do seek function (should be overwritten by implementing embedLibs)
        // first check if seek can be done on locally downloaded content. 
@@ -1938,9 +1940,12 @@
                js_log('f:mv_embed:doSeek:'+perc);
                if( this.supportsURLTimeEncoding() ){
                        js_log('Seeking to ' + this.seek_time_sec + ' (local 
copy of clip not loaded at' + perc + '%)');
-                       this.stop();                    
-                       //this.seek_time_sec = 0; 
+                       this.stop();                                    
+                       this.didSeekJump=true;
+                       //update the slider
+                       this.setSliderValue( perc ); 
                }
+               
                //do play in 100ms (give things time to clear) 
                setTimeout('$j(\'#' + this.id + '\').get(0).play()',100);
        },      
@@ -2001,7 +2006,7 @@
                        '</div>'
                );      
        
-       //start animation (make thumb small in uper left add in div for 
"loading"           
+       //start animation (make thumb small in upper left add in div for 
"loading"          
        $j('#img_thumb_'+this.id).animate({                     
                        width:parseInt(parseInt(_this.width)/2),
                        height:parseInt(parseInt(_this.height)/2),
@@ -2292,7 +2297,7 @@
                this.updateThumbTime( ntp2seconds(time) - 
parseInt(this.start_offset) );
        },
        updateThumbTime:function( float_sec ){
-               js_log('updateThumbTime:'+float_sec);
+               //js_log('updateThumbTime:'+float_sec);
                var _this = this;                                               
                                                        
                if( typeof this.org_thum_src=='undefined' ){            
                        this.org_thum_src = 
this.media_element.getThumbnailURL();



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to