mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-02 00:42:45 +01:00
element-picker: Declare we support both light and dark color-schemes. (#3872)
This fixes https://github.com/uBlockOrigin/uBlock-issues/issues/2240 and should get the desired behavior regardless of browser. Delay showing the iframe until load to prevent flashing a white background on the initial about:blank.
This commit is contained in:
parent
453fb1eb5e
commit
4044aa182a
@ -902,9 +902,6 @@ const onMessage = function(request, sender, callback) {
|
|||||||
pickerURL: vAPI.getURL(
|
pickerURL: vAPI.getURL(
|
||||||
`/web_accessible_resources/epicker-ui.html?secret=${vAPI.warSecret()}`
|
`/web_accessible_resources/epicker-ui.html?secret=${vAPI.warSecret()}`
|
||||||
),
|
),
|
||||||
needColorScheme:
|
|
||||||
vAPI.webextFlavor.soup.has('firefox') === false ||
|
|
||||||
vAPI.webextFlavor.major < 106,
|
|
||||||
});
|
});
|
||||||
µb.epickerArgs.target = '';
|
µb.epickerArgs.target = '';
|
||||||
});
|
});
|
||||||
|
@ -1278,22 +1278,21 @@ const pickerCSSStyle = [
|
|||||||
'position: fixed',
|
'position: fixed',
|
||||||
'top: 0',
|
'top: 0',
|
||||||
'transform: none',
|
'transform: none',
|
||||||
'visibility: visible',
|
'visibility: hidden',
|
||||||
'width: 100%',
|
'width: 100%',
|
||||||
'z-index: 2147483647',
|
'z-index: 2147483647',
|
||||||
|
'color-scheme: light dark',
|
||||||
|
''
|
||||||
];
|
];
|
||||||
|
|
||||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/1408
|
|
||||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/2240
|
|
||||||
if ( pickerBootArgs.needColorScheme ) {
|
|
||||||
pickerCSSStyle.push('color-scheme: light');
|
|
||||||
}
|
|
||||||
pickerCSSStyle.push(''); // Important
|
|
||||||
|
|
||||||
const pickerCSS = `
|
const pickerCSS = `
|
||||||
:root > [${vAPI.sessionId}] {
|
:root > [${vAPI.sessionId}] {
|
||||||
${pickerCSSStyle.join(' !important;')}
|
${pickerCSSStyle.join(' !important;')}
|
||||||
}
|
}
|
||||||
|
:root > [${vAPI.sessionId}-loaded] {
|
||||||
|
visibility: visible !important;
|
||||||
|
}
|
||||||
:root [${vAPI.sessionId}-clickblind] {
|
:root [${vAPI.sessionId}-clickblind] {
|
||||||
pointer-events: none !important;
|
pointer-events: none !important;
|
||||||
}
|
}
|
||||||
@ -1316,7 +1315,10 @@ vAPI.MessagingConnection.addListener(onConnectionMessage);
|
|||||||
if ( pickerBootArgs.zap ) {
|
if ( pickerBootArgs.zap ) {
|
||||||
url.searchParams.set('zap', '1');
|
url.searchParams.set('zap', '1');
|
||||||
}
|
}
|
||||||
pickerRoot.contentWindow.location = url.href;
|
pickerRoot.addEventListener("load", function() {
|
||||||
|
pickerRoot.setAttribute(`${vAPI.sessionId}-loaded`, "");
|
||||||
|
});
|
||||||
|
pickerRoot.src = url.href;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<meta name="color-scheme" content="light dark">
|
||||||
<title>uBlock Origin Element Picker</title>
|
<title>uBlock Origin Element Picker</title>
|
||||||
<link rel="stylesheet" href="../lib/codemirror/lib/codemirror.css">
|
<link rel="stylesheet" href="../lib/codemirror/lib/codemirror.css">
|
||||||
<link rel="stylesheet" href="../lib/codemirror/addon/hint/show-hint.css">
|
<link rel="stylesheet" href="../lib/codemirror/addon/hint/show-hint.css">
|
||||||
|
Loading…
Reference in New Issue
Block a user