Commit a9d2d949c19af9cd82dc64b8bf67da155065c686
1 parent
7e829100
Exists in
master
Fixes a little bug
Showing
2 changed files
with
8 additions
and
9 deletions
Show diff stats
safari.safariextension/Info.plist
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <key>Chrome</key> | 19 | <key>Chrome</key> |
| 20 | <dict> | 20 | <dict> |
| 21 | <key>Database Quota</key> | 21 | <key>Database Quota</key> |
| 22 | - <real>5242880</real> | 22 | + <real>52428800</real> |
| 23 | <key>Global Page</key> | 23 | <key>Global Page</key> |
| 24 | <string>global.html</string> | 24 | <string>global.html</string> |
| 25 | </dict> | 25 | </dict> |
| @@ -27,10 +27,6 @@ | @@ -27,10 +27,6 @@ | ||
| 27 | <dict> | 27 | <dict> |
| 28 | <key>Scripts</key> | 28 | <key>Scripts</key> |
| 29 | <dict> | 29 | <dict> |
| 30 | - <key>End</key> | ||
| 31 | - <array> | ||
| 32 | - <string>scripts/delegator.js</string> | ||
| 33 | - </array> | ||
| 34 | <key>Start</key> | 30 | <key>Start</key> |
| 35 | <array> | 31 | <array> |
| 36 | <string>scripts/contextmenu.js</string> | 32 | <string>scripts/contextmenu.js</string> |
safari.safariextension/background.js
| 1 | var popup = null; | 1 | var popup = null; |
| 2 | var selectedText = undefined; | 2 | var selectedText = undefined; |
| 3 | +var appURL = safari.extension.baseURI + 'app/player/window.html'; | ||
| 3 | 4 | ||
| 4 | safari.application.addEventListener('contextmenu', function (event){ | 5 | safari.application.addEventListener('contextmenu', function (event){ |
| 5 | var selectedText = event.userInfo; | 6 | var selectedText = event.userInfo; |
| @@ -21,14 +22,16 @@ safari.application.addEventListener('command', function (event){ | @@ -21,14 +22,16 @@ safari.application.addEventListener('command', function (event){ | ||
| 21 | 22 | ||
| 22 | if (popup === null) { | 23 | if (popup === null) { |
| 23 | popup = safari.application.openBrowserWindow().activeTab; | 24 | popup = safari.application.openBrowserWindow().activeTab; |
| 24 | - popup.url = safari.extension.baseURI + 'app/player/window.html'; | 25 | + popup.url = appURL; |
| 25 | 26 | ||
| 26 | popup.addEventListener('close', function () { | 27 | popup.addEventListener('close', function () { |
| 27 | popup = null; | 28 | popup = null; |
| 28 | }); | 29 | }); |
| 29 | 30 | ||
| 30 | - popup.addEventListener('navigate', function () { | ||
| 31 | - popup = null; | 31 | + popup.addEventListener('navigate', function (event) { |
| 32 | + if (event.target.url !== appURL) { | ||
| 33 | + popup = null; | ||
| 34 | + } | ||
| 32 | }); | 35 | }); |
| 33 | 36 | ||
| 34 | popup.addEventListener('message', function (request) { | 37 | popup.addEventListener('message', function (request) { |
| @@ -43,4 +46,4 @@ safari.application.addEventListener('command', function (event){ | @@ -43,4 +46,4 @@ safari.application.addEventListener('command', function (event){ | ||
| 43 | selectedText = undefined; | 46 | selectedText = undefined; |
| 44 | } | 47 | } |
| 45 | } | 48 | } |
| 46 | -}, false); | ||
| 47 | \ No newline at end of file | 49 | \ No newline at end of file |
| 50 | +}, false); |