Cleanup: Remove dark mode banner code

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

Change-Id: I9410171e1025e428b48e5dd12c7dc1161cc800f6
This commit is contained in:
Jon Robson 2024-09-06 09:32:29 -07:00 committed by Jdlrobson
parent 1c3ee74a7a
commit ea8660bb60
6 changed files with 3 additions and 119 deletions

View file

@ -93,9 +93,5 @@
"vector-night-mode-issue-reporting-link-notification": "Report received!", "vector-night-mode-issue-reporting-link-notification": "Report received!",
"vector-night-mode-issue-reporting-preload-title": "$1 dark mode error", "vector-night-mode-issue-reporting-preload-title": "$1 dark mode error",
"vector-night-mode-issue-reporting-preload-content": "<!--\nInstructions\nPlease describe how the dark mode colors are making Wikipedia difficult to read.\nPlease include the section of the article where you found the issue.\n-->\n'''Issue Description'''", "vector-night-mode-issue-reporting-preload-content": "<!--\nInstructions\nPlease describe how the dark mode colors are making Wikipedia difficult to read.\nPlease include the section of the article where you found the issue.\n-->\n'''Issue Description'''",
"vector-night-mode-beta-tag": "(beta)", "vector-night-mode-beta-tag": "(beta)"
"vector-night-mode-launch-title": "Wikipedia's new colors",
"vector-night-mode-launch-subtitle": "Try dark mode today",
"vector-night-mode-launch-description-day": "Wikipedia is now available in dark mode. Try it out by clicking \"Dark\" in the \"Color\" section of the Appearance menu on the right.",
"vector-night-mode-launch-close-label": "Close"
} }

View file

@ -110,9 +110,5 @@
"vector-night-mode-issue-reporting-link-notification": "Notification that shows after clicking link.", "vector-night-mode-issue-reporting-link-notification": "Notification that shows after clicking link.",
"vector-night-mode-issue-reporting-preload-title": "The prefilled title of the form used to submit dark mode errors. $1 is a link to the current page, formatted as a wikitext external link, for example \"<nowiki>[https://en.wikipedia.org/wiki/Songhai_Empire Songhai Empire]</nowiki>\".", "vector-night-mode-issue-reporting-preload-title": "The prefilled title of the form used to submit dark mode errors. $1 is a link to the current page, formatted as a wikitext external link, for example \"<nowiki>[https://en.wikipedia.org/wiki/Songhai_Empire Songhai Empire]</nowiki>\".",
"vector-night-mode-issue-reporting-preload-content": "The prefilled content of the form used to submit dark mode errors", "vector-night-mode-issue-reporting-preload-content": "The prefilled content of the form used to submit dark mode errors",
"vector-night-mode-beta-tag": "A tag appearing in the Appearance menu informing users that this feature is in beta.", "vector-night-mode-beta-tag": "A tag appearing in the Appearance menu informing users that this feature is in beta."
"vector-night-mode-launch-title": "Title of a modal that appears informing users of the new dark mode feature",
"vector-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}}.",
"vector-night-mode-launch-description-day": "Text in the dark mode launch modal describing the dark mode feature, when dark mode is disabled.\n\n'''In right to left languages, translate \"on the right\" as \"on the left\".'''\n\n* \"Dark\" must be consistent with {{msg-mw|skin-theme-night-label}}\n* \"Color\" must be consistent with {{msg-mw|skin-theme-name}}\n* \"Appearance\" must be consistent with {{msg-mw|vector-appearance-label}}",
"vector-night-mode-launch-close-label": "Label for button to close the dark-mode launch modal"
} }

View file

@ -26,8 +26,7 @@ module.exports = {
// An array of regexp pattern strings used to skip coverage collection // An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: [ coveragePathIgnorePatterns: [
'/node_modules/', '/node_modules/'
'DarkModeLaunchBanner.js'
], ],
// An object that configures minimum threshold enforcement for coverage results // An object that configures minimum threshold enforcement for coverage results

View file

@ -1,74 +0,0 @@
const makeTemplate = function () {
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( 'vector-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( 'vector-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-vector-launch-image"></div>
<h3>
${ mw.message( 'vector-night-mode-launch-subtitle' ).escaped() }
</h3>
<p>
${ mw.message( 'vector-night-mode-launch-description-day' ).escaped() }
</p>
</div>
<footer class="cdx-dialog__footer cdx-dialog__footer--default"></footer>
</div>
<div tabindex="0"></div>
</div>`;
const templateElement = document.createElement( 'div' );
templateElement.id = 'vector-dark-mode-launch-banner';
templateElement.innerHTML = templateString;
return templateElement;
};
function closeModal() {
const modal = document.getElementById( 'vector-dark-mode-launch-banner' );
if ( modal ) {
modal.remove();
}
}
function init() {
const mountElement = document.getElementById( 'mw-teleport-target' ),
isNotSkinVector2022 = mw.config.get( 'skin' ) !== 'vector-2022',
templateElement = makeTemplate(),
dialogOverlay = templateElement.querySelector( '.cdx-dialog-backdrop' ),
dialogCloseButton = templateElement.querySelector( '.cdx-dialog__header__close-button' );
// since this can module can run via centralNotice, ensuring the currect skin is Vector 2022
if ( isNotSkinVector2022 ) {
return;
}
if ( dialogOverlay ) {
dialogOverlay.addEventListener( 'click', ( e ) => {
if ( e.target === dialogOverlay ) {
closeModal();
}
} );
}
if ( dialogCloseButton ) {
dialogCloseButton.addEventListener( 'click', closeModal );
}
if ( mountElement ) {
mountElement.appendChild( templateElement );
}
}
module.exports = init;

View file

@ -1,9 +0,0 @@
@import 'mediawiki.skin.variables.less';
.skin-vector-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

@ -483,30 +483,6 @@
"vector-night-mode-gadget-warning" "vector-night-mode-gadget-warning"
] ]
}, },
"skins.vector.DarkModeLaunchBanner": {
"packageFiles": [
"resources/skins.vector.DarkModeLaunchBanner/DarkModeLaunchBanner.js"
],
"styles": [
"resources/skins.vector.DarkModeLaunchBanner/DarkModeLaunchBanner.less"
],
"dependencies": [
"skins.vector.DarkModeLaunchBanner.codexModules"
],
"messages": [
"vector-night-mode-launch-title",
"vector-night-mode-launch-subtitle",
"vector-night-mode-launch-description-day",
"vector-night-mode-launch-close-label"
]
},
"skins.vector.DarkModeLaunchBanner.codexModules": {
"class": "MediaWiki\\ResourceLoader\\CodexModule",
"codexStyleOnly": true,
"codexComponents": [
"CdxDialog"
]
},
"skins.vector.legacy.js": { "skins.vector.legacy.js": {
"packageFiles": [ "packageFiles": [
"resources/skins.vector.legacy.js/skin-legacy.js", "resources/skins.vector.legacy.js/skin-legacy.js",