mirror of https://github.com/gorhill/uBlock.git
This commit is contained in:
parent
d2cb0f17ea
commit
813d96175d
|
@ -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);
|
||||||
|
});
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue