mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-09-29 08:41:11 +13:00
Hopefully this fixes #301
This commit is contained in:
parent
d265619145
commit
479b454307
4 changed files with 26 additions and 6 deletions
|
@ -81,6 +81,10 @@ vAPI.closePopup = function() {
|
|||
window.open('','_self').close();
|
||||
};
|
||||
|
||||
vAPI.resizePopup = function() {
|
||||
// Nothing to do: chromium API takes care to resize the popup
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// A localStorage-like object which should be accessible from the
|
||||
|
|
|
@ -2022,6 +2022,15 @@ vAPI.toolbarButton = {
|
|||
}
|
||||
};
|
||||
|
||||
var onResizeRequested = function() {
|
||||
var body = iframe.contentDocument.body;
|
||||
if ( body.getAttribute('data-resize-popup') !== 'true' ) {
|
||||
return;
|
||||
}
|
||||
body.removeAttribute('data-resize-popup');
|
||||
resizePopupDelayed();
|
||||
};
|
||||
|
||||
var onPopupReady = function() {
|
||||
var win = this.contentWindow;
|
||||
|
||||
|
@ -2033,16 +2042,14 @@ vAPI.toolbarButton = {
|
|||
tbb.onBeforePopupReady.call(this);
|
||||
}
|
||||
|
||||
new win.MutationObserver(resizePopupDelayed).observe(win.document.body, {
|
||||
var mutationObserver = new win.MutationObserver(onResizeRequested);
|
||||
mutationObserver.observe(win.document.body, {
|
||||
attributes: true,
|
||||
characterData: true,
|
||||
subtree: true
|
||||
attributeFilter: [ 'data-resize-popup' ]
|
||||
});
|
||||
|
||||
resizePopupDelayed();
|
||||
};
|
||||
|
||||
iframe.addEventListener('load', onPopupReady, true);
|
||||
iframe.addEventListener('DOMContentLoaded', onPopupReady, true);
|
||||
};
|
||||
})();
|
||||
|
||||
|
|
|
@ -120,6 +120,10 @@ vAPI.closePopup = function() {
|
|||
sendAsyncMessage(location.host + ':closePopup');
|
||||
};
|
||||
|
||||
vAPI.resizePopup = function() {
|
||||
document.body.setAttribute('data-resize-popup', 'true');
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// A localStorage-like object which should be accessible from the
|
||||
|
|
|
@ -288,6 +288,7 @@ function toggleCollapseState(elem) {
|
|||
} else {
|
||||
toggleSpecificCollapseState(elem);
|
||||
}
|
||||
vAPI.resizePopup();
|
||||
}
|
||||
|
||||
function toggleMainCollapseState(uelem) {
|
||||
|
@ -368,6 +369,7 @@ function updateMatrixColors() {
|
|||
cell = cells.nodeAt(i);
|
||||
cell.className = 'matCell ' + getCellClass(cell.hostname, cell.reqType);
|
||||
}
|
||||
vAPI.resizePopup();
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -393,6 +395,7 @@ function updateMatrixBehavior() {
|
|||
}
|
||||
section.toggleClass('collapsible', subdomainRows.filter('.collapsible').length > 0);
|
||||
}
|
||||
vAPI.resizePopup();
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -475,6 +478,7 @@ var endMatrixUpdate = function() {
|
|||
updateMatrixBehavior();
|
||||
matrixList.css('display', '');
|
||||
matrixList.appendTo('.paneContent');
|
||||
vAPI.resizePopup();
|
||||
};
|
||||
|
||||
var createMatrixGroup = function() {
|
||||
|
@ -1363,6 +1367,7 @@ uDom('#matList').on('click', '.g4Meta', function() {
|
|||
.toggleClass('g4Collapsed')
|
||||
.hasClass('g4Collapsed');
|
||||
setUISetting('popupHideBlacklisted', collapsed);
|
||||
vAPI.resizePopup();
|
||||
});
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
Loading…
Reference in a new issue