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

Unified Diff: safari/ext/popup.js

Issue 5220277533278208: Made the bubble use the ext object from the background page instead of including ext/background.js (Closed)
Patch Set: Don't use with statement Created Jan. 15, 2014, 4:53 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome/ext/popup.js ('K') | « safari/ext/background.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: safari/ext/popup.js
===================================================================
new file mode 100644
--- /dev/null
+++ b/safari/ext/popup.js
@@ -0,0 +1,19 @@
+(function()
+{
+ // Safari will load the popover once, and then show it everytime the icon is
+ // clicked. While Chrome loads it everytime you click the icon. So in order to
+ // force the same behavior in Safari, we are going to reload the page of the
+ // bubble everytime it is shown.
+ safari.application.addEventListener("popover", function()
+ {
+ document.documentElement.style.display = "none";
+ document.location.reload();
+ }, true);
+
+ // 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.
+ var backgroundPage = safari.extension.globalPage.contentWindow;
+ ext = backgroundPage.ext;
+ TabMap = backgroundPage.TabMap;
+})();
« chrome/ext/popup.js ('K') | « safari/ext/background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld