mirror of https://github.com/gorhill/uBlock.git
code review for 14709d18cf
This commit is contained in:
parent
b04c76cdc3
commit
e5d5d9eaf6
|
@ -34,34 +34,24 @@ if ( typeof popupFontSize === 'string' && popupFontSize !== 'unset' ) {
|
||||||
document.body.style.setProperty('font-size', popupFontSize);
|
document.body.style.setProperty('font-size', popupFontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the popup is properly sized as soon as possible. It is assume the DOM
|
// https://github.com/gorhill/uBlock/issues/3032
|
||||||
// content is ready at this point, which should be the case given where this
|
|
||||||
// script file is included in the HTML file.
|
|
||||||
|
|
||||||
var dfPaneVisibleStored = vAPI.localStorage.getItem('popupFirewallPane') === 'true';
|
|
||||||
|
|
||||||
// Popup panel can be in one of two modes:
|
// Popup panel can be in one of two modes:
|
||||||
// - not responsive: viewport is expected to adjust to popup panel size
|
// - not responsive: viewport is expected to adjust to popup panel size
|
||||||
// - responsive: popup panel must adjust to viewport size -- this happens when
|
// - responsive: popup panel must adjust to viewport size -- this happens
|
||||||
// the viewport is not resized by the browser to perfectly fits uBO's popup
|
// when the viewport is not resized by the browser to perfectly fits uBO's
|
||||||
// panel.
|
// popup panel.
|
||||||
if ( /[\?&]responsive=1/.test(window.location.search) ) {
|
if (
|
||||||
document.body.classList.add('responsive');
|
vAPI.webextFlavor.soup.has('mobile') ||
|
||||||
}
|
/[\?&]responsive=1/.test(window.location.search)
|
||||||
|
) {
|
||||||
// Mobile device?
|
|
||||||
// https://github.com/gorhill/uBlock/issues/3032
|
|
||||||
// - If at least one of the window's viewport dimension is larger than the
|
|
||||||
// corresponding device's screen dimension, assume uBO's popup panel sits in
|
|
||||||
// its own tab.
|
|
||||||
if ( vAPI.webextFlavor.soup.has('mobile') ) {
|
|
||||||
document.body.classList.add('responsive');
|
document.body.classList.add('responsive');
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/chrisaljoudi/uBlock/issues/996
|
// https://github.com/chrisaljoudi/uBlock/issues/996
|
||||||
// Experimental: mitigate glitchy popup UI: immediately set the firewall pane
|
// Experimental: mitigate glitchy popup UI: immediately set the firewall
|
||||||
// visibility to its last known state. By default the pane is hidden.
|
// pane visibility to its last known state. By default the pane is hidden.
|
||||||
// Will remove if it makes no difference.
|
let dfPaneVisibleStored =
|
||||||
|
vAPI.localStorage.getItem('popupFirewallPane') === 'true';
|
||||||
if ( dfPaneVisibleStored ) {
|
if ( dfPaneVisibleStored ) {
|
||||||
document.getElementById('panes').classList.add('dfEnabled');
|
document.getElementById('panes').classList.add('dfEnabled');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue