Cleanup: Remove dark mode banner code

this is not being utilized any more, tested or maintained so should
be removed.

Change-Id: Ib51bc5cb829f25b8a2ab864f7b9266578a4b1232
This commit is contained in:
Jon Robson 2024-09-06 09:30:00 -07:00
parent 8c35813ba3
commit e89aab6b43
6 changed files with 0 additions and 136 deletions

View file

@ -26,13 +26,5 @@
{
"resourceModule": "skins.minerva.scripts",
"maxSize": "14.5KB"
},
{
"resourceModule": "skins.minerva.DarkModeLaunchBanner",
"maxSize": "3.3KB"
},
{
"resourceModule": "skins.minerva.DarkModeLaunchBanner.codexModules",
"maxSize": "3.3KB"
}
]

View file

@ -60,12 +60,6 @@
"skin-minerva-mobile-option-MinervaPageIssuesNewTreatment-description": "Page issues (Template:ambox) will be inlined in the article.",
"skin-minerva-recentchanges-warning-enhanced-not-supported": "Unfortunately, grouping results by page is not available on mobile. If you would like to use the group by page feature please visit the desktop site.",
"skin-minerva-night-mode-unavailable": "Page only available in \"Light\" color theme.",
"skin-minerva-night-mode-launch-title": "Wikipedia's new colors",
"skin-minerva-night-mode-launch-subtitle": "Try dark mode today",
"skin-minerva-night-mode-launch-description-night": "Wikipedia is now available in dark mode. Try it out by tapping on \"Settings\" in the main menu.",
"skin-minerva-night-mode-launch-description-day": "Wikipedia is now available in dark mode. Try it out by tapping on \"Settings\" in the main menu.",
"skin-minerva-night-mode-launch-settings-label": "Go to Settings",
"skin-minerva-night-mode-launch-close-label": "Close",
"minerva.css": "/* All CSS here will be loaded for users of the MinervaNeue skin */",
"minerva.js": "/* All JavaScript here will be loaded for users of the MinervaNeue skin */"
}

View file

@ -75,12 +75,6 @@
"skin-minerva-mobile-option-MinervaPageIssuesNewTreatment-description": "Description shown on Special:MobileOptions for page issues beta feature.",
"skin-minerva-recentchanges-warning-enhanced-not-supported": "Warning message when informing about the lack of the '''group results by page''' feature availability on the mobile site. Message should recommend visiting desktop site to access grouping results by page.",
"skin-minerva-night-mode-unavailable": "Informs reader if page could not be rendered in preferred dark mode theme.",
"skin-minerva-night-mode-launch-title": "Title of a modal that appears informing users of the new dark mode feature",
"skin-minerva-night-mode-launch-subtitle": "Subtitle of a modal that appears informing users of the new dark mode feature. \"Dark\" should be translated consistently with {{msg-mw|Skin-theme-night-label}}.",
"skin-minerva-night-mode-launch-description-night": "Text in the dark mode launch modal describing the dark mode feature, when dark mode is enabled. \"Settings\" is {{msg-mw|Mobile-frontend-main-menu-settings-heading}}.",
"skin-minerva-night-mode-launch-description-day": "Text in the dark mode launch modal describing the dark mode feature, when dark mode is disabled. \"Settings\" is {{msg-mw|Mobile-frontend-main-menu-settings-heading}}.",
"skin-minerva-night-mode-launch-settings-label": "Label of a button that directs to the Special:MobileOptions page",
"skin-minerva-night-mode-launch-close-label": "Label for button to close the dark-mode launch modal",
"minerva.css": "{{optional}}\n{{related/css}}",
"minerva.js": "{{optional}}\n{{related/js}}"
}

View file

@ -1,81 +0,0 @@
const makeTemplate = function ( description ) {
const templateString = `<div class="cdx-dialog-backdrop">
<div tabindex="0"></div>
<div class="cdx-dialog cdx-dialog--horizontal-actions" role="dialog" aria-labelledby="cdx-dialog-label-0" aria-modal="true">
<header class="cdx-dialog__header cdx-dialog__header--default">
<div class="cdx-dialog__header__title-group">
<h2 id="cdx-dialog-label-0" class="cdx-dialog__header__title">
${ mw.message( 'skin-minerva-night-mode-launch-title' ).escaped() }
</h2>
</div>
<button class="cdx-button cdx-button--action-default cdx-button--weight-quiet cdx-button--size-medium cdx-button--icon-only cdx-dialog__header__close-button" type="button" aria-label="${ mw.message( 'skin-minerva-night-mode-launch-close-label' ).escaped() }">
<span class="cdx-icon cdx-icon--medium">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 20 20"><title>Close</title><g><path d="m4.34 2.93 12.73 12.73-1.41 1.41L2.93 4.35z"></path><path d="M17.07 4.34 4.34 17.07l-1.41-1.41L15.66 2.93z"></path></g></svg>
</span>
</button>
</header>
<div class="cdx-dialog-focus-trap" tabindex="-1"></div>
<div class="cdx-dialog__body">
<div class="skin-minerva-launch-image"></div>
<h3>
${ mw.message( 'skin-minerva-night-mode-launch-subtitle' ).escaped() }
</h3>
<p>
${ description }
</p>
</div>
<footer class="cdx-dialog__footer cdx-dialog__footer--default">
<div class="cdx-dialog__footer__actions">
<button class="cdx-button cdx-button--action-progressive cdx-button--weight-primary cdx-button--size-medium cdx-button--framed cdx-dialog__footer__primary-action">
${ mw.message( 'skin-minerva-night-mode-launch-settings-label' ).escaped() }
</button>
</div>
</footer>
</div>
<div tabindex="0"></div>
</div>`;
const templateElement = document.createElement( 'div' );
templateElement.id = 'minerva-dark-mode-launch-banner';
templateElement.innerHTML = templateString;
return templateElement;
};
function closeModal() {
document.getElementById( 'minerva-dark-mode-launch-banner' ).remove();
}
function primaryActionHandler() {
closeModal();
const url = mw.util.getUrl( 'Special:MobileOptions', { returnto: mw.config.get( 'wgPageName' ) } );
window.location.href = url;
}
function init() {
const mountElement = document.getElementById( 'mw-teleport-target' ),
matchMediaDark = window.matchMedia( '(prefers-color-scheme: dark)' ),
colorMode = mw.user.clientPrefs.get( 'skin-theme' ),
description = (
colorMode === 'night' ||
( colorMode === 'auto' && matchMediaDark )
) ?
mw.message( 'skin-minerva-night-mode-launch-description-night' ).escaped() :
mw.message( 'skin-minerva-night-mode-launch-description-day' ).escaped(),
templateElement = makeTemplate( description ),
dialogOverlay = templateElement.querySelector( '.cdx-dialog-backdrop' ),
dialogCloseButton = templateElement.querySelector( '.cdx-dialog__header__close-button' ),
primaryActionButton = templateElement.querySelector( '.cdx-dialog__footer__primary-action' );
dialogOverlay.addEventListener( 'click', ( e ) => {
if ( e.target === dialogOverlay ) {
closeModal();
}
} );
dialogCloseButton.addEventListener( 'click', closeModal );
primaryActionButton.addEventListener( 'click', primaryActionHandler );
mountElement.appendChild( templateElement );
}
module.exports = init;

View file

@ -1,9 +0,0 @@
@import 'mediawiki.skin.variables.less';
.skin-minerva-launch-image {
background: url( dark-mode-banner.svg ) no-repeat 0 0;
background-size: 100%;
width: ~'calc(100% + @{spacing-300})';
margin: -@spacing-100 -@spacing-150 0 -@spacing-150;
aspect-ratio: ( 2 / 1 );
}

View file

@ -444,32 +444,6 @@
"resources/skins.minerva.userpage.styles/userpage.less"
]
},
"skins.minerva.DarkModeLaunchBanner": {
"packageFiles": [
"resources/skins.minerva.DarkModeLaunchBanner/DarkModeLaunchBanner.js"
],
"styles": [
"resources/skins.minerva.DarkModeLaunchBanner/DarkModeLaunchBanner.less"
],
"dependencies": [
"skins.minerva.DarkModeLaunchBanner.codexModules"
],
"messages": [
"skin-minerva-night-mode-launch-title",
"skin-minerva-night-mode-launch-subtitle",
"skin-minerva-night-mode-launch-description-night",
"skin-minerva-night-mode-launch-description-day",
"skin-minerva-night-mode-launch-settings-label",
"skin-minerva-night-mode-launch-close-label"
]
},
"skins.minerva.DarkModeLaunchBanner.codexModules": {
"class": "MediaWiki\\ResourceLoader\\CodexModule",
"codexStyleOnly": true,
"codexComponents": [
"CdxDialog"
]
},
"skins.minerva.personalMenu.icons": {
"class": "MediaWiki\\ResourceLoader\\OOUIIconPackModule",
"selectorWithoutVariant": ".minerva-icon--{name}",