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