浏览代码

add url parser for web extension feature

pull/342/head
Guillaume Vincent 8 年前
父节点
当前提交
5e08c5d60c
共有 5 个文件被更改,包括 30 次插入16 次删除
  1. +17
    -14
      dist/lesspass.js
  2. +2
    -2
      src/domain/url-parser.js
  3. +3
    -0
      src/store.js
  4. +7
    -0
      src/views/PasswordGenerator.vue
  5. +1
    -0
      webpack.config.js

+ 17
- 14
dist/lesspass.js
文件差异内容过多而无法显示
查看文件


+ 2
- 2
src/domain/url-parser.js 查看文件

@@ -23,7 +23,7 @@ function isWebExtension() {
}

function getCurrentUrl() {
return new Promise(function (resolve) {
return new Promise(resolve => {
chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
resolve(tabs[0].url);
});
@@ -37,7 +37,7 @@ function getSite() {
return getDomainName(currentUrl)
});
}
return new Promise(function (resolve) {
return new Promise(resolve => {
resolve('')
});
}


+ 3
- 0
src/store.js 查看文件

@@ -67,6 +67,9 @@ const mutations = {
},
SET_DEFAULT_PASSWORD(state){
state.password = Object.assign({}, defaultPassword)
},
UPDATE_SITE(state, {site}){
state.password.site = site
}
};



+ 7
- 0
src/views/PasswordGenerator.vue 查看文件

@@ -166,6 +166,7 @@
import debounce from 'lodash.debounce';
import {showTooltip} from '../api/tooltip';
import Password from '../domain/password';
import {getSite} from '../domain/url-parser';

function fetchPasswords(store) {
return store.dispatch('FETCH_PASSWORDS')
@@ -196,6 +197,12 @@
fetchPasswords(this.$store);
}

getSite().then(site => {
if (site) {
this.$store.commit('UPDATE_SITE', {site})
}
});

var clipboard = new Clipboard('#copyPasswordButton');
clipboard.on('success', event => {
if (event.text) {


+ 1
- 0
webpack.config.js 查看文件

@@ -24,6 +24,7 @@ module.exports = {
loaders: [
{test: /\.vue$/, loader: 'vue-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: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader', {publicPath: ''})},
{test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},


正在加载...
取消
保存