Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: safari/ext/popup.js

Issue 5768552254537728: Fixed: Popup in Safari won't open after closing it programmatically (Closed)
Left Patch Set: Created Jan. 16, 2014, 11:18 a.m.
Right Patch Set: Created Jan. 16, 2014, 3:26 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « popup.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 (function() 1 (function()
2 { 2 {
3 // Safari will load the popover once, and then show it everytime the icon is 3 // Safari will load the popover once, and then show it everytime the icon is
4 // clicked. While Chrome loads it everytime you click the icon. So in order to 4 // clicked. While Chrome loads it everytime you click the icon. So in order to
5 // force the same behavior in Safari, we are going to reload the page of the 5 // force the same behavior in Safari, we are going to reload the page of the
6 // bubble everytime it is shown. 6 // bubble everytime it is shown.
7 safari.application.addEventListener("popover", function() 7 safari.application.addEventListener("popover", function()
8 { 8 {
9 document.documentElement.style.display = "none"; 9 document.documentElement.style.display = "none";
10 document.location.reload(); 10 document.location.reload();
11 }, true); 11 }, true);
12 12
13 // 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 ,
14 // when the background page isn't ready yet. So it is important to put it belo w 14 // when the background page isn't ready yet. So it is important to put it belo w
15 // the reloading code above. 15 // the reloading code above.
16 var backgroundPage = safari.extension.globalPage.contentWindow; 16 var backgroundPage = safari.extension.globalPage.contentWindow;
17 window.ext = backgroundPage.ext; 17 window.ext = {
18 __proto__: backgroundPage.ext,
19 closePopup: function()
20 {
21 safari.self.hide();
22 }
23 };
18 window.TabMap = backgroundPage.TabMap; 24 window.TabMap = backgroundPage.TabMap;
19
20 window.closePopup = function()
Sebastian Noack 2014/01/16 11:28:11 This should go into the ext namespace. However sin
Thomas Greiner 2014/01/16 15:17:48 Done.
21 {
22 safari.self.hide();
23 }
24 })(); 25 })();
LEFTRIGHT
« popup.js ('k') | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld