diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2016-11-12 02:26:12 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2016-11-12 02:26:12 +0800 |
commit | 23263bec7d5100accd61f7648fd9355fc95e2bb7 (patch) | |
tree | 3c24f23655b5e1aad7102b603412d6fae70d5e43 /app/scripts/contentscript.js | |
parent | c664b8f11e32eaa7f8f1b46d4be938f2ebb74d35 (diff) | |
download | tangerine-wallet-browser-23263bec7d5100accd61f7648fd9355fc95e2bb7.tar tangerine-wallet-browser-23263bec7d5100accd61f7648fd9355fc95e2bb7.tar.gz tangerine-wallet-browser-23263bec7d5100accd61f7648fd9355fc95e2bb7.tar.bz2 tangerine-wallet-browser-23263bec7d5100accd61f7648fd9355fc95e2bb7.tar.lz tangerine-wallet-browser-23263bec7d5100accd61f7648fd9355fc95e2bb7.tar.xz tangerine-wallet-browser-23263bec7d5100accd61f7648fd9355fc95e2bb7.tar.zst tangerine-wallet-browser-23263bec7d5100accd61f7648fd9355fc95e2bb7.zip |
Linting to the max.
Diffstat (limited to 'app/scripts/contentscript.js')
-rw-r--r-- | app/scripts/contentscript.js | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index e2a968ac9..ab64dc9fa 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -6,7 +6,7 @@ const extension = require('./lib/extension') const fs = require('fs') const path = require('path') -const inpageText = fs.readFileSync(path.join(__dirname + '/inpage.js')).toString() +const inpageText = fs.readFileSync(path.join(__dirname, 'inpage.js')).toString() // Eventually this streaming injection could be replaced with: // https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.exportFunction @@ -20,9 +20,8 @@ if (shouldInjectWeb3()) { setupStreams() } -function setupInjection(){ +function setupInjection () { try { - // inject in-page script var scriptTag = document.createElement('script') scriptTag.src = extension.extension.getURL('scripts/inpage.js') @@ -31,14 +30,12 @@ function setupInjection(){ var container = document.head || document.documentElement // append as first child container.insertBefore(scriptTag, container.children[0]) - } catch (e) { console.error('Metamask injection failed.', e) } } -function setupStreams(){ - +function setupStreams () { // setup communication to page and plugin var pageStream = new LocalMessageDuplexStream({ name: 'contentscript', @@ -65,14 +62,13 @@ function setupStreams(){ mx.ignoreStream('provider') mx.ignoreStream('publicConfig') mx.ignoreStream('reload') - } -function shouldInjectWeb3(){ +function shouldInjectWeb3 () { return isAllowedSuffix(window.location.href) } -function isAllowedSuffix(testCase) { +function isAllowedSuffix (testCase) { var prohibitedTypes = ['xml', 'pdf'] var currentUrl = window.location.href var currentRegex |