Browse Source

Open stickerset on click

Closes #820
TitanNano-voice_recorder
Igor Zhukov 10 years ago
parent
commit
2a28adb6e5
  1. 4
      app/js/controllers.js
  2. 10
      app/js/directives.js
  3. 21
      app/js/services.js
  4. 3
      app/less/app.less
  5. 2
      app/partials/desktop/message_attach_document.html
  6. 2
      app/partials/mobile/message_attach_document.html

4
app/js/controllers.js

@ -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;
}
}

10
app/js/directives.js

@ -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);
});
}
}
})

21
app/js/services.js

@ -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',

3
app/less/app.less

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

2
app/partials/desktop/message_attach_document.html

@ -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>

2
app/partials/mobile/message_attach_document.html

@ -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>

Loading…
Cancel
Save