r70255 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70254‎ | r70255 | r70256 >
Date:05:06, 1 August 2010
Author:dale
Status:deferred
Tags:
Comment:
more undo redo debug helpers
moved body dom to getter method rather than local variable
Modified paths:
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
@@ -1,4 +1,4 @@
2 -/**
 2+/**
33 * The smil body also see:
44 * http://www.w3.org/TR/2008/REC-SMIL3-20081201/smil-structure.html#edef-body
55 */
@@ -35,12 +35,15 @@
3636 // Constructor:
3737 init: function( smilObject ){
3838 this.smil = smilObject;
39 - this.$dom = this.smil.getDom().find( 'body' );
4039
4140 // Assign ids to smil body elements
42 - this.assignIds( this.$dom );
 41+ this.assignIds( this.getDom() );
4342 },
4443
 44+ getDom: function(){
 45+ return this.smil.getDom().find('body');
 46+ },
 47+
4548 /**
4649 * Assigns body smil elements id (for content that has a html representation "ref" & "smilText" )
4750 * ( enables fast sync between smilDom and htmlDom )
@@ -52,7 +55,7 @@
5356 ){
5457 var idString = _this.getNodeSmilType( $node ) + '_' + _this.idIndex;
5558 // Make sure the id does not already exist ( should be a rare case )
56 - while( this.$dom.find( '#' + idString ).length != 0 ){
 59+ while( this.getDom().find( '#' + idString ).length != 0 ){
5760 _this.idIndex++;
5861 idString = _this.getNodeSmilType( $node ) + '_' + _this.idIndex;
5962 }
@@ -161,7 +164,7 @@
162165 return smallIndex = i;
163166 }
164167 // Build an audio timeline starting from the top level node:
165 - this.getRefElementsRecurse( this.$dom, 0, function( $node ){
 168+ this.getRefElementsRecurse( this.getDom(), 0, function( $node ){
166169 var nodeType = _this.smil.getRefType( $node ) ;
167170 // Check if the node is audio ( first in wins / "audio" wins over video)
168171 if( nodeType == 'audio' || nodeType == 'video' ) {
@@ -237,7 +240,7 @@
238241 time =0;
239242 }
240243 // Recurse on every ref element and run relevant callbacks
241 - this.getRefElementsRecurse( this.$dom, 0, function( $node ){
 244+ this.getRefElementsRecurse( this.getDom(), 0, function( $node ){
242245 var startOffset = $node.data( 'startOffset' );
243246 var nodeDuration = _this.getClipDuration( $node );
244247
@@ -260,7 +263,7 @@
261264 */
262265 getSeqElements: function( $node ){
263266 if( ! $node ){
264 - $node = this.$dom;
 267+ $node = this.getDom();
265268 }
266269 return $node.find('seq');
267270 },
@@ -321,7 +324,7 @@
322325 * ( wraps getDurationRecurse to get top level node duration )
323326 */
324327 getDuration: function( forceRefresh ){
325 - this.duration = this.getClipDuration( this.$dom , forceRefresh);
 328+ this.duration = this.getClipDuration( this.getDom() , forceRefresh);
326329 mw.log("smilBody:: getDuration: " + this.duration );
327330 return this.duration;
328331 },
@@ -339,7 +342,7 @@
340343 }
341344 if( forceRefresh ){
342345 //clear out implictDuration
343 - $node.data( 'implictDuration', false );
 346+ $node.data( 'implictDuration', 0);
344347 $node.data( 'computedDuration', false );
345348 }
346349
@@ -350,7 +353,7 @@
351354 var blockType = this.getNodeSmilType( $node );
352355
353356 // Recurse on children
354 - if( $node.children().length ){
 357+ if( $node.children().length ){
355358 $node.children().each( function( inx, childNode ){
356359 // If in a sequence add to duration
357360 var childDuration = _this.getClipDuration( $j( childNode ), forceRefresh );
@@ -363,7 +366,8 @@
364367 $node.data( 'implictDuration', childDuration);
365368 }
366369 }
367 - });
 370+ });
 371+ alert( 'getting duration for ' + $node.children().length + ' children ');
368372 }
369373
370374 // Check the explicit duration attribute:
@@ -375,7 +379,7 @@
376380 }
377381 //mw.log(" return dur: " + mw.smil.parseTime( $node.attr('dur') ) );
378382 $node.data('computedDuration', computedDuration );
379 - } else {
 383+ } else {
380384 // Else return use implictDuration ( built from its children )
381385 if( $node.data( 'implictDuration' ) ){
382386 //mw.log(" implictDuration:: " + $node.data( 'implictDuration' ) );
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
@@ -98,10 +98,11 @@
9999 updateSmilXML: function( smilXML ){
100100 mw.log("Sequencer::updateSmilXML" + smilXML);
101101 var _this = this;
102 - alert( 'before update seq len: ' + this.getSmil().$dom.find('seq').children().length )
 102+ alert( 'before Dur:' + this.getEmbedPlayer().getDuration( true ) + ' update seq len: ' + this.getSmil().$dom.find('seq').children().length )
103103 // Update the embedPlayer smil:
104104 this.getSmil().updateFromString( smilXML );
105 - alert( 'after update seq len: ' + this.getSmil().$dom.find('seq').children().length )
 105+ debugger;
 106+ alert( 'after Dur:' + this.getEmbedPlayer().getDuration( true ) + ' update seq len: ' + this.getSmil().$dom.find('seq').children().length )
106107 // Get a duration ( forceRefresh to clear the cache )
107108 var dur = this.getEmbedPlayer().getDuration( true );
108109 alert( 'restored dur should be: ' + dur);

Status & tagging log