|
|
@ -383,9 +383,18 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var $avatar = $userAdmin.find('.cp-dropdown-button-title');
|
|
|
|
var $avatar = $userAdmin.find('.cp-dropdown-button-title');
|
|
|
|
var oldUrl;
|
|
|
|
var oldUrl;
|
|
|
|
|
|
|
|
var loadingAvatar;
|
|
|
|
|
|
|
|
var to;
|
|
|
|
var updateButton = function () {
|
|
|
|
var updateButton = function () {
|
|
|
|
var myData = metadataMgr.getUserData();
|
|
|
|
var myData = metadataMgr.getUserData();
|
|
|
|
if (!myData) { return; }
|
|
|
|
if (!myData) { return; }
|
|
|
|
|
|
|
|
if (loadingAvatar) {
|
|
|
|
|
|
|
|
// Try again in 200ms
|
|
|
|
|
|
|
|
window.clearTimeout(to);
|
|
|
|
|
|
|
|
to = window.setTimeout(updateButton, 200);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
loadingAvatar = true;
|
|
|
|
var newName = myData.name;
|
|
|
|
var newName = myData.name;
|
|
|
|
var url = myData.avatar;
|
|
|
|
var url = myData.avatar;
|
|
|
|
$displayName.text(newName || Messages.anonymous);
|
|
|
|
$displayName.text(newName || Messages.anonymous);
|
|
|
@ -396,8 +405,11 @@ define([
|
|
|
|
if ($img) {
|
|
|
|
if ($img) {
|
|
|
|
$userAdmin.find('button').addClass('cp-avatar');
|
|
|
|
$userAdmin.find('button').addClass('cp-avatar');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
loadingAvatar = false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
loadingAvatar = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
metadataMgr.onChange(updateButton);
|
|
|
|
metadataMgr.onChange(updateButton);
|
|
|
|
updateButton();
|
|
|
|
updateButton();
|
|
|
@ -465,12 +477,13 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
common.initFilePicker(common, fileDialogCfg);
|
|
|
|
common.initFilePicker(fileDialogCfg);
|
|
|
|
var pickerCfg = {
|
|
|
|
var pickerCfg = {
|
|
|
|
types: [type],
|
|
|
|
types: [type],
|
|
|
|
where: ['template']
|
|
|
|
where: ['template']
|
|
|
|
};
|
|
|
|
};
|
|
|
|
common.openFilePicker(common, pickerCfg);
|
|
|
|
console.log(pickerCfg);
|
|
|
|
|
|
|
|
common.openFilePicker(pickerCfg);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return UI;
|
|
|
|
return UI;
|
|
|
|