Skip to content

Commit

Permalink
fix: stop popup being inverted in Wikipedia's experimental dark mode
Browse files Browse the repository at this point in the history
Fixes #1590.
  • Loading branch information
birtles committed Feb 5, 2024
1 parent 20a4cbd commit cd8197a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ app.

## [Unreleased]

- Stopped popup being inverted when Wikipedia's experimental dark mode is
enabled
([#1590](https://github.com/birchill/10ten-ja-reader/issues/1590)).

## [1.17.1] - 2024-01-04

- (Chrome, Edge) Fixed support for Google Docs on chromium browsers
Expand Down
11 changes: 10 additions & 1 deletion src/content/popup/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,23 @@ export function renderPopup(
}

function getDefaultContainer(): HTMLElement {
return getOrCreateEmptyContainer({
const defaultContainer = getOrCreateEmptyContainer({
id: 'tenten-ja-window',
styles: popupStyles.toString(),
// Make sure the popup container appears _before_ the puck container so that
// we can assign them the same z-index and have the puck appear on top.
before: LookupPuck.id,
legacyIds: ['rikaichamp-window'],
});

// Make sure our popup doesn't get inverted by Wikipedia's (experimental) dark
// mode.
if (document.location.hostname.endsWith('wikipedia.org')) {
defaultContainer.classList.add('mw-no-invert');
defaultContainer.style.filter = 'inherit';
}

return defaultContainer;
}

function resetContainer({
Expand Down

0 comments on commit cd8197a

Please sign in to comment.