Skip to content

Commit

Permalink
Remove popup borders check
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderby committed Sep 24, 2023
1 parent 1e15b5a commit 4b31c31
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 55 deletions.
4 changes: 1 addition & 3 deletions src/ui/popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {m} from 'malevic';
import {sync} from 'malevic/dom';
import Connector from '../connect/connector';
import Body from './components/body';
import {popupHasBuiltInHorizontalBorders, popupHasBuiltInBorders, fixNotClosingPopupOnNavigation} from './utils/issues';
import {fixNotClosingPopupOnNavigation} from './utils/issues';
import type {ExtensionData, ExtensionActions, DebugMessageBGtoCS, DebugMessageBGtoUI} from '../../definitions';
import {isMobile, isFirefox} from '../../utils/platform';
import {DebugMessageTypeBGtoUI} from '../../utils/message';
Expand Down Expand Up @@ -45,8 +45,6 @@ addEventListener('load', start, {passive: true});

document.documentElement.classList.toggle('mobile', isMobile);
document.documentElement.classList.toggle('firefox', isFirefox);
document.documentElement.classList.toggle('built-in-borders', popupHasBuiltInBorders());
document.documentElement.classList.toggle('built-in-horizontal-borders', popupHasBuiltInHorizontalBorders());

if (isFirefox) {
fixNotClosingPopupOnNavigation();
Expand Down
25 changes: 0 additions & 25 deletions src/ui/popup/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -150,29 +150,4 @@ body {
width: calc(100% - 4px);
}

.built-in-horizontal-borders {
body {
border-bottom: none;
border-top: none;
}

.overlay {
height: 100%;
top: 0;
}
}

.built-in-borders {
body {
border: none;
}

.overlay {
height: 100%;
left: 0;
top: 0;
width: 100%;
}
}

@import "./body/style";
27 changes: 0 additions & 27 deletions src/ui/popup/utils/issues.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,4 @@
import {compareChromeVersions, chromiumVersion, isWindows, isOpera, isYaBrowser, isVivaldi, isEdge, isMacOS} from '../../../utils/platform';

declare const __THUNDERBIRD__: boolean;
declare const __CHROMIUM_MV3__: boolean;

export function popupHasBuiltInBorders(): boolean {
return !__CHROMIUM_MV3__ && Boolean(
chromiumVersion &&
!isVivaldi &&
!isYaBrowser &&
!isOpera &&
isWindows &&
compareChromeVersions(chromiumVersion, '62.0.3167.0') < 0
);
}

export function popupHasBuiltInHorizontalBorders(): boolean {
return !__CHROMIUM_MV3__ && Boolean(
chromiumVersion &&
!isVivaldi &&
!isYaBrowser &&
!isEdge &&
!isOpera && (
(isWindows && compareChromeVersions(chromiumVersion, '62.0.3167.0') >= 0) && compareChromeVersions(chromiumVersion, '74.0.0.0') < 0 ||
(isMacOS && compareChromeVersions(chromiumVersion, '67.0.3373.0') >= 0 && compareChromeVersions(chromiumVersion, '73.0.3661.0') < 0)
)
);
}

export function fixNotClosingPopupOnNavigation(): void {
// This event listener must not be passive since it calls e.preventDefault()
Expand Down

0 comments on commit 4b31c31

Please sign in to comment.