Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -220,16 +220,20 @@ |
221 | 221 | var indexDiv = $( '<div />' ) |
222 | 222 | .attr( 'class', 'index' ) |
223 | 223 | .appendTo( $(this) ); |
224 | | - |
| 224 | + // Builds name name of booklet state cookie |
225 | 225 | var bookletCookie = 'edittoolbar-' + $(this).attr( 'id' ) + '-booklet-' + id; |
| 226 | + // Gets ID of selected page |
226 | 227 | var selectedID = $.cookie( bookletCookie ); |
227 | | - |
228 | 228 | // Loops over each page |
229 | 229 | for ( page in section.pages ) { |
| 230 | + // Fallback to current (first) page for selectedID |
| 231 | + if ( selectedID === null ) { |
| 232 | + selectedID = page; |
| 233 | + } |
230 | 234 | // Appends index entry |
231 | 235 | indexDiv.append( |
232 | 236 | $( '<div />' ) |
233 | | - .attr( 'class', page == selectedID ? 'current' : null ) |
| 237 | + .attr( 'class', page === selectedID ? 'current' : null ) |
234 | 238 | .text( msg( section.pages[page], 'label' ) ) |
235 | 239 | .data( 'page', page ) |
236 | 240 | .data( 'cookie', bookletCookie ) |
— | — | @@ -252,6 +256,7 @@ |
253 | 257 | // Appends page |
254 | 258 | var pageDiv = $( '<div />' ) |
255 | 259 | .attr( 'class', 'page page-' + page ) |
| 260 | + .css( 'display', page === selectedID ? 'block' : 'none' ) |
256 | 261 | .appendTo( pagesDiv ); |
257 | 262 | // Checks if there's content for this page |
258 | 263 | switch ( section.pages[page].layout ) { |
— | — | @@ -721,27 +726,27 @@ |
722 | 727 | } |
723 | 728 | } |
724 | 729 | }, |
725 | | - 'newline': { |
726 | | - labelMsg: 'edittoolbar-tool-newline', |
| 730 | + 'table': { |
| 731 | + labelMsg: 'edittoolbar-tool-table', |
727 | 732 | type: 'button', |
728 | | - icon: 'insert-newline.png', |
| 733 | + icon: 'insert-table.png', |
729 | 734 | action: { |
730 | 735 | type: 'encapsulate', |
731 | 736 | options: { |
732 | | - pre: "<br />\n" |
| 737 | + pre: "{| class=\"wikitable\" border=\"1\"\n|", |
| 738 | + periMsg: 'edittoolbar-tool-table-example', |
| 739 | + post: "\n|}" |
733 | 740 | } |
734 | 741 | } |
735 | 742 | }, |
736 | | - 'table': { |
737 | | - labelMsg: 'edittoolbar-tool-table', |
| 743 | + 'newline': { |
| 744 | + labelMsg: 'edittoolbar-tool-newline', |
738 | 745 | type: 'button', |
739 | | - icon: 'insert-table.png', |
| 746 | + icon: 'insert-newline.png', |
740 | 747 | action: { |
741 | 748 | type: 'encapsulate', |
742 | 749 | options: { |
743 | | - pre: "{| class=\"wikitable\" border=\"1\"\n|", |
744 | | - periMsg: 'edittoolbar-tool-table-example', |
745 | | - post: "\n|}" |
| 750 | + pre: "<br />\n" |
746 | 751 | } |
747 | 752 | } |
748 | 753 | } |