Browse Source

Fixed mobile issues

master
Igor Zhukov 10 years ago
parent
commit
6a786419a8
  1. 5
      app/js/directives.js
  2. 29
      app/js/message_composer.js
  3. 2
      app/js/services.js
  4. 2
      app/partials/mobile/chat_modal.html

5
app/js/directives.js

@ -1231,7 +1231,7 @@ angular.module('myApp.directives', ['myApp.filters'])
var dragStarted, dragTimeout; var dragStarted, dragTimeout;
var submitBtn = $('.im_submit', element)[0]; var submitBtn = $('.im_submit', element)[0];
new EmojiTooltip(emojiButton, { var emojiTooltip = new EmojiTooltip(emojiButton, {
getStickers: function (callback) { getStickers: function (callback) {
AppStickersManager.getStickers().then(function () { AppStickersManager.getStickers().then(function () {
AppStickersManager.getStickersImages().then(function (stickersData) { AppStickersManager.getStickersImages().then(function (stickersData) {
@ -1372,6 +1372,9 @@ angular.module('myApp.directives', ['myApp.filters'])
if (!Config.Navigator.touch) { if (!Config.Navigator.touch) {
composer.focus(); composer.focus();
} }
if (emojiTooltip) {
emojiTooltip.hide();
}
}); });
$scope.$on('ui_peer_reply', function () { $scope.$on('ui_peer_reply', function () {
onContentLoaded(function () { onContentLoaded(function () {

29
app/js/message_composer.js

@ -166,6 +166,11 @@ function EmojiTooltip (btnEl, options) {
} }
return cancelEvent(e); return cancelEvent(e);
}); });
$(document).on('mousedown', function (e) {
if (self.shown) {
self.hide();
}
});
} }
EmojiTooltip.prototype.onMouseEnter = function (triggerShow) { EmojiTooltip.prototype.onMouseEnter = function (triggerShow) {
@ -191,6 +196,21 @@ EmojiTooltip.prototype.onMouseLeave = function (triggerUnshow) {
} }
}; };
EmojiTooltip.prototype.getScrollWidth = function() {
var outer = $('<div>').css({
position: 'absolute',
width: 100,
height: 100,
overflow: 'scroll',
top: -9999
}).appendTo($(document.body));
var scrollbarWidth = outer[0].offsetWidth - outer[0].clientWidth;
outer.remove();
return scrollbarWidth;
};
EmojiTooltip.prototype.createTooltip = function () { EmojiTooltip.prototype.createTooltip = function () {
@ -207,6 +227,13 @@ EmojiTooltip.prototype.createTooltip = function () {
this.footerEl = $('.composer_emoji_tooltip_footer', this.tooltip); this.footerEl = $('.composer_emoji_tooltip_footer', this.tooltip);
this.settingsEl = $('.composer_emoji_tooltip_settings', this.tooltip); this.settingsEl = $('.composer_emoji_tooltip_settings', this.tooltip);
var scrollWidth = this.getScrollWidth();
if (scrollWidth > 0) {
this.tooltipEl.css({
width: parseInt(this.tooltipEl.css('width')) + scrollWidth
});
}
angular.forEach(['recent', 'smile', 'flower', 'bell', 'car', 'grid', 'stickers'], function (tabName, tabIndex) { angular.forEach(['recent', 'smile', 'flower', 'bell', 'car', 'grid', 'stickers'], function (tabName, tabIndex) {
var tab = $('<a class="composer_emoji_tooltip_tab composer_emoji_tooltip_tab_' + tabName + '"></a>') var tab = $('<a class="composer_emoji_tooltip_tab composer_emoji_tooltip_tab_' + tabName + '"></a>')
.on('mousedown', function (e) { .on('mousedown', function (e) {
@ -363,8 +390,10 @@ EmojiTooltip.prototype.show = function () {
}; };
EmojiTooltip.prototype.hide = function () { EmojiTooltip.prototype.hide = function () {
if (this.tooltipEl) {
this.tooltipEl.removeClass('composer_emoji_tooltip_shown'); this.tooltipEl.removeClass('composer_emoji_tooltip_shown');
this.btnEl.removeClass('composer_emoji_insert_btn_on'); this.btnEl.removeClass('composer_emoji_insert_btn_on');
}
delete this.hideTimeout; delete this.hideTimeout;
delete this.shown; delete this.shown;
}; };

2
app/js/services.js

@ -637,7 +637,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
} }
chatFull.thumb = { chatFull.thumb = {
placeholder: 'img/placeholders/GroupAvatar'+((Math.abs(id) % 4) + 1)+'@2x.png', placeholder: 'img/placeholders/GroupAvatar'+(Config.Mobile ? chat.num : Math.ceil(chat.num / 2))+'@2x.png',
location: chat && chat.photo && chat.photo.photo_small, location: chat && chat.photo && chat.photo.photo_small,
width: 72, width: 72,
height: 72, height: 72,

2
app/partials/mobile/chat_modal.html

@ -49,12 +49,14 @@
<div class="mobile_user_modal_photo_profile_wrap"> <div class="mobile_user_modal_photo_profile_wrap">
<a href="" ng-click="openPhoto(chatFull.chat_photo.id, {p: -chatFull.chat.id})" class="mobile_user_modal_image_wrap pull-left" ng-class="{disabled: !chatFull.chat.photo.photo_small}">
<img <img
class="mobile_user_modal_image mobile_chat_modal_image" class="mobile_user_modal_image mobile_chat_modal_image"
my-load-thumb my-load-thumb
watch="true" watch="true"
thumb="chatFull.thumb" thumb="chatFull.thumb"
/> />
</a>
<div class="mobile_user_modal_info_wrap clearfix"> <div class="mobile_user_modal_info_wrap clearfix">
<h4 class="mobile_user_modal_header" my-chat-link="chatFull.chat.id"></h4> <h4 class="mobile_user_modal_header" my-chat-link="chatFull.chat.id"></h4>

Loading…
Cancel
Save