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"){
"Block generation": "Block generation ", "Block generation": "Block generation ",
"busted_oh": "oh noes!", "busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here", "busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Cancel", "Cancel": "Cancel",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -203,6 +204,8 @@ if(preferredLanguage == "en"){
"Terminate Daemon:": "Terminate Daemon:", "Terminate Daemon:": "Terminate Daemon:",
"Exit": "Exit", "Exit": "Exit",
"Save Changes": "Save Changes", "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:", "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 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.", "You have to log in to post replies.": "You have to log in to post replies.",
@ -360,6 +363,7 @@ if(preferredLanguage == "es"){
"Block generation": "Generación de bloques ", "Block generation": "Generación de bloques ",
"busted_oh": "oh noes!", "busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here", "busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Cancelar", "Cancel": "Cancelar",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -520,6 +524,8 @@ if(preferredLanguage == "es"){
"Terminate Daemon:": "Terminar Demonio:", "Terminate Daemon:": "Terminar Demonio:",
"Exit": "Salir", "Exit": "Salir",
"Save Changes": "Guardar cambios", "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:", "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 messages.": "Debes estar logueado para escribir mensajes.",
"You have to log in to post replies.": "Debes estar logueado para escribir respuestas.", "You have to log in to post replies.": "Debes estar logueado para escribir respuestas.",
@ -661,6 +667,7 @@ if(preferredLanguage == "uk"){
"Block generation": "Генерація блоку ", "Block generation": "Генерація блоку ",
"busted_oh": "oh noes!", "busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here", "busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Відміна", "Cancel": "Відміна",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -818,6 +825,8 @@ if(preferredLanguage == "uk"){
"Terminate Daemon:": "Зупинити Twister:", "Terminate Daemon:": "Зупинити Twister:",
"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.": "Ви повинні увійти для публікації відповідей.",
@ -961,6 +970,7 @@ if(preferredLanguage == "zh-CN"){
"Block generation": "区块生成器", "Block generation": "区块生成器",
"busted_oh": "噢,阻挡!", "busted_oh": "噢,阻挡!",
"busted_avowal": "系统检测到此用户试图在这里注入恶意代码", "busted_avowal": "系统检测到此用户试图在这里注入恶意代码",
"btn_ok": "Okay",
"Cancel": "取消", "Cancel": "取消",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -1120,6 +1130,8 @@ if(preferredLanguage == "zh-CN"){
"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.": "你必须登录才能发送回复。",
@ -1278,6 +1290,7 @@ if(preferredLanguage == "nl"){
"Block generation": "Block productie", "Block generation": "Block productie",
"busted_oh": "oh noes!", "busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here", "busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Annuleren", "Cancel": "Annuleren",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -1438,6 +1451,8 @@ if(preferredLanguage == "nl"){
"Terminate Daemon:": "Daemon beëindigen", "Terminate Daemon:": "Daemon beëindigen",
"Exit": "Beëindigen", "Exit": "Beëindigen",
"Save Changes": "Opslaan", "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:", "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 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.", "You have to log in to post replies.": "You have to log in to post replies.",
@ -1579,6 +1594,7 @@ if(preferredLanguage == "it"){
"Block generation": "Generatore di blocchi:", "Block generation": "Generatore di blocchi:",
"busted_oh": "oh noes!", "busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here", "busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Cancella", "Cancel": "Cancella",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -1736,6 +1752,8 @@ if(preferredLanguage == "it"){
"Terminate Daemon:": "Terminate Daemon:", "Terminate Daemon:": "Terminate Daemon:",
"Exit": "Exit", "Exit": "Exit",
"Save Changes": "Save Changes", "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:", "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 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.", "You have to log in to post replies.": "You have to log in to post replies.",
@ -1877,6 +1895,7 @@ if(preferredLanguage == "fr"){
"Block generation": "Production de blocs", "Block generation": "Production de blocs",
"busted_oh": "oh noes!", "busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here", "busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Annuler", "Cancel": "Annuler",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -2037,6 +2056,8 @@ if(preferredLanguage == "fr"){
"Terminate Daemon:": "Tuer le démon:", "Terminate Daemon:": "Tuer le démon:",
"Exit": "Quitter", "Exit": "Quitter",
"Save Changes": "Sauvegarder les changements", "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:", "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 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.", "You have to log in to post replies.": "You have to log in to post replies.",
@ -2180,6 +2201,7 @@ if(preferredLanguage == "ru"){
"Block generation": "Майнинг блоков ", "Block generation": "Майнинг блоков ",
"busted_oh": "о нет!", "busted_oh": "о нет!",
"busted_avowal": "я пойман на попытке вставить этот подозрительный код здесь", "busted_avowal": "я пойман на попытке вставить этот подозрительный код здесь",
"btn_ok": "Лады́",
"Cancel": "Отмена", "Cancel": "Отмена",
"Confirm": "Несомненно", "Confirm": "Несомненно",
"сonfirm_group_leaving_header": "Подтверждение ухода из группы", "сonfirm_group_leaving_header": "Подтверждение ухода из группы",
@ -2340,6 +2362,8 @@ if(preferredLanguage == "ru"){
"Terminate Daemon:": "Остановить twister:", "Terminate Daemon:": "Остановить twister:",
"Exit": "Выход", "Exit": "Выход",
"Save Changes": "Сохранить изменения", "Save Changes": "Сохранить изменения",
"profile_saved": "Данные профайла сохранены в DHT.",
"profile_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.": "Войдите, чтобы отвечать на сообщения.",
@ -2486,6 +2510,7 @@ if(preferredLanguage == "de"){
"Block generation": "Block-Generierung ", "Block generation": "Block-Generierung ",
"busted_oh": "Oh nein!", "busted_oh": "Oh nein!",
"busted_avowal": "Ich bin ertappt, habe versucht, hier Schadcode einzugeben!", "busted_avowal": "Ich bin ertappt, habe versucht, hier Schadcode einzugeben!",
"btn_ok": "Okay",
"Cancel": "Abbrechen", "Cancel": "Abbrechen",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -2647,6 +2672,8 @@ if(preferredLanguage == "de"){
"Terminate Daemon:": "Daemon beenden:", "Terminate Daemon:": "Daemon beenden:",
"Exit": "Beenden", "Exit": "Beenden",
"Save Changes": "Änderungen speichern", "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:", "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 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.", "You have to log in to post replies.": "You have to log in to post replies.",
@ -2789,6 +2816,7 @@ if(preferredLanguage == "ja"){
"Block generation": "ブロック生成", "Block generation": "ブロック生成",
"busted_oh": "oh noes!", "busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here", "busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "キャンセル", "Cancel": "キャンセル",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -2946,6 +2974,8 @@ if(preferredLanguage == "ja"){
"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 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.", "You have to log in to post replies.": "You have to log in to post replies.",
@ -3088,6 +3118,7 @@ if(preferredLanguage == "pt-BR"){
"Block generation": "Geração de blocos ", "Block generation": "Geração de blocos ",
"busted_oh": "oh noes!", "busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here", "busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Cancelar", "Cancel": "Cancelar",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -3249,6 +3280,8 @@ if(preferredLanguage == "pt-BR"){
"Terminate Daemon:": "Encerrar a execução do Cliente do Twister", "Terminate Daemon:": "Encerrar a execução do Cliente do Twister",
"Exit": "Sair", "Exit": "Sair",
"Save Changes": "Salvar Alterações", "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", // não existia
"Secret key:": "Chave secreta:", "Secret key:": "Chave secreta:",
"You have to log in to post messages.": "You have to log in to post messages.", "You have to log in to post messages.": "You have to log in to post messages.",
@ -3391,6 +3424,7 @@ if(preferredLanguage == "tr"){
"Block generation": "Blok üretimi ", "Block generation": "Blok üretimi ",
"busted_oh": "oh noes!", "busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here", "busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "İptal", "Cancel": "İptal",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -3550,6 +3584,8 @@ if(preferredLanguage == "tr"){
"Terminate Daemon:": "Servisi Durdur:", "Terminate Daemon:": "Servisi Durdur:",
"Exit": "Çıkış", "Exit": "Çıkış",
"Save Changes": "Değişiklikleri Kaydet", "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:", "Secret key:": "Gizli anahtar:",
"Options": "Ayarlar", "Options": "Ayarlar",
"Switch to Promoted posts": "Destekli Mesajlara Geç", "Switch to Promoted posts": "Destekli Mesajlara Geç",
@ -3691,6 +3727,7 @@ if(preferredLanguage == "cs"){
"Block generation": "Generování bloků ", "Block generation": "Generování bloků ",
"busted_oh": "oh noes!", "busted_oh": "oh noes!",
"busted_avowal": "I\'m busted trying inject this suspicious stuff here", "busted_avowal": "I\'m busted trying inject this suspicious stuff here",
"btn_ok": "Okay",
"Cancel": "Zrušit", "Cancel": "Zrušit",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -3849,6 +3886,8 @@ if(preferredLanguage == "cs"){
"Terminate Daemon:": "Ukončit server:", "Terminate Daemon:": "Ukončit server:",
"Exit": "Konec", "Exit": "Konec",
"Save Changes": "Uložit změny", "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íč:", "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 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.", "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() {
}, {} ); }, {} );
} }
function saveProfile(e) function saveProfile(e) {
{ function saveAvatar(req, isProfileDataSaved) {
var profile = {}; dhtput(defaultScreenName, 'avatar', 's',
profile["fullname"] = $(".input-name").val(); req.avatarImgSrc,
profile["bio"] = $(".input-description").val(); defaultScreenName, ++avatarSeqNum,
profile["location"] = $(".input-city").val(); completeProfileSaving, {isProfileDataSaved: isProfileDataSaved}
profile["url"] = $(".input-website").val(); );
var tox = $(".input-tox").val(); }
if( tox.length )
profile["tox"] = tox; function completeProfileSaving(req, isAvatarDataSaved) {
var bitmessage = $(".input-bitmessage").val(); if (req.isProfileDataSaved && isAvatarDataSaved) {
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 );
clearAvatarAndProfileCache(defaultScreenName); 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 @@
<div style="font-size:80%;text-align: center;" class="secret-key-container"> <div style="font-size:80%;text-align: center;" class="secret-key-container">
<span class="label">Secret key:</span> <span class="secret-key"></span> <span class="label">Secret key:</span> <span class="secret-key"></span>
</div> </div>
</div> </div>
</div>
<!-- ÁREA DE POSTS END -->
<input type="file" id="avatar-file" name="avatar_files" style="display:none;"/> <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> </body>
</html> </html>

Loading…
Cancel
Save