@@ -23,7 +23,7 @@ function isWebExtension() { | |||||
} | } | ||||
function getCurrentUrl() { | function getCurrentUrl() { | ||||
return new Promise(function (resolve) { | |||||
return new Promise(resolve => { | |||||
chrome.tabs.query({active: true, currentWindow: true}, function (tabs) { | chrome.tabs.query({active: true, currentWindow: true}, function (tabs) { | ||||
resolve(tabs[0].url); | resolve(tabs[0].url); | ||||
}); | }); | ||||
@@ -37,7 +37,7 @@ function getSite() { | |||||
return getDomainName(currentUrl) | return getDomainName(currentUrl) | ||||
}); | }); | ||||
} | } | ||||
return new Promise(function (resolve) { | |||||
return new Promise(resolve => { | |||||
resolve('') | resolve('') | ||||
}); | }); | ||||
} | } | ||||
@@ -67,6 +67,9 @@ const mutations = { | |||||
}, | }, | ||||
SET_DEFAULT_PASSWORD(state){ | SET_DEFAULT_PASSWORD(state){ | ||||
state.password = Object.assign({}, defaultPassword) | state.password = Object.assign({}, defaultPassword) | ||||
}, | |||||
UPDATE_SITE(state, {site}){ | |||||
state.password.site = site | |||||
} | } | ||||
}; | }; | ||||
@@ -166,6 +166,7 @@ | |||||
import debounce from 'lodash.debounce'; | import debounce from 'lodash.debounce'; | ||||
import {showTooltip} from '../api/tooltip'; | import {showTooltip} from '../api/tooltip'; | ||||
import Password from '../domain/password'; | import Password from '../domain/password'; | ||||
import {getSite} from '../domain/url-parser'; | |||||
function fetchPasswords(store) { | function fetchPasswords(store) { | ||||
return store.dispatch('FETCH_PASSWORDS') | return store.dispatch('FETCH_PASSWORDS') | ||||
@@ -196,6 +197,12 @@ | |||||
fetchPasswords(this.$store); | fetchPasswords(this.$store); | ||||
} | } | ||||
getSite().then(site => { | |||||
if (site) { | |||||
this.$store.commit('UPDATE_SITE', {site}) | |||||
} | |||||
}); | |||||
var clipboard = new Clipboard('#copyPasswordButton'); | var clipboard = new Clipboard('#copyPasswordButton'); | ||||
clipboard.on('success', event => { | clipboard.on('success', event => { | ||||
if (event.text) { | if (event.text) { | ||||
@@ -24,6 +24,7 @@ module.exports = { | |||||
loaders: [ | loaders: [ | ||||
{test: /\.vue$/, loader: 'vue-loader'}, | {test: /\.vue$/, loader: 'vue-loader'}, | ||||
{test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}, | {test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}, | ||||
{test: /\.json/, loader: 'json-loader'}, | |||||
{test: /\.(png|jpg|jpeg|gif)$/, loader: 'file-loader?name=[name].[ext]',}, | {test: /\.(png|jpg|jpeg|gif)$/, loader: 'file-loader?name=[name].[ext]',}, | ||||
{test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader', {publicPath: ''})}, | {test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader', {publicPath: ''})}, | ||||
{test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'}, | {test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'}, | ||||