1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-24 11:22:44 +01:00

code review for 14709d18cf

This commit is contained in:
Raymond Hill 2018-05-05 06:28:16 -04:00
parent b04c76cdc3
commit e5d5d9eaf6
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -34,34 +34,24 @@ if ( typeof popupFontSize === 'string' && popupFontSize !== 'unset' ) {
document.body.style.setProperty('font-size', popupFontSize);
}
// Ensure the popup is properly sized as soon as possible. It is assume the DOM
// 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';
// https://github.com/gorhill/uBlock/issues/3032
// Popup panel can be in one of two modes:
// - not responsive: viewport is expected to adjust to popup panel size
// - responsive: popup panel must adjust to viewport size -- this happens when
// the viewport is not resized by the browser to perfectly fits uBO's popup
// panel.
if ( /[\?&]responsive=1/.test(window.location.search) ) {
document.body.classList.add('responsive');
}
// 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') ) {
// - responsive: popup panel must adjust to viewport size -- this happens
// when the viewport is not resized by the browser to perfectly fits uBO's
// popup panel.
if (
vAPI.webextFlavor.soup.has('mobile') ||
/[\?&]responsive=1/.test(window.location.search)
) {
document.body.classList.add('responsive');
}
// https://github.com/chrisaljoudi/uBlock/issues/996
// Experimental: mitigate glitchy popup UI: immediately set the firewall pane
// visibility to its last known state. By default the pane is hidden.
// Will remove if it makes no difference.
// Experimental: mitigate glitchy popup UI: immediately set the firewall
// pane visibility to its last known state. By default the pane is hidden.
let dfPaneVisibleStored =
vAPI.localStorage.getItem('popupFirewallPane') === 'true';
if ( dfPaneVisibleStored ) {
document.getElementById('panes').classList.add('dfEnabled');
}