1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00
Raymond Hill 2019-04-13 08:10:55 -04:00
parent d2cb0f17ea
commit 813d96175d
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -29,7 +29,7 @@
/******************************************************************************/ /******************************************************************************/
let resizeFrame = function() { const resizeFrame = function() {
let navRect = document.getElementById('dashboard-nav').getBoundingClientRect(); let navRect = document.getElementById('dashboard-nav').getBoundingClientRect();
let viewRect = document.documentElement.getBoundingClientRect(); let viewRect = document.documentElement.getBoundingClientRect();
document.getElementById('iframe').style.setProperty( document.getElementById('iframe').style.setProperty(
@ -38,7 +38,7 @@ let resizeFrame = function() {
); );
}; };
let loadDashboardPanel = function() { const loadDashboardPanel = function() {
let pane = window.location.hash.slice(1); let pane = window.location.hash.slice(1);
if ( pane === '' ) { if ( pane === '' ) {
pane = vAPI.localStorage.getItem('dashboardLastVisitedPane'); pane = vAPI.localStorage.getItem('dashboardLastVisitedPane');
@ -55,7 +55,7 @@ let loadDashboardPanel = function() {
tabButton.toggleClass('selected', true); tabButton.toggleClass('selected', true);
}; };
let onTabClickHandler = function(e) { const onTabClickHandler = function(e) {
let url = window.location.href, let url = window.location.href,
pos = url.indexOf('#'); pos = url.indexOf('#');
if ( pos !== -1 ) { if ( pos !== -1 ) {
@ -75,9 +75,19 @@ vAPI.messaging.send('dashboard', { what: 'canUpdateShortcuts' }, response => {
}); });
resizeFrame(); resizeFrame();
loadDashboardPanel();
window.addEventListener('resize', resizeFrame); window.addEventListener('resize', resizeFrame);
uDom('.tabButton').on('click', onTabClickHandler); uDom('.tabButton').on('click', onTabClickHandler);
loadDashboardPanel();
// https://github.com/uBlockOrigin/uBlock-issues/issues/468
// See https://github.com/WICG/page-lifecycle
document.addEventListener('freeze', ( ) => {
uDom('.tabButton').off('click', onTabClickHandler);
});
document.addEventListener('resume', ( ) => {
uDom('.tabButton').on('click', onTabClickHandler);
});
/******************************************************************************/ /******************************************************************************/