Index: trunk/parsers/wikidom/lib/es/es.ListBlockList.js |
— | — | @@ -1,3 +1,11 @@ |
| 2 | +/** |
| 3 | + * Creates a list block list. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @extends {es.Container} |
| 8 | + * @param list {es.ListBlockItem} Flat list to initialize with |
| 9 | + */ |
2 | 10 | es.ListBlockList = function( items ) { |
3 | 11 | es.DomContainer.call( this, 'list', 'items', items ); |
4 | 12 | }; |
— | — | @@ -2,2 +10,12 @@ |
3 | 11 | |
| 12 | +/* Static Methods */ |
| 13 | + |
| 14 | +/** |
| 15 | + * Creates a new list block list object from WikiDom data. |
| 16 | + * |
| 17 | + * @static |
| 18 | + * @method |
| 19 | + * @param wikidomList {Object} WikiDom data to convert from |
| 20 | + * @returns {es.ListBlockList} List block list |
| 21 | + */ |
4 | 22 | es.ListBlockList.newFromWikiDomList = function( wikidomList ) { |
— | — | @@ -8,20 +26,6 @@ |
9 | 27 | return new es.ListBlockList( items ); |
10 | 28 | }; |
11 | 29 | |
12 | | -es.ListBlockList.prototype.renderContent = function( offset ) { |
13 | | - for ( var i = 0; i < this.items.length; i++ ) { |
14 | | - this.items[i].renderContent(); |
15 | | - } |
16 | | -}; |
17 | | - |
18 | | -es.ListBlockList.prototype.traverseItems = function( callback ) { |
19 | | - for( var i = 0; i < this.items.length; i++ ) { |
20 | | - if ( callback( this.items[i], i ) === false ) { |
21 | | - return false; |
22 | | - } |
23 | | - } |
24 | | -}; |
25 | | - |
26 | 30 | es.ListBlockList.flattenList = function( wikidomList, items, level ) { |
27 | 31 | for ( var i = 0; i < wikidomList.items.length; i++ ) { |
28 | 32 | items.push( |
— | — | @@ -41,4 +45,14 @@ |
42 | 46 | } |
43 | 47 | }; |
44 | 48 | |
| 49 | +/* Public Methods */ |
| 50 | + |
| 51 | +es.ListBlockList.prototype.renderContent = function( offset ) { |
| 52 | + // TODO: If offset is passed then render only item containing that offset |
| 53 | + for ( var i = 0; i < this.items.length; i++ ) { |
| 54 | + this.items[i].renderContent(); |
| 55 | + } |
| 56 | +}; |
| 57 | + |
| 58 | +/* Inheritance */ |
45 | 59 | es.extend( es.ListBlockList, es.DomContainer ); |
Index: trunk/parsers/wikidom/lib/es/es.ListBlockItem.js |
— | — | @@ -1,3 +1,13 @@ |
| 2 | +/** |
| 3 | + * Creates a list block item. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @extends {es.EventEmitter} |
| 8 | + * @param content {es.Content} |
| 9 | + * @param style {String} |
| 10 | + * @param level {Integer} |
| 11 | + */ |
2 | 12 | es.ListBlockItem = function( content, style, level ) { |
3 | 13 | es.EventEmitter.call( this ); |
4 | 14 | |
— | — | @@ -17,6 +27,8 @@ |
18 | 28 | } ); |
19 | 29 | } |
20 | 30 | |
| 31 | +/* Public Methods */ |
| 32 | + |
21 | 33 | es.ListBlockItem.prototype.setNumber = function( number ) { |
22 | 34 | this.$icon.text( number + '.' ); |
23 | 35 | }; |
— | — | @@ -37,4 +49,5 @@ |
38 | 50 | this.flow.render(); |
39 | 51 | }; |
40 | 52 | |
| 53 | +/* Inheritance */ |
41 | 54 | es.extend( es.ListBlockItem, es.EventEmitter ); |
\ No newline at end of file |