Index: trunk/extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js |
— | — | @@ -230,8 +230,8 @@ |
231 | 231 | tests++; |
232 | 232 | } |
233 | 233 | if ( window.console !== undefined ) { |
234 | | - for ( message in messages ) { |
235 | | - console.log( messages[message] ); |
| 234 | + for ( var i = 0; i < messages.length; i++ ) { |
| 235 | + console.log( messages[i] ); |
236 | 236 | } |
237 | 237 | } |
238 | 238 | $(this) |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | api : { |
11 | 11 | addToToolbar : function( context, data ) { |
12 | 12 | |
13 | | - var smooth = true, type; |
| 13 | + var smooth = true, type, i; |
14 | 14 | |
15 | 15 | for ( type in data ) { |
16 | 16 | switch ( type ) { |
— | — | @@ -93,9 +93,9 @@ |
94 | 94 | var $table = context.modules.toolbar.$toolbar.find( |
95 | 95 | 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.page + '].page table' |
96 | 96 | ); |
97 | | - for ( var row in data[type] ) { |
| 97 | + for ( i = 0; i < data.rows.length; i++ ) { |
98 | 98 | // Row |
99 | | - $table.append( $.wikiEditor.modules.toolbar.fn.buildRow( context, data[type][row] ) ); |
| 99 | + $table.append( $.wikiEditor.modules.toolbar.fn.buildRow( context, data.rows[i] ) ); |
100 | 100 | } |
101 | 101 | smooth = false; |
102 | 102 | break; |
— | — | @@ -107,11 +107,11 @@ |
108 | 108 | 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.page + '].page div' |
109 | 109 | ); |
110 | 110 | var actions = $characters.data( 'actions' ); |
111 | | - for ( var character in data[type] ) { |
| 111 | + for ( i = 0; data.character.length; i++ ) { |
112 | 112 | // Character |
113 | 113 | $characters |
114 | 114 | .append( |
115 | | - $( $.wikiEditor.modules.toolbar.fn.buildCharacter( data[type][character], actions ) ) |
| 115 | + $( $.wikiEditor.modules.toolbar.fn.buildCharacter( data.characters[i], actions ) ) |
116 | 116 | .mousedown( function( e ) { |
117 | 117 | context.fn.saveCursorAndScrollTop(); |
118 | 118 | // No dragging! |
— | — | @@ -321,8 +321,8 @@ |
322 | 322 | }, |
323 | 323 | buildTool : function( context, id, tool ) { |
324 | 324 | if ( 'filters' in tool ) { |
325 | | - for ( var filter in tool.filters ) { |
326 | | - if ( $( tool.filters[filter] ).size() === 0 ) { |
| 325 | + for ( var i = 0; i < tool.filters.length; i++ ) { |
| 326 | + if ( $( tool.filters[i] ).size() === 0 ) { |
327 | 327 | return null; |
328 | 328 | } |
329 | 329 | } |
— | — | @@ -470,6 +470,7 @@ |
471 | 471 | } ); |
472 | 472 | }, |
473 | 473 | buildPage : function( context, id, page ) { |
| 474 | + var html; |
474 | 475 | var $page = $( '<div/>' ).attr( { |
475 | 476 | 'class' : 'page page-' + id, |
476 | 477 | 'rel' : id |
— | — | @@ -477,14 +478,14 @@ |
478 | 479 | switch ( page.layout ) { |
479 | 480 | case 'table': |
480 | 481 | $page.addClass( 'page-table' ); |
481 | | - var html = |
| 482 | + html = |
482 | 483 | '<table cellpadding=0 cellspacing=0 ' + 'border=0 width="100%" class="table table-' + id + '">'; |
483 | 484 | if ( 'headings' in page ) { |
484 | 485 | html += $.wikiEditor.modules.toolbar.fn.buildHeading( context, page.headings ); |
485 | 486 | } |
486 | 487 | if ( 'rows' in page ) { |
487 | | - for ( var row in page.rows ) { |
488 | | - html += $.wikiEditor.modules.toolbar.fn.buildRow( context, page.rows[row] ); |
| 488 | + for ( var i = 0; i < page.rows.length; i++ ) { |
| 489 | + html += $.wikiEditor.modules.toolbar.fn.buildRow( context, page.rows[i] ); |
489 | 490 | } |
490 | 491 | } |
491 | 492 | $page.html( html ); |
— | — | @@ -500,7 +501,7 @@ |
501 | 502 | $characters.attr( 'dir', page.direction ); |
502 | 503 | } |
503 | 504 | if ( 'characters' in page ) { |
504 | | - var html = ''; |
| 505 | + html = ''; |
505 | 506 | for ( var i = 0; i < page.characters.length; i++ ) { |
506 | 507 | html += $.wikiEditor.modules.toolbar.fn.buildCharacter( page.characters[i], actions ); |
507 | 508 | } |
— | — | @@ -530,8 +531,8 @@ |
531 | 532 | }, |
532 | 533 | buildHeading : function( context, headings ) { |
533 | 534 | var html = '<tr>'; |
534 | | - for ( var heading in headings ) { |
535 | | - html += '<th>' + $.wikiEditor.autoMsg( headings[heading], ['html', 'text'] ) + '</th>'; |
| 535 | + for ( var i = 0; i< headings.length; i++ ) { |
| 536 | + html += '<th>' + $.wikiEditor.autoMsg( headings[i], ['html', 'text'] ) + '</th>'; |
536 | 537 | } |
537 | 538 | return html; |
538 | 539 | }, |