Open stickerset on click

Closes #820
This commit is contained in:
Igor Zhukov 2015-07-09 12:09:44 +03:00
parent 47e4124cb0
commit 2a28adb6e5
6 changed files with 32 additions and 10 deletions

View File

@ -1415,6 +1415,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
target.getAttribute('ng-click')) {
return false;
}
var events = $._data(target, 'events');
if (events && (events.click || events.mousedown)) {
return false;
}
target = target.parentNode;
}
}

View File

@ -1898,7 +1898,7 @@ angular.module('myApp.directives', ['myApp.filters'])
}
})
.directive('myLoadSticker', function(MtpApiFileManager, FileManager) {
.directive('myLoadSticker', function(MtpApiFileManager, FileManager, AppStickersManager) {
var emptySrc = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
@ -1969,6 +1969,14 @@ angular.module('myApp.directives', ['myApp.filters'])
console.log('Download sticker failed', e, fullLocation);
});
}
if (attrs.open && $scope.document.stickerSetInput) {
element
.addClass('clickable')
.on('click', function () {
AppStickersManager.openStickerset($scope.document.stickerSetInput);
});
}
}
})

View File

@ -3707,9 +3707,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
apiDoc.stickerEmojiRaw = attribute.alt;
apiDoc.stickerEmoji = RichTextProcessor.wrapRichText(apiDoc.stickerEmojiRaw, {noLinks: true, noLinebreaks: true});
}
if (attribute.stickerset &&
attribute.stickerset._ == 'inputStickerSetID') {
apiDoc.stickerSetID = attribute.stickerset.id;
if (attribute.stickerset) {
if (attribute.stickerset._ == 'inputStickerSetEmpty') {
delete attribute.stickerset;
}
else if (attribute.stickerset._ == 'inputStickerSetID') {
apiDoc.stickerSetInput = attribute.stickerset;
}
}
break;
case 'documentAttributeImageSize':
@ -4017,6 +4021,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return {
start: start,
openStickersetLink: openStickersetLink,
openStickerset: openStickerset,
installStickerset: installStickerset,
getStickers: getStickers,
getStickerset: getStickerset,
@ -4178,11 +4183,15 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
function openStickersetLink (shortName) {
var scope = $rootScope.$new(true);
scope.inputStickerset = {
return openStickerset({
_: 'inputStickerSetShortName',
short_name: shortName
};
});
}
function openStickerset (inputStickerset) {
var scope = $rootScope.$new(true);
scope.inputStickerset = inputStickerset;
var modal = $modal.open({
templateUrl: templateUrl('stickerset_modal'),
controller: 'StickersetModalController',

View File

@ -1660,7 +1660,8 @@ div.im_message_video_thumb {
}
.im_history_select_active {
a {
a,
.clickable {
pointer-events: none;
}
}

View File

@ -2,7 +2,7 @@
<div ng-switch-when="gif" my-load-gif document="document"></div>
<div ng-switch-when="sticker" my-load-sticker document="document"></div>
<div ng-switch-when="sticker" my-load-sticker document="document" open="true"></div>
<div ng-switch-when="audio" class="im_message_audio">
<div my-audio-player audio="document"></div>

View File

@ -2,7 +2,7 @@
<div ng-switch-when="gif" my-load-gif document="document"></div>
<div ng-switch-when="sticker" my-load-sticker document="document"></div>
<div ng-switch-when="sticker" my-load-sticker document="document" open="true"></div>
<div ng-switch-when="audio" class="im_message_audio">
<div my-audio-player audio="document"></div>