OLD | NEW |
1 (function() | 1 (function() |
2 { | 2 { |
3 // Safari doesn't adjust the size of the popover automatically to the size | 3 // Safari doesn't adjust the size of the popover automatically to the size |
4 // of its content, like when the ad counter is expanded/collapsed. So we add | 4 // of its content, like when the ad counter is expanded/collapsed. So we add |
5 // event listeners to do so. | 5 // event listeners to do so. |
6 var mayResize = true; | 6 var mayResize = true; |
| 7 var resizingScheduled = false; |
7 | 8 |
8 var updateSize = function() | 9 var updateSize = function() |
9 { | 10 { |
10 if (mayResize) | 11 if (mayResize && !resizingScheduled) |
11 { | 12 { |
12 safari.self.width = document.body.offsetWidth; | 13 setTimeout(function() |
13 safari.self.height = document.body.offsetHeight; | 14 { |
| 15 safari.self.width = document.body.offsetWidth; |
| 16 safari.self.height = document.body.offsetHeight; |
| 17 |
| 18 resizingScheduled = false; |
| 19 }, 0); |
| 20 |
| 21 resizingScheduled = true; |
14 } | 22 } |
15 }; | 23 }; |
16 | 24 |
17 window.addEventListener("load", function() | 25 window.addEventListener("load", function() |
18 { | 26 { |
19 updateSize(); | 27 updateSize(); |
20 | 28 |
21 var MutationObserver = window.MutationObserver || window.WebKitMutationObser
ver; | 29 var MutationObserver = window.MutationObserver || window.WebKitMutationObser
ver; |
22 if (MutationObserver) | 30 if (MutationObserver) |
23 { | 31 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 67 |
60 window.ext = { | 68 window.ext = { |
61 __proto__: backgroundPage.ext, | 69 __proto__: backgroundPage.ext, |
62 closePopup: function() | 70 closePopup: function() |
63 { | 71 { |
64 safari.self.hide(); | 72 safari.self.hide(); |
65 } | 73 } |
66 }; | 74 }; |
67 window.TabMap = backgroundPage.TabMap; | 75 window.TabMap = backgroundPage.TabMap; |
68 })(); | 76 })(); |
OLD | NEW |