1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-14 23:12:28 +02:00

Use modern popup panel in logger

The logger was still embedding the now deprecated popup
panel.
This commit is contained in:
Raymond Hill 2020-08-21 08:23:36 -04:00
parent 8275690e93
commit 394a61570c
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 18 additions and 16 deletions

View File

@ -448,8 +448,9 @@ body.colorBlind #netFilteringDialog > .panes > .details > div[data-status="2"] b
background: white;
border: 1px solid gray;
bottom: 0;
box-sizing: border-box;
display: none;
max-height: 70vh;
min-width: 360px;
overflow: hidden;
position: fixed;
right: 0;

View File

@ -2323,7 +2323,7 @@ const popupManager = (( ) => {
const setTabId = function(tabId) {
if ( popup === null ) { return; }
popup.setAttribute('src', 'popup.html?tabId=' + tabId);
popup.setAttribute('src', 'popup-fenix.html?portrait=1&tabId=' + tabId);
};
const onTabIdChanged = function() {

View File

@ -1206,18 +1206,13 @@ const getPopupData = async function(tabId) {
/******************************************************************************/
// Popup DOM is assumed to be loaded at this point -- because this script
// is loaded after everything else..
// is loaded after everything else.
{
// If there's no tab id specified in the query string,
// it will default to current tab.
let tabId = null;
// Extract the tab id of the page this popup is for
const matches = self.location.search.match(/[\?&]tabId=([^&]+)/);
if ( matches && matches.length === 2 ) {
tabId = parseInt(matches[1], 10) || 0;
}
// Extract the tab id of the page for this popup. If there's no tab id
// specified in the query string, it will default to current tab.
const selfURL = new URL(self.location.href);
const tabId = parseInt(selfURL.searchParams.get('tabId'), 10) || null;
const nextFrames = async n => {
for ( let i = 0; i < n; i++ ) {
@ -1240,16 +1235,22 @@ const getPopupData = async function(tabId) {
// when testing against viewport width.
const checkViewport = async function() {
const root = document.querySelector(':root');
if ( root.classList.contains('desktop') ) {
if (
root.classList.contains('mobile') ||
selfURL.searchParams.get('portrait')
) {
root.classList.add('portrait');
} else if ( root.classList.contains('desktop') ) {
await nextFrames(4);
const main = document.getElementById('main');
const firewall = document.getElementById('firewall');
const minWidth = (main.offsetWidth + firewall.offsetWidth) / 1.1;
if ( window.innerWidth < minWidth ) {
if (
selfURL.searchParams.get('portrait') ||
window.innerWidth < minWidth
) {
root.classList.add('portrait');
}
} else if ( root.classList.contains('mobile') ) {
root.classList.add('portrait');
}
if ( root.classList.contains('portrait') ) {
const panes = document.getElementById('panes');