Use pseudo elements to style changelist-separators on Contributions
authorjdlrobson <jdlrobson@gmail.com>
Tue, 18 Sep 2018 21:11:08 +0000 (14:11 -0700)
committerjdlrobson <jdlrobson@gmail.com>
Mon, 1 Oct 2018 23:29:46 +0000 (16:29 -0700)
Currently, these separators are unnecessarily hardcoded in HTML.
This is problematic, as it limits the extent to which skins such
as Minerva and Timeless can skin these pages.

If the pseudo selector is not available (e.g. legacy browsers)
this degrades nicely to whitespace and the page is still useable.

Right now, these changes are scoped to pages uses the ContribsPager
(used by Special:Contributions)
but we can adopt them in other pages once we have this approach set in
stone (CSS)

Bug: T205581
Change-Id: Ia2c485e6058ebf4282ed2f7eb7b046b2deb03f57

includes/specials/pagers/ContribsPager.php
resources/src/mediawiki.special.changeslist.css

index 81a1f5a..5b50f0a 100644 (file)
@@ -502,22 +502,22 @@ class ContribsPager extends RangeChronologicalPager {
                                // For some reason rev_parent_id isn't populated for this row.
                                // Its rumoured this is true on wikipedia for some revisions (T36922).
                                // Next best thing is to have the total number of bytes.
                                // For some reason rev_parent_id isn't populated for this row.
                                // Its rumoured this is true on wikipedia for some revisions (T36922).
                                // Next best thing is to have the total number of bytes.
-                               $chardiff = ' <span class="mw-changeslist-separator">. .</span> ';
+                               $chardiff = ' <span class="mw-changeslist-separator"></span> ';
                                $chardiff .= Linker::formatRevisionSize( $row->rev_len );
                                $chardiff .= Linker::formatRevisionSize( $row->rev_len );
-                               $chardiff .= ' <span class="mw-changeslist-separator">. .</span> ';
+                               $chardiff .= ' <span class="mw-changeslist-separator"></span> ';
                        } else {
                                $parentLen = 0;
                                if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) {
                                        $parentLen = $this->mParentLens[$row->rev_parent_id];
                                }
 
                        } else {
                                $parentLen = 0;
                                if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) {
                                        $parentLen = $this->mParentLens[$row->rev_parent_id];
                                }
 
-                               $chardiff = ' <span class="mw-changeslist-separator">. .</span> ';
+                               $chardiff = ' <span class="mw-changeslist-separator"></span> ';
                                $chardiff .= ChangesList::showCharacterDifference(
                                        $parentLen,
                                        $row->rev_len,
                                        $this->getContext()
                                );
                                $chardiff .= ChangesList::showCharacterDifference(
                                        $parentLen,
                                        $row->rev_len,
                                        $this->getContext()
                                );
-                               $chardiff .= ' <span class="mw-changeslist-separator">. .</span> ';
+                               $chardiff .= ' <span class="mw-changeslist-separator"></span> ';
                        }
 
                        $lang = $this->getLanguage();
                        }
 
                        $lang = $this->getLanguage();
@@ -543,7 +543,8 @@ class ContribsPager extends RangeChronologicalPager {
                        $userlink = '';
                        if ( ( $this->contribs == 'newbie' && !$rev->isDeleted( Revision::DELETED_USER ) )
                                || $this->isQueryableRange( $this->target ) ) {
                        $userlink = '';
                        if ( ( $this->contribs == 'newbie' && !$rev->isDeleted( Revision::DELETED_USER ) )
                                || $this->isQueryableRange( $this->target ) ) {
-                               $userlink = ' . . ' . $lang->getDirMark()
+                               $userlink = ' <span class="mw-changeslist-separator"></span> '
+                                       . $lang->getDirMark()
                                        . Linker::userLink( $rev->getUser(), $rev->getUserText() );
                                $userlink .= ' ' . $this->msg( 'parentheses' )->rawParams(
                                        Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) )->escaped() . ' ';
                                        . Linker::userLink( $rev->getUser(), $rev->getUserText() );
                                $userlink .= ' ' . $this->msg( 'parentheses' )->rawParams(
                                        Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) )->escaped() . ' ';
index 1b37ec3..a884b83 100644 (file)
@@ -60,3 +60,9 @@
 .mw-rcfilters-ui-highlights {
        display: none;
 }
 .mw-rcfilters-ui-highlights {
        display: none;
 }
+
+/* Content dividers */
+/* @todo FIXME: Hard coded ". .". Is there a message for this? Should there be? */
+.mw-changeslist-separator:empty:before {
+       content: '. .';
+}