Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js |
— | — | @@ -7,11 +7,83 @@ |
8 | 8 | |
9 | 9 | init: function( $body ){ |
10 | 10 | this.$dom = $body; |
| 11 | + }, |
| 12 | + // maybe "build" layout ? |
| 13 | + updateLayout: function ( $layoutDom , time ) { |
| 14 | + var _this = this; |
| 15 | + |
| 16 | + // Set up the top level smil blocks container |
| 17 | + this.smilBlocks = []; |
| 18 | + |
| 19 | + this.recurseSmilBlocks( this.$dom, this.smilBlocks ); |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + return $layoutDom; |
| 24 | + }, |
| 25 | + |
| 26 | + /** |
| 27 | + * Recurse parse out smil elements |
| 28 | + */ |
| 29 | + recurseSmilBlocks: function( $node, blockStore ){ |
| 30 | + var _this = this; |
| 31 | + // Recursively parse the body for "<par>" and <seq>" |
| 32 | + $node.each( function( inx, bodyChild ){ |
| 33 | + var smilBlock = null; |
| 34 | + switch( bodyChild.nodeName ) { |
| 35 | + case 'par': |
| 36 | + smilBlock = new mw.SmilPar( bodyChild ) ) |
| 37 | + break; |
| 38 | + case 'seq': |
| 39 | + smilBlock = new mw.SmilSeq( bodyChild ) ) |
| 40 | + break; |
| 41 | + default: |
| 42 | + mw.log(' Skiped ' + bodyChild.nodeName + ' ( not recognized tag )'); |
| 43 | + break; |
| 44 | + } |
| 45 | + // Add a blockStore the smilBlock |
| 46 | + blockStore.push( smilBlock ); |
| 47 | + // if children have children add a block store |
| 48 | + |
| 49 | + // recurse |
| 50 | + |
| 51 | + }); |
| 52 | + // Check if we have more children |
11 | 53 | }, |
12 | 54 | |
13 | 55 | |
14 | | - updateLayout: function ( $layoutDom ) { |
15 | | - // parse out the time |
16 | | - return $layoutDom; |
| 56 | + // Updates the layout and adds a css animation to the next frame |
| 57 | + updateLayoutCssAnimation: function(){ |
| 58 | + |
17 | 59 | } |
18 | | -} |
\ No newline at end of file |
| 60 | +} |
| 61 | + |
| 62 | +/** |
| 63 | +* Par Block |
| 64 | +*/ |
| 65 | +mw.SmilPar = function( $parElement ){ |
| 66 | + return this.init( $parElement ); |
| 67 | +} |
| 68 | +mw.SmilPar.prototype = { |
| 69 | + init: function( $parElement ) { |
| 70 | + var _this = this; |
| 71 | + this.$dom = $parElement; |
| 72 | + |
| 73 | + // Go though all its children recursing on mw.SmilSeq where needed |
| 74 | + |
| 75 | + } |
| 76 | +} |
| 77 | + |
| 78 | +/** |
| 79 | +* Seq Block |
| 80 | +*/ |
| 81 | +mw.SmilSeq = function( $seqElement ){ |
| 82 | + return this.init( $seqElement ); |
| 83 | +} |
| 84 | +mw.SmilSeq.prototype = { |
| 85 | + init: function( $seqElement ) { |
| 86 | + var _this = this; |
| 87 | + this.$dom = $seqElement; |
| 88 | + // Go though all its children recursing on mw.SmilSeq where needed |
| 89 | + } |
| 90 | +} |