From cce8193ebcedbeebade2f3aaf08d2a86ccdc2442 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Thu, 11 Sep 2014 17:06:06 +0400 Subject: [PATCH] Init separate mobile version Attach desktop/mobile styles conditionally Separate templates for mobile Make ConfigStorage angular-independent --- app/css/desktop.css | 0 app/css/{app_mobile.css => mobile.css} | 7 +- app/index.html | 3 +- app/js/app.js | 18 +- app/js/controllers.js | 38 +-- app/js/directives.js | 44 +-- app/js/filters.js | 2 +- app/js/init.js | 28 +- app/js/lib/config.js | 129 ++++++++ app/js/lib/ng_utils.js | 129 +------- app/js/lib/utils.js | 4 + app/js/services.js | 57 ++-- .../{ => desktop}/changelog_modal.html | 0 .../{ => desktop}/chat_create_modal.html | 0 .../{ => desktop}/chat_edit_modal.html | 0 app/partials/{ => desktop}/chat_modal.html | 0 app/partials/{ => desktop}/confirm_modal.html | 0 .../{ => desktop}/contacts_modal.html | 0 .../{ => desktop}/country_select_modal.html | 0 app/partials/{ => desktop}/dialog.html | 0 .../{ => desktop}/edit_contact_modal.html | 0 app/partials/{ => desktop}/error_modal.html | 0 app/partials/{ => desktop}/full_gif.html | 0 app/partials/{ => desktop}/full_photo.html | 0 app/partials/{ => desktop}/full_video.html | 0 app/partials/{ => desktop}/head.html | 0 app/partials/{ => desktop}/im.html | 0 .../{ => desktop}/import_contact_modal.html | 0 app/partials/{ => desktop}/login.html | 0 app/partials/{ => desktop}/message.html | 0 .../{ => desktop}/message_attach_audio.html | 0 .../{ => desktop}/message_attach_contact.html | 0 .../message_attach_document.html | 0 .../{ => desktop}/message_attach_map.html | 0 .../{ => desktop}/message_attach_pending.html | 0 .../{ => desktop}/message_attach_photo.html | 0 .../{ => desktop}/message_attach_video.html | 0 .../{ => desktop}/message_service.html | 0 app/partials/{ => desktop}/peer_select.html | 0 app/partials/{ => desktop}/photo_modal.html | 0 .../{ => desktop}/profile_edit_modal.html | 0 .../{ => desktop}/settings_modal.html | 0 app/partials/{ => desktop}/user_modal.html | 0 app/partials/{ => desktop}/video_modal.html | 0 app/partials/{ => desktop}/welcome.html | 0 app/partials/mobile/changelog_modal.html | 199 +++++++++++++ app/partials/mobile/chat_create_modal.html | 24 ++ app/partials/mobile/chat_edit_modal.html | 24 ++ app/partials/mobile/confirm_modal.html | 65 ++++ app/partials/mobile/dialog.html | 89 ++++++ app/partials/mobile/edit_contact_modal.html | 30 ++ app/partials/mobile/error_modal.html | 87 ++++++ app/partials/mobile/full_gif.html | 25 ++ app/partials/mobile/full_photo.html | 19 ++ app/partials/mobile/full_video.html | 26 ++ app/partials/mobile/head.html | 132 +++++++++ app/partials/mobile/im.html | 278 ++++++++++++++++++ app/partials/mobile/import_contact_modal.html | 31 ++ app/partials/mobile/login.html | 84 ++++++ app/partials/mobile/message.html | 79 +++++ app/partials/mobile/message_attach_audio.html | 33 +++ .../mobile/message_attach_contact.html | 8 + .../mobile/message_attach_document.html | 39 +++ app/partials/mobile/message_attach_map.html | 3 + .../mobile/message_attach_pending.html | 17 ++ app/partials/mobile/message_attach_photo.html | 7 + app/partials/mobile/message_attach_video.html | 31 ++ app/partials/mobile/message_service.html | 32 ++ app/partials/mobile/photo_modal.html | 22 ++ app/partials/mobile/profile_edit_modal.html | 27 ++ app/partials/mobile/video_modal.html | 21 ++ app/partials/mobile/welcome.html | 56 ++++ app/webogram.appcache | 2 +- 73 files changed, 1730 insertions(+), 219 deletions(-) create mode 100644 app/css/desktop.css rename app/css/{app_mobile.css => mobile.css} (99%) rename app/partials/{ => desktop}/changelog_modal.html (100%) rename app/partials/{ => desktop}/chat_create_modal.html (100%) rename app/partials/{ => desktop}/chat_edit_modal.html (100%) rename app/partials/{ => desktop}/chat_modal.html (100%) rename app/partials/{ => desktop}/confirm_modal.html (100%) rename app/partials/{ => desktop}/contacts_modal.html (100%) rename app/partials/{ => desktop}/country_select_modal.html (100%) rename app/partials/{ => desktop}/dialog.html (100%) rename app/partials/{ => desktop}/edit_contact_modal.html (100%) rename app/partials/{ => desktop}/error_modal.html (100%) rename app/partials/{ => desktop}/full_gif.html (100%) rename app/partials/{ => desktop}/full_photo.html (100%) rename app/partials/{ => desktop}/full_video.html (100%) rename app/partials/{ => desktop}/head.html (100%) rename app/partials/{ => desktop}/im.html (100%) rename app/partials/{ => desktop}/import_contact_modal.html (100%) rename app/partials/{ => desktop}/login.html (100%) rename app/partials/{ => desktop}/message.html (100%) rename app/partials/{ => desktop}/message_attach_audio.html (100%) rename app/partials/{ => desktop}/message_attach_contact.html (100%) rename app/partials/{ => desktop}/message_attach_document.html (100%) rename app/partials/{ => desktop}/message_attach_map.html (100%) rename app/partials/{ => desktop}/message_attach_pending.html (100%) rename app/partials/{ => desktop}/message_attach_photo.html (100%) rename app/partials/{ => desktop}/message_attach_video.html (100%) rename app/partials/{ => desktop}/message_service.html (100%) rename app/partials/{ => desktop}/peer_select.html (100%) rename app/partials/{ => desktop}/photo_modal.html (100%) rename app/partials/{ => desktop}/profile_edit_modal.html (100%) rename app/partials/{ => desktop}/settings_modal.html (100%) rename app/partials/{ => desktop}/user_modal.html (100%) rename app/partials/{ => desktop}/video_modal.html (100%) rename app/partials/{ => desktop}/welcome.html (100%) create mode 100644 app/partials/mobile/changelog_modal.html create mode 100644 app/partials/mobile/chat_create_modal.html create mode 100644 app/partials/mobile/chat_edit_modal.html create mode 100644 app/partials/mobile/confirm_modal.html create mode 100644 app/partials/mobile/dialog.html create mode 100644 app/partials/mobile/edit_contact_modal.html create mode 100644 app/partials/mobile/error_modal.html create mode 100644 app/partials/mobile/full_gif.html create mode 100644 app/partials/mobile/full_photo.html create mode 100644 app/partials/mobile/full_video.html create mode 100644 app/partials/mobile/head.html create mode 100644 app/partials/mobile/im.html create mode 100644 app/partials/mobile/import_contact_modal.html create mode 100644 app/partials/mobile/login.html create mode 100644 app/partials/mobile/message.html create mode 100644 app/partials/mobile/message_attach_audio.html create mode 100644 app/partials/mobile/message_attach_contact.html create mode 100644 app/partials/mobile/message_attach_document.html create mode 100644 app/partials/mobile/message_attach_map.html create mode 100644 app/partials/mobile/message_attach_pending.html create mode 100644 app/partials/mobile/message_attach_photo.html create mode 100644 app/partials/mobile/message_attach_video.html create mode 100644 app/partials/mobile/message_service.html create mode 100644 app/partials/mobile/photo_modal.html create mode 100644 app/partials/mobile/profile_edit_modal.html create mode 100644 app/partials/mobile/video_modal.html create mode 100644 app/partials/mobile/welcome.html diff --git a/app/css/desktop.css b/app/css/desktop.css new file mode 100644 index 00000000..e69de29b diff --git a/app/css/app_mobile.css b/app/css/mobile.css similarity index 99% rename from app/css/app_mobile.css rename to app/css/mobile.css index 855f6739..38f15631 100644 --- a/app/css/app_mobile.css +++ b/app/css/mobile.css @@ -1,5 +1,3 @@ -@media (max-width: 479px) { - html { background: #FFF; } @@ -1286,7 +1284,4 @@ a.mobile_modal_action .tg_checkbox_label { } .countries_scrollable_wrap a.countries_modal_country { padding: 8px 8px; -} - - -} +} \ No newline at end of file diff --git a/app/index.html b/app/index.html index 503713d9..8828f037 100644 --- a/app/index.html +++ b/app/index.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,6 @@ - diff --git a/app/js/app.js b/app/js/app.js index c382122c..3f4f3b4a 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -53,21 +53,9 @@ config(['$locationProvider', '$routeProvider', '$compileProvider', 'StorageProvi StorageProvider.setPrefix('t_'); } - $routeProvider.when('/', {templateUrl: 'partials/welcome.html', controller: 'AppWelcomeController'}); - $routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'AppLoginController'}); - $routeProvider.when('/im', {templateUrl: 'partials/im.html', controller: 'AppIMController', reloadOnSearch: false}); + $routeProvider.when('/', {templateUrl: templateUrl('welcome'), controller: 'AppWelcomeController'}); + $routeProvider.when('/login', {templateUrl: templateUrl('login'), controller: 'AppLoginController'}); + $routeProvider.when('/im', {templateUrl: templateUrl('im'), controller: 'AppIMController', reloadOnSearch: false}); $routeProvider.otherwise({redirectTo: '/'}); }]); - - -(function () { - var classes = [ - Config.Navigator.osX ? 'osx' : 'non_osx', - Config.Navigator.retina ? 'is_2x' : 'is_1x' - ]; - if (Config.Modes.ios_standalone) { - classes.push('ios_standalone'); - } - $(document.body).addClass(classes.join(' ')); -})(); \ No newline at end of file diff --git a/app/js/controllers.js b/app/js/controllers.js index 4a8dbcac..df1f32bc 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -42,16 +42,13 @@ angular.module('myApp.controllers', []) $scope.callPending = {}; $scope.chooseCountry = function () { - var tUrl = 'partials/country_select_modal.html', - className = 'countries_modal_window page_modal'; - - if (Config.Navigator.mobile) { - tUrl = 'partials/mobile/country_select_modal.html'; + var className = 'countries_modal_window page_modal'; + if (Config.Mobile) { className += ' mobile_modal'; } var modal = $modal.open({ - templateUrl: tUrl, + templateUrl: templateUrl('country_select_modal'), controller: 'CountrySelectModalController', windowClass: className }); @@ -62,7 +59,7 @@ angular.module('myApp.controllers', []) function initPhoneCountry () { var langCode = (navigator.language || '').toLowerCase(), countryIso2 = Config.LangCountries[langCode], - shouldPregenerate = !Config.Navigator.mobile; + shouldPregenerate = !Config.Mobile; if (['en', 'en-us', 'en-uk'].indexOf(langCode) == -1) { if (countryIso2 !== undefined) { @@ -316,16 +313,13 @@ angular.module('myApp.controllers', []) $scope.historyState = {selectActions: false, typing: []}; $scope.openSettings = function () { - var tUrl = 'partials/settings_modal.html', - className = 'settings_modal_window page_modal'; - - if (Config.Navigator.mobile) { - tUrl = 'partials/mobile/settings_modal.html'; + var className = 'settings_modal_window page_modal'; + if (Config.Mobile) { className += ' mobile_modal'; } $modal.open({ - templateUrl: tUrl, + templateUrl: templateUrl('settings_modal'), controller: 'SettingsModalController', windowClass: className }); @@ -347,7 +341,7 @@ angular.module('myApp.controllers', []) scope.userIDs = userIDs; $modal.open({ - templateUrl: 'partials/chat_create_modal.html', + templateUrl: templateUrl('chat_create_modal'), controller: 'ChatCreateModalController', scope: scope, windowClass: 'group_edit_modal_window' @@ -535,7 +529,7 @@ angular.module('myApp.controllers', []) } }); - if (Config.Navigator.mobile) { + if (Config.Mobile) { $scope.$watch('curDialog.peer', function () { $scope.$broadcast('ui_dialogs_update') }); @@ -879,7 +873,7 @@ angular.module('myApp.controllers', []) var curJump = jump, curMoreJump = moreJump, inputMediaFilter = $scope.historyFilter.mediaType && {_: inputMediaFilters[$scope.historyFilter.mediaType]}, - limit = Config.Navigator.mobile ? 20 : 0, + limit = Config.Mobile ? 20 : 0, getMessagesPromise = inputMediaFilter ? AppMessagesManager.getSearch($scope.curDialog.inputPeer, '', inputMediaFilter, maxID, limit) : AppMessagesManager.getHistory($scope.curDialog.inputPeer, maxID, limit); @@ -920,7 +914,7 @@ angular.module('myApp.controllers', []) else if (forceRecent) { limit = 10; } - else if (Config.Navigator.mobile) { + else if (Config.Mobile) { limit = 20; } @@ -1330,7 +1324,7 @@ angular.module('myApp.controllers', []) AppPhotosManager.downloadPhoto($scope.photoID); }; - if (!$scope.messageID || Config.Navigator.mobile) { + if (!$scope.messageID || Config.Mobile) { $scope.nav.next = function () { $modalInstance.close(); } @@ -1352,7 +1346,7 @@ angular.module('myApp.controllers', []) }; - if (Config.Navigator.mobile) { + if (Config.Mobile) { $scope.canForward = true; $scope.canDelete = true; return; @@ -1676,7 +1670,7 @@ angular.module('myApp.controllers', []) }; $modal.open({ - templateUrl: edit ? 'partials/edit_contact_modal.html' : 'partials/import_contact_modal.html', + templateUrl: templateUrl(edit ? 'edit_contact_modal' : 'import_contact_modal'), controller: 'ImportContactModalController', windowClass: 'import_contact_modal_window page_modal', scope: scope @@ -1873,7 +1867,7 @@ angular.module('myApp.controllers', []) scope.chatID = $scope.chatID; $modal.open({ - templateUrl: 'partials/chat_edit_modal.html', + templateUrl: templateUrl('chat_edit_modal'), controller: 'ChatEditModalController', scope: scope, windowClass: 'group_edit_modal_window' @@ -1966,7 +1960,7 @@ angular.module('myApp.controllers', []) $scope.editProfile = function () { $modal.open({ - templateUrl: 'partials/profile_edit_modal.html', + templateUrl: templateUrl('profile_edit_modal'), controller: 'ProfileEditModalController', windowClass: 'profile_edit_modal_window page_modal' }); diff --git a/app/js/directives.js b/app/js/directives.js index 6eee4a3e..cb777e31 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -15,61 +15,61 @@ angular.module('myApp.directives', ['myApp.filters']) .directive('myHead', function() { return { restrict: 'AE', - templateUrl: 'partials/head.html' + templateUrl: templateUrl('head') }; }) .directive('myDialog', function() { return { restrict: 'AE', - templateUrl: 'partials/dialog.html' + templateUrl: templateUrl('dialog') }; }) .directive('myMessage', function() { return { - templateUrl: 'partials/message.html' + templateUrl: templateUrl('message') }; }) .directive('myServiceMessage', function() { return { - templateUrl: 'partials/message_service.html' + templateUrl: templateUrl('message_service') }; }) .directive('myMessagePhoto', function() { return { - templateUrl: 'partials/message_attach_photo.html' + templateUrl: templateUrl('message_attach_photo') }; }) .directive('myMessageVideo', function() { return { - templateUrl: 'partials/message_attach_video.html' + templateUrl: templateUrl('message_attach_video') }; }) .directive('myMessageDocument', function() { return { - templateUrl: 'partials/message_attach_document.html' + templateUrl: templateUrl('message_attach_document') }; }) .directive('myMessageAudio', function() { return { - templateUrl: 'partials/message_attach_audio.html' + templateUrl: templateUrl('message_attach_audio') }; }) .directive('myMessageMap', function() { return { - templateUrl: 'partials/message_attach_map.html' + templateUrl: templateUrl('message_attach_map') }; }) .directive('myMessageContact', function() { return { - templateUrl: 'partials/message_attach_contact.html' + templateUrl: templateUrl('message_attach_contact') }; }) .directive('myMessagePending', function() { return { - templateUrl: 'partials/message_attach_pending.html' + templateUrl: templateUrl('message_attach_pending') }; }) @@ -241,7 +241,7 @@ angular.module('myApp.directives', ['myApp.filters']) dialogsColWrap = $('.im_dialogs_col_wrap')[0], scrollableWrap = $('.im_dialogs_scrollable_wrap', element)[0], headWrap = $('.tg_page_head')[0], - panelWrapSelector = Config.Navigator.mobile && attrs.modal + panelWrapSelector = Config.Mobile && attrs.modal ? '.mobile_modal_body .im_dialogs_panel' : '.im_dialogs_panel', panelWrap = $(panelWrapSelector)[0], @@ -311,7 +311,7 @@ angular.module('myApp.directives', ['myApp.filters']) $(element).css({ height: $($window).height() - (panelWrap ? panelWrap.offsetHeight : 58) - - (Config.Navigator.mobile ? 46 : 200) + (Config.Mobile ? 46 : 200) }); updateScroller(); return; @@ -367,7 +367,7 @@ angular.module('myApp.directives', ['myApp.filters']) height: $($window).height() - (panelWrap && panelWrap.offsetHeight || 0) - (searchWrap && searchWrap.offsetHeight || 0) - - (Config.Navigator.mobile ? 64 : 200) + (Config.Mobile ? 64 : 200) }); $(contactsWrap).nanoScroller(); } @@ -401,7 +401,7 @@ angular.module('myApp.directives', ['myApp.filters']) height: $($window).height() - (panelWrap && panelWrap.offsetHeight || 0) - (searchWrap && searchWrap.offsetHeight || 0) - - (Config.Navigator.mobile ? 46 + 18 : 200) + - (Config.Mobile ? 46 + 18 : 200) }); $(countriesWrap).nanoScroller(); } @@ -679,7 +679,7 @@ angular.module('myApp.directives', ['myApp.filters']) var marginTop = scrollableWrap.offsetHeight - historyMessagesEl.offsetHeight - 20 - - (Config.Navigator.mobile ? 0 : 49); + - (Config.Mobile ? 0 : 49); if (historyMessagesEl.offsetHeight > 0 && marginTop > 0) { $(historyMessagesEl).css({marginTop: marginTop}); @@ -743,7 +743,7 @@ angular.module('myApp.directives', ['myApp.filters']) var self = this; $scope.$apply(function () { $scope.draftMessage.files = Array.prototype.slice.call(self.files); - $scope.draftMessage.isMedia = $(self).hasClass('im_media_attach_input') || Config.Navigator.mobile; + $scope.draftMessage.isMedia = $(self).hasClass('im_media_attach_input') || Config.Mobile; setTimeout(function () { try { self.value = ''; @@ -1054,7 +1054,7 @@ angular.module('myApp.directives', ['myApp.filters']) return { link: link, transclude: true, - templateUrl: 'partials/full_photo.html', + templateUrl: templateUrl('full_photo'), scope: { fullPhoto: '=', thumbLocation: '=' @@ -1133,7 +1133,7 @@ angular.module('myApp.directives', ['myApp.filters']) return { link: link, transclude: true, - templateUrl: 'partials/full_video.html', + templateUrl: templateUrl('full_video'), scope: { video: '=' } @@ -1196,7 +1196,7 @@ angular.module('myApp.directives', ['myApp.filters']) return { link: link, - templateUrl: 'partials/full_gif.html', + templateUrl: templateUrl('full_gif'), scope: { document: '=' } @@ -1393,7 +1393,7 @@ angular.module('myApp.directives', ['myApp.filters']) function link($scope, element, attrs) { attrs.$observe('myModalWidth', function (newW) { - $(element[0].parentNode.parentNode).css({width: parseInt(newW) + (Config.Navigator.mobile ? 0 : 36)}); + $(element[0].parentNode.parentNode).css({width: parseInt(newW) + (Config.Mobile ? 0 : 36)}); }); }; @@ -1496,7 +1496,7 @@ angular.module('myApp.directives', ['myApp.filters']) function link($scope, element, attrs) { var updateMargin = function () { - if (Config.Navigator.mobile && + if (Config.Mobile && $(element[0].parentNode.parentNode.parentNode).hasClass('page_modal')) { return; } diff --git a/app/js/filters.js b/app/js/filters.js index 6f0f428a..c7e9afe0 100644 --- a/app/js/filters.js +++ b/app/js/filters.js @@ -78,7 +78,7 @@ angular.module('myApp.filters', []) .filter('time', ['$filter', function($filter) { var cachedDates = {}, dateFilter = $filter('date'), - format = Config.Navigator.mobile ? 'HH:mm' : 'HH:mm:ss'; + format = Config.Mobile ? 'HH:mm' : 'HH:mm:ss'; return function (timestamp) { if (cachedDates[timestamp]) { diff --git a/app/js/init.js b/app/js/init.js index 0aea81b7..2311d528 100644 --- a/app/js/init.js +++ b/app/js/init.js @@ -1,4 +1,4 @@ -;(function () { +;(function initAutoUpgrade () { // Prevent click-jacking try { @@ -61,3 +61,29 @@ scheduleUpdate(3000); window.addEventListener('load', attach); })(); + +(function initApplication () { + var classes = [ + Config.Navigator.osX ? 'osx' : 'non_osx', + Config.Navigator.retina ? 'is_2x' : 'is_1x' + ]; + if (Config.Modes.ios_standalone) { + classes.push('ios_standalone'); + } + $(document.body).addClass(classes.join(' ')); + + ConfigStorage.get('current_layout', function (layout) { + switch (layout) { + case 'mobile': Config.Mobile = true; break; + case 'desktop': Config.Mobile = false; break; + default: Config.Mobile = Config.Mobile; break; + } + + $('head').append( + '' + ); + $(document).ready(function() { + angular.bootstrap(document, ['myApp']); + }); + }); +})(); \ No newline at end of file diff --git a/app/js/lib/config.js b/app/js/lib/config.js index 9d33d8a5..2ec5cbd7 100644 --- a/app/js/lib/config.js +++ b/app/js/lib/config.js @@ -62,3 +62,132 @@ Config.EmojiCategorySpritesheetDimens = [[7, 27], [4, 29], [7, 33], [3, 34], [6, Config.CountryCodes = [["AB", "Abkhazia", "+7 840", "+7 940", "+995 44"], ["AF", "Afghanistan", "+93"], ["AX", "Åland Islands", "+358 18"], ["AL", "Albania", "+355"], ["DZ", "Algeria", "+213"], ["AS", "American Samoa", "+1 684"], ["AD", "Andorra", "+376"], ["AO", "Angola", "+244"], ["AI", "Anguilla", "+1 264"], ["AG", "Antigua and Barbuda", "+1 268"], ["AR", "Argentina", "+54"], ["AM", "Armenia", "+374"], ["AW", "Aruba", "+297"], ["SH", "Ascension", "+247"], ["AU", "Australia", "+61"], ["AU", "Australian External Territories", "+672"], ["AT", "Austria", "+43"], ["AZ", "Azerbaijan", "+994"], ["BS", "Bahamas", "+1 242"], ["BH", "Bahrain", "+973"], ["BD", "Bangladesh", "+880"], ["BB", "Barbados", "+1 246"], ["AG", "Barbuda", "+1 268"], ["BY", "Belarus", "+375"], ["BE", "Belgium", "+32"], ["BZ", "Belize", "+501"], ["BJ", "Benin", "+229"], ["BM", "Bermuda", "+1 441"], ["BT", "Bhutan", "+975"], ["BO", "Bolivia", "+591"], ["BQ", "Bonaire", "+599 7"], ["BA", "Bosnia and Herzegovina", "+387"], ["BW", "Botswana", "+267"], ["BR", "Brazil", "+55"], ["IO", "British Indian Ocean Territory", "+246"], ["VG", "British Virgin Islands", "+1 284"], ["BN", "Brunei Darussalam", "+673"], ["BG", "Bulgaria", "+359"], ["BF", "Burkina Faso", "+226"], ["MY", "Burma", "+95"], ["BI", "Burundi", "+257"], ["KH", "Cambodia", "+855"], ["CM", "Cameroon", "+237"], ["CA", "Canada", "+1"], ["CV", "Cape Verde", "+238"], ["KY", "Cayman Islands", "+1 345"], ["CF", "Central African Republic", "+236"], ["TD", "Chad", "+235"], ["CL", "Chile", "+56"], ["CN", "China", "+86"], ["CX", "Christmas Island", "+61"], ["CC", "Cocos (Keeling) Islands", "+61"], ["CO", "Colombia", "+57"], ["KM", "Comoros", "+269"], ["CG", "Congo", "+242"], ["CD", "Congo, Democratic Republic of the (Zaire)", "+243"], ["CK", "Cook Islands", "+682"], ["CR", "Costa Rica", "+506"], ["CI", "Côte d'Ivoire", "+225"], ["HR", "Croatia", "+385"], ["CU", "Cuba", "+53"], ["CW", "Curaçao", "+599 9"], ["CY", "Cyprus", "+357"], ["CZ", "Czech Republic", "+420"], ["DK", "Denmark", "+45"], ["DG", "Diego Garcia", "+246"], ["DJ", "Djibouti", "+253"], ["DM", "Dominica", "+1 767"], ["DO", "Dominican Republic", "+1 809", "+1 829", "+1 849"], ["TL", "East Timor", "+670"], ["EC", "Ecuador", "+593"], ["EG", "Egypt", "+20"], ["SV", "El Salvador", "+503"], ["GQ", "Equatorial Guinea", "+240"], ["ER", "Eritrea", "+291"], ["EE", "Estonia", "+372"], ["ET", "Ethiopia", "+251"], ["FK", "Falkland Islands", "+500"], ["FO", "Faroe Islands", "+298"], ["FJ", "Fiji", "+679"], ["FI", "Finland", "+358"], ["FR", "France", "+33"], ["GF", "French Guiana", "+594"], ["PF", "French Polynesia", "+689"], ["GA", "Gabon", "+241"], ["GM", "Gambia", "+220"], ["GE", "Georgia", "+995"], ["DE", "Germany", "+49"], ["GH", "Ghana", "+233"], ["GI", "Gibraltar", "+350"], ["GR", "Greece", "+30"], ["GL", "Greenland", "+299"], ["GD", "Grenada", "+1 473"], ["GP", "Guadeloupe", "+590"], ["GU", "Guam", "+1 671"], ["GT", "Guatemala", "+502"], ["GG", "Guernsey", "+44"], ["GN", "Guinea", "+224"], ["GW", "Guinea-Bissau", "+245"], ["GY", "Guyana", "+592"], ["HT", "Haiti", "+509"], ["HN", "Honduras", "+504"], ["HK", "Hong Kong", "+852"], ["HU", "Hungary", "+36"], ["IS", "Iceland", "+354"], ["IN", "India", "+91"], ["ID", "Indonesia", "+62"], ["IR", "Iran", "+98"], ["IQ", "Iraq", "+964"], ["IE", "Ireland", "+353"], ["IL", "Israel", "+972"], ["IT", "Italy", "+39"], ["JM", "Jamaica", "+1 876"], ["SJ", "Jan Mayen", "+47 79"], ["JP", "Japan", "+81"], ["JE", "Jersey", "+44"], ["JO", "Jordan", "+962"], ["KZ", "Kazakhstan", "+7 6", "+7 7"], ["KE", "Kenya", "+254"], ["KI", "Kiribati", "+686"], ["KP", "Korea, North", "+850"], ["KR", "Korea, South", "+82"], ["KW", "Kuwait", "+965"], ["KG", "Kyrgyzstan", "+996"], ["LA", "Laos", "+856"], ["LV", "Latvia", "+371"], ["LB", "Lebanon", "+961"], ["LS", "Lesotho", "+266"], ["LR", "Liberia", "+231"], ["LY", "Libya", "+218"], ["LI", "Liechtenstein", "+423"], ["LT", "Lithuania", "+370"], ["LU", "Luxembourg", "+352"], ["MO", "Macau", "+853"], ["MK", "Macedonia", "+389"], ["MG", "Madagascar", "+261"], ["MW", "Malawi", "+265"], ["MY", "Malaysia", "+60"], ["MV", "Maldives", "+960"], ["ML", "Mali", "+223"], ["MT", "Malta", "+356"], ["MH", "Marshall Islands", "+692"], ["MQ", "Martinique", "+596"], ["MR", "Mauritania", "+222"], ["MU", "Mauritius", "+230"], ["YT", "Mayotte", "+262"], ["MX", "Mexico", "+52"], ["FM", "Micronesia, Federated States of", "+691"], ["MD", "Moldova", "+373"], ["MC", "Monaco", "+377"], ["MN", "Mongolia", "+976"], ["ME", "Montenegro", "+382"], ["MS", "Montserrat", "+1 664"], ["MA", "Morocco", "+212"], ["MZ", "Mozambique", "+258"], ["NA", "Namibia", "+264"], ["NR", "Nauru", "+674"], ["NP", "Nepal", "+977"], ["NL", "Netherlands", "+31"], ["NC", "New Caledonia", "+687"], ["NZ", "New Zealand", "+64"], ["NI", "Nicaragua", "+505"], ["NE", "Niger", "+227"], ["NG", "Nigeria", "+234"], ["NU", "Niue", "+683"], ["NF", "Norfolk Island", "+672"], ["MP", "Northern Mariana Islands", "+1 670"], ["NO", "Norway", "+47"], ["OM", "Oman", "+968"], ["PK", "Pakistan", "+92"], ["PW", "Palau", "+680"], ["PS", "Palestinian territories", "+970"], ["PA", "Panama", "+507"], ["PG", "Papua New Guinea", "+675"], ["PY", "Paraguay", "+595"], ["PE", "Peru", "+51"], ["PH", "Philippines", "+63"], ["PN", "Pitcairn Islands", "+64"], ["PL", "Poland", "+48"], ["PT", "Portugal", "+351"], ["PR", "Puerto Rico", "+1 787", "+1 939"], ["QA", "Qatar", "+974"], ["RE", "Réunion", "+262"], ["RO", "Romania", "+40"], ["RU", "Russia", "+7"], ["RW", "Rwanda", "+250"], ["BL", "Saint Barthélemy", "+590"], ["SH", "Saint Helena", "+290"], ["KN", "Saint Kitts and Nevis", "+1 869"], ["LC", "Saint Lucia", "+1 758"], ["MF", "Saint Martin (France)", "+590"], ["PM", "Saint Pierre and Miquelon", "+508"], ["VC", "Saint Vincent and the Grenadines", "+1 784"], ["WS", "Samoa", "+685"], ["SM", "San Marino", "+378"], ["ST", "São Tomé and Príncipe", "+239"], ["SA", "Saudi Arabia", "+966"], ["SN", "Senegal", "+221"], ["RS", "Serbia", "+381"], ["SC", "Seychelles", "+248"], ["SL", "Sierra Leone", "+232"], ["SG", "Singapore", "+65"], ["BQ", "Sint Eustatius", "+599 3"], ["SX", "Sint Maarten (Netherlands)", "+1 721"], ["SK", "Slovakia", "+421"], ["SI", "Slovenia", "+386"], ["SB", "Solomon Islands", "+677"], ["SO", "Somalia", "+252"], ["ZA", "South Africa", "+27"], ["GS", "South Georgia and the South Sandwich Islands", "+500"], [false, "South Ossetia", "+995 34"], ["SS", "South Sudan", "+211"], ["ES", "Spain", "+34"], ["LK", "Sri Lanka", "+94"], ["SD", "Sudan", "+249"], ["SR", "Suriname", "+597"], ["SJ", "Svalbard", "+47 79"], ["SZ", "Swaziland", "+268"], ["SE", "Sweden", "+46"], ["CH", "Switzerland", "+41"], ["SY", "Syria", "+963"], ["TW", "Taiwan", "+886"], ["TJ", "Tajikistan", "+992"], ["TZ", "Tanzania", "+255"], ["TH", "Thailand", "+66"], ["TG", "Togo", "+228"], ["TK", "Tokelau", "+690"], ["TO", "Tonga", "+676"], ["TT", "Trinidad and Tobago", "+1 868"], ["TN", "Tunisia", "+216"], ["TR", "Turkey", "+90"], ["TM", "Turkmenistan", "+993"], ["TC", "Turks and Caicos Islands", "+1 649"], ["TV", "Tuvalu", "+688"], ["UG", "Uganda", "+256"], ["UA", "Ukraine", "+380"], ["AE", "United Arab Emirates", "+971"], ["UK", "United Kingdom", "+44"], ["US", "United States", "+1"], ["UY", "Uruguay", "+598"], ["VI", "US Virgin Islands", "+1 340"], ["UZ", "Uzbekistan", "+998"], ["VU", "Vanuatu", "+678"], ["VE", "Venezuela", "+58"], ["VA", "Vatican City State (Holy See)", "+39 06 698", "+379"], ["VN", "Vietnam", "+84"], ["WF", "Wallis and Futuna", "+681"], ["YE", "Yemen", "+967"], ["ZM", "Zambia", "+260"], [false, "Zanzibar", "+255"], ["ZW", "Zimbabwe", "+263"] ]; Config.LangCountries = {"es": "ES", "ru": "RU", "en": "US", "de": "DE", "it": "IT", "nl": "NL", "fr": "FR", "ca": "ES", "es-419": "MX", "ar": "SA", "he": "IL", "tr": "TR", "id": "ID", "pl": "PL"}; + + + + + +// ConfigStorage +(function (window) { + var keyPrefix = ''; + var noPrefix = false; + var cache = {}; + var useCs = !!(window.chrome && chrome.storage && chrome.storage.local); + var useLs = !useCs && !!window.localStorage; + + function storageSetPrefix (newPrefix) { + keyPrefix = newPrefix; + } + + function storageSetNoPrefix() { + noPrefix = true; + } + + function storageGetPrefix () { + if (noPrefix) { + noPrefix = false; + return ''; + } + return keyPrefix; + } + + function storageGetValue() { + var keys = Array.prototype.slice.call(arguments), + callback = keys.pop(), + result = [], + single = keys.length == 1, + allFound = true, + prefix = storageGetPrefix(), + i, key; + + for (i = 0; i < keys.length; i++) { + key = keys[i] = prefix + keys[i]; + if (cache[key] !== undefined) { + result.push(cache[key]); + } + else if (useLs) { + var value = localStorage.getItem(key); + value = (value === undefined || value === null) ? false : JSON.parse(value); + result.push(cache[key] = value); + } + else if (!useCs) { + result.push(cache[key] = false); + } + else { + allFound = false; + } + } + + if (allFound) { + return callback(single ? result[0] : result); + } + + chrome.storage.local.get(keys, function (resultObj) { + var value; + result = []; + for (i = 0; i < keys.length; i++) { + key = keys[i]; + value = resultObj[key]; + value = value === undefined || value === null ? false : JSON.parse(value); + result.push(cache[key] = value); + } + + callback(single ? result[0] : result); + }); + }; + + function storageSetValue(obj, callback) { + var keyValues = {}, + prefix = storageGetPrefix(), + key, value; + + for (key in obj) { + if (obj.hasOwnProperty(key)) { + value = obj[key]; + key = prefix + key; + cache[key] = value; + value = JSON.stringify(value); + if (useLs) { + localStorage.setItem(key, value); + } else { + keyValues[key] = value; + } + } + } + + if (useLs || !useCs) { + if (callback) { + callback(); + } + return; + } + + chrome.storage.local.set(keyValues, callback); + }; + + function storageRemoveValue () { + var keys = Array.prototype.slice.call(arguments), + prefix = storageGetPrefix(), + i, key; + + for (i = 0; i < keys.length; i++) { + key = keys[i] = prefix + keys[i]; + delete cache[key]; + if (useLs) { + localStorage.removeItem(key); + } + } + if (useCs) { + chrome.storage.local.remove(keys); + } + }; + + window.ConfigStorage = { + prefix: storageSetPrefix, + noPrefix: storageSetNoPrefix, + get: storageGetValue, + set: storageSetValue, + remove: storageRemoveValue + }; + +})(this); diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js index c0df4d27..aea2a9bc 100644 --- a/app/js/lib/ng_utils.js +++ b/app/js/lib/ng_utils.js @@ -9,127 +9,26 @@ angular.module('izhukov.utils', []) .provider('Storage', function () { - var keyPrefix = ''; - var cache = {}; - var useCs = !!(window.chrome && chrome.storage && chrome.storage.local); - var useLs = !useCs && !!window.localStorage; - this.setPrefix = function (newPrefix) { - keyPrefix = newPrefix + ConfigStorage.prefix(newPrefix); }; this.$get = ['$q', function ($q) { - function getValue() { - var keys = Array.prototype.slice.call(arguments), - result = [], - single = keys.length == 1, - allFound = true; - - for (var i = 0; i < keys.length; i++) { - keys[i] = keyPrefix + keys[i]; - } - - angular.forEach(keys, function (key) { - if (cache[key] !== undefined) { - result.push(cache[key]); - } - else if (useLs) { - var value = localStorage.getItem(key); - value = (value === undefined || value === null) ? false : JSON.parse(value); - result.push(cache[key] = value); - } - else if (!useCs) { - result.push(cache[key] = false); - } - else { - allFound = false; - } - }); - - if (allFound) { - return $q.when(single ? result[0] : result); - } - - var deferred = $q.defer(); - - chrome.storage.local.get(keys, function (resultObj) { - result = []; - angular.forEach(keys, function (key) { - var value = resultObj[key]; - value = value === undefined || value === null ? false : JSON.parse(value); - result.push(cache[key] = value); - }); - - deferred.resolve(single ? result[0] : result); - }); - - return deferred.promise; - }; - - function setValue(obj) { - var keyValues = {}; - angular.forEach(obj, function (value, key) { - keyValues[keyPrefix + key] = JSON.stringify(value); - cache[keyPrefix + key] = value; - }); - - if (useLs) { - angular.forEach(keyValues, function (value, key) { - localStorage.setItem(key, value); - }); - return $q.when(); - } - - if (!useCs) { - return $q.when(); - } - - var deferred = $q.defer(); - - chrome.storage.local.set(keyValues, function () { - deferred.resolve(); - }); - - return deferred.promise; - }; - - function removeValue () { - var keys = Array.prototype.slice.call(arguments); - - for (var i = 0; i < keys.length; i++) { - keys[i] = keyPrefix + keys[i]; - } - - angular.forEach(keys, function(key){ - delete cache[key]; - }); + var methods = {}; + angular.forEach(['get', 'set', 'remove'], function (methodName) { + methods[methodName] = function () { + var deferred = $q.defer(), + args = Array.prototype.slice.call(arguments); - if (useLs) { - angular.forEach(keys, function(key){ - localStorage.removeItem(key); + args.push(function (result) { + deferred.resolve(result); }); + ConfigStorage[methodName].apply(ConfigStorage, args); - return $q.when(); - } - - if (!useCs) { - return $q.when(); - } - - var deferred = $q.defer(); - - chrome.storage.local.remove(keys, function () { - deferred.resolve(); - }); - - return deferred.promise; - }; - - return { - get: getValue, - set: setValue, - remove: removeValue - }; + return deferred.promise; + }; + }); + return methods; }]; }) @@ -284,7 +183,7 @@ angular.module('izhukov.utils', []) } function downloadFile (url, mimeType, fileName) { - // if (Config.Navigator.mobile) { + // if (Config.Mobile) { // window.open(url, '_blank'); // return; // } diff --git a/app/js/lib/utils.js b/app/js/lib/utils.js index 1af066ea..82031834 100644 --- a/app/js/lib/utils.js +++ b/app/js/lib/utils.js @@ -135,3 +135,7 @@ if (!Function.prototype.bind) { }; } +function templateUrl (tplName) { + return 'partials/' + (Config.Navigator.mobile ? 'mobile' : 'desktop') + '/' + tplName + '.html'; +} + diff --git a/app/js/services.js b/app/js/services.js index 28381f99..a6ffe2f2 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -180,16 +180,13 @@ angular.module('myApp.services', []) var scope = $rootScope.$new(); scope.userID = userID; - var tUrl = 'partials/user_modal.html', - className = 'user_modal_window page_modal'; - - if (Config.Navigator.mobile) { - tUrl = 'partials/mobile/user_modal.html'; + var className = 'user_modal_window page_modal'; + if (Config.Mobile) { className += ' mobile_modal'; } var modalInstance = $modal.open({ - templateUrl: tUrl, + templateUrl: templateUrl('user_modal'), controller: 'UserModalController', scope: scope, windowClass: className @@ -283,7 +280,7 @@ angular.module('myApp.services', []) function openImportContact () { return $modal.open({ - templateUrl: 'partials/import_contact_modal.html', + templateUrl: templateUrl('import_contact_modal'), controller: 'ImportContactModalController', windowClass: 'import_contact_modal_window' }).result.then(function (foundUserID) { @@ -358,7 +355,7 @@ angular.module('myApp.services', []) }; function isAvailable () { - if (Config.Navigator.mobile && Config.Navigator.ffos && Config.Modes.packed) { + if (Config.Mobile && Config.Navigator.ffos && Config.Modes.packed) { try { return navigator.mozContacts && navigator.mozContacts.getAll; } catch (e) { @@ -371,7 +368,7 @@ angular.module('myApp.services', []) function openPhonebookImport () { return $modal.open({ - templateUrl: 'partials/mobile/phonebook_modal.html', + templateUrl: templateUrl('phonebook_modal'), controller: 'PhonebookModalController', windowClass: 'phonebook_modal_window page_modal mobile_modal' }); @@ -516,16 +513,13 @@ angular.module('myApp.services', []) var scope = $rootScope.$new(); scope.chatID = chatID; - var tUrl = 'partials/chat_modal.html', - className = 'chat_modal_window page_modal'; - - if (Config.Navigator.mobile) { - tUrl = 'partials/mobile/chat_modal.html'; + var className = 'chat_modal_window page_modal'; + if (Config.Mobile) { className += ' mobile_modal'; } var modalInstance = $modal.open({ - templateUrl: tUrl, + templateUrl: templateUrl('chat_modal'), controller: 'ChatModalController', scope: scope, windowClass: className @@ -2058,7 +2052,7 @@ angular.module('myApp.services', []) $rootScope.$broadcast('dialogs_update', dialog); - if ((Config.Navigator.mobile && $rootScope.selectedPeerID != peerID || $rootScope.idle.isIDLE) && + if ((Config.Mobile && $rootScope.selectedPeerID != peerID || $rootScope.idle.isIDLE) && !message.out && message.unread) { NotificationsManager.getPeerMuted(peerID).then(function (muted) { @@ -2321,7 +2315,7 @@ angular.module('myApp.services', []) function wrapForFull (photoID) { var photo = wrapForHistory(photoID), - fullWidth = $(window).width() - (Config.Navigator.mobile ? 20 : 36), + fullWidth = $(window).width() - (Config.Mobile ? 20 : 36), fullHeight = $($window).height() - 150, fullPhotoSize = choosePhotoSize(photo, fullWidth, fullHeight), full = { @@ -2347,7 +2341,7 @@ angular.module('myApp.services', []) } } - if (!Config.Navigator.mobile && full.width >= fullPhotoSize.w && full.height >= fullPhotoSize.h) { + if (!Config.Mobile && full.width >= fullPhotoSize.w && full.height >= fullPhotoSize.h) { full.width = fullPhotoSize.w; full.height = fullPhotoSize.h; } @@ -2379,7 +2373,7 @@ angular.module('myApp.services', []) } var modalInstance = $modal.open({ - templateUrl: 'partials/photo_modal.html', + templateUrl: templateUrl('photo_modal'), controller: scope.userID ? 'UserpicModalController' : 'PhotoModalController', scope: scope, windowClass: 'photo_modal_window' @@ -2534,7 +2528,7 @@ angular.module('myApp.services', []) scope.messageID = messageID; var modalInstance = $modal.open({ - templateUrl: 'partials/video_modal.html', + templateUrl: templateUrl('video_modal'), controller: 'VideoModalController', scope: scope, windowClass: 'video_modal_window' @@ -3730,7 +3724,7 @@ angular.module('myApp.services', []) shownBoxes++; var modal = $modal.open({ - templateUrl: 'partials/error_modal.html', + templateUrl: templateUrl('error_modal'), scope: scope, windowClass: options.windowClass || 'error_modal_window' }); @@ -3755,7 +3749,7 @@ angular.module('myApp.services', []) angular.extend(scope, params); var modal = $modal.open({ - templateUrl: 'partials/confirm_modal.html', + templateUrl: templateUrl('confirm_modal'), scope: scope, windowClass: options.windowClass || 'confirm_modal_window' }); @@ -3791,16 +3785,14 @@ angular.module('myApp.services', []) angular.extend(scope, options); } - var tUrl = 'partials/peer_select.html', - className = 'peer_select_window page_modal'; + var className = 'peer_select_window page_modal'; - if (Config.Navigator.mobile) { - tUrl = 'partials/mobile/peer_select.html'; + if (Config.Mobile) { className += ' mobile_modal'; } return $modal.open({ - templateUrl: tUrl, + templateUrl: templateUrl('peer_select'), controller: 'PeerSelectController', scope: scope, windowClass: className @@ -3826,16 +3818,13 @@ angular.module('myApp.services', []) scope.action = 'select'; } - var tUrl = 'partials/contacts_modal.html', - className = 'contacts_modal_window page_modal'; - - if (Config.Navigator.mobile) { - tUrl = 'partials/mobile/contacts_modal.html'; + var className = 'contacts_modal_window page_modal'; + if (Config.Mobile) { className += ' mobile_modal'; } return $modal.open({ - templateUrl: tUrl, + templateUrl: templateUrl('contacts_modal'), controller: 'ContactsModalController', scope: scope, windowClass: className @@ -3906,7 +3895,7 @@ angular.module('myApp.services', []) }; $modal.open({ - templateUrl: 'partials/changelog_modal.html', + templateUrl: templateUrl('changelog_modal'), scope: $scope, windowClass: 'changelog_modal_window page_modal' }); diff --git a/app/partials/changelog_modal.html b/app/partials/desktop/changelog_modal.html similarity index 100% rename from app/partials/changelog_modal.html rename to app/partials/desktop/changelog_modal.html diff --git a/app/partials/chat_create_modal.html b/app/partials/desktop/chat_create_modal.html similarity index 100% rename from app/partials/chat_create_modal.html rename to app/partials/desktop/chat_create_modal.html diff --git a/app/partials/chat_edit_modal.html b/app/partials/desktop/chat_edit_modal.html similarity index 100% rename from app/partials/chat_edit_modal.html rename to app/partials/desktop/chat_edit_modal.html diff --git a/app/partials/chat_modal.html b/app/partials/desktop/chat_modal.html similarity index 100% rename from app/partials/chat_modal.html rename to app/partials/desktop/chat_modal.html diff --git a/app/partials/confirm_modal.html b/app/partials/desktop/confirm_modal.html similarity index 100% rename from app/partials/confirm_modal.html rename to app/partials/desktop/confirm_modal.html diff --git a/app/partials/contacts_modal.html b/app/partials/desktop/contacts_modal.html similarity index 100% rename from app/partials/contacts_modal.html rename to app/partials/desktop/contacts_modal.html diff --git a/app/partials/country_select_modal.html b/app/partials/desktop/country_select_modal.html similarity index 100% rename from app/partials/country_select_modal.html rename to app/partials/desktop/country_select_modal.html diff --git a/app/partials/dialog.html b/app/partials/desktop/dialog.html similarity index 100% rename from app/partials/dialog.html rename to app/partials/desktop/dialog.html diff --git a/app/partials/edit_contact_modal.html b/app/partials/desktop/edit_contact_modal.html similarity index 100% rename from app/partials/edit_contact_modal.html rename to app/partials/desktop/edit_contact_modal.html diff --git a/app/partials/error_modal.html b/app/partials/desktop/error_modal.html similarity index 100% rename from app/partials/error_modal.html rename to app/partials/desktop/error_modal.html diff --git a/app/partials/full_gif.html b/app/partials/desktop/full_gif.html similarity index 100% rename from app/partials/full_gif.html rename to app/partials/desktop/full_gif.html diff --git a/app/partials/full_photo.html b/app/partials/desktop/full_photo.html similarity index 100% rename from app/partials/full_photo.html rename to app/partials/desktop/full_photo.html diff --git a/app/partials/full_video.html b/app/partials/desktop/full_video.html similarity index 100% rename from app/partials/full_video.html rename to app/partials/desktop/full_video.html diff --git a/app/partials/head.html b/app/partials/desktop/head.html similarity index 100% rename from app/partials/head.html rename to app/partials/desktop/head.html diff --git a/app/partials/im.html b/app/partials/desktop/im.html similarity index 100% rename from app/partials/im.html rename to app/partials/desktop/im.html diff --git a/app/partials/import_contact_modal.html b/app/partials/desktop/import_contact_modal.html similarity index 100% rename from app/partials/import_contact_modal.html rename to app/partials/desktop/import_contact_modal.html diff --git a/app/partials/login.html b/app/partials/desktop/login.html similarity index 100% rename from app/partials/login.html rename to app/partials/desktop/login.html diff --git a/app/partials/message.html b/app/partials/desktop/message.html similarity index 100% rename from app/partials/message.html rename to app/partials/desktop/message.html diff --git a/app/partials/message_attach_audio.html b/app/partials/desktop/message_attach_audio.html similarity index 100% rename from app/partials/message_attach_audio.html rename to app/partials/desktop/message_attach_audio.html diff --git a/app/partials/message_attach_contact.html b/app/partials/desktop/message_attach_contact.html similarity index 100% rename from app/partials/message_attach_contact.html rename to app/partials/desktop/message_attach_contact.html diff --git a/app/partials/message_attach_document.html b/app/partials/desktop/message_attach_document.html similarity index 100% rename from app/partials/message_attach_document.html rename to app/partials/desktop/message_attach_document.html diff --git a/app/partials/message_attach_map.html b/app/partials/desktop/message_attach_map.html similarity index 100% rename from app/partials/message_attach_map.html rename to app/partials/desktop/message_attach_map.html diff --git a/app/partials/message_attach_pending.html b/app/partials/desktop/message_attach_pending.html similarity index 100% rename from app/partials/message_attach_pending.html rename to app/partials/desktop/message_attach_pending.html diff --git a/app/partials/message_attach_photo.html b/app/partials/desktop/message_attach_photo.html similarity index 100% rename from app/partials/message_attach_photo.html rename to app/partials/desktop/message_attach_photo.html diff --git a/app/partials/message_attach_video.html b/app/partials/desktop/message_attach_video.html similarity index 100% rename from app/partials/message_attach_video.html rename to app/partials/desktop/message_attach_video.html diff --git a/app/partials/message_service.html b/app/partials/desktop/message_service.html similarity index 100% rename from app/partials/message_service.html rename to app/partials/desktop/message_service.html diff --git a/app/partials/peer_select.html b/app/partials/desktop/peer_select.html similarity index 100% rename from app/partials/peer_select.html rename to app/partials/desktop/peer_select.html diff --git a/app/partials/photo_modal.html b/app/partials/desktop/photo_modal.html similarity index 100% rename from app/partials/photo_modal.html rename to app/partials/desktop/photo_modal.html diff --git a/app/partials/profile_edit_modal.html b/app/partials/desktop/profile_edit_modal.html similarity index 100% rename from app/partials/profile_edit_modal.html rename to app/partials/desktop/profile_edit_modal.html diff --git a/app/partials/settings_modal.html b/app/partials/desktop/settings_modal.html similarity index 100% rename from app/partials/settings_modal.html rename to app/partials/desktop/settings_modal.html diff --git a/app/partials/user_modal.html b/app/partials/desktop/user_modal.html similarity index 100% rename from app/partials/user_modal.html rename to app/partials/desktop/user_modal.html diff --git a/app/partials/video_modal.html b/app/partials/desktop/video_modal.html similarity index 100% rename from app/partials/video_modal.html rename to app/partials/desktop/video_modal.html diff --git a/app/partials/welcome.html b/app/partials/desktop/welcome.html similarity index 100% rename from app/partials/welcome.html rename to app/partials/desktop/welcome.html diff --git a/app/partials/mobile/changelog_modal.html b/app/partials/mobile/changelog_modal.html new file mode 100644 index 00000000..bc41f668 --- /dev/null +++ b/app/partials/mobile/changelog_modal.html @@ -0,0 +1,199 @@ +
+ + + + + +
\ No newline at end of file diff --git a/app/partials/mobile/chat_create_modal.html b/app/partials/mobile/chat_create_modal.html new file mode 100644 index 00000000..28cb5493 --- /dev/null +++ b/app/partials/mobile/chat_create_modal.html @@ -0,0 +1,24 @@ +
+ + + + + + + +
\ No newline at end of file diff --git a/app/partials/mobile/chat_edit_modal.html b/app/partials/mobile/chat_edit_modal.html new file mode 100644 index 00000000..a73bb27c --- /dev/null +++ b/app/partials/mobile/chat_edit_modal.html @@ -0,0 +1,24 @@ +
+ + + + + + + +
\ No newline at end of file diff --git a/app/partials/mobile/confirm_modal.html b/app/partials/mobile/confirm_modal.html new file mode 100644 index 00000000..a5840e6f --- /dev/null +++ b/app/partials/mobile/confirm_modal.html @@ -0,0 +1,65 @@ +
+ + + + + + + +
\ No newline at end of file diff --git a/app/partials/mobile/dialog.html b/app/partials/mobile/dialog.html new file mode 100644 index 00000000..208e1a2c --- /dev/null +++ b/app/partials/mobile/dialog.html @@ -0,0 +1,89 @@ + + +
+
+ + +
+ +
+ +
+ +
+ +
+ + + + +
+ +
+
+ deleted message +
+
+ + You{{((dialogMessage.out || dialogMessage.peerID < 0) && (dialogMessage.message.length || dialogMessage.media && dialogMessage.media._ != 'messageMediaEmpty')) ? ':' : ''}} + + + + Photo + Video + Document + Audio + Location + Contact + + + + created the group + changed group name + changed group photo + removed group photo + + + + returned to group + + + invited + + + + + + left group + + + kicked + + + + + +
+
+ +
+
diff --git a/app/partials/mobile/edit_contact_modal.html b/app/partials/mobile/edit_contact_modal.html new file mode 100644 index 00000000..237ae51b --- /dev/null +++ b/app/partials/mobile/edit_contact_modal.html @@ -0,0 +1,30 @@ +
+ + + + + + + +
\ No newline at end of file diff --git a/app/partials/mobile/error_modal.html b/app/partials/mobile/error_modal.html new file mode 100644 index 00000000..d8115053 --- /dev/null +++ b/app/partials/mobile/error_modal.html @@ -0,0 +1,87 @@ +
+ + + + + +
\ No newline at end of file diff --git a/app/partials/mobile/full_gif.html b/app/partials/mobile/full_gif.html new file mode 100644 index 00000000..cffc8140 --- /dev/null +++ b/app/partials/mobile/full_gif.html @@ -0,0 +1,25 @@ + + +
+ + + + +
+ +
+ +
+
+
+
+
+ +
+
GIF
+
+
+ +
+ +
\ No newline at end of file diff --git a/app/partials/mobile/full_photo.html b/app/partials/mobile/full_photo.html new file mode 100644 index 00000000..1c26c433 --- /dev/null +++ b/app/partials/mobile/full_photo.html @@ -0,0 +1,19 @@ +
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
\ No newline at end of file diff --git a/app/partials/mobile/full_video.html b/app/partials/mobile/full_video.html new file mode 100644 index 00000000..c06f6ad7 --- /dev/null +++ b/app/partials/mobile/full_video.html @@ -0,0 +1,26 @@ +
+
+
+
+
+
+
+
+
+ +
+
+ + +
+
+
+
+
+
\ No newline at end of file diff --git a/app/partials/mobile/head.html b/app/partials/mobile/head.html new file mode 100644 index 00000000..0de2e01f --- /dev/null +++ b/app/partials/mobile/head.html @@ -0,0 +1,132 @@ +
+ +
diff --git a/app/partials/mobile/im.html b/app/partials/mobile/im.html new file mode 100644 index 00000000..ecea3ec2 --- /dev/null +++ b/app/partials/mobile/im.html @@ -0,0 +1,278 @@ +
+ +
+ +
+ +
+
+ + + + +
+ +
+
+
+ +
+

No contacts yet

+

Get started by adding a contact to chat with

+ + +
+ +
+ + +
+ +
+
Contacts
+ +
+ +
+
+
+
+ +
+
+
+

Get started

+

Welcome to Telegram Web. You can always set your profile photo and change your name in Settings.

+ +
+
+ Please select a chat to start messaging +
+
+
+ Loading history +
+ +
+
+ +
+ +
+
+ + Info + Edit + + + + Show recent messages + Show all messages + + + +
+

Photos

+

Videos

+

Documents

+

Voice messages

+ +

+
+ + +
+
+ + + + + +
+

+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ Loading history + No messages here yet... +
+ +
+
+
+
+ +
+ +
+ + is typing + + + and are typing + + + , and {{historyState.typing.length - 2}} more are typing + +
+
+ +
+ +
+ +
+ +
+ + + +
+ +
+ +
+
+ + +
+
+ +
+
+ +
+
Drop photos here to send
+ +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ + +
+ + + +
diff --git a/app/partials/mobile/import_contact_modal.html b/app/partials/mobile/import_contact_modal.html new file mode 100644 index 00000000..9cd14722 --- /dev/null +++ b/app/partials/mobile/import_contact_modal.html @@ -0,0 +1,31 @@ +
+ + + + + + + +
\ No newline at end of file diff --git a/app/partials/mobile/login.html b/app/partials/mobile/login.html new file mode 100644 index 00000000..143dfc92 --- /dev/null +++ b/app/partials/mobile/login.html @@ -0,0 +1,84 @@ +
+ + +
+
+ +
+ + + + + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + + +
+
+ +
+ + +
+ + +
+ +
+ + + + + +
+ + +
+ + +
+ +
diff --git a/app/partials/mobile/message.html b/app/partials/mobile/message.html new file mode 100644 index 00000000..59461d7f --- /dev/null +++ b/app/partials/mobile/message.html @@ -0,0 +1,79 @@ +
+ Unread messages +
+ +
+
+
+ +
+ + +
+ +
+
+ + +
+ + + + + +
+ +
+
+ +
+ + + + + + + + + +
+ + +
+ +
+ + + +
+
Forwarded message
+ +
+ +
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+ +
+
+ +
+ diff --git a/app/partials/mobile/message_attach_audio.html b/app/partials/mobile/message_attach_audio.html new file mode 100644 index 00000000..d964bd3e --- /dev/null +++ b/app/partials/mobile/message_attach_audio.html @@ -0,0 +1,33 @@ +
+ + + + + +
+
+ + Voice message + + + +
+
+ Play +
+
+ Cancel +
+
+
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/app/partials/mobile/message_attach_contact.html b/app/partials/mobile/message_attach_contact.html new file mode 100644 index 00000000..755e386d --- /dev/null +++ b/app/partials/mobile/message_attach_contact.html @@ -0,0 +1,8 @@ +
+ +
+ + +
+
+
\ No newline at end of file diff --git a/app/partials/mobile/message_attach_document.html b/app/partials/mobile/message_attach_document.html new file mode 100644 index 00000000..91c58065 --- /dev/null +++ b/app/partials/mobile/message_attach_document.html @@ -0,0 +1,39 @@ +
+ +
+ +
+ + + +
+ +
+
+ +
+
+ + + +
+
+ Download + Open +
+
+ Cancel +
+
+
+
+
+
+
+ +
+
\ No newline at end of file diff --git a/app/partials/mobile/message_attach_map.html b/app/partials/mobile/message_attach_map.html new file mode 100644 index 00000000..ab127f85 --- /dev/null +++ b/app/partials/mobile/message_attach_map.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/app/partials/mobile/message_attach_pending.html b/app/partials/mobile/message_attach_pending.html new file mode 100644 index 00000000..308f8fcc --- /dev/null +++ b/app/partials/mobile/message_attach_pending.html @@ -0,0 +1,17 @@ +
+ +
+
+ + +
+
+ Cancel +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/app/partials/mobile/message_attach_photo.html b/app/partials/mobile/message_attach_photo.html new file mode 100644 index 00000000..5bb9b925 --- /dev/null +++ b/app/partials/mobile/message_attach_photo.html @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/app/partials/mobile/message_attach_video.html b/app/partials/mobile/message_attach_video.html new file mode 100644 index 00000000..f463cd15 --- /dev/null +++ b/app/partials/mobile/message_attach_video.html @@ -0,0 +1,31 @@ +
+ + + + + + +
+
+ Video + + +
+ +
+ Cancel +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/app/partials/mobile/message_service.html b/app/partials/mobile/message_service.html new file mode 100644 index 00000000..689d6612 --- /dev/null +++ b/app/partials/mobile/message_service.html @@ -0,0 +1,32 @@ + + + created the group «» + + + changed group name to «» + + + changed group photo + + + removed group photo + + + + invited + + + returned to group + + + + + kicked + + + left group + + + + + \ No newline at end of file diff --git a/app/partials/mobile/photo_modal.html b/app/partials/mobile/photo_modal.html new file mode 100644 index 00000000..6f10fb04 --- /dev/null +++ b/app/partials/mobile/photo_modal.html @@ -0,0 +1,22 @@ +
+ + + +
\ No newline at end of file diff --git a/app/partials/mobile/profile_edit_modal.html b/app/partials/mobile/profile_edit_modal.html new file mode 100644 index 00000000..dd0e0e40 --- /dev/null +++ b/app/partials/mobile/profile_edit_modal.html @@ -0,0 +1,27 @@ +
+ + + + + + + +
\ No newline at end of file diff --git a/app/partials/mobile/video_modal.html b/app/partials/mobile/video_modal.html new file mode 100644 index 00000000..e23f29ab --- /dev/null +++ b/app/partials/mobile/video_modal.html @@ -0,0 +1,21 @@ +
+ + + +
\ No newline at end of file diff --git a/app/partials/mobile/welcome.html b/app/partials/mobile/welcome.html new file mode 100644 index 00000000..6149e88b --- /dev/null +++ b/app/partials/mobile/welcome.html @@ -0,0 +1,56 @@ +
+ +
+ +
+ + +

Telegram Web

+ +
+

This is an unofficial web-client for the Telegram Messenger.

+

It's still an alpha-version and may not be 200% reliable

+
+ +
+ + + + + +
diff --git a/app/webogram.appcache b/app/webogram.appcache index 0b7c5e7e..7ff0f8c9 100644 --- a/app/webogram.appcache +++ b/app/webogram.appcache @@ -1,6 +1,6 @@ CACHE MANIFEST -# 28 +# 30 NETWORK: *