ci: lint code to MediaWiki standards

Check commit and GitHub actions for more details
This commit is contained in:
github-actions 2021-01-11 17:17:37 +00:00
parent 68d8621220
commit 90e1826134
3 changed files with 14 additions and 14 deletions

View file

@ -208,9 +208,9 @@ class CitizenHooks {
* @return bool|void True or no return value to continue or false to abort
*/
public static function onPreferencesFormPreSave( $formData, $form, $user, &$result, $oldUserOptions ) {
if (isset($formData['CitizenThemeUser']) && $formData['CitizenThemeUser'] !== 'auto') {
if ( isset( $formData['CitizenThemeUser'] ) && $formData['CitizenThemeUser'] !== 'auto' ) {
// Reset override cookie from theme toggle
$form->getOutput()->getRequest()->response()->setCookie('skin-citizen-theme-override', null);
$form->getOutput()->getRequest()->response()->setCookie( 'skin-citizen-theme-override', null );
}
}
}

View file

@ -775,15 +775,15 @@ class SkinCitizen extends SkinMustache {
// Add HTML class based on theme set
$out->addHtmlClasses( 'skin-citizen-' . $theme );
if ($this->getRequest()->getCookie('skin-citizen-theme-override') === null) {
if ( $this->getRequest()->getCookie( 'skin-citizen-theme-override' ) === null ) {
// Only set the theme cookie if the theme wasn't overridden by the user through the button
$this->getRequest()->response()->setCookie('skin-citizen-theme', $theme, 0, [
$this->getRequest()->response()->setCookie( 'skin-citizen-theme', $theme, 0, [
'httpOnly' => false,
]);
] );
}
// Script content at 'skins.citizen.scripts.theme-switcher/inline.js
$this->getOutput()->addHeadItem('theme-switcher', '<script>(()=>{try{const t=document.cookie.match(/skin-citizen-theme=(dark|light|auto)/),e=null!==t?t.pop():null;null!==e&&(document.documentElement.classList.remove(...["auto","dark","light"].map(t=>"skin-citizen-"+t)),document.documentElement.classList.add("skin-citizen-"+e))}catch(t){}})();</script>');
$this->getOutput()->addModules('skins.citizen.scripts.theme-switcher');
$this->getOutput()->addHeadItem( 'theme-switcher', '<script>(()=>{try{const t=document.cookie.match(/skin-citizen-theme=(dark|light|auto)/),e=null!==t?t.pop():null;null!==e&&(document.documentElement.classList.remove(...["auto","dark","light"].map(t=>"skin-citizen-"+t)),document.documentElement.classList.add("skin-citizen-"+e))}catch(t){}})();</script>' );
$this->getOutput()->addModules( 'skins.citizen.scripts.theme-switcher' );
}
}

View file

@ -1,16 +1,16 @@
.mw-theme-toggle {
background-color: transparent;
border: 0;
background-repeat: no-repeat;
background-position: center;
font-size: 0;
opacity: 0.4;
width: 39px;
height: 56px;
border: 0;
background-color: transparent;
background-position: center;
background-repeat: no-repeat;
font-size: 0;
opacity: 0.4;
}
.skin-citizen-dark {
.mw-theme-toggle {
filter: invert(1);
filter: invert( 1 );
}
}