randomize avatar for same names

This commit is contained in:
Ginger Wong
2020-07-07 23:30:26 -07:00
parent 426bfe000f
commit 827e402bcc
2 changed files with 3 additions and 3 deletions

View File

@@ -81,7 +81,8 @@ class Messaging {
initLocalStates() { initLocalStates() {
this.username = getLocalStorage(KEY_USERNAME) || generateUsername(); this.username = getLocalStorage(KEY_USERNAME) || generateUsername();
this.imgUsernameAvatar.src = getLocalStorage(KEY_AVATAR) || generateAvatar(this.username); this.imgUsernameAvatar.src =
getLocalStorage(KEY_AVATAR) || generateAvatar(`${this.username}${Date.now()}`);
this.updateUsernameFields(this.username); this.updateUsernameFields(this.username);
this.chatDisplayed = getLocalStorage(KEY_CHAT_DISPLAYED) || false; this.chatDisplayed = getLocalStorage(KEY_CHAT_DISPLAYED) || false;
@@ -149,7 +150,7 @@ class Messaging {
if (newValue) { if (newValue) {
this.username = newValue; this.username = newValue;
this.updateUsernameFields(newValue); this.updateUsernameFields(newValue);
this.imgUsernameAvatar.src = generateAvatar(newValue); this.imgUsernameAvatar.src = generateAvatar(`${newValue}${Date.now()}`);
setLocalStorage(KEY_USERNAME, newValue); setLocalStorage(KEY_USERNAME, newValue);
setLocalStorage(KEY_AVATAR, this.imgUsernameAvatar.src); setLocalStorage(KEY_AVATAR, this.imgUsernameAvatar.src);
} }

View File

@@ -60,7 +60,6 @@ function setupPlayerEventHandlers() {
function restartPlayer() { function restartPlayer() {
try { try {
console.log('restarting', player.src())
const player = videojs(VIDEO_ID); const player = videojs(VIDEO_ID);
player.pause(); player.pause();
player.src(player.src()); // Reload the same video player.src(player.src()); // Reload the same video