mirror of https://github.com/gorhill/uBlock.git
Set default dimensions for Safari's popup
This commit is contained in:
parent
ab12c8d7d9
commit
2e787d8541
|
@ -28,11 +28,11 @@
|
||||||
<key>Filename</key>
|
<key>Filename</key>
|
||||||
<string>popup.html</string>
|
<string>popup.html</string>
|
||||||
<key>Height</key>
|
<key>Height</key>
|
||||||
<real>1</real>
|
<real>310</real>
|
||||||
<key>Identifier</key>
|
<key>Identifier</key>
|
||||||
<string>popover</string>
|
<string>popover</string>
|
||||||
<key>Width</key>
|
<key>Width</key>
|
||||||
<real>1</real>
|
<real>180</real>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>Toolbar Items</key>
|
<key>Toolbar Items</key>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.7.0.7</string>
|
<string>0.7.0.7</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1452035</string>
|
<string>1452564</string>
|
||||||
<key>Chrome</key>
|
<key>Chrome</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>Database Quota</key>
|
<key>Database Quota</key>
|
||||||
|
@ -28,11 +28,11 @@
|
||||||
<key>Filename</key>
|
<key>Filename</key>
|
||||||
<string>popup.html</string>
|
<string>popup.html</string>
|
||||||
<key>Height</key>
|
<key>Height</key>
|
||||||
<real>1</real>
|
<real>310</real>
|
||||||
<key>Identifier</key>
|
<key>Identifier</key>
|
||||||
<string>popover</string>
|
<string>popover</string>
|
||||||
<key>Width</key>
|
<key>Width</key>
|
||||||
<real>1</real>
|
<real>180</real>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>Toolbar Items</key>
|
<key>Toolbar Items</key>
|
||||||
|
|
|
@ -49,7 +49,10 @@ if (window.chrome) {
|
||||||
|
|
||||||
// update popover size to its content
|
// update popover size to its content
|
||||||
if (safari.self.identifier === 'popover' && safari.self) {
|
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 upadteTimer = null;
|
||||||
var resizePopover = function() {
|
var resizePopover = function() {
|
||||||
if (upadteTimer) {
|
if (upadteTimer) {
|
||||||
|
@ -57,10 +60,10 @@ if (window.chrome) {
|
||||||
}
|
}
|
||||||
|
|
||||||
upadteTimer = setTimeout(function() {
|
upadteTimer = setTimeout(function() {
|
||||||
safari.self.width = document.body.clientWidth;
|
safari.self.width = Math.max(pWidth, document.body.clientWidth);
|
||||||
safari.self.height = document.body.clientHeight;
|
safari.self.height = Math.max(pHeight, document.body.clientHeight);
|
||||||
upadteTimer = null;
|
upadteTimer = null;
|
||||||
}, 50);
|
}, 20);
|
||||||
};
|
};
|
||||||
|
|
||||||
var mutObs = window.MutationObserver || window.WebkitMutationObserver;
|
var mutObs = window.MutationObserver || window.WebkitMutationObserver;
|
||||||
|
@ -77,7 +80,7 @@ if (window.chrome) {
|
||||||
// Safari doesn't support DOMAttrModified
|
// Safari doesn't support DOMAttrModified
|
||||||
document.addEventListener('DOMSubtreeModified', resizePopover);
|
document.addEventListener('DOMSubtreeModified', resizePopover);
|
||||||
}
|
}
|
||||||
})();
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue