From cacc2ca974ca6ed10a027c01c76691ecbdac5f76 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 16 Dec 2018 23:16:26 +0000 Subject: [PATCH] Special:AllMessages: Remove al_title and allmessages-customised classes * The al_title class was unused, and thus removed. * The allmessages-customised class was used in CSS to target elements with 'al_default' and 'al_actual' classses within it, which are in turn only used for that purpose. Change the HTML to match the needs of the CSS by only setting al_default/al_actual classes on customised messages and remove need for the parent element class. On a plain install this reduced output by ~2K from 75.8K to 74.0K, and allocate 100 (2x50) fewer attribute nodes. Change-Id: If2dd4cf5c937935f03f30b8410a32b6821b0bf34 --- .../specials/pagers/AllMessagesTablePager.php | 29 ++++++++++--------- resources/src/mediawiki.special/special.css | 6 ++-- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/includes/specials/pagers/AllMessagesTablePager.php b/includes/specials/pagers/AllMessagesTablePager.php index a9479c4846..18c1d70867 100644 --- a/includes/specials/pagers/AllMessagesTablePager.php +++ b/includes/specials/pagers/AllMessagesTablePager.php @@ -345,6 +345,7 @@ class AllMessagesTablePager extends TablePager { return ''; } + /** @return string HTML */ function formatRow( $row ) { // Do all the normal stuff $s = parent::formatRow( $row ); @@ -365,28 +366,28 @@ class AllMessagesTablePager extends TablePager { return $s; } - function getRowAttrs( $row, $isSecond = false ) { - $arr = []; - - if ( $row->am_customised ) { - $arr['class'] = 'allmessages-customised'; - } - - return $arr; + function getRowAttrs( $row ) { + return []; } + /** @return array HTML attributes */ function getCellAttrs( $field, $value ) { - if ( $this->mCurrentRow->am_customised && $field === 'am_title' ) { - return [ 'rowspan' => '2', 'class' => $field ]; - } elseif ( $field === 'am_title' ) { - return [ 'class' => $field ]; + $attr = []; + if ( $field === 'am_title' ) { + if ( $this->mCurrentRow->am_customised ) { + $attr += [ 'rowspan' => '2' ]; + } } else { - return [ + $attr += [ 'lang' => $this->lang->getHtmlCode(), 'dir' => $this->lang->getDir(), - 'class' => $field ]; + if ( $this->mCurrentRow->am_customised ) { + // CSS class: am_default, am_actual + $attr += [ 'class' => $field ]; + } } + return $attr; } // This is not actually used, as getStartBody is overridden above diff --git a/resources/src/mediawiki.special/special.css b/resources/src/mediawiki.special/special.css index 35cdee7ed6..cb05793820 100644 --- a/resources/src/mediawiki.special/special.css +++ b/resources/src/mediawiki.special/special.css @@ -1,9 +1,9 @@ /* Special:AllMessages */ -#mw-allmessagestable .allmessages-customised .am_default { +#mw-allmessagestable .am_default { background-color: #fcffc4; } -#mw-allmessagestable .allmessages-customised:hover .am_default { +#mw-allmessagestable tr:hover .am_default { background-color: #faff90; } @@ -11,7 +11,7 @@ background-color: #e2ffe2; } -#mw-allmessagestable .allmessages-customised:hover + .allmessages-customised .am_actual { +#mw-allmessagestable tr:hover + tr .am_actual { background-color: #b1ffb1; } -- 2.20.1