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 | 19 | <key>Chrome</key> |
| 20 | 20 | <dict> |
| 21 | 21 | <key>Database Quota</key> |
| 22 | - <real>5242880</real> | |
| 22 | + <real>52428800</real> | |
| 23 | 23 | <key>Global Page</key> |
| 24 | 24 | <string>global.html</string> |
| 25 | 25 | </dict> |
| ... | ... | @@ -27,10 +27,6 @@ |
| 27 | 27 | <dict> |
| 28 | 28 | <key>Scripts</key> |
| 29 | 29 | <dict> |
| 30 | - <key>End</key> | |
| 31 | - <array> | |
| 32 | - <string>scripts/delegator.js</string> | |
| 33 | - </array> | |
| 34 | 30 | <key>Start</key> |
| 35 | 31 | <array> |
| 36 | 32 | <string>scripts/contextmenu.js</string> | ... | ... |
safari.safariextension/background.js
| 1 | 1 | var popup = null; |
| 2 | 2 | var selectedText = undefined; |
| 3 | +var appURL = safari.extension.baseURI + 'app/player/window.html'; | |
| 3 | 4 | |
| 4 | 5 | safari.application.addEventListener('contextmenu', function (event){ |
| 5 | 6 | var selectedText = event.userInfo; |
| ... | ... | @@ -21,14 +22,16 @@ safari.application.addEventListener('command', function (event){ |
| 21 | 22 | |
| 22 | 23 | if (popup === null) { |
| 23 | 24 | popup = safari.application.openBrowserWindow().activeTab; |
| 24 | - popup.url = safari.extension.baseURI + 'app/player/window.html'; | |
| 25 | + popup.url = appURL; | |
| 25 | 26 | |
| 26 | 27 | popup.addEventListener('close', function () { |
| 27 | 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 | 37 | popup.addEventListener('message', function (request) { |
| ... | ... | @@ -43,4 +46,4 @@ safari.application.addEventListener('command', function (event){ |
| 43 | 46 | selectedText = undefined; |
| 44 | 47 | } |
| 45 | 48 | } |
| 46 | -}, false); | |
| 47 | 49 | \ No newline at end of file |
| 50 | +}, false); | ... | ... |