http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70255

Revision: 70255
Author:   dale
Date:     2010-08-01 05:06:36 +0000 (Sun, 01 Aug 2010)

Log Message:
-----------
more undo redo debug helpers
moved body dom to getter method rather than local variable 

Modified Paths:
--------------
    branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js        
2010-08-01 04:37:08 UTC (rev 70254)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js        
2010-08-01 05:06:36 UTC (rev 70255)
@@ -98,10 +98,11 @@
        updateSmilXML: function( smilXML ){
                mw.log("Sequencer::updateSmilXML" + smilXML);
                var _this = this;
-               alert( 'before update seq len: ' + 
this.getSmil().$dom.find('seq').children().length )
+               alert( 'before Dur:' + this.getEmbedPlayer().getDuration( true 
) + ' update seq len: ' + this.getSmil().$dom.find('seq').children().length )
                // Update the embedPlayer smil: 
                this.getSmil().updateFromString( smilXML );
-               alert( 'after update seq len: ' + 
this.getSmil().$dom.find('seq').children().length )
+               debugger;
+               alert( 'after Dur:' + this.getEmbedPlayer().getDuration( true ) 
+ '  update seq len: ' + this.getSmil().$dom.find('seq').children().length )
                // Get a duration ( forceRefresh to clear the cache ) 
                var dur = this.getEmbedPlayer().getDuration( true );
                alert( 'restored dur should be: ' + dur);

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js        
2010-08-01 04:37:08 UTC (rev 70254)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js        
2010-08-01 05:06:36 UTC (rev 70255)
@@ -1,4 +1,4 @@
-/** 
+/**
  * The smil body also see: 
  * http://www.w3.org/TR/2008/REC-SMIL3-20081201/smil-structure.html#edef-body
  */
@@ -35,12 +35,15 @@
        // Constructor: 
        init: function( smilObject ){
                this.smil = smilObject;
-               this.$dom = this.smil.getDom().find( 'body' );
                
                // Assign ids to smil body elements
-               this.assignIds( this.$dom );
+               this.assignIds( this.getDom() );
        },
        
+       getDom: function(){
+               return this.smil.getDom().find('body');
+       },
+       
        /**
        * Assigns body smil elements id (for content that has a html 
representation "ref" & "smilText" ) 
        *       ( enables fast sync between smilDom and htmlDom )  
@@ -52,7 +55,7 @@
                ){
                        var idString = _this.getNodeSmilType( $node ) + '_' + 
_this.idIndex;
                        // Make sure the id does not already exist ( should be 
a rare case ) 
-                       while( this.$dom.find( '#' + idString ).length != 0 ){
+                       while( this.getDom().find( '#' + idString ).length != 0 
){
                                _this.idIndex++;
                                idString = _this.getNodeSmilType( $node ) + '_' 
+ _this.idIndex;
                        }
@@ -161,7 +164,7 @@
                        return smallIndex = i;
                }
                // Build an audio timeline starting from the top level node: 
-               this.getRefElementsRecurse( this.$dom, 0, function( $node ){
+               this.getRefElementsRecurse( this.getDom(), 0, function( $node ){
                        var nodeType = _this.smil.getRefType( $node ) ;
                        // Check if the node is audio ( first in wins / "audio" 
wins over video) 
                        if( nodeType == 'audio' || nodeType == 'video' ) {
@@ -237,7 +240,7 @@
                        time =0;
                }               
                // Recurse on every ref element and run relevant callbacks
-               this.getRefElementsRecurse( this.$dom, 0, function( $node ){
+               this.getRefElementsRecurse( this.getDom(), 0, function( $node ){
                        var startOffset = $node.data( 'startOffset' );
                        var nodeDuration = _this.getClipDuration( $node );
                        
@@ -260,7 +263,7 @@
         */
        getSeqElements: function( $node ){
                if( ! $node ){
-                       $node = this.$dom;
+                       $node = this.getDom();
                }
                return $node.find('seq');
        },
@@ -321,7 +324,7 @@
         * ( wraps getDurationRecurse to get top level node duration ) 
         */     
        getDuration: function( forceRefresh ){          
-               this.duration = this.getClipDuration( this.$dom , 
forceRefresh);        
+               this.duration = this.getClipDuration( this.getDom() , 
forceRefresh);    
                mw.log("smilBody:: getDuration: " + this.duration );
                return this.duration;   
        },
@@ -339,7 +342,7 @@
                }
                if( forceRefresh ){
                        //clear out implictDuration
-                       $node.data( 'implictDuration', false );
+                       $node.data( 'implictDuration', 0);
                        $node.data( 'computedDuration', false );
                }
                
@@ -350,7 +353,7 @@
                var blockType = this.getNodeSmilType( $node );
                                
                // Recurse on children
-               if( $node.children().length ){
+               if( $node.children().length ){                  
                        $node.children().each( function( inx, childNode ){      
                        
                                // If in a sequence add to duration             
                                var childDuration = _this.getClipDuration( $j( 
childNode ), forceRefresh );                                                    
 
@@ -363,7 +366,8 @@
                                                $node.data( 'implictDuration',  
childDuration); 
                                        }
                                }
-                       });             
+                       });
+                       alert( 'getting duration for ' + 
$node.children().length + ' children ');
                }
                                                
                // Check the explicit duration attribute: 
@@ -375,7 +379,7 @@
                        }  
                        //mw.log(" return dur: " + mw.smil.parseTime( 
$node.attr('dur') ) );                    
                        $node.data('computedDuration', computedDuration );
-               } else { 
+               } else {
                        // Else return use implictDuration ( built from its 
children )
                        if( $node.data( 'implictDuration' ) ){
                                //mw.log(" implictDuration:: " + $node.data( 
'implictDuration' ) ); 



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to