Change CSS identifiers

Apply CSS coding conventions from:
https://www.mediawiki.org/wiki/Manual:Coding_conventions/CSS#Naming

* Use class instead of id.
* Use class names with the prefix "ext-replacetext-".
* Remove stylelint rule:
    "selector-max-id": null
* Add stylelint rule:
    "selector-class-pattern": "^client-nojs$|^ext-replacetext-"

Change-Id: Ia7e3d41030aba7287716a219acbe6115e8fcbe46
This commit is contained in:
Fomafix 2018-12-23 17:50:58 +01:00
parent bd20365fbe
commit 78e75ed030
4 changed files with 16 additions and 16 deletions

View file

@ -1,6 +1,6 @@
{
"extends": "stylelint-config-wikimedia",
"rules": {
"selector-max-id": null
"selector-class-pattern": "^client-nojs$|^ext-replacetext-"
}
}

View file

@ -20,7 +20,7 @@
$( function () {
var $checkboxes = $( '#powersearch input[id^=mw-search-ns]' );
$( '.mw-replacetext-invert' ).on( 'click', invertSelections );
$( '.ext-replacetext-invert' ).on( 'click', invertSelections );
// Attach handler for check all/none buttons
$( '#mw-search-toggleall' ).on( 'click', function () {

View file

@ -1,12 +1,12 @@
.mw-replacetext-invert {
.ext-replacetext-invert {
margin-top: 20px;
}
.searchmatch {
.ext-replacetext-searchmatch {
font-weight: bold;
}
#mw-searchoptions {
.ext-replacetext-searchoptions {
// Support: Firefox, needs `clear: both` on `fieldset` when zoom level > 100%, see T176499
clear: both;
padding: 0.5em 0.75em 0.75em 0.75em;
@ -32,7 +32,7 @@
}
}
.divider {
.ext-replacetext-divider {
clear: both;
border-bottom: 1px solid #eaecf0;
padding-top: 0.5em;
@ -40,7 +40,7 @@
}
}
#mw-search-togglebox {
.ext-replacetext-search-togglebox {
float: right;
label {
@ -53,8 +53,8 @@
}
.client-nojs {
#mw-search-togglebox,
.mw-replacetext-invert {
.ext-replacetext-search-togglebox,
.ext-replacetext-invert {
display: none;
}
}

View file

@ -492,7 +492,7 @@ class SpecialReplaceText extends SpecialPage {
$tables = $this->namespaceTables( $namespaces );
$out->addHTML(
"<div class=\"mw-search-formheader\"></div>\n" .
"<fieldset id=\"mw-searchoptions\">\n" .
"<fieldset class=\"ext-replacetext-searchoptions\">\n" .
Xml::tags( 'h4', null, $this->msg( 'powersearch-ns' )->parse() )
);
// The ability to select/unselect groups of namespaces in the
@ -505,7 +505,7 @@ class SpecialReplaceText extends SpecialPage {
$out->addHTML(
Html::rawElement(
'div',
[ 'id' => 'mw-search-togglebox' ],
[ 'class' => 'ext-replacetext-search-togglebox' ],
Html::element( 'label', [],
$this->msg( 'powersearch-togglelabel' )->text()
) .
@ -523,7 +523,7 @@ class SpecialReplaceText extends SpecialPage {
);
}
$out->addHTML(
Xml::element( 'div', [ 'class' => 'divider' ], '', false ) .
Xml::element( 'div', [ 'class' => 'ext-replacetext-divider' ], '', false ) .
"$tables\n</fieldset>"
);
// @todo FIXME: raw html messages
@ -537,9 +537,9 @@ class SpecialReplaceText extends SpecialPage {
'flags' => [ 'primary', 'progressive' ]
] );
$out->addHTML(
"<fieldset id=\"mw-searchoptions\">\n" .
"<fieldset class=\"ext-replacetext-searchoptions\">\n" .
Xml::tags( 'h4', null, $this->msg( 'replacetext_optionalfilters' )->parse() ) .
Xml::element( 'div', [ 'class' => 'divider' ], '', false ) .
Xml::element( 'div', [ 'class' => 'ext-replacetext-divider' ], '', false ) .
"<p>$category_search_label\n" .
Xml::input( 'category', 20, $this->category, [ 'type' => 'text' ] ) . '</p>' .
"<p>$prefix_search_label\n" .
@ -670,7 +670,7 @@ class SpecialReplaceText extends SpecialPage {
if ( count( $titles_for_edit ) + count( $titles_for_move ) > 5 ) {
$invertButton = new OOUI\ButtonWidget( [
'label' => $this->msg( 'replacetext_invertselections' )->text(),
'classes' => [ 'mw-replacetext-invert' ]
'classes' => [ 'ext-replacetext-invert' ]
] );
$out->addHTML( $invertButton );
}
@ -814,7 +814,7 @@ class SpecialReplaceText extends SpecialPage {
$targetq = preg_quote( $this->convertWhiteSpaceToHTML( $target ), '/' );
$targetStr = "/$targetq/i";
}
$context .= preg_replace( $targetStr, '<span class="searchmatch">\0</span>', $snippet );
$context .= preg_replace( $targetStr, '<span class="ext-replacetext-searchmatch">\0</span>', $snippet );
$context .= $this->convertWhiteSpaceToHTML( $contextAfter );
}