mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-09-30 00:56:32 +13:00
Set default dimensions for Safari's popup
This commit is contained in:
parent
2216b7f32e
commit
25caa9241c
1 changed files with 8 additions and 5 deletions
|
@ -49,7 +49,10 @@ if (window.chrome) {
|
|||
|
||||
// update popover size to its content
|
||||
if (safari.self.identifier === 'popover' && safari.self) {
|
||||
(function() {
|
||||
window.addEventListener('load', function() {
|
||||
// Initial dimensions are set in Info.plist
|
||||
var pWidth = safari.self.width;
|
||||
var pHeight = safari.self.height;
|
||||
var upadteTimer = null;
|
||||
var resizePopover = function() {
|
||||
if (upadteTimer) {
|
||||
|
@ -57,10 +60,10 @@ if (window.chrome) {
|
|||
}
|
||||
|
||||
upadteTimer = setTimeout(function() {
|
||||
safari.self.width = document.body.clientWidth;
|
||||
safari.self.height = document.body.clientHeight;
|
||||
safari.self.width = Math.max(pWidth, document.body.clientWidth);
|
||||
safari.self.height = Math.max(pHeight, document.body.clientHeight);
|
||||
upadteTimer = null;
|
||||
}, 50);
|
||||
}, 20);
|
||||
};
|
||||
|
||||
var mutObs = window.MutationObserver || window.WebkitMutationObserver;
|
||||
|
@ -77,7 +80,7 @@ if (window.chrome) {
|
|||
// Safari doesn't support DOMAttrModified
|
||||
document.addEventListener('DOMSubtreeModified', resizePopover);
|
||||
}
|
||||
})();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue