) {
$this->title = $title;
$this->setContext( $context );
+ $this->getOutput()->addModuleStyles( array(
+ 'mediawiki.action.view.categoryPage.styles'
+ ) );
$this->from = $from;
$this->until = $until;
$this->limit = $context->getConfig()->get( 'CategoryPagingLimit' );
* TODO: Take the headers into account when creating columns, so they're
* more visually equal.
*
- * More distant TODO: Scrap this and use CSS columns, whenever IE finally
- * supports those.
+ * TODO: shortList and columnList are similar, need merging
*
* @param array $articles
* @param string[] $articles_start_char
*/
static function columnList( $articles, $articles_start_char ) {
$columns = array_combine( $articles, $articles_start_char );
- # Split into three columns
- $columns = array_chunk( $columns, ceil( count( $columns ) / 3 ), true /* preserve keys */ );
- $ret = '<table style="width: 100%;"><tr style="vertical-align: top;">';
- $prevchar = null;
+ $ret = Html::openElement( 'div', array( 'class' => 'mw-category' ) );
- foreach ( $columns as $column ) {
- $ret .= '<td style="width: 33.3%;">';
- $colContents = array();
+ $colContents = array();
- # Kind of like array_flip() here, but we keep duplicates in an
- # array instead of dropping them.
- foreach ( $column as $article => $char ) {
- if ( !isset( $colContents[$char] ) ) {
- $colContents[$char] = array();
- }
- $colContents[$char][] = $article;
+ # Kind of like array_flip() here, but we keep duplicates in an
+ # array instead of dropping them.
+ foreach ( $columns as $article => $char ) {
+ if ( !isset( $colContents[$char] ) ) {
+ $colContents[$char] = array();
}
+ $colContents[$char][] = $article;
+ }
- $first = true;
- foreach ( $colContents as $char => $articles ) {
- # Change space to non-breaking space to keep headers aligned
- $h3char = $char === ' ' ? ' ' : htmlspecialchars( $char );
+ foreach ( $colContents as $char => $articles ) {
+ # Change space to non-breaking space to keep headers aligned
+ $h3char = $char === ' ' ? ' ' : htmlspecialchars( $char );
- $ret .= '<h3>' . $h3char;
- if ( $first && $char === $prevchar ) {
- # We're continuing a previous chunk at the top of a new
- # column, so add " cont." after the letter.
- $ret .= ' ' . wfMessage( 'listingcontinuesabbrev' )->escaped();
- }
- $ret .= "</h3>\n";
+ $ret .= '<div class="mw-category-group"><h3>' . $h3char;
+ $ret .= "</h3>\n";
- $ret .= '<ul><li>';
- $ret .= implode( "</li>\n<li>", $articles );
- $ret .= '</li></ul>';
-
- $first = false;
- $prevchar = $char;
- }
+ $ret .= '<ul><li>';
+ $ret .= implode( "</li>\n<li>", $articles );
+ $ret .= '</li></ul></div>';
- $ret .= "</td>\n";
}
- $ret .= '</tr></table>';
+ $ret .= Html::closeElement( 'div' );
return $ret;
}
-webkit-box-shadow: @value; // Safari 3.1-5.0, iOS 3.2-4.3, Android 2.1-3.0
box-shadow: @value; // Chrome 10+, Firefox 4+, IE 9+, Safari 5.1+, Opera 11+, iOS 5+, Android 4+
}
+
+.column-count(@value) {
+ -webkit-column-count: @value;
+ -moz-column-count: @value;
+ -o-column-count: @value;
+ column-count: @value;
+}
+
+.column-break-inside(@value) {
+ -webkit-column-break-inside: @value; // Chrome Any, Safari 3+, Opera 11.1+
+ page-break-inside: @value; // Firefox 1.5+
+ break-inside: @value; // IE 10+
+}