Browse Source

add the button for manual checking for client (twister-html itself) updates

readme-update
Simon Grim 8 years ago
parent
commit
8399674f3a
  1. 1
      home.html
  2. 12
      js/interface_common.js
  3. 117
      js/interface_localization.js
  4. 163
      js/mobile_abstract.js
  5. 2
      network.html

1
home.html

@ -53,6 +53,7 @@
<a class="dropdown-menu-item" href="options.html">Options</a> <a class="dropdown-menu-item" href="options.html">Options</a>
<a class="dropdown-menu-item" href="network.html">Network config</a> <a class="dropdown-menu-item" href="network.html">Network config</a>
<a class="dropdown-menu-item" href="profile-edit.html">Setup account</a> <a class="dropdown-menu-item" href="profile-edit.html">Setup account</a>
<a class="dropdown-menu-item updates-check-client">Check for client's updates</a>
<a class="dropdown-menu-item dropdown-menu-following" href="#following">Following users</a> <a class="dropdown-menu-item dropdown-menu-following" href="#following">Following users</a>
<a class="dropdown-menu-item" href="login.html">Change user</a> <a class="dropdown-menu-item" href="login.html">Change user</a>
<a class="dropdown-menu-item promoted-posts-only selectable_theme theme_original theme_calm" href="#">Switch to Promoted posts</a> <a class="dropdown-menu-item promoted-posts-only selectable_theme theme_original theme_calm" href="#">Switch to Promoted posts</a>

12
js/interface_common.js

@ -16,7 +16,10 @@ var twister = {
tmpl: { // templates pointers are stored here tmpl: { // templates pointers are stored here
root: $('<div>') // templates should be detached from DOM and attached here; use extractTemplate() root: $('<div>') // templates should be detached from DOM and attached here; use extractTemplate()
}, },
modal: {} modal: {},
var: {
updatesCheckClient: {}
}
}; };
var window_scrollY = 0; var window_scrollY = 0;
var _watchHashChangeRelaxDontDoIt = window.location.hash === '' ? true : false; var _watchHashChangeRelaxDontDoIt = window.location.hash === '' ? true : false;
@ -2701,6 +2704,13 @@ function initInterfaceCommon() {
$('.uri-shortener').on('mouseup', {route: '#/uri-shortener'}, routeOnClick); $('.uri-shortener').on('mouseup', {route: '#/uri-shortener'}, routeOnClick);
$('.updates-check-client').text(polyglot.t('updates_check_client'))
.on('mouseup', function (event) {
muteEvent(event);
checkUpdatesClient(true);
}
);
$('.post-area-new textarea') $('.post-area-new textarea')
.on('focus', .on('focus',
function (event) { function (event) {

117
js/interface_localization.js

@ -45,6 +45,7 @@ if(preferredLanguage == "en"){
"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", "btn_ok": "Okay",
"Cancel": "Cancel", "Cancel": "Cancel",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -191,6 +192,14 @@ if(preferredLanguage == "en"){
"Unfollow": "Unfollow", "Unfollow": "Unfollow",
"Update": "Update", "Update": "Update",
"Auto updating": "Automatic updating", "Auto updating": "Automatic updating",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "Updating status...", // status of block chain "Updating status...": "Updating status...", // status of block chain
"user_not_yet_accepted": "Other peers have not yet accepted this new user.\n" + "user_not_yet_accepted": "Other peers have not yet accepted this new user.\n" +
"Unfortunately it is not possible to save profile\n" + "Unfortunately it is not possible to save profile\n" +
@ -396,6 +405,7 @@ if(preferredLanguage == "es"){
"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", "btn_ok": "Okay",
"Cancel": "Cancelar", "Cancel": "Cancelar",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -542,6 +552,14 @@ if(preferredLanguage == "es"){
"Unfollow": "Dejar de seguir", "Unfollow": "Dejar de seguir",
"Update": "Actualizar", "Update": "Actualizar",
"Auto updating": "Auto updating", "Auto updating": "Auto updating",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "Actualización del estado ...", // status of block chain "Updating status...": "Actualización del estado ...", // status of block chain
"user_not_yet_accepted": "Otros pares no han aceptado este nuevo usuario.\n" + "user_not_yet_accepted": "Otros pares no han aceptado este nuevo usuario.\n" +
"Por desgracia, no es posible guardar el perfil\n" + "Por desgracia, no es posible guardar el perfil\n" +
@ -744,6 +762,7 @@ if(preferredLanguage == "uk"){
"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", "btn_ok": "Okay",
"Cancel": "Відміна", "Cancel": "Відміна",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -891,6 +910,14 @@ if(preferredLanguage == "uk"){
"Unfollow": "Відписатись", "Unfollow": "Відписатись",
"Update": "Оновити", "Update": "Оновити",
"Auto updating": "Автоматичне оновлення", "Auto updating": "Автоматичне оновлення",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "Оновлення статусу...", // status of block chain "Updating status...": "Оновлення статусу...", // status of block chain
"user_not_yet_accepted": "Триває підтвердження нового користувача.\n" + "user_not_yet_accepted": "Триває підтвердження нового користувача.\n" +
"У цей час не можна редагувати профіль та надсилати повідомлення.\n\n" + "У цей час не можна редагувати профіль та надсилати повідомлення.\n\n" +
@ -1090,6 +1117,7 @@ if(preferredLanguage == "zh-CN"){
"busted_avowal": "系统检测到此用户试图在这里注入恶意代码", "busted_avowal": "系统检测到此用户试图在这里注入恶意代码",
"btn_ok": "Okay", "btn_ok": "Okay",
"Cancel": "取消", "Cancel": "取消",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -1236,6 +1264,14 @@ if(preferredLanguage == "zh-CN"){
"Unfollow": "取消关注", "Unfollow": "取消关注",
"Update": "更新", "Update": "更新",
"Auto updating": "自动更新", "Auto updating": "自动更新",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "状态更新中...", // status of block chain "Updating status...": "状态更新中...", // status of block chain
"user_not_yet_accepted": "其他节点还没有接受这个新用户。\n" + "user_not_yet_accepted": "其他节点还没有接受这个新用户。\n" +
"很抱歉,现在你还不能保存你的个人简介\n" + "很抱歉,现在你还不能保存你的个人简介\n" +
@ -1441,6 +1477,7 @@ if(preferredLanguage == "nl"){
"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", "btn_ok": "Okay",
"Cancel": "Annuleren", "Cancel": "Annuleren",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -1587,6 +1624,14 @@ if(preferredLanguage == "nl"){
"Unfollow": "Ontvolgen", "Unfollow": "Ontvolgen",
"Update": "Update", "Update": "Update",
"Auto updating": "Auto updating", "Auto updating": "Auto updating",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "Status aan het updaten...", // status of block chain "Updating status...": "Status aan het updaten...", // status of block chain
"user_not_yet_accepted": "Other peers have not yet accepted this new user.\n" + "user_not_yet_accepted": "Other peers have not yet accepted this new user.\n" +
"Unfortunately it is not possible to save profile\n" + "Unfortunately it is not possible to save profile\n" +
@ -1789,6 +1834,7 @@ if(preferredLanguage == "it"){
"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", "btn_ok": "Okay",
"Cancel": "Cancella", "Cancel": "Cancella",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -1935,6 +1981,14 @@ if(preferredLanguage == "it"){
"Unfollow": "Smetti di seguire", "Unfollow": "Smetti di seguire",
"Update": "Aggiorna", "Update": "Aggiorna",
"Auto updating": "Auto updating", "Auto updating": "Auto updating",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "Aggiornamento in corso...", // status of block chain "Updating status...": "Aggiornamento in corso...", // status of block chain
"user_not_yet_accepted": "Gli altri nodi non hanno ancora accettato il nuovo utente.\n" + "user_not_yet_accepted": "Gli altri nodi non hanno ancora accettato il nuovo utente.\n" +
"Al momento non puoi salvare il profilo o spedire messaggi.\n" + "Al momento non puoi salvare il profilo o spedire messaggi.\n" +
@ -2135,6 +2189,7 @@ if(preferredLanguage == "fr"){
"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", "btn_ok": "Okay",
"Cancel": "Annuler", "Cancel": "Annuler",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -2281,6 +2336,14 @@ if(preferredLanguage == "fr"){
"Unfollow": "Se désabonner", "Unfollow": "Se désabonner",
"Update": "Mettre à jour", "Update": "Mettre à jour",
"Auto updating": "Mise à jour automatique", "Auto updating": "Mise à jour automatique",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "Mise à jour du statut...", // status of block chain "Updating status...": "Mise à jour du statut...", // status of block chain
"user_not_yet_accepted": "Les autres pairs n'ont pas encore accepté ce nouvel utilisateur.\n" + "user_not_yet_accepted": "Les autres pairs n'ont pas encore accepté ce nouvel utilisateur.\n" +
"Malheureusement, il n'est pas possible d'enregistrer le profil\n" + "Malheureusement, il n'est pas possible d'enregistrer le profil\n" +
@ -2484,6 +2547,7 @@ if(preferredLanguage == "ru"){
"busted_avowal": "я пойман на попытке вставить этот подозрительный код здесь", "busted_avowal": "я пойман на попытке вставить этот подозрительный код здесь",
"btn_ok": "Лады́", "btn_ok": "Лады́",
"Cancel": "Отмена", "Cancel": "Отмена",
'cant_get_requested_resourse': 'Невозможно получить %{link}\n статус: %{status}.',
"clear_cache": "Очистить кэш", "clear_cache": "Очистить кэш",
"Confirm": "Несомненно", "Confirm": "Несомненно",
"сonfirm_group_leaving_header": "Подтверждение ухода из группы", "сonfirm_group_leaving_header": "Подтверждение ухода из группы",
@ -2630,6 +2694,14 @@ if(preferredLanguage == "ru"){
"Unfollow": "Отписаться", "Unfollow": "Отписаться",
"Update": "Обновить", "Update": "Обновить",
"Auto updating": "Автоматическое обновление", "Auto updating": "Автоматическое обновление",
'updates_are_available': 'Доступны обновления',
'updates_not_available': 'Обновления не доступны',
'updates_check_client': 'Проверить обновления клиента',
'updates_repo_overview': 'Мы сейчас на ветке %{branch} в %{repo} на коммите\n %{commit} от %{date},\n'
+ 'а вот HEAD её источника уже на коммите\n %{commitUpstream} от %{dateUpstream}.',
'updates_checkout_diff': 'Смотри [сравнение на GitHub](%{link}), чтобы узнать каковы изменения.',
'updates_checkout_diff_nfmt': 'Смотри сравнение на GitHub, чтобы узнать каковы изменения:\n %{link}',
'updates_upstream_isnt_changed': 'Соответствующая ветка в исходном репозитории выглядит неизменённой.',
"Updating status...": "Обновление информации...", // status of block chain "Updating status...": "Обновление информации...", // status of block chain
"user_not_yet_accepted": "Другие участники сети еще не получили информацию о новом пользователе.\n" + "user_not_yet_accepted": "Другие участники сети еще не получили информацию о новом пользователе.\n" +
"К сожалению, сейчас вы не можете редактировать ваш профиль\n" + "К сожалению, сейчас вы не можете редактировать ваш профиль\n" +
@ -2836,6 +2908,7 @@ if(preferredLanguage == "de"){
"busted_avowal": "Ich bin ertappt, habe versucht, hier Schadcode einzugeben!", "busted_avowal": "Ich bin ertappt, habe versucht, hier Schadcode einzugeben!",
"btn_ok": "Okay", "btn_ok": "Okay",
"Cancel": "Abbrechen", "Cancel": "Abbrechen",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -2983,6 +3056,14 @@ if(preferredLanguage == "de"){
"Unfollow": "Nicht mehr folgen", "Unfollow": "Nicht mehr folgen",
"Update": "Aktualisieren", "Update": "Aktualisieren",
"Auto updating": "Automatische Aktualisierung", "Auto updating": "Automatische Aktualisierung",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "Status wird aktualisiert...", // status of block chain "Updating status...": "Status wird aktualisiert...", // status of block chain
"user_not_yet_accepted": "Andere Peers haben diesen Benutzter noch nicht akzeptiert.\n" + "user_not_yet_accepted": "Andere Peers haben diesen Benutzter noch nicht akzeptiert.\n" +
"Leider ist es nicht möglich, das Profil zu speichern\n" + "Leider ist es nicht möglich, das Profil zu speichern\n" +
@ -3186,6 +3267,7 @@ if(preferredLanguage == "ja"){
"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", "btn_ok": "Okay",
"Cancel": "キャンセル", "Cancel": "キャンセル",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -3332,6 +3414,14 @@ if(preferredLanguage == "ja"){
"Unfollow": "解除", "Unfollow": "解除",
"Update": "アップデート", "Update": "アップデート",
"Auto updating": "Auto updating", "Auto updating": "Auto updating",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "ブロックチェーンを更新中…", // status of block chain "Updating status...": "ブロックチェーンを更新中…", // status of block chain
"user_not_yet_accepted": "この新ユーザーが他のピアーにまだ認証されていない。\n" + "user_not_yet_accepted": "この新ユーザーが他のピアーにまだ認証されていない。\n" +
"なので、プロファイルの保存やメッセージの投稿は現在不可能です。\n" + "なので、プロファイルの保存やメッセージの投稿は現在不可能です。\n" +
@ -3532,6 +3622,7 @@ if(preferredLanguage == "pt-BR"){
"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", "btn_ok": "Okay",
"Cancel": "Cancelar", "Cancel": "Cancelar",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -3679,6 +3770,14 @@ if(preferredLanguage == "pt-BR"){
"Unfollow": "Deixar de seguir", "Unfollow": "Deixar de seguir",
"Update": "Atualizar", "Update": "Atualizar",
"Auto updating": "Auto updating", "Auto updating": "Auto updating",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "Atualizando estado da Cadeia de Blocos...", // status of block chain "Updating status...": "Atualizando estado da Cadeia de Blocos...", // status of block chain
"URI_shortener_caption": "URI Shortener", "URI_shortener_caption": "URI Shortener",
"user_not_yet_accepted": "Outros nós ainda não aceitaram este novo usuário.\n" + "user_not_yet_accepted": "Outros nós ainda não aceitaram este novo usuário.\n" +
@ -3882,6 +3981,7 @@ if(preferredLanguage == "tr"){
"busted_avowal": "Şüpheli bir şeyler iliştirmeye çalışırken enselendim.", "busted_avowal": "Şüpheli bir şeyler iliştirmeye çalışırken enselendim.",
"btn_ok": "Tamam", "btn_ok": "Tamam",
"Cancel": "İptal", "Cancel": "İptal",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Geçmişi temizle", "clear_cache": "Geçmişi temizle",
"Confirm": "Onayla", "Confirm": "Onayla",
"сonfirm_group_leaving_header": "Gruptan ayrılmayı onayla", "сonfirm_group_leaving_header": "Gruptan ayrılmayı onayla",
@ -4028,6 +4128,14 @@ if(preferredLanguage == "tr"){
"Unfollow": "Takibi bırak", "Unfollow": "Takibi bırak",
"Update": "Güncelle", "Update": "Güncelle",
"Auto updating": "Otomatik güncelleme", "Auto updating": "Otomatik güncelleme",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "Durum güncelleniyor...", // status of block chain "Updating status...": "Durum güncelleniyor...", // status of block chain
"user_not_yet_accepted": "Diğer eşler bu yeni kullanıcıyı henüz kabul etmediler.\n" + "user_not_yet_accepted": "Diğer eşler bu yeni kullanıcıyı henüz kabul etmediler.\n" +
"Malesef profili kaydetmek ya da bu durumda\n" + "Malesef profili kaydetmek ya da bu durumda\n" +
@ -4229,6 +4337,7 @@ if(preferredLanguage == "cs"){
"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", "btn_ok": "Okay",
"Cancel": "Zrušit", "Cancel": "Zrušit",
'cant_get_requested_resourse': 'Can\'t get resourse at %{link}\n status: %{status}.',
"clear_cache": "Clear cache", "clear_cache": "Clear cache",
"Confirm": "Confirm", "Confirm": "Confirm",
"сonfirm_group_leaving_header": "Confirm group leaving", "сonfirm_group_leaving_header": "Confirm group leaving",
@ -4376,6 +4485,14 @@ if(preferredLanguage == "cs"){
"Unfollow": "Přestat sledovat", "Unfollow": "Přestat sledovat",
"Update": "Aktualizovat", "Update": "Aktualizovat",
"Auto updating": "Automatická aktualizace", "Auto updating": "Automatická aktualizace",
'updates_are_available': 'Updates are available',
'updates_not_available': 'No updates are available',
'updates_check_client': 'Check for client\'s updates',
'updates_repo_overview': 'Currently we are on the branch %{branch} of %{repo} at the commit\n %{commit} of %{date}\n'
+ 'but HEAD of its source is already at the commit\n %{commitUpstream} of %{dateUpstream}.',
'updates_checkout_diff': 'Checkout [the diff on GitHub](%{link}) to learn what is changed.',
'updates_checkout_diff_nfmt': 'Checkout the diff on GitHub to learn what is changed:\n %{link}',
'updates_upstream_isnt_changed': 'A corresponding branch of the source repository seems to have not changed.',
"Updating status...": "Aktualizuji stav...", // status of block chain "Updating status...": "Aktualizuji stav...", // status of block chain
"user_not_yet_accepted": "Ostatní uzly ještě nepřijaly tohoto nového uživatele.\n" + "user_not_yet_accepted": "Ostatní uzly ještě nepřijaly tohoto nového uživatele.\n" +
"Proto zatím není možné uložit profil nebo vkládat příspěvky.\n" + "Proto zatím není možné uložit profil nebo vkládat příspěvky.\n" +

163
js/mobile_abstract.js

@ -592,3 +592,166 @@ function filterLang(string) {
} }
} }
function checkUpdatesClient(alertIfNoUpdates) {
function handleGetFail(jqXHR) {
twister.var.updatesCheckClient.isOngoing = false;
console.warn(polyglot.t('cant_get_requested_resourse', {link: this.url, status: jqXHR.status + ', \'' + jqXHR.statusText + '\''}));
if (alertIfNoUpdates) {
if ($.hasOwnProperty('mobile'))
alert(polyglot.t('updates_not_available') + '.\n\n'
+ polyglot.t('cant_get_requested_resourse', {link: this.url, status: jqXHR.status + ', \'' + jqXHR.statusText + '\''})
);
else
alertPopup({
txtTitle: polyglot.t('updates_not_available'),
txtMessage: polyglot.t('cant_get_requested_resourse', {link: this.url, status: jqXHR.status + ', ~' + jqXHR.statusText + '~'})
});
}
}
if (twister.var.updatesCheckClient.isOngoing)
return;
twister.var.updatesCheckClient.isOngoing = true;
$.get('.git/HEAD', function (ret) {
if (ret.slice(0, 16) !== 'ref: refs/heads/') {
twister.var.updatesCheckClient.isOngoing = false;
if (alertIfNoUpdates)
alert(polyglot.t('updates_not_available') + '.\n\nCan\'t parse local HEAD: unknown syntax, FUBAR!');
return;
}
var branch = ret.slice(16).trim();
$.get('.git/refs/heads/' + branch, function (ret) {
var commit = ret.trim();
if (!commit) {
twister.var.updatesCheckClient.isOngoing = false;
if (alertIfNoUpdates)
alert(polyglot.t('updates_not_available') + '.\n\nCan\'t parse local HEAD: \'' + '.git/refs/heads/' + branch + '\' is empty, FUBAR!');
return;
}
var repo = 'twister-html'; // TODO source repo selection in options
var repoOwner = 'miguelfreitas';
// TODO notification if local branch was changed ('r u wanna reload the page?')
/*if (!twister.var.updatesCheckClient.formerBranch || !twister.var.updatesCheckClient.formerCommit) {
twister.var.updatesCheckClient.formerBranch = branch;
twister.var.updatesCheckClient.formerCommit = commit;
}*/
console.log('currently we are on the branch \'' + branch + '\' of ' + repo + ' at the commit ' + commit);
$.get('https://api.github.com/repos/' + repoOwner + '/' + repo + '/branches', function (ret) {
for (var i = 0; i < ret.length; i++) {
if (ret[i].name === branch) {
if (ret[i].commit.sha === commit) {
twister.var.updatesCheckClient.isOngoing = false;
console.log(polyglot.t('updates_upstream_isnt_changed'));
if (alertIfNoUpdates) {
if ($.hasOwnProperty('mobile'))
alert(polyglot.t('updates_not_available') + '.\n\n'
+ polyglot.t('updates_upstream_isnt_changed')
);
else
alertPopup({
txtTitle: polyglot.t('updates_not_available'),
txtMessage: polyglot.t('updates_upstream_isnt_changed')
});
}
} else {
console.log('source branch has a different HEAD: ' + ret[i].commit.sha);
var commitUpstream = ret[i].commit.sha;
$.get('https://api.github.com/repos/' + repoOwner + '/' + repo + '/git/commits/' + commit, function (ret) {
if (ret.sha !== commit) { // the response is wrong if so, should be 404 instead
twister.var.updatesCheckClient.isOngoing = false;
console.log('upstream tree doesn\'t have our most recent commit,\nlooks like we are in the process of development locally.');
if (alertIfNoUpdates)
alert(polyglot.t('updates_not_available') + '.\n\nUpstream tree doesn\'t have our most recent commit,\nlooks like we are in the process of development locally.');
return;
}
commit = ret;
$.get('https://api.github.com/repos/' + repoOwner + '/' + repo + '/git/commits/' + commitUpstream, function (ret) {
twister.var.updatesCheckClient.isOngoing = false;
if (ret.sha !== commitUpstream) { // the response is wrong if so, should be 404 instead
console.warn('upstream tree doesn\'t have the commit which is named most recent in the list of branches, FUBAR!');
if (alertIfNoUpdates)
alert(polyglot.t('updates_not_available') + '.\n\nUpstream tree doesn\'t have the commit which is named most recent in the list of branches, FUBAR!');
return;
}
commitUpstream = ret;
var linkGitHubDiff = 'https://github.com/' + repoOwner + '/' + repo + '/compare/' + commit.sha + '...' + repoOwner + ':' + branch;
console.log(polyglot.t('updates_checkout_diff_nfmt', {link: linkGitHubDiff}));
if ($.hasOwnProperty('mobile'))
alert(polyglot.t('updates_are_available') + '.\n\n'
+ polyglot.t('updates_repo_overview', {
branch: '\'' + branch + '\'',
repo: repo,
commit: commit.sha,
date: new Date(commit.author.date).toString().replace(/ GMT.*/g, ''),
commitUpstream: commitUpstream.sha,
dateUpstream: new Date(commitUpstream.author.date).toString().replace(/ GMT.*/g, '')
}) + '\n\n'
+ polyglot.t('updates_checkout_diff_nfmt', {link: linkGitHubDiff})
);
else
alertPopup({
txtTitle: polyglot.t('updates_are_available'),
txtMessage: polyglot.t('updates_repo_overview', {
branch: '~' + branch + '~',
repo: repo,
commit: '*' + commit.sha + '*',
date: new Date(commit.author.date).toString().replace(/ GMT.*/g, ''),
commitUpstream: '*' + commitUpstream.sha + '*',
dateUpstream: new Date(commitUpstream.author.date).toString().replace(/ GMT.*/g, '')
}) + '\n\n'
+ polyglot.t('updates_checkout_diff', {link: linkGitHubDiff})
});
}).fail(function (jqXHR) {
if (jqXHR.status === 404) {
twister.var.updatesCheckClient.isOngoing = false;
console.warn('upstream tree doesn\'t have the commit which is named most recent in the list of branches, FUBAR!');
if (alertIfNoUpdates)
alert(polyglot.t('updates_not_available') + '.\n\nUpstream tree doesn\'t have the commit which is named most recent in the list of branches, FUBAR!');
} else
handleGetFail(jqXHR);
});
}).fail(function (jqXHR) {
if (jqXHR.status === 404) {
twister.var.updatesCheckClient.isOngoing = false;
console.log('upstream tree doesn\'t have our most recent commit,\nlooks like we are in the process of development locally.');
if (alertIfNoUpdates)
alert(polyglot.t('updates_not_available') + '.\n\nUpstream tree doesn\'t have our most recent commit,\nlooks like we are in the process of development locally.');
} else
handleGetFail(jqXHR);
});
}
return;
}
}
twister.var.updatesCheckClient.isOngoing = false;
console.log('upstream tree doesn\'t have our branch,\nlooks like we are in the process of development locally.');
if (alertIfNoUpdates)
alert(polyglot.t('updates_not_available') + '.\n\nUpstream tree doesn\'t have our branch,\nlooks like we are in the process of development locally.');
}).fail(handleGetFail);
}).fail(handleGetFail);
}).fail(handleGetFail);
}

2
network.html

@ -45,7 +45,7 @@
</div> </div>
<a class="dropdown-menu-item" href="options.html">Options</a> <a class="dropdown-menu-item" href="options.html">Options</a>
<a class="dropdown-menu-item" href="profile-edit.html">Setup account</a> <a class="dropdown-menu-item" href="profile-edit.html">Setup account</a>
<a class="dropdown-menu-item" href="network.html">Network config</a> <a class="dropdown-menu-item updates-check-client">Check for client's updates</a>
<a class="dropdown-menu-item" href="login.html">Change user</a> <a class="dropdown-menu-item" href="login.html">Change user</a>
</div> </div>
</a> </a>

Loading…
Cancel
Save