Browse Source

add informational popup after profile saving

readme-update
Simon Grim 9 years ago
parent
commit
1d1abd24ad
  1. 39
      js/interface_localization.js
  2. 71
      js/twister_user.js
  3. 21
      profile-edit.html

39
js/interface_localization.js

@ -43,6 +43,7 @@ if(preferredLanguage == "en"){ @@ -43,6 +43,7 @@ if(preferredLanguage == "en"){
"Block generation": "Block generation ",
"busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Cancel",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -203,6 +204,8 @@ if(preferredLanguage == "en"){ @@ -203,6 +204,8 @@ if(preferredLanguage == "en"){
"Terminate Daemon:": "Terminate Daemon:",
"Exit": "Exit",
"Save Changes": "Save Changes",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "Secret key:",
"You have to log in to post messages.": "You have to log in to post messages.",
"You have to log in to post replies.": "You have to log in to post replies.",
@ -360,6 +363,7 @@ if(preferredLanguage == "es"){ @@ -360,6 +363,7 @@ if(preferredLanguage == "es"){
"Block generation": "Generación de bloques ",
"busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Cancelar",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -520,6 +524,8 @@ if(preferredLanguage == "es"){ @@ -520,6 +524,8 @@ if(preferredLanguage == "es"){
"Terminate Daemon:": "Terminar Demonio:",
"Exit": "Salir",
"Save Changes": "Guardar cambios",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "Clave secreta:",
"You have to log in to post messages.": "Debes estar logueado para escribir mensajes.",
"You have to log in to post replies.": "Debes estar logueado para escribir respuestas.",
@ -661,6 +667,7 @@ if(preferredLanguage == "uk"){ @@ -661,6 +667,7 @@ if(preferredLanguage == "uk"){
"Block generation": "Генерація блоку ",
"busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Відміна",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -818,6 +825,8 @@ if(preferredLanguage == "uk"){ @@ -818,6 +825,8 @@ if(preferredLanguage == "uk"){
"Terminate Daemon:": "Зупинити Twister:",
"Exit": "Вихід",
"Save Changes": "Зберегти зміни",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "Секретний ключ:",
"You have to log in to post messages.": "Ви повинні увійти для публікації повідомлень.",
"You have to log in to post replies.": "Ви повинні увійти для публікації відповідей.",
@ -961,6 +970,7 @@ if(preferredLanguage == "zh-CN"){ @@ -961,6 +970,7 @@ if(preferredLanguage == "zh-CN"){
"Block generation": "区块生成器",
"busted_oh": "噢,阻挡!",
"busted_avowal": "系统检测到此用户试图在这里注入恶意代码",
"btn_ok": "Okay",
"Cancel": "取消",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -1120,6 +1130,8 @@ if(preferredLanguage == "zh-CN"){ @@ -1120,6 +1130,8 @@ if(preferredLanguage == "zh-CN"){
"Terminate Daemon:": "终止后台进程:",
"Exit": "退出",
"Save Changes": "保存更改",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "私钥:",
"You have to log in to post messages.": "你必须登录才能发送信息。",
"You have to log in to post replies.": "你必须登录才能发送回复。",
@ -1278,6 +1290,7 @@ if(preferredLanguage == "nl"){ @@ -1278,6 +1290,7 @@ if(preferredLanguage == "nl"){
"Block generation": "Block productie",
"busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Annuleren",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -1438,6 +1451,8 @@ if(preferredLanguage == "nl"){ @@ -1438,6 +1451,8 @@ if(preferredLanguage == "nl"){
"Terminate Daemon:": "Daemon beëindigen",
"Exit": "Beëindigen",
"Save Changes": "Opslaan",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "Geheime sleutel:",
"You have to log in to post messages.": "You have to log in to post messages.",
"You have to log in to post replies.": "You have to log in to post replies.",
@ -1579,6 +1594,7 @@ if(preferredLanguage == "it"){ @@ -1579,6 +1594,7 @@ if(preferredLanguage == "it"){
"Block generation": "Generatore di blocchi:",
"busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Cancella",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -1736,6 +1752,8 @@ if(preferredLanguage == "it"){ @@ -1736,6 +1752,8 @@ if(preferredLanguage == "it"){
"Terminate Daemon:": "Terminate Daemon:",
"Exit": "Exit",
"Save Changes": "Save Changes",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "Secret key:",
"You have to log in to post messages.": "You have to log in to post messages.",
"You have to log in to post replies.": "You have to log in to post replies.",
@ -1877,6 +1895,7 @@ if(preferredLanguage == "fr"){ @@ -1877,6 +1895,7 @@ if(preferredLanguage == "fr"){
"Block generation": "Production de blocs",
"busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Annuler",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -2037,6 +2056,8 @@ if(preferredLanguage == "fr"){ @@ -2037,6 +2056,8 @@ if(preferredLanguage == "fr"){
"Terminate Daemon:": "Tuer le démon:",
"Exit": "Quitter",
"Save Changes": "Sauvegarder les changements",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "Clef secrète:",
"You have to log in to post messages.": "You have to log in to post messages.",
"You have to log in to post replies.": "You have to log in to post replies.",
@ -2180,6 +2201,7 @@ if(preferredLanguage == "ru"){ @@ -2180,6 +2201,7 @@ if(preferredLanguage == "ru"){
"Block generation": "Майнинг блоков ",
"busted_oh": "о нет!",
"busted_avowal": "я пойман на попытке вставить этот подозрительный код здесь",
"btn_ok": "Лады́",
"Cancel": "Отмена",
"Confirm": "Несомненно",
"сonfirm_group_leaving_header": "Подтверждение ухода из группы",
@ -2340,6 +2362,8 @@ if(preferredLanguage == "ru"){ @@ -2340,6 +2362,8 @@ if(preferredLanguage == "ru"){
"Terminate Daemon:": "Остановить twister:",
"Exit": "Выход",
"Save Changes": "Сохранить изменения",
"profile_saved": "Данные профайла сохранены в DHT.",
"profile_not_saved": "Данные профайла не сохранены.",
"Secret key:": "Секретный ключ:",
"You have to log in to post messages.": "Войдите, чтобы отправлять сообщения.",
"You have to log in to post replies.": "Войдите, чтобы отвечать на сообщения.",
@ -2486,6 +2510,7 @@ if(preferredLanguage == "de"){ @@ -2486,6 +2510,7 @@ if(preferredLanguage == "de"){
"Block generation": "Block-Generierung ",
"busted_oh": "Oh nein!",
"busted_avowal": "Ich bin ertappt, habe versucht, hier Schadcode einzugeben!",
"btn_ok": "Okay",
"Cancel": "Abbrechen",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -2647,6 +2672,8 @@ if(preferredLanguage == "de"){ @@ -2647,6 +2672,8 @@ if(preferredLanguage == "de"){
"Terminate Daemon:": "Daemon beenden:",
"Exit": "Beenden",
"Save Changes": "Änderungen speichern",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "Privater Schlüssel:",
"You have to log in to post messages.": "You have to log in to post messages.",
"You have to log in to post replies.": "You have to log in to post replies.",
@ -2789,6 +2816,7 @@ if(preferredLanguage == "ja"){ @@ -2789,6 +2816,7 @@ if(preferredLanguage == "ja"){
"Block generation": "ブロック生成",
"busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "キャンセル",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -2946,6 +2974,8 @@ if(preferredLanguage == "ja"){ @@ -2946,6 +2974,8 @@ if(preferredLanguage == "ja"){
"Terminate Daemon:": "デーモンを終了する:",
"Exit": "終了",
"Save Changes": "変更を保存",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "シークレットキー:",
"You have to log in to post messages.": "You have to log in to post messages.",
"You have to log in to post replies.": "You have to log in to post replies.",
@ -3088,6 +3118,7 @@ if(preferredLanguage == "pt-BR"){ @@ -3088,6 +3118,7 @@ if(preferredLanguage == "pt-BR"){
"Block generation": "Geração de blocos ",
"busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Cancelar",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -3249,6 +3280,8 @@ if(preferredLanguage == "pt-BR"){ @@ -3249,6 +3280,8 @@ if(preferredLanguage == "pt-BR"){
"Terminate Daemon:": "Encerrar a execução do Cliente do Twister",
"Exit": "Sair",
"Save Changes": "Salvar Alterações",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret Key": "Chave Secreta", // não existia
"Secret key:": "Chave secreta:",
"You have to log in to post messages.": "You have to log in to post messages.",
@ -3391,6 +3424,7 @@ if(preferredLanguage == "tr"){ @@ -3391,6 +3424,7 @@ if(preferredLanguage == "tr"){
"Block generation": "Blok üretimi ",
"busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "İptal",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -3550,6 +3584,8 @@ if(preferredLanguage == "tr"){ @@ -3550,6 +3584,8 @@ if(preferredLanguage == "tr"){
"Terminate Daemon:": "Servisi Durdur:",
"Exit": "Çıkış",
"Save Changes": "Değişiklikleri Kaydet",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "Gizli anahtar:",
"Options": "Ayarlar",
"Switch to Promoted posts": "Destekli Mesajlara Geç",
@ -3691,6 +3727,7 @@ if(preferredLanguage == "cs"){ @@ -3691,6 +3727,7 @@ if(preferredLanguage == "cs"){
"Block generation": "Generování bloků ",
"busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Zrušit",
"Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving",
@ -3849,6 +3886,8 @@ if(preferredLanguage == "cs"){ @@ -3849,6 +3886,8 @@ if(preferredLanguage == "cs"){
"Terminate Daemon:": "Ukončit server:",
"Exit": "Konec",
"Save Changes": "Uložit změny",
"profile_saved": "Profile data has been saved to DHT.",
"profile_not_saved": "Profile data has been not saved.",
"Secret key:": "Tajný klíč:",
"You have to log in to post messages.": "Pro vkládání příspěvků je třeba se přihlásit.",
"You have to log in to post replies.": "Pro vkládání odpovědí je třeba se přihlásit.",

71
js/twister_user.js

@ -261,24 +261,59 @@ function loadProfileForEdit() { @@ -261,24 +261,59 @@ function loadProfileForEdit() {
}, {} );
}
function saveProfile(e)
{
var profile = {};
profile["fullname"] = $(".input-name").val();
profile["bio"] = $(".input-description").val();
profile["location"] = $(".input-city").val();
profile["url"] = $(".input-website").val();
var tox = $(".input-tox").val();
if( tox.length )
profile["tox"] = tox;
var bitmessage = $(".input-bitmessage").val();
if( bitmessage.length )
profile["bitmessage"] = bitmessage;
dhtput( defaultScreenName, "profile", "s",
profile, defaultScreenName, ++profileSeqNum );
var avatarData = $(".profile-card-photo.forEdition").attr("src");
dhtput( defaultScreenName, "avatar", "s",
avatarData, defaultScreenName, ++avatarSeqNum );
function saveProfile(e) {
function saveAvatar(req, isProfileDataSaved) {
dhtput(defaultScreenName, 'avatar', 's',
req.avatarImgSrc,
defaultScreenName, ++avatarSeqNum,
completeProfileSaving, {isProfileDataSaved: isProfileDataSaved}
);
}
function completeProfileSaving(req, isAvatarDataSaved) {
if (req.isProfileDataSaved && isAvatarDataSaved) {
clearAvatarAndProfileCache(defaultScreenName);
var titleTxt = '';
var messageTxt = polyglot.t('profile_saved');
} else {
var titleTxt = polyglot.t('error', {error: ''});
var messageTxt = polyglot.t('profile_not_saved');
}
confirmPopup(null, {
titleTxt: titleTxt,
messageTxt: messageTxt,
confirmTxt: polyglot.t('btn_ok'),
confirmFunc: $.MAL.enableButton,
confirmFuncArgs: $('.submit-changes'),
closeFunc: 'confirmFunc',
removeCancel: true
});
}
$.MAL.disableButton($('.submit-changes'));
dhtput(defaultScreenName, 'profile', 's',
setObjPropFromElemVal({}, {
fullname: '.input-name',
bio: '.input-description',
location: '.input-city',
url: '.input-website',
tox: '.input-tox',
bitmessage: '.input-bitmessage'
}),
defaultScreenName, ++profileSeqNum,
saveAvatar, {avatarImgSrc: $('.profile-card-photo.forEdition').attr('src')}
);
}
function setObjPropFromElemVal(object, req) {
var props = Object.getOwnPropertyNames(req); // req's props names will be object's props names
for (var i = 0; i < props.length; i++) {
elem = $(req[props[i]]); // req's props values are elements selectors
if (elem.length && elem.val())
object[props[i]] = elem.val();
}
return object;
}

21
profile-edit.html

@ -85,12 +85,27 @@ @@ -85,12 +85,27 @@
<div style="font-size:80%;text-align: center;" class="secret-key-container">
<span class="label">Secret key:</span> <span class="secret-key"></span>
</div>
</div>
<!-- ÁREA DE POSTS END -->
</div>
<input type="file" id="avatar-file" name="avatar_files" style="display:none;"/>
<div id="templates" style="display:none;">
<div class="prompt-wrapper">
<div class="modal-header">
<h3></h3>
<span class="modal-close prompt-close">&times;</span>
</div>
<div class="modal-content"></div>
</div>
<div id="confirm-popup-template">
<div class="message"></div>
<div class="modal-buttons">
<button class="confirm"></button>
<button class="cancel"></button>
</div>
</div>
</div>
</body>
</html>

Loading…
Cancel
Save