Parcourir la source

add tooltips after copy to clipboard

pull/44/head
Guillaume Vincent il y a 9 ans
Parent
révision
71c3546335
3 fichiers modifiés avec 29 ajouts et 4 suppressions
  1. +18
    -2
      app/app.js
  2. +10
    -1
      package.json
  3. +1
    -1
      static/index.html

+ 18
- 2
app/app.js Voir le fichier

@@ -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);
}
}


+ 10
- 1
package.json Voir le fichier

@@ -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


+ 1
- 1
static/index.html Voir le fichier

@@ -116,7 +116,7 @@
aria-label="Help">
<span class="glyphicon glyphicon-question-sign"></span>
</button>
<button type="button" class="btn btn-default copy-btn"
<button id="copy-btn" type="button" class="btn btn-default"
data-clipboard-target="#password_generated">
<span class="glyphicon glyphicon-copy"></span>
</button>


Chargement…
Annuler
Enregistrer