Index: safari/ext/popup.js |
=================================================================== |
--- a/safari/ext/popup.js |
+++ b/safari/ext/popup.js |
@@ -10,6 +10,30 @@ |
document.location.reload(); |
}, true); |
+ |
+ // Safari doesn't adjust the size of the popover automatically to the size |
+ // of its content, like when the ad counter is expanded/collapsed. So we add |
+ // event listeners to do so. |
+ var updateSize = function() |
+ { |
+ safari.self.width = document.body.offsetWidth; |
+ safari.self.height = document.body.offsetHeight; |
+ }; |
+ |
+ window.addEventListener("load", function() |
+ { |
+ updateSize(); |
+ |
+ if ("WebKitMutationObserver" in window) |
Wladimir Palant
2014/01/16 07:55:59
We should go for the standardized name first, futu
Sebastian Noack
2014/01/16 11:00:31
Done.
|
+ new WebKitMutationObserver(updateSize).observe(document, { |
+ childList: true, attributes: true, |
+ characterData: true, subtree: true |
+ }); |
+ else |
+ document.addEventListener("DOMSubtreeModified", updateSize); |
+ }); |
+ |
+ |
// import ext into the javascript context of the popover. This code might fail, |
// when the background page isn't ready yet. So it is important to put it below |
// the reloading code above. |