Zak Johnson avatar Zak Johnson committed 97a063c

Handle Google international domains; release 1.2

Comments (0)

Files changed (3)

 	<key>CFBundleDisplayName</key>
 	<string>Google Reader Background Tabs</string>
 	<key>CFBundleIdentifier</key>
-	<string>cx.nox.googlereaderbackgroundtabs</string>
+	<string>cx.nox.safari.googlereaderbackgroundtabs</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.1</string>
+	<string>1.2</string>
 	<key>CFBundleVersion</key>
-	<string>2</string>
+	<string>3</string>
 	<key>Chrome</key>
 	<dict>
 		<key>Global Page</key>
 		</dict>
 		<key>Whitelist</key>
 		<array>
-			<string>http://*.google.com/reader/view*</string>
-			<string>https://*.google.com/reader/view*</string>
+			<string>http://*/reader/view*</string>
+			<string>https://*/reader/view*</string>
 		</array>
 	</dict>
 	<key>Description</key>
 	<dict>
 		<key>Website Access</key>
 		<dict>
-			<key>Allowed Domains</key>
-			<array>
-				<string>*.google.com</string>
-			</array>
 			<key>Include Secure Pages</key>
 			<true/>
 			<key>Level</key>
-			<string>Some</string>
+			<string>All</string>
 		</dict>
 	</dict>
 	<key>Update Manifest URL</key>
 	<string>http://bitbucket.org/zakj/greader-bgtabs/raw/tip/Manifest.plist</string>
 	<key>Website</key>
-	<string>http://nox.cx/google-reader-background-tabs</string>
+	<string>http://bitbucket.org/zakj/greader-bgtabs</string>
 </dict>
 </plist>
      <dict>
        <key>CFBundleIdentifier</key>
        <string>cx.nox.safari.googlereaderbackgroundtabs</string>
-       <key>Team Identifier</key
+       <key>Team Identifier</key>
        <string>QWE2UZ4U42</string>
        <key>CFBundleVersion</key>
-       <string>2</string>
+       <string>3</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.1</string>
+       <string>1.2</string>
        <key>URL</key>
-       <string>http://bitbucket.org/zakj/greader-bgtabs/downloads/greader-bgtabs-1.1.safariextz</string>
+       <string>http://bitbucket.org/zakj/greader-bgtabs/downloads/greader-bgtabs-1.2.safariextz</string>
      </dict>
    </array>
 </dict>
-document.addEventListener('keypress', function (event) {
-    // Ignore keypresses on some common form elements.
-    var tag = event.target.tagName;
-    if (tag === 'TEXTAREA' || tag === 'INPUT' || tag === 'SELECT') {
-        return;
-    }
-
-    // Catch 'v', but not ctrl-v or cmd-v.
-    if (event.which === 118 && !event.ctrlKey && !event.metaKey) {
-        var current = document.getElementById('current-entry');
-        if (current === null) {
+// Safari extension whitelist wildcards are very limited, and Google uses many
+// international domains.  To work around the problem, we allow any domain in
+// the extension whitelist, and check for a Google-like domain here.  The
+// Reader path itself is still managed by the extension whitelist.  False
+// positives shouldn't cause too much trouble.
+if (document.location.host.indexOf('.google.') !== -1) {
+    document.addEventListener('keypress', function (event) {
+        // Ignore keypresses on some common form elements.
+        var tag = event.target.tagName;
+        if (tag === 'TEXTAREA' || tag === 'INPUT' || tag === 'SELECT') {
             return;
         }
-        var url = current.getElementsByTagName('a')[0].getAttribute('href');
-        event.stopPropagation();
-        event.preventDefault();
-        safari.self.tab.dispatchMessage('openBackgroundTab', url);
-    }
-}, true);
+
+        // Catch 'v', but not ctrl-v or cmd-v.
+        if (event.which === 118 && !event.ctrlKey && !event.metaKey) {
+            var current = document.getElementById('current-entry');
+            if (!current) {
+                return;
+            }
+            event.stopPropagation();
+            event.preventDefault();
+            safari.self.tab.dispatchMessage('openBackgroundTab',
+                current.getElementsByTagName('a')[0].getAttribute('href'));
+        }
+    }, true);
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.