diff --git a/app/app.js b/app/app.js index d2c58e1..f20f672 100644 --- a/app/app.js +++ b/app/app.js @@ -3,6 +3,9 @@ import angular from 'angular'; import Clipboard from 'clipboard'; +window.jQuery = $ = require('jquery'); +var bootstrap = require('bootstrap/dist/js/bootstrap'); + class lesspassController { constructor($scope) { var vm = this; @@ -20,13 +23,26 @@ class lesspassController { }, function () { vm.updatePassword(); }); + $scope.$watchCollection(function () { return vm.site; }, function () { vm.updatePassword(); }); - new Clipboard('.copy-btn'); + var clipboard = new Clipboard('#copy-btn'); + clipboard.on('success', function (e) { + var copyBtn = document.getElementById("copy-btn"); + var t = $(copyBtn).tooltip({title: 'CopiƩ'}); + t.tooltip('show'); + e.clearSelection(); + }); + + clipboard.on('error', function (e) { + var passwordGenerated = document.getElementById("password_generated"); + var t = $(passwordGenerated).tooltip({title: 'Cmd + C pour copier le mot de passe'}); + t.tooltip('show'); + }); } updatePasswordTypes(type) { @@ -41,7 +57,7 @@ class lesspassController { } updatePassword() { - if(this.password && this.site.site_name){ + if (this.password && this.site.site_name) { this.generatedPassword = lesspass.create_password(this.password, this.site); } } diff --git a/package.json b/package.json index 318cccf..717552f 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "dependencies": { "angular": "^1.4.8", "bootstrap": "^3.3.6", - "clipboard": "^1.5.5" + "clipboard": "^1.5.5", + "jquery": "^2.1.4" }, "devDependencies": { "babel-core": "latest", @@ -69,6 +70,14 @@ } ], [ + "babelify", + { + "presets": [ + "es2015" + ] + } + ], + [ "sassify", { "auto-inject": true diff --git a/static/index.html b/static/index.html index a8a2732..ddbc73a 100644 --- a/static/index.html +++ b/static/index.html @@ -116,7 +116,7 @@ aria-label="Help"> -