From b49f9d0efd51cb78d70e8b9527d9242569a9400e Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Mon, 2 Feb 2015 16:37:08 +0300 Subject: [PATCH] Multi search + latinizer Added latinizer for search indexer. Closes #678 Added multisearch for conversations / messages. Closes #676 --- app/css/app.css | 3 +- app/js/controllers.js | 149 +++++++++++++++++++---------------- app/js/lib/config.js | 5 ++ app/js/lib/ng_utils.js | 23 ++---- app/partials/desktop/im.html | 30 +++---- app/partials/mobile/im.html | 33 ++++---- 6 files changed, 120 insertions(+), 123 deletions(-) diff --git a/app/css/app.css b/app/css/app.css index a65e8e92..f8bf0eb7 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -2473,7 +2473,8 @@ a.peer_photo_init:focus { -.im_dialogs_contacts_wrap h5 { +.im_dialogs_contacts_wrap h5, +.im_dialogs_messages_wrap h5 { color: #999; font-size: 13px; margin-left: 20px; diff --git a/app/js/controllers.js b/app/js/controllers.js index f937720f..b0ece371 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -409,7 +409,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) $scope.searchClear = function () { $scope.search.query = ''; - $scope.search.messages = false; $scope.$broadcast('search_clear'); } @@ -468,7 +467,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) if ($routeParams.q) { if ($routeParams.q !== lastSearch) { $scope.search.query = lastSearch = $routeParams.q; - $scope.search.messages = true; if ($scope.curDialog !== undefined) { return false; } @@ -505,7 +503,8 @@ angular.module('myApp.controllers', ['myApp.i18n']) $scope.dialogs = []; $scope.contacts = []; $scope.foundUsers = []; - $scope.contactsLoaded = false; + $scope.foundMessages = []; + if ($scope.search === undefined) { $scope.search = {}; } @@ -514,12 +513,13 @@ angular.module('myApp.controllers', ['myApp.i18n']) } $scope.phonebookAvailable = PhonebookContactsService.isAvailable(); - var offset = 0, - maxID = 0, - hasMore = false, - jump = 0, - peersInDialogs = {}, - contactsShown; + var searchMessages = false; + var maxID = 0; + var hasMore = false; + var jump = 0; + var contactsJump = 0; + var peersInDialogs = {}; + var contactsShown; $scope.$on('dialogs_need_more', function () { // console.log('on need more'); @@ -550,7 +550,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) if (pos !== false) { var prev = $scope.dialogs.splice(pos, 1); safeReplaceObject(prev, wrappedDialog); - offset++; } $scope.dialogs.unshift(wrappedDialog); delete $scope.isEmpty.dialogs; @@ -558,7 +557,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) if (!peersInDialogs[dialog.peerID]) { peersInDialogs[dialog.peerID] = true; if (contactsShown) { - showMoreContacts(); + showMoreConversations(); } } @@ -584,17 +583,14 @@ angular.module('myApp.controllers', ['myApp.i18n']) } }); - var prevMessages = false; $scope.$watchCollection('search', function () { - if ($scope.search.messages != prevMessages) { - prevMessages = $scope.search.messages; - $scope.dialogs = []; - loadDialogs(true); - } else { - loadDialogs(); - } + $scope.dialogs = []; + $scope.foundMessages = []; + searchMessages = false; + contactsJump++; + loadDialogs(); - if ($routeParams.q && (!$scope.search.messages || $scope.search.query != $routeParams.q)) { + if ($routeParams.q && $scope.search.query != $routeParams.q) { $timeout(function () { $location.url( '/im' + @@ -620,7 +616,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) $scope.$on('contacts_update', function () { if (contactsShown) { - showMoreContacts(); + showMoreConversations(); } }); @@ -628,13 +624,12 @@ angular.module('myApp.controllers', ['myApp.i18n']) var searchTimeoutPromise; function getDialogs(force) { - var searchMessages = $scope.search.messages && $scope.search.query.length > 0, - curJump = ++jump, + var curJump = ++jump, promise; $timeout.cancel(searchTimeoutPromise); if (searchMessages) { - searchTimeoutPromise = force ? $q.when() : $timeout(angular.noop, 500); + searchTimeoutPromise = (force || maxID) ? $q.when() : $timeout(angular.noop, 500); promise = searchTimeoutPromise.then(function () { return AppMessagesManager.getSearch({_: 'inputPeerEmpty'}, $scope.search.query, {_: 'inputMessagesFilterEmpty'}, maxID); }); @@ -686,29 +681,38 @@ angular.module('myApp.controllers', ['myApp.i18n']) }; function loadDialogs (force) { - offset = 0; maxID = 0; hasMore = false; - peersInDialogs = {}; - contactsShown = false; + if (!searchMessages) { + peersInDialogs = {}; + contactsShown = false; + } getDialogs(force).then(function (dialogsResult) { - $scope.dialogs = []; - $scope.contacts = []; - $scope.foundUsers = []; - - if (dialogsResult.dialogs.length) { - offset += dialogsResult.dialogs.length; + if (!searchMessages) { + $scope.dialogs = []; + $scope.contacts = []; + $scope.foundUsers = []; + } + $scope.foundMessages = []; - maxID = dialogsResult.dialogs[dialogsResult.dialogs.length - 1].top_message; - hasMore = dialogsResult.count === null || offset < dialogsResult.count; + var dialogsList = searchMessages ? $scope.foundMessages : $scope.dialogs; + if (dialogsResult.dialogs.length) { angular.forEach(dialogsResult.dialogs, function (dialog) { - peersInDialogs[dialog.peerID] = true; var wrappedDialog = AppMessagesManager.wrapForDialog(dialog.top_message, dialog.unread_count); - $scope.dialogs.push(wrappedDialog); + if (!searchMessages) { + peersInDialogs[dialog.peerID] = true; + } + dialogsList.push(wrappedDialog); }); - delete $scope.isEmpty.dialogs; + + maxID = dialogsResult.dialogs[dialogsResult.dialogs.length - 1].top_message; + hasMore = dialogsResult.count === null || dialogsList.length < dialogsResult.count; + + if (!searchMessages) { + delete $scope.isEmpty.dialogs; + } } $scope.$broadcast('ui_dialogs_change'); @@ -726,12 +730,42 @@ angular.module('myApp.controllers', ['myApp.i18n']) }); } - function showMoreContacts () { + function showMoreDialogs () { + if (contactsShown && (!hasMore || !maxID)) { + return; + } + + if (!hasMore && !searchMessages && ($scope.search.query || !$scope.dialogs.length)) { + showMoreConversations(); + return; + } + + getDialogs().then(function (dialogsResult) { + if (dialogsResult.dialogs.length) { + var dialogsList = searchMessages ? $scope.foundMessages : $scope.dialogs; + + angular.forEach(dialogsResult.dialogs, function (dialog) { + var wrappedDialog = AppMessagesManager.wrapForDialog(dialog.top_message, dialog.unread_count); + if (!searchMessages) { + peersInDialogs[dialog.peerID] = true; + } + dialogsList.push(wrappedDialog); + }); + + maxID = dialogsResult.dialogs[dialogsResult.dialogs.length - 1].top_message; + hasMore = dialogsResult.count === null || dialogsList.length < dialogsResult.count; + + $scope.$broadcast('ui_dialogs_append'); + } + }); + }; + + function showMoreConversations () { contactsShown = true; - var curJump = ++jump; + var curJump = ++contactsJump; AppUsersManager.getContacts($scope.search.query).then(function (contactsList) { - if (curJump != jump) return; + if (curJump != contactsJump) return; $scope.contacts = []; angular.forEach(contactsList, function(userID) { if (peersInDialogs[userID] === undefined) { @@ -753,10 +787,10 @@ angular.module('myApp.controllers', ['myApp.i18n']) if ($scope.search.query && $scope.search.query.length >= 5) { $timeout(function() { - if (curJump != jump) return; + if (curJump != contactsJump) return; MtpApiManager.invokeApi('contacts.search', {q: $scope.search.query, limit: 10}).then(function (result) { AppUsersManager.saveApiUsers(result.users); - if (curJump != jump) return; + if (curJump != contactsJump) return; $scope.foundUsers = []; angular.forEach(result.results, function(contactFound) { var userID = contactFound.user_id; @@ -775,33 +809,12 @@ angular.module('myApp.controllers', ['myApp.i18n']) }); }, 500); } - } - function showMoreDialogs () { - if (contactsShown && (!hasMore || !offset)) { - return; - } - - if (!hasMore && !$scope.search.messages && ($scope.search.query || !$scope.dialogs.length)) { - showMoreContacts(); - return; + if ($scope.search.query) { + searchMessages = true; + loadDialogs(); } - - getDialogs().then(function (dialogsResult) { - if (dialogsResult.dialogs.length) { - offset += dialogsResult.dialogs.length; - maxID = dialogsResult.dialogs[dialogsResult.dialogs.length - 1].top_message; - hasMore = dialogsResult.count === null || offset < dialogsResult.count; - - angular.forEach(dialogsResult.dialogs, function (dialog) { - peersInDialogs[dialog.peerID] = true; - $scope.dialogs.push(AppMessagesManager.wrapForDialog(dialog.top_message, dialog.unread_count)); - }); - - $scope.$broadcast('ui_dialogs_append'); - } - }); - }; + } }) diff --git a/app/js/lib/config.js b/app/js/lib/config.js index 7e1e3a5a..443e05e5 100644 --- a/app/js/lib/config.js +++ b/app/js/lib/config.js @@ -98,6 +98,11 @@ Config.EmojiCategories = [[ "1f604", "1f603", "1f600", "1f60a", "263a", "1f609", Config.EmojiCategorySpritesheetDimens = [[7, 27], [4, 29], [7, 33], [3, 34], [7,34]]; +// From https://raw.githubusercontent.com/FGRibreau/latenize/master/latinize_map.js + +Config.LatinizeMap = {'Á': 'A','Ă': 'A','Ắ': 'A','Ặ': 'A','Ằ': 'A','Ẳ': 'A','Ẵ': 'A','Ǎ': 'A','Â': 'A','Ấ': 'A','Ậ': 'A','Ầ': 'A','Ẩ': 'A','Ẫ': 'A','Ä': 'A','Ǟ': 'A','Ȧ': 'A','Ǡ': 'A','Ạ': 'A','Ȁ': 'A','À': 'A','Ả': 'A','Ȃ': 'A','Ā': 'A','Ą': 'A','Å': 'A','Ǻ': 'A','Ḁ': 'A','Ⱥ': 'A','Ã': 'A','Ꜳ': 'AA','Æ': 'AE','Ǽ': 'AE','Ǣ': 'AE','Ꜵ': 'AO','Ꜷ': 'AU','Ꜹ': 'AV','Ꜻ': 'AV','Ꜽ': 'AY','Ḃ': 'B','Ḅ': 'B','Ɓ': 'B','Ḇ': 'B','Ƀ': 'B','Ƃ': 'B','Ć': 'C','Č': 'C','Ç': 'C','Ḉ': 'C','Ĉ': 'C','Ċ': 'C','Ƈ': 'C','Ȼ': 'C','Ď': 'D','Ḑ': 'D','Ḓ': 'D','Ḋ': 'D','Ḍ': 'D','Ɗ': 'D','Ḏ': 'D','Dz': 'D','Dž': 'D','Đ': 'D','Ƌ': 'D','DZ': 'DZ','DŽ': 'DZ','É': 'E','Ĕ': 'E','Ě': 'E','Ȩ': 'E','Ḝ': 'E','Ê': 'E','Ế': 'E','Ệ': 'E','Ề': 'E','Ể': 'E','Ễ': 'E','Ḙ': 'E','Ë': 'E','Ė': 'E','Ẹ': 'E','Ȅ': 'E','È': 'E','Ẻ': 'E','Ȇ': 'E','Ē': 'E','Ḗ': 'E','Ḕ': 'E','Ę': 'E','Ɇ': 'E','Ẽ': 'E','Ḛ': 'E','Ꝫ': 'ET','Ḟ': 'F','Ƒ': 'F','Ǵ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V','Ꝡ': 'VY','Ẃ': 'W','Ŵ': 'W','Ẅ': 'W','Ẇ': 'W','Ẉ': 'W','Ẁ': 'W','Ⱳ': 'W','Ẍ': 'X','Ẋ': 'X','Ý': 'Y','Ŷ': 'Y','Ÿ': 'Y','Ẏ': 'Y','Ỵ': 'Y','Ỳ': 'Y','Ƴ': 'Y','Ỷ': 'Y','Ỿ': 'Y','Ȳ': 'Y','Ɏ': 'Y','Ỹ': 'Y','Ź': 'Z','Ž': 'Z','Ẑ': 'Z','Ⱬ': 'Z','Ż': 'Z','Ẓ': 'Z','Ȥ': 'Z','Ẕ': 'Z','Ƶ': 'Z','IJ': 'IJ','Œ': 'OE','ᴀ': 'A','ᴁ': 'AE','ʙ': 'B','ᴃ': 'B','ᴄ': 'C','ᴅ': 'D','ᴇ': 'E','ꜰ': 'F','ɢ': 'G','ʛ': 'G','ʜ': 'H','ɪ': 'I','ʁ': 'R','ᴊ': 'J','ᴋ': 'K','ʟ': 'L','ᴌ': 'L','ᴍ': 'M','ɴ': 'N','ᴏ': 'O','ɶ': 'OE','ᴐ': 'O','ᴕ': 'OU','ᴘ': 'P','ʀ': 'R','ᴎ': 'N','ᴙ': 'R','ꜱ': 'S','ᴛ': 'T','ⱻ': 'E','ᴚ': 'R','ᴜ': 'U','ᴠ': 'V','ᴡ': 'W','ʏ': 'Y','ᴢ': 'Z','á': 'a','ă': 'a','ắ': 'a','ặ': 'a','ằ': 'a','ẳ': 'a','ẵ': 'a','ǎ': 'a','â': 'a','ấ': 'a','ậ': 'a','ầ': 'a','ẩ': 'a','ẫ': 'a','ä': 'a','ǟ': 'a','ȧ': 'a','ǡ': 'a','ạ': 'a','ȁ': 'a','à': 'a','ả': 'a','ȃ': 'a','ā': 'a','ą': 'a','ᶏ': 'a','ẚ': 'a','å': 'a','ǻ': 'a','ḁ': 'a','ⱥ': 'a','ã': 'a','ꜳ': 'aa','æ': 'ae','ǽ': 'ae','ǣ': 'ae','ꜵ': 'ao','ꜷ': 'au','ꜹ': 'av','ꜻ': 'av','ꜽ': 'ay','ḃ': 'b','ḅ': 'b','ɓ': 'b','ḇ': 'b','ᵬ': 'b','ᶀ': 'b','ƀ': 'b','ƃ': 'b','ɵ': 'o','ć': 'c','č': 'c','ç': 'c','ḉ': 'c','ĉ': 'c','ɕ': 'c','ċ': 'c','ƈ': 'c','ȼ': 'c','ď': 'd','ḑ': 'd','ḓ': 'd','ȡ': 'd','ḋ': 'd','ḍ': 'd','ɗ': 'd','ᶑ': 'd','ḏ': 'd','ᵭ': 'd','ᶁ': 'd','đ': 'd','ɖ': 'd','ƌ': 'd','ı': 'i','ȷ': 'j','ɟ': 'j','ʄ': 'j','dz': 'dz','dž': 'dz','é': 'e','ĕ': 'e','ě': 'e','ȩ': 'e','ḝ': 'e','ê': 'e','ế': 'e','ệ': 'e','ề': 'e','ể': 'e','ễ': 'e','ḙ': 'e','ë': 'e','ė': 'e','ẹ': 'e','ȅ': 'e','è': 'e','ẻ': 'e','ȇ': 'e','ē': 'e','ḗ': 'e','ḕ': 'e','ⱸ': 'e','ę': 'e','ᶒ': 'e','ɇ': 'e','ẽ': 'e','ḛ': 'e','ꝫ': 'et','ḟ': 'f','ƒ': 'f','ᵮ': 'f','ᶂ': 'f','ǵ': 'g','ğ': 'g','ǧ': 'g','ģ': 'g','ĝ': 'g','ġ': 'g','ɠ': 'g','ḡ': 'g','ᶃ': 'g','ǥ': 'g','ḫ': 'h','ȟ': 'h','ḩ': 'h','ĥ': 'h','ⱨ': 'h','ḧ': 'h','ḣ': 'h','ḥ': 'h','ɦ': 'h','ẖ': 'h','ħ': 'h','ƕ': 'hv','í': 'i','ĭ': 'i','ǐ': 'i','î': 'i','ï': 'i','ḯ': 'i','ị': 'i','ȉ': 'i','ì': 'i','ỉ': 'i','ȋ': 'i','ī': 'i','į': 'i','ᶖ': 'i','ɨ': 'i','ĩ': 'i','ḭ': 'i','ꝺ': 'd','ꝼ': 'f','ᵹ': 'g','ꞃ': 'r','ꞅ': 's','ꞇ': 't','ꝭ': 'is','ǰ': 'j','ĵ': 'j','ʝ': 'j','ɉ': 'j','ḱ': 'k','ǩ': 'k','ķ': 'k','ⱪ': 'k','ꝃ': 'k','ḳ': 'k','ƙ': 'k','ḵ': 'k','ᶄ': 'k','ꝁ': 'k','ꝅ': 'k','ĺ': 'l','ƚ': 'l','ɬ': 'l','ľ': 'l','ļ': 'l','ḽ': 'l','ȴ': 'l','ḷ': 'l','ḹ': 'l','ⱡ': 'l','ꝉ': 'l','ḻ': 'l','ŀ': 'l','ɫ': 'l','ᶅ': 'l','ɭ': 'l','ł': 'l','lj': 'lj','ſ': 's','ẜ': 's','ẛ': 's','ẝ': 's','ḿ': 'm','ṁ': 'm','ṃ': 'm','ɱ': 'm','ᵯ': 'm','ᶆ': 'm','ń': 'n','ň': 'n','ņ': 'n','ṋ': 'n','ȵ': 'n','ṅ': 'n','ṇ': 'n','ǹ': 'n','ɲ': 'n','ṉ': 'n','ƞ': 'n','ᵰ': 'n','ᶇ': 'n','ɳ': 'n','ñ': 'n','nj': 'nj','ó': 'o','ŏ': 'o','ǒ': 'o','ô': 'o','ố': 'o','ộ': 'o','ồ': 'o','ổ': 'o','ỗ': 'o','ö': 'o','ȫ': 'o','ȯ': 'o','ȱ': 'o','ọ': 'o','ő': 'o','ȍ': 'o','ò': 'o','ỏ': 'o','ơ': 'o','ớ': 'o','ợ': 'o','ờ': 'o','ở': 'o','ỡ': 'o','ȏ': 'o','ꝋ': 'o','ꝍ': 'o','ⱺ': 'o','ō': 'o','ṓ': 'o','ṑ': 'o','ǫ': 'o','ǭ': 'o','ø': 'o','ǿ': 'o','õ': 'o','ṍ': 'o','ṏ': 'o','ȭ': 'o','ƣ': 'oi','ꝏ': 'oo','ɛ': 'e','ᶓ': 'e','ɔ': 'o','ᶗ': 'o','ȣ': 'ou','ṕ': 'p','ṗ': 'p','ꝓ': 'p','ƥ': 'p','ᵱ': 'p','ᶈ': 'p','ꝕ': 'p','ᵽ': 'p','ꝑ': 'p','ꝙ': 'q','ʠ': 'q','ɋ': 'q','ꝗ': 'q','ŕ': 'r','ř': 'r','ŗ': 'r','ṙ': 'r','ṛ': 'r','ṝ': 'r','ȑ': 'r','ɾ': 'r','ᵳ': 'r','ȓ': 'r','ṟ': 'r','ɼ': 'r','ᵲ': 'r','ᶉ': 'r','ɍ': 'r','ɽ': 'r','ↄ': 'c','ꜿ': 'c','ɘ': 'e','ɿ': 'r','ś': 's','ṥ': 's','š': 's','ṧ': 's','ş': 's','ŝ': 's','ș': 's','ṡ': 's','ṣ': 's','ṩ': 's','ʂ': 's','ᵴ': 's','ᶊ': 's','ȿ': 's','ɡ': 'g','ß': 'ss','ᴑ': 'o','ᴓ': 'o','ᴝ': 'u','ť': 't','ţ': 't','ṱ': 't','ț': 't','ȶ': 't','ẗ': 't','ⱦ': 't','ṫ': 't','ṭ': 't','ƭ': 't','ṯ': 't','ᵵ': 't','ƫ': 't','ʈ': 't','ŧ': 't','ᵺ': 'th','ɐ': 'a','ᴂ': 'ae','ǝ': 'e','ᵷ': 'g','ɥ': 'h','ʮ': 'h','ʯ': 'h','ᴉ': 'i','ʞ': 'k','ꞁ': 'l','ɯ': 'm','ɰ': 'm','ᴔ': 'oe','ɹ': 'r','ɻ': 'r','ɺ': 'r','ⱹ': 'r','ʇ': 't','ʌ': 'v','ʍ': 'w','ʎ': 'y','ꜩ': 'tz','ú': 'u','ŭ': 'u','ǔ': 'u','û': 'u','ṷ': 'u','ü': 'u','ǘ': 'u','ǚ': 'u','ǜ': 'u','ǖ': 'u','ṳ': 'u','ụ': 'u','ű': 'u','ȕ': 'u','ù': 'u','ủ': 'u','ư': 'u','ứ': 'u','ự': 'u','ừ': 'u','ử': 'u','ữ': 'u','ȗ': 'u','ū': 'u','ṻ': 'u','ų': 'u','ᶙ': 'u','ů': 'u','ũ': 'u','ṹ': 'u','ṵ': 'u','ᵫ': 'ue','ꝸ': 'um','ⱴ': 'v','ꝟ': 'v','ṿ': 'v','ʋ': 'v','ᶌ': 'v','ⱱ': 'v','ṽ': 'v','ꝡ': 'vy','ẃ': 'w','ŵ': 'w','ẅ': 'w','ẇ': 'w','ẉ': 'w','ẁ': 'w','ⱳ': 'w','ẘ': 'w','ẍ': 'x','ẋ': 'x','ᶍ': 'x','ý': 'y','ŷ': 'y','ÿ': 'y','ẏ': 'y','ỵ': 'y','ỳ': 'y','ƴ': 'y','ỷ': 'y','ỿ': 'y','ȳ': 'y','ẙ': 'y','ɏ': 'y','ỹ': 'y','ź': 'z','ž': 'z','ẑ': 'z','ʑ': 'z','ⱬ': 'z','ż': 'z','ẓ': 'z','ȥ': 'z','ẕ': 'z','ᵶ': 'z','ᶎ': 'z','ʐ': 'z','ƶ': 'z','ɀ': 'z','ff': 'ff','ffi': 'ffi','ffl': 'ffl','fi': 'fi','fl': 'fl','ij': 'ij','œ': 'oe','st': 'st','ₐ': 'a','ₑ': 'e','ᵢ': 'i','ⱼ': 'j','ₒ': 'o','ᵣ': 'r','ᵤ': 'u','ᵥ': 'v','ₓ': 'x','Ё': 'YO', 'Й': 'I', 'Ц': 'TS', 'У': 'U', 'К': 'K', 'Е': 'E', 'Н': 'N', 'Г': 'G', 'Ш': 'SH', 'Щ': 'SCH', 'З': 'Z', 'Х': 'H', 'Ъ': '', 'ё': 'yo', 'й': 'i', 'ц': 'ts', 'у': 'u', 'к': 'k', 'е': 'e', 'н': 'n', 'г': 'g', 'ш': 'sh', 'щ': 'sch', 'з': 'z', 'х': 'h', 'ъ': '', 'Ф': 'F', 'Ы': 'I', 'В': 'V', 'А': 'A', 'П': 'P', 'Р': 'R', 'О': 'O', 'Л': 'L', 'Д': 'D', 'Ж': 'ZH', 'Э': 'E', 'ф': 'f', 'ы': 'i', 'в': 'v', 'а': 'a', 'п': 'p', 'р': 'r', 'о': 'o', 'л': 'l', 'д': 'd', 'ж': 'zh', 'э': 'e', 'Я': 'Ya', 'Ч': 'CH', 'С': 'S', 'М': 'M', 'И': 'I', 'Т': 'T', 'Ь': '', 'Б': 'B', 'Ю': 'YU', 'я': 'ya', 'ч': 'ch', 'с': 's', 'м': 'm', 'и': 'i', 'т': 't', 'ь': '', 'б': 'b', 'ю': 'yu'}; + + Config.CountryCodes = [["AB","country_select_modal_country_ab","+7 840","+7 940","+995 44"],["AF","country_select_modal_country_af","+93"],["AX","country_select_modal_country_ax","+358 18"],["AL","country_select_modal_country_al","+355"],["DZ","country_select_modal_country_dz","+213"],["AS","country_select_modal_country_as","+1 684"],["AD","country_select_modal_country_ad","+376"],["AO","country_select_modal_country_ao","+244"],["AI","country_select_modal_country_ai","+1 264"],["AG","country_select_modal_country_ag","+1 268"],["AR","country_select_modal_country_ar","+54"],["AM","country_select_modal_country_am","+374"],["AW","country_select_modal_country_aw","+297"],["SH","country_select_modal_country_sh_ac","+247"],["AU","country_select_modal_country_au","+61"],["AU","country_select_modal_country_au_et","+672"],["AT","country_select_modal_country_at","+43"],["AZ","country_select_modal_country_az","+994"],["BS","country_select_modal_country_bs","+1 242"],["BH","country_select_modal_country_bh","+973"],["BD","country_select_modal_country_bd","+880"],["BB","country_select_modal_country_bb","+1 246"],["AG","country_select_modal_country_ag_bar","+1 268"],["BY","country_select_modal_country_by","+375"],["BE","country_select_modal_country_be","+32"],["BZ","country_select_modal_country_bz","+501"],["BJ","country_select_modal_country_bj","+229"],["BM","country_select_modal_country_bm","+1 441"],["BT","country_select_modal_country_bt","+975"],["BO","country_select_modal_country_bo","+591"],["BQ","country_select_modal_country_bq","+599 7"],["BA","country_select_modal_country_ba","+387"],["BW","country_select_modal_country_bw","+267"],["BR","country_select_modal_country_br","+55"],["IO","country_select_modal_country_io","+246"],["VG","country_select_modal_country_vg","+1 284"],["BN","country_select_modal_country_bn","+673"],["BG","country_select_modal_country_bg","+359"],["BF","country_select_modal_country_bf","+226"],["MY","country_select_modal_country_mm","+95"],["BI","country_select_modal_country_bi","+257"],["KH","country_select_modal_country_kh","+855"],["CM","country_select_modal_country_cm","+237"],["CA","country_select_modal_country_ca","+1"],["CV","country_select_modal_country_cv","+238"],["KY","country_select_modal_country_ky","+1 345"],["CF","country_select_modal_country_cf","+236"],["TD","country_select_modal_country_td","+235"],["CL","country_select_modal_country_cl","+56"],["CN","country_select_modal_country_cn","+86"],["CX","country_select_modal_country_cx","+61"],["CC","country_select_modal_country_cc","+61"],["CO","country_select_modal_country_co","+57"],["KM","country_select_modal_country_km","+269"],["CG","country_select_modal_country_cg","+242"],["CD","country_select_modal_country_cd","+243"],["CK","country_select_modal_country_ck","+682"],["CR","country_select_modal_country_cr","+506"],["CI","country_select_modal_country_ci","+225"],["HR","country_select_modal_country_hr","+385"],["CU","country_select_modal_country_cu","+53"],["CW","country_select_modal_country_cw","+599 9"],["CY","country_select_modal_country_cy","+357"],["CZ","country_select_modal_country_cz","+420"],["DK","country_select_modal_country_dk","+45"],["DG","country_select_modal_country_dg","+246"],["DJ","country_select_modal_country_dj","+253"],["DM","country_select_modal_country_dm","+1 767"],["DO","country_select_modal_country_do","+1 809","+1 829","+1 849"],["TL","country_select_modal_country_tl","+670"],["EC","country_select_modal_country_ec","+593"],["EG","country_select_modal_country_eg","+20"],["SV","country_select_modal_country_sv","+503"],["GQ","country_select_modal_country_gq","+240"],["ER","country_select_modal_country_er","+291"],["EE","country_select_modal_country_ee","+372"],["ET","country_select_modal_country_et","+251"],["FK","country_select_modal_country_fk","+500"],["FO","country_select_modal_country_fo","+298"],["FJ","country_select_modal_country_fj","+679"],["FI","country_select_modal_country_fi","+358"],["FR","country_select_modal_country_fr","+33"],["GF","country_select_modal_country_gf","+594"],["PF","country_select_modal_country_pf","+689"],["GA","country_select_modal_country_ga","+241"],["GM","country_select_modal_country_gm","+220"],["GE","country_select_modal_country_ge","+995"],["DE","country_select_modal_country_de","+49"],["GH","country_select_modal_country_gh","+233"],["GI","country_select_modal_country_gi","+350"],["GR","country_select_modal_country_gr","+30"],["GL","country_select_modal_country_gl","+299"],["GD","country_select_modal_country_gd","+1 473"],["GP","country_select_modal_country_gp","+590"],["GU","country_select_modal_country_gu","+1 671"],["GT","country_select_modal_country_gt","+502"],["GG","country_select_modal_country_gg","+44"],["GN","country_select_modal_country_gn","+224"],["GW","country_select_modal_country_gw","+245"],["GY","country_select_modal_country_gy","+592"],["HT","country_select_modal_country_ht","+509"],["HN","country_select_modal_country_hn","+504"],["HK","country_select_modal_country_hk","+852"],["HU","country_select_modal_country_hu","+36"],["IS","country_select_modal_country_is","+354"],["IN","country_select_modal_country_in","+91"],["ID","country_select_modal_country_id","+62"],["IR","country_select_modal_country_ir","+98"],["IQ","country_select_modal_country_iq","+964"],["IE","country_select_modal_country_ie","+353"],["IL","country_select_modal_country_il","+972"],["IT","country_select_modal_country_it","+39"],["JM","country_select_modal_country_jm","+1 876"],["SJ","country_select_modal_country_sj","+47 79"],["JP","country_select_modal_country_jp","+81"],["JE","country_select_modal_country_je","+44"],["JO","country_select_modal_country_jo","+962"],["KZ","country_select_modal_country_kz","+7 6","+7 7"],["KE","country_select_modal_country_ke","+254"],["KI","country_select_modal_country_ki","+686"],["KP","country_select_modal_country_kp","+850"],["KR","country_select_modal_country_kr","+82"],["KW","country_select_modal_country_kw","+965"],["KG","country_select_modal_country_kg","+996"],["LA","country_select_modal_country_la","+856"],["LV","country_select_modal_country_lv","+371"],["LB","country_select_modal_country_lb","+961"],["LS","country_select_modal_country_ls","+266"],["LR","country_select_modal_country_lr","+231"],["LY","country_select_modal_country_ly","+218"],["LI","country_select_modal_country_li","+423"],["LT","country_select_modal_country_lt","+370"],["LU","country_select_modal_country_lu","+352"],["MO","country_select_modal_country_mo","+853"],["MK","country_select_modal_country_mk","+389"],["MG","country_select_modal_country_mg","+261"],["MW","country_select_modal_country_mw","+265"],["MY","country_select_modal_country_my","+60"],["MV","country_select_modal_country_mv","+960"],["ML","country_select_modal_country_ml","+223"],["MT","country_select_modal_country_mt","+356"],["MH","country_select_modal_country_mh","+692"],["MQ","country_select_modal_country_mq","+596"],["MR","country_select_modal_country_mr","+222"],["MU","country_select_modal_country_mu","+230"],["YT","country_select_modal_country_yt","+262"],["MX","country_select_modal_country_mx","+52"],["FM","country_select_modal_country_fm","+691"],["MD","country_select_modal_country_md","+373"],["MC","country_select_modal_country_mc","+377"],["MN","country_select_modal_country_mn","+976"],["ME","country_select_modal_country_me","+382"],["MS","country_select_modal_country_ms","+1 664"],["MA","country_select_modal_country_ma","+212"],["MZ","country_select_modal_country_mz","+258"],["NA","country_select_modal_country_na","+264"],["NR","country_select_modal_country_nr","+674"],["NP","country_select_modal_country_np","+977"],["NL","country_select_modal_country_nl","+31"],["NC","country_select_modal_country_nc","+687"],["NZ","country_select_modal_country_nz","+64"],["NI","country_select_modal_country_ni","+505"],["NE","country_select_modal_country_ne","+227"],["NG","country_select_modal_country_ng","+234"],["NU","country_select_modal_country_nu","+683"],["NF","country_select_modal_country_nf","+672"],["MP","country_select_modal_country_mp","+1 670"],["NO","country_select_modal_country_no","+47"],["OM","country_select_modal_country_om","+968"],["PK","country_select_modal_country_pk","+92"],["PW","country_select_modal_country_pw","+680"],["PS","country_select_modal_country_ps","+970"],["PA","country_select_modal_country_pa","+507"],["PG","country_select_modal_country_pg","+675"],["PY","country_select_modal_country_py","+595"],["PE","country_select_modal_country_pe","+51"],["PH","country_select_modal_country_ph","+63"],["PN","country_select_modal_country_pn","+64"],["PL","country_select_modal_country_pl","+48"],["PT","country_select_modal_country_pt","+351"],["PR","country_select_modal_country_pr","+1 787","+1 939"],["QA","country_select_modal_country_qa","+974"],["RE","country_select_modal_country_re","+262"],["RO","country_select_modal_country_ro","+40"],["RU","country_select_modal_country_ru","+7"],["RW","country_select_modal_country_rw","+250"],["BL","country_select_modal_country_bl","+590"],["SH","country_select_modal_country_sh","+290"],["KN","country_select_modal_country_kn","+1 869"],["LC","country_select_modal_country_lc","+1 758"],["MF","country_select_modal_country_mf","+590"],["PM","country_select_modal_country_pm","+508"],["VC","country_select_modal_country_vc","+1 784"],["WS","country_select_modal_country_ws","+685"],["SM","country_select_modal_country_sm","+378"],["ST","country_select_modal_country_st","+239"],["SA","country_select_modal_country_sa","+966"],["SN","country_select_modal_country_sn","+221"],["RS","country_select_modal_country_rs","+381"],["SC","country_select_modal_country_sc","+248"],["SL","country_select_modal_country_sl","+232"],["SG","country_select_modal_country_sg","+65"],["BQ","country_select_modal_country_nl_bq3","+599 3"],["SX","country_select_modal_country_sx","+1 721"],["SK","country_select_modal_country_sk","+421"],["SI","country_select_modal_country_si","+386"],["SB","country_select_modal_country_sb","+677"],["SO","country_select_modal_country_so","+252"],["ZA","country_select_modal_country_za","+27"],["GS","country_select_modal_country_gs","+500"],[false,"country_select_modal_country_ge_so","+995 34"],["SS","country_select_modal_country_ss","+211"],["ES","country_select_modal_country_es","+34"],["LK","country_select_modal_country_lk","+94"],["SD","country_select_modal_country_sd","+249"],["SR","country_select_modal_country_sr","+597"],["SJ","country_select_modal_country_sj_no","+47 79"],["SZ","country_select_modal_country_sz","+268"],["SE","country_select_modal_country_se","+46"],["CH","country_select_modal_country_ch","+41"],["SY","country_select_modal_country_sy","+963"],["TW","country_select_modal_country_tw","+886"],["TJ","country_select_modal_country_tj","+992"],["TZ","country_select_modal_country_tz","+255"],["TH","country_select_modal_country_th","+66"],["TG","country_select_modal_country_tg","+228"],["TK","country_select_modal_country_tk","+690"],["TO","country_select_modal_country_to","+676"],["TT","country_select_modal_country_tt","+1 868"],["TN","country_select_modal_country_tn","+216"],["TR","country_select_modal_country_tr","+90"],["TM","country_select_modal_country_tm","+993"],["TC","country_select_modal_country_tc","+1 649"],["TV","country_select_modal_country_tv","+688"],["UG","country_select_modal_country_ug","+256"],["UA","country_select_modal_country_ua","+380"],["AE","country_select_modal_country_ae","+971"],["UK","country_select_modal_country_uk","+44"],["US","country_select_modal_country_us","+1"],["UY","country_select_modal_country_uy","+598"],["VI","country_select_modal_country_vi","+1 340"],["UZ","country_select_modal_country_uz","+998"],["VU","country_select_modal_country_vu","+678"],["VE","country_select_modal_country_ve","+58"],["VA","country_select_modal_country_va","+39 06 698","+379"],["VN","country_select_modal_country_vn","+84"],["WF","country_select_modal_country_wf","+681"],["YE","country_select_modal_country_ye","+967"],["ZM","country_select_modal_country_zm","+260"],[false,"country_select_modal_country_tz_uk","+255"],["ZW","country_select_modal_country_zw","+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"}; diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js index c7bb80e5..5882ebe1 100644 --- a/app/js/lib/ng_utils.js +++ b/app/js/lib/ng_utils.js @@ -736,16 +736,7 @@ angular.module('izhukov.utils', []) .service('SearchIndexManager', function () { var badCharsRe = /[`~!@#$%^&*()\-_=+\[\]\\|{}'";:\/?.>,<\s]+/g, - trimRe = /^\s+|\s$/g, - accentsReplace = { - a: /[åáâäà]/g, - e: /[éêëè]/g, - i: /[íîïì]/g, - o: /[óôöò]/g, - u: /[úûüù]/g, - c: /ç/g, - ss: /ß/g - } + trimRe = /^\s+|\s$/g; return { createIndex: createIndex, @@ -762,13 +753,11 @@ angular.module('izhukov.utils', []) } function cleanSearchText (text) { - text = text.replace(badCharsRe, ' ').replace(trimRe, '').toLowerCase(); - - for (var key in accentsReplace) { - if (accentsReplace.hasOwnProperty(key)) { - text = text.replace(accentsReplace[key], key); - } - } + text = text.replace(badCharsRe, ' ').replace(trimRe, ''); + text = text.replace(/[^A-Za-z0-9]/g, function (ch) { + return Config.LatinizeMap[ch] || ch; + }); + text = text.toLowerCase(); return text; } diff --git a/app/partials/desktop/im.html b/app/partials/desktop/im.html index 01e3cc84..575aca6e 100644 --- a/app/partials/desktop/im.html +++ b/app/partials/desktop/im.html @@ -12,13 +12,6 @@ - -
-
- - -
-
@@ -32,22 +25,16 @@
-
- - -
+ -
+ -
+
+
+
+ +
+
diff --git a/app/partials/mobile/im.html b/app/partials/mobile/im.html index 5bd132b6..752cebc0 100644 --- a/app/partials/mobile/im.html +++ b/app/partials/mobile/im.html @@ -12,13 +12,6 @@ - -
-
- - -
-
@@ -30,21 +23,16 @@
-
- - -
+ -
+ -