diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-08-17 07:46:44 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-08-17 07:46:44 +0800 |
commit | 030bdec27a95390207b9147c95b810893756db6d (patch) | |
tree | 459f0411c7f57b7ae86dce77a8dc71c55fef257b /app | |
parent | 4ba90969ee8fa9b9e21e88f5c6f0d646874049a3 (diff) | |
download | tangerine-wallet-browser-030bdec27a95390207b9147c95b810893756db6d.tar tangerine-wallet-browser-030bdec27a95390207b9147c95b810893756db6d.tar.gz tangerine-wallet-browser-030bdec27a95390207b9147c95b810893756db6d.tar.bz2 tangerine-wallet-browser-030bdec27a95390207b9147c95b810893756db6d.tar.lz tangerine-wallet-browser-030bdec27a95390207b9147c95b810893756db6d.tar.xz tangerine-wallet-browser-030bdec27a95390207b9147c95b810893756db6d.tar.zst tangerine-wallet-browser-030bdec27a95390207b9147c95b810893756db6d.zip |
Unify notification and popup ui files
Diffstat (limited to 'app')
-rw-r--r-- | app/notification.html | 7 | ||||
-rw-r--r-- | app/scripts/lib/extension-instance.js | 6 | ||||
-rw-r--r-- | app/scripts/lib/is-popup-or-notification.js | 8 | ||||
-rw-r--r-- | app/scripts/lib/notifications.js | 2 | ||||
-rw-r--r-- | app/scripts/popup.js | 7 |
5 files changed, 27 insertions, 3 deletions
diff --git a/app/notification.html b/app/notification.html index 927f1634c..cc485da7f 100644 --- a/app/notification.html +++ b/app/notification.html @@ -3,9 +3,14 @@ <head> <meta charset="utf-8"> <title>MetaMask Notification</title> + <style> + body { + overflow: hidden; + } + </style> </head> <body> <div id="app-content"></div> - <script src="./scripts/notification.js" type="text/javascript" charset="utf-8"></script> + <script src="./scripts/popup.js" type="text/javascript" charset="utf-8"></script> </body> </html> diff --git a/app/scripts/lib/extension-instance.js b/app/scripts/lib/extension-instance.js index eb3b8a1e9..d284895bc 100644 --- a/app/scripts/lib/extension-instance.js +++ b/app/scripts/lib/extension-instance.js @@ -42,6 +42,12 @@ function Extension () { } catch (e) {} try { + if (browser[api]) { + _this[api] = browser[api] + } + } + + try { _this.api = browser.extension[api] } catch (e) {} diff --git a/app/scripts/lib/is-popup-or-notification.js b/app/scripts/lib/is-popup-or-notification.js new file mode 100644 index 000000000..5c38ac823 --- /dev/null +++ b/app/scripts/lib/is-popup-or-notification.js @@ -0,0 +1,8 @@ +module.exports = function isPopupOrNotification() { + const url = window.location.href + if (url.match(/popup.html$/)) { + return 'popup' + } else { + return 'notification' + } +} diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js index 75fb60dd0..e6bdeff09 100644 --- a/app/scripts/lib/notifications.js +++ b/app/scripts/lib/notifications.js @@ -31,7 +31,7 @@ function createMsgNotification (state) { } function showNotification() { - chrome.windows.create({ + extension.windows.create({ url:"notification.html", type:"panel", width:360, diff --git a/app/scripts/popup.js b/app/scripts/popup.js index 20be15df7..4c729e227 100644 --- a/app/scripts/popup.js +++ b/app/scripts/popup.js @@ -9,6 +9,7 @@ const injectCss = require('inject-css') const PortStream = require('./lib/port-stream.js') const StreamProvider = require('web3-stream-provider') const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex +const isPopupOrNotification = require('./lib/is-popup-or-notification') const extension = require('./lib/extension') // setup app @@ -22,7 +23,10 @@ async.parallel({ function connectToAccountManager (cb) { // setup communication with background - var pluginPort = extension.runtime.connect({name: 'popup'}) + + var name = isPopupOrNotification() + window.METAMASK_UI_TYPE = name + var pluginPort = extension.runtime.connect({ name }) var portStream = new PortStream(pluginPort) // setup multiplexing var mx = setupMultiplex(portStream) @@ -93,3 +97,4 @@ function setupApp (err, opts) { networkVersion: opts.networkVersion, }) } + |