| LEFT | RIGHT |
| 1 with (safari.extension.globalPage.contentWindow) | 1 (function() |
| 2 { | 2 { |
| 3 this.ext = ext; | 3 // Safari will load the popover once, and then show it everytime the icon is |
| 4 this.TabMap = TabMap; | 4 // clicked. While Chrome loads it everytime you click the icon. So in order to |
| 5 } | 5 // force the same behavior in Safari, we are going to reload the page of the |
| 6 // bubble everytime it is shown. |
| 7 safari.application.addEventListener("popover", function() |
| 8 { |
| 9 document.documentElement.style.display = "none"; |
| 10 document.location.reload(); |
| 11 }, true); |
| 6 | 12 |
| 7 // Safari will load the popover once, and then show it everytime the icon is | 13 // import ext into the javascript context of the popover. This code might fail
, |
| 8 // clicked. While Chrome loads it everytime you click the icon. So in order to | 14 // when the background page isn't ready yet. So it is important to put it belo
w |
| 9 // force the same behavior in Safari, we are going to reload the page of the | 15 // the reloading code above. |
| 10 // bubble everytime it is shown. | 16 var backgroundPage = safari.extension.globalPage.contentWindow; |
| 11 safari.application.addEventListener("popover", function() | 17 window.ext = backgroundPage.ext; |
| 12 { | 18 window.TabMap = backgroundPage.TabMap; |
| 13 document.documentElement.style.display = "none"; | 19 })(); |
| 14 document.location.reload(); | |
| 15 }, true); | |
| LEFT | RIGHT |