Dynamicaly change avatar and header bg from account setting (#4289)

pull/4286/head
Yamagishi Kazutoshi 2017-07-21 19:47:16 +09:00 committed by Eugen Rochko
parent dbaa6a0e13
commit f2390e2803
2 changed files with 18 additions and 0 deletions

View File

@ -88,6 +88,20 @@ function main() {
noteCounter.textContent = 160 - length(target.value); noteCounter.textContent = 160 - length(target.value);
} }
}); });
delegate(document, '#account_avatar', 'change', ({ target }) => {
const avatar = document.querySelector('.card.compact .avatar img');
const [file] = target.files || [];
const url = URL.createObjectURL(file);
avatar.src = url;
});
delegate(document, '#account_header', 'change', ({ target }) => {
const header = document.querySelector('.card.compact');
const [file] = target.files || [];
const url = URL.createObjectURL(file);
header.style.backgroundImage = `url(${url})`;
});
} }
loadPolyfills().then(main).catch(error => { loadPolyfills().then(main).catch(error => {

View File

@ -32,6 +32,10 @@
.avatar { .avatar {
margin-bottom: 0; margin-bottom: 0;
img {
object-fit: cover;
}
} }
} }