diff options
author | Marvin Borner | 2018-07-01 21:46:59 +0200 |
---|---|---|
committer | Marvin Borner | 2018-07-01 21:46:59 +0200 |
commit | f7abf66d963770e60e2ed2a67fbeaa14e14568a6 (patch) | |
tree | c3b2a36f38e3e9d9e97ada0a723573da20720af7 /resources/assets | |
parent | 6c557a4be1a88de5dd681837bd77c50a98352168 (diff) |
Added avatar preview and optimized avatar saving
Diffstat (limited to 'resources/assets')
-rw-r--r-- | resources/assets/js/app.js | 1 | ||||
-rw-r--r-- | resources/assets/js/chat.js | 24 | ||||
-rw-r--r-- | resources/assets/js/profile.js | 13 |
3 files changed, 26 insertions, 12 deletions
diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 3c056ef..16d3a12 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -7,4 +7,5 @@ window.openpgp = require('openpgp'); window.Vue = require('vue'); require('./bootstrap'); +require('./profile'); require('./chat'); diff --git a/resources/assets/js/chat.js b/resources/assets/js/chat.js index f2a8cb2..60563aa 100644 --- a/resources/assets/js/chat.js +++ b/resources/assets/js/chat.js @@ -1,18 +1,18 @@ -var openpgp = window.openpgp; +// var openpgp = window.openpgp; -var options = { - userIds: [{ name:'Marvin Borner', email:'test@test.de' }], // multiple user IDs - numBits: 4096, // RSA key size - passphrase: 'cool password of private key' -}; +// var options = { +// userIds: [{ name:'Marvin Borner', email:'test@test.de' }], // multiple user IDs +// numBits: 4096, // RSA key size +// passphrase: 'cool password of private key' +// }; -openpgp.generateKey(options).then(function(key) { - var privateKey = key.privateKeyArmored; // '-----BEGIN PGP PRIVATE KEY BLOCK ... ' - var publicKey = key.publicKeyArmored; // '-----BEGIN PGP PUBLIC KEY BLOCK ... ' +// openpgp.generateKey(options).then(function(key) { +// var privateKey = key.privateKeyArmored; // '-----BEGIN PGP PRIVATE KEY BLOCK ... ' +// var publicKey = key.publicKeyArmored; // '-----BEGIN PGP PUBLIC KEY BLOCK ... ' - console.log(publicKey); - console.log(privateKey); -}); +// console.log(publicKey); +// console.log(privateKey); +// }); diff --git a/resources/assets/js/profile.js b/resources/assets/js/profile.js new file mode 100644 index 0000000..bce94da --- /dev/null +++ b/resources/assets/js/profile.js @@ -0,0 +1,13 @@ +$("#avatarFile").on("change", () => { + var preview = document.querySelector('#image-preview'); + var file = document.querySelector("#avatarFile").files[0]; + var reader = new FileReader(); + + reader.addEventListener("load", () => { + preview.src = reader.result; + }, false); + + if (file) { + reader.readAsDataURL(file); + } +});
\ No newline at end of file |