|
@ -1970,27 +1970,40 @@ vAPI.toolbarButton = { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var scrollBarWidth = 0; |
|
|
var scrollBarWidth = 0; |
|
|
|
|
|
var popupCommittedWidth = 0; |
|
|
|
|
|
var popupCommittedHeight = 0; |
|
|
var resizeTimer = null; |
|
|
var resizeTimer = null; |
|
|
|
|
|
|
|
|
var resizePopupDelayed = function(attempts) { |
|
|
var resizePopupDelayed = function(attempts) { |
|
|
if ( resizeTimer !== null ) { |
|
|
if ( resizeTimer !== null ) { |
|
|
return; |
|
|
|
|
|
|
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Sanity check
|
|
|
// Sanity check
|
|
|
attempts = (attempts || 0) + 1; |
|
|
attempts = (attempts || 0) + 1; |
|
|
if ( attempts > 1/*000*/ ) { |
|
|
if ( attempts > 1/*000*/ ) { |
|
|
console.error('uMatrix> resizePopupDelayed: giving up after too many attempts'); |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
//console.error('uMatrix> resizePopupDelayed: giving up after too many attempts');
|
|
|
|
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
resizeTimer = vAPI.setTimeout(resizePopup, 10, attempts); |
|
|
resizeTimer = vAPI.setTimeout(resizePopup, 10, attempts); |
|
|
|
|
|
return true; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var resizePopup = function(attempts) { |
|
|
var resizePopup = function(attempts) { |
|
|
resizeTimer = null; |
|
|
resizeTimer = null; |
|
|
var body = iframe.contentDocument.body; |
|
|
|
|
|
|
|
|
|
|
|
panel.parentNode.style.maxWidth = 'none'; |
|
|
panel.parentNode.style.maxWidth = 'none'; |
|
|
|
|
|
var body = iframe.contentDocument.body; |
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/gorhill/uMatrix/issues/301
|
|
|
|
|
|
// Don't resize if committed size did not change.
|
|
|
|
|
|
if ( |
|
|
|
|
|
popupCommittedWidth === body.clientWidth && |
|
|
|
|
|
popupCommittedHeight === body.clientHeight |
|
|
|
|
|
) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// We set a limit for height
|
|
|
// We set a limit for height
|
|
|
var height = Math.min(body.clientHeight, 600); |
|
|
var height = Math.min(body.clientHeight, 600); |
|
@ -2017,9 +2030,15 @@ vAPI.toolbarButton = { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ( iframe.clientHeight !== height || panel.clientWidth !== width ) { |
|
|
if ( iframe.clientHeight !== height || panel.clientWidth !== width ) { |
|
|
resizePopupDelayed(attempts); |
|
|
|
|
|
|
|
|
if ( resizePopupDelayed(attempts) ) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
// resizePopupDelayed won't be called again, so commit
|
|
|
|
|
|
// dimentsions.
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
popupCommittedWidth = body.clientWidth; |
|
|
|
|
|
popupCommittedHeight = body.clientHeight; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var onResizeRequested = function() { |
|
|
var onResizeRequested = function() { |
|
|