fix: fix incorrect files from rebased PR (#203)

* refactor: Fix switching theme

* ci: lint code to MediaWiki standards

Check commit and GitHub actions for more details

* refactor: Fix bad rebase

* ci: lint code to MediaWiki standards

Check commit and GitHub actions for more details

Co-authored-by: github-actions <github-actions@users.noreply.github.com>
This commit is contained in:
H. C. Kruse 2021-01-12 02:12:14 +01:00 committed by GitHub
parent b4488f8ddb
commit dde77d19dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View file

@ -784,16 +784,16 @@ class SkinCitizen extends SkinMustache {
}
// Script content at 'skins.citizen.scripts.theme/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()->addHeadItem( 'theme-switcher', '<script>window.switchTheme=(()=>{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){}}),window.switchTheme();</script>' );
// Add styles and scripts module
$options['scripts'] = array_merge(
$options['scripts'],
[ 'skins.citizen.scripts.theme' ]
);
if ( $theme === 'auto' ) {
$options['scripts'] = array_merge(
$options['scripts'],
[ 'skins.citizen.scripts.theme' ]
);
}
$options['styles'] = array_merge(
$options['styles'],
[ 'skins.citizen.styles.theme' ]

View file

@ -125,7 +125,8 @@
"resources/skins.citizen.scripts/skins.citizen.scripts.js"
],
"dependencies": [
"mediawiki.page.ready"
"mediawiki.page.ready",
"mediawiki.cookie"
]
},
"skins.citizen.scripts.lazyload": {