瀏覽代碼

reduce memory footprint

pull/342/head
Guillaume Vincent 8 年之前
父節點
當前提交
5f99bfeaf5
共有 8 個檔案被更改,包括 23 行新增16 行删除
  1. +3
    -3
      dist/lesspass-pure.js
  2. +1
    -1
      dist/lesspass-pure.js.map
  3. +1
    -1
      dist/lesspass-vendors.css
  4. +2
    -2
      dist/lesspass-vendors.js
  5. +1
    -1
      dist/lesspass-vendors.js.map
  6. +0
    -1
      package.json
  7. +14
    -6
      src/app.js
  8. +1
    -1
      webpack.config.js

+ 3
- 3
dist/lesspass-pure.js
文件差異過大導致無法顯示
查看文件


+ 1
- 1
dist/lesspass-pure.js.map
文件差異過大導致無法顯示
查看文件


+ 1
- 1
dist/lesspass-vendors.css
文件差異過大導致無法顯示
查看文件


+ 2
- 2
dist/lesspass-vendors.js 查看文件

@@ -1,2 +1,2 @@
!function(t){function n(o){if(r[o])return r[o].exports;var e=r[o]={exports:{},id:o,loaded:!1};return t[o].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var r={};return n.m=t,n.c=r,n.p="/pure/dist/",n(0)}({0:function(t,n,r){"use strict";r(16),r(17),r(18)},16:function(t,n){},17:function(t,n){},18:function(t,n){}});
//# sourceMappingURL=lesspass-vendors.js.map?6369a672674763854654
!function(t){function n(o){if(r[o])return r[o].exports;var e=r[o]={exports:{},id:o,loaded:!1};return t[o].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var r={};return n.m=t,n.c=r,n.p="/dist/",n(0)}({0:function(t,n,r){"use strict";r(16),r(17),r(18)},16:function(t,n){},17:function(t,n){},18:function(t,n){}});
//# sourceMappingURL=lesspass-vendors.js.map?06b628343b70e86e7829

+ 1
- 1
dist/lesspass-vendors.js.map 查看文件

@@ -1 +1 @@
{"version":3,"sources":["webpack:///lesspass-vendors.js","webpack:///webpack/bootstrap 6369a672674763854654?5849","webpack:///./src/vendors.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","id","loaded","call","m","c","p","0","16","17","18"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAE,WACAE,GAAAJ,EACAK,QAAA,EAUA,OANAP,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,QAAA,EAGAF,EAAAD,QAvBA,GAAAD,KAqCA,OATAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,cAGAV,EAAA,KDMMW,EACA,SAASP,EAAQD,EAASH,GAE/B,YE/CDA,GAAA,IACAA,EAAA,IACAA,EAAA,KFuDMY,GACA,SAASR,EAAQD,KAMjBU,GACA,SAAST,EAAQD,KAMjBW,GACA,SAASV,EAAQD","file":"lesspass-vendors.js?6369a672674763854654","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/pure/dist/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 0:\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\t__webpack_require__(16);\n\t\n\t__webpack_require__(17);\n\t\n\t__webpack_require__(18);\n\n/***/ },\n\n/***/ 16:\n/***/ function(module, exports) {\n\n\t// removed by extract-text-webpack-plugin\n\n/***/ },\n\n/***/ 17:\n/***/ function(module, exports) {\n\n\t// removed by extract-text-webpack-plugin\n\n/***/ },\n\n/***/ 18:\n/***/ function(module, exports) {\n\n\t// removed by extract-text-webpack-plugin\n\n/***/ }\n\n/******/ });\n\n\n/** WEBPACK FOOTER **\n ** lesspass-vendors.js?6369a672674763854654\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/pure/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 6369a672674763854654\n **/","import \"bootstrap/dist/css/bootstrap.css\";\nimport \"font-awesome/css/font-awesome.css\";\nimport \"hint.css/hint.css\";\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendors.js\n **/"],"sourceRoot":""}
{"version":3,"sources":["webpack:///lesspass-vendors.js","webpack:///webpack/bootstrap 06b628343b70e86e7829?189c","webpack:///./src/vendors.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","id","loaded","call","m","c","p","0","16","17","18"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAE,WACAE,GAAAJ,EACAK,QAAA,EAUA,OANAP,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,QAAA,EAGAF,EAAAD,QAvBA,GAAAD,KAqCA,OATAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAGAV,EAAA,KDMMW,EACA,SAASP,EAAQD,EAASH,GAE/B,YE/CDA,GAAA,IACAA,EAAA,IACAA,EAAA,KFuDMY,GACA,SAASR,EAAQD,KAMjBU,GACA,SAAST,EAAQD,KAMjBW,GACA,SAASV,EAAQD","file":"lesspass-vendors.js?06b628343b70e86e7829","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/dist/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 0:\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\t__webpack_require__(16);\n\t\n\t__webpack_require__(17);\n\t\n\t__webpack_require__(18);\n\n/***/ },\n\n/***/ 16:\n/***/ function(module, exports) {\n\n\t// removed by extract-text-webpack-plugin\n\n/***/ },\n\n/***/ 17:\n/***/ function(module, exports) {\n\n\t// removed by extract-text-webpack-plugin\n\n/***/ },\n\n/***/ 18:\n/***/ function(module, exports) {\n\n\t// removed by extract-text-webpack-plugin\n\n/***/ }\n\n/******/ });\n\n\n/** WEBPACK FOOTER **\n ** lesspass-vendors.js?06b628343b70e86e7829\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 06b628343b70e86e7829\n **/","import \"bootstrap/dist/css/bootstrap.css\";\nimport \"font-awesome/css/font-awesome.css\";\nimport \"hint.css/hint.css\";\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendors.js\n **/"],"sourceRoot":""}

+ 0
- 1
package.json 查看文件

@@ -38,7 +38,6 @@
"font-awesome-webpack": "0.0.4",
"hint.css": "^2.3.1",
"html-webpack-plugin": "^2.22.0",
"less-loader": "^2.2.3",
"node-sass": "^3.8.0",
"sass-loader": "^4.0.0",
"style-loader": "^0.13.1",


+ 14
- 6
src/app.js 查看文件

@@ -2,6 +2,8 @@ import './app.scss'
import lesspass from 'lesspass';
import Clipboard from 'clipboard';

var encryptedLogin;

function showTooltip(elem, msg) {
var classNames = elem.className;
elem.setAttribute('class', classNames + ' hint--top');
@@ -35,6 +37,7 @@ function displayPasswordIndication() {
return;
}
lesspass.encryptLogin(login, masterPassword).then(function (secretHash) {
encryptedLogin = secretHash;
var color = secretHash.substring(0, 6);
var colorHex = getColor(color);
fingerprint.innerText = color;
@@ -47,7 +50,7 @@ document.getElementById('copyPasswordButton').addEventListener('click', generate
document.getElementById('generatedPasswordForm').addEventListener('change', generatePassword);
document.getElementById('passwordLength').addEventListener('input', generatePassword);
document.getElementById('passwordCounter').addEventListener('input', generatePassword);
document.getElementById('generatedPasswordForm').oninput = generatePassword;
function getData() {
const defaultOptions = {
login: document.getElementById('login').value,
@@ -77,13 +80,11 @@ function getFormData() {
function generatePassword() {
const data = getFormData();
var generatedPasswordField = document.getElementById('generatedPassword');
if (!data.login || !data.masterPassword || !data.site || !data.password.settings.length) {
if (!encryptedLogin || !data.site || !data.password.settings.length) {
generatedPasswordField.value = '';
return;
}
lesspass.generatePassword(data.login, data.masterPassword, data.site, data).then(function (generatedPassword) {
generatedPasswordField.value = generatedPassword;
});
generatedPasswordField.value = lesspass.renderPassword(encryptedLogin, data.site, data);
}

document.getElementById('displayMasterPasswordButton').addEventListener('click', toggleMasterPassword);
@@ -95,12 +96,19 @@ function toggleMasterPassword() {
}
}

function cleanData(){
document.getElementById('generatedPassword').value = '';
document.getElementById('masterPassword').value = '';
}

var clipboard = new Clipboard('.btn-copy');

clipboard.on('success', function (e) {
if (e.text) {
showTooltip(e.trigger, 'copied !');
e.clearSelection();
setTimeout(function () {
cleanData()
}, 10000);
}
});



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

@@ -9,7 +9,7 @@ module.exports = {
},
output: {
path: 'dist',
publicPath: '/pure/dist/',
publicPath: '/dist/',
filename: 'lesspass-[name].js?[hash]'
},
module: {


Loading…
取消
儲存