Hash-tags support
This commit is contained in:
parent
b25172c438
commit
88e3cb9b80
@ -230,6 +230,7 @@ angular.module('myApp.controllers', [])
|
|||||||
|
|
||||||
$scope.isLoggedIn = true;
|
$scope.isLoggedIn = true;
|
||||||
$scope.isEmpty = {};
|
$scope.isEmpty = {};
|
||||||
|
$scope.search = {};
|
||||||
$scope.historyFilter = {mediaType: false};
|
$scope.historyFilter = {mediaType: false};
|
||||||
$scope.historyPeer = {};
|
$scope.historyPeer = {};
|
||||||
|
|
||||||
@ -314,7 +315,17 @@ angular.module('myApp.controllers', [])
|
|||||||
|
|
||||||
updateCurDialog();
|
updateCurDialog();
|
||||||
|
|
||||||
|
var lastSearch = false;
|
||||||
function updateCurDialog() {
|
function updateCurDialog() {
|
||||||
|
if ($routeParams.q) {
|
||||||
|
if ($routeParams.q !== lastSearch) {
|
||||||
|
$scope.search.query = lastSearch = $routeParams.q;
|
||||||
|
$scope.search.messages = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
lastSearch = false;
|
||||||
|
}
|
||||||
$scope.curDialog = {
|
$scope.curDialog = {
|
||||||
peer: $routeParams.p || false,
|
peer: $routeParams.p || false,
|
||||||
messageID: $routeParams.m || false
|
messageID: $routeParams.m || false
|
||||||
@ -324,11 +335,10 @@ angular.module('myApp.controllers', [])
|
|||||||
ChangelogNotifyService.checkUpdate();
|
ChangelogNotifyService.checkUpdate();
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('AppImDialogsController', function ($scope, $location, $q, $timeout, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, PhonebookContactsService, ErrorService) {
|
.controller('AppImDialogsController', function ($scope, $location, $q, $timeout, $routeParams, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, PhonebookContactsService, ErrorService) {
|
||||||
|
|
||||||
$scope.dialogs = [];
|
$scope.dialogs = [];
|
||||||
$scope.contacts = [];
|
$scope.contacts = [];
|
||||||
$scope.search = {};
|
|
||||||
$scope.contactsLoaded = false;
|
$scope.contactsLoaded = false;
|
||||||
$scope.phonebookAvailable = PhonebookContactsService.isAvailable();
|
$scope.phonebookAvailable = PhonebookContactsService.isAvailable();
|
||||||
|
|
||||||
@ -392,7 +402,7 @@ angular.module('myApp.controllers', [])
|
|||||||
var prevMessages = false;
|
var prevMessages = false;
|
||||||
$scope.$watchCollection('search', function () {
|
$scope.$watchCollection('search', function () {
|
||||||
if ($scope.search.messages && (!angular.isString($scope.search.query) || !$scope.search.query.length)) {
|
if ($scope.search.messages && (!angular.isString($scope.search.query) || !$scope.search.query.length)) {
|
||||||
prevMessages = $scope.search.messages = false;
|
$scope.search.messages = false;
|
||||||
}
|
}
|
||||||
if ($scope.search.messages != prevMessages) {
|
if ($scope.search.messages != prevMessages) {
|
||||||
prevMessages = $scope.search.messages;
|
prevMessages = $scope.search.messages;
|
||||||
@ -401,6 +411,19 @@ angular.module('myApp.controllers', [])
|
|||||||
} else {
|
} else {
|
||||||
loadDialogs();
|
loadDialogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($routeParams.q && (!$scope.search.messages || $scope.search.query != $routeParams.q)) {
|
||||||
|
$timeout(function () {
|
||||||
|
$location.url(
|
||||||
|
'/im' +
|
||||||
|
($scope.curDialog.peer
|
||||||
|
? '?p=' + $scope.curDialog.peer +
|
||||||
|
($scope.curDialog.messageID ? '&m=' + $scope.curDialog.messageID : '')
|
||||||
|
: ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.importPhonebook = function () {
|
$scope.importPhonebook = function () {
|
||||||
|
@ -3109,7 +3109,7 @@ angular.module('myApp.services', [])
|
|||||||
emojiMap[emojiData[emojiCode][0]] = emojiCode;
|
emojiMap[emojiData[emojiCode][0]] = emojiCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
var regExp = new RegExp('((?:(ftp|https?)://|(?:mailto:)?([A-Za-z0-9._%+-]+@))(\\S*\\.\\S*[^\\s.;,(){}<>"\']))|(\\n)|(' + emojiUtf.join('|') + ')', 'i');
|
var regExp = new RegExp('((?:(ftp|https?)://|(?:mailto:)?([A-Za-z0-9._%+-]+@))(\\S*\\.\\S*[^\\s.;,(){}<>"\']))|(\\n)|(' + emojiUtf.join('|') + ')|(^|\s)(#[A-Za-z0-9\_\.]{4,20})', 'i');
|
||||||
var youtubeRegex = /(?:https?:\/\/)?(?:www\.)?youtu(?:|.be|be.com|.b)(?:\/v\/|\/watch\\?v=|e\/|\/watch(?:.+)v=)(.{11})(?:\&[^\s]*)?/;
|
var youtubeRegex = /(?:https?:\/\/)?(?:www\.)?youtu(?:|.be|be.com|.b)(?:\/v\/|\/watch\\?v=|e\/|\/watch(?:.+)v=)(.{11})(?:\&[^\s]*)?/;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -3214,6 +3214,23 @@ angular.module('myApp.services', [])
|
|||||||
html.push(encodeEntities(match[6]));
|
html.push(encodeEntities(match[6]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (match[8]) {
|
||||||
|
if (!options.noLinks) {
|
||||||
|
html.push(
|
||||||
|
match[7],
|
||||||
|
'<a href="#/im?q=',
|
||||||
|
encodeURIComponent(match[8]),
|
||||||
|
'">',
|
||||||
|
encodeEntities(match[8]),
|
||||||
|
'</a>'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
html.push(
|
||||||
|
match[7],
|
||||||
|
encodeEntities(match[8])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
raw = raw.substr(match.index + match[0].length);
|
raw = raw.substr(match.index + match[0].length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user