Mercurial > xmpp-account-manager
comparison avatar.js @ 43:aff7caa10489
Encode the default avatar using encodeURIComponent().
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 23 May 2020 18:46:34 +0200 |
parents | 07e33207e598 |
children | 2f45bee88b47 |
comparison
equal
deleted
inserted
replaced
42:fe59565063af | 43:aff7caa10489 |
---|---|
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 function initAvatar(connection) { | 3 function initAvatar(connection) { |
4 const DEFAULT_AVATAR = 'data:image/svg+xml,<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 150 150"><rect width="150" height="150" fill="#888" stroke-width="1" stroke="#000"/><text x="75" y="100" text-anchor="middle" font-size="100">?</text></svg>'; | 4 const DEFAULT_AVATAR = 'data:image/svg+xml,' + encodeURIComponent('<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 150 150"><rect width="150" height="150" fill="#888" stroke-width="1" stroke="#000"/><text x="75" y="100" text-anchor="middle" font-size="100">?</text></svg>'); |
5 | 5 |
6 const avatar_data = {}; | 6 const avatar_data = {}; |
7 const avatar_img = document.getElementById('avatar'); | 7 const avatar_img = document.getElementById('avatar'); |
8 const avatar_size = document.getElementById('avatar-size'); | 8 const avatar_size = document.getElementById('avatar-size'); |
9 const avatar_file = document.getElementById('avatar-file'); | 9 const avatar_file = document.getElementById('avatar-file'); |