Index: trunk/extensions/wikihiero/SpecialHieroglyphs.php |
— | — | @@ -62,9 +62,12 @@ |
63 | 63 | . Html::closeElement( 'form' ) |
64 | 64 | ); |
65 | 65 | |
| 66 | + $out->addHTML( '<table><tr><td>' ); |
66 | 67 | $out->addHTML( '<div class="mw-hiero-list">' ); |
67 | 68 | $out->addHTML( $this->listHieroglyphs() ); |
68 | | - $out->addHTML( '</div>' ); |
| 69 | + $out->addHTML( '</div></td><td>' ); |
| 70 | + $out->addHTML( $this->getToc() ); |
| 71 | + $out->addHTML( '</td></tr></table>' ); |
69 | 72 | } |
70 | 73 | |
71 | 74 | /** |
— | — | @@ -124,6 +127,32 @@ |
125 | 128 | return $html; |
126 | 129 | } |
127 | 130 | |
| 131 | + private function getToc() { |
| 132 | + $html = '<table class="toc mw-hiero-toc"><tr>'; |
| 133 | + $count = 0; |
| 134 | + $cats = $this->getCategories(); |
| 135 | + $end = array_pop( $cats ); |
| 136 | + foreach ( $cats as $cat ) { |
| 137 | + $html .= '<td>' |
| 138 | + . Html::element( 'a', |
| 139 | + array( 'href' => "#cat-$cat", 'title' => wfMessage( "wikihiero-category-$cat" )->text() ), |
| 140 | + $cat |
| 141 | + ) |
| 142 | + . '</td>'; |
| 143 | + $count++; |
| 144 | + if ( $count % 5 == 0 ) { |
| 145 | + $html .= '</tr><tr>'; |
| 146 | + } |
| 147 | + } |
| 148 | + $html .= '</tr><tr><td colspan="5">' |
| 149 | + . Html::element( 'a', |
| 150 | + array( 'href' => "#cat-$end", 'title' => wfMessage( "wikihiero-category-$end" )->text() ), |
| 151 | + $end |
| 152 | + ) |
| 153 | + . '</td>'; |
| 154 | + return $html . '</tr></table>'; |
| 155 | + } |
| 156 | + |
128 | 157 | /** |
129 | 158 | * Returns an array with hieroglyph categories from Gardiner's list |
130 | 159 | */ |
Index: trunk/extensions/wikihiero/modules/ext.wikihiero.Special.css |
— | — | @@ -2,4 +2,9 @@ |
3 | 3 | overflow: auto; |
4 | 4 | height: 400px; |
5 | 5 | margin-top: 1em; |
| 6 | + border: 1px solid silver; |
6 | 7 | } |
| 8 | + |
| 9 | +.mw-hiero-toc { |
| 10 | + text-align: center; |
| 11 | +} |