Browse Source

Fixed mobile issues

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

5
app/js/directives.js

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

33
app/js/message_composer.js

@ -166,6 +166,11 @@ function EmojiTooltip (btnEl, options) { @@ -166,6 +166,11 @@ function EmojiTooltip (btnEl, options) {
}
return cancelEvent(e);
});
$(document).on('mousedown', function (e) {
if (self.shown) {
self.hide();
}
});
}
EmojiTooltip.prototype.onMouseEnter = function (triggerShow) {
@ -191,6 +196,21 @@ EmojiTooltip.prototype.onMouseLeave = function (triggerUnshow) { @@ -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 () {
@ -207,6 +227,13 @@ EmojiTooltip.prototype.createTooltip = function () { @@ -207,6 +227,13 @@ EmojiTooltip.prototype.createTooltip = function () {
this.footerEl = $('.composer_emoji_tooltip_footer', 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) {
var tab = $('<a class="composer_emoji_tooltip_tab composer_emoji_tooltip_tab_' + tabName + '"></a>')
.on('mousedown', function (e) {
@ -363,8 +390,10 @@ EmojiTooltip.prototype.show = function () { @@ -363,8 +390,10 @@ EmojiTooltip.prototype.show = function () {
};
EmojiTooltip.prototype.hide = function () {
this.tooltipEl.removeClass('composer_emoji_tooltip_shown');
this.btnEl.removeClass('composer_emoji_insert_btn_on');
if (this.tooltipEl) {
this.tooltipEl.removeClass('composer_emoji_tooltip_shown');
this.btnEl.removeClass('composer_emoji_insert_btn_on');
}
delete this.hideTimeout;
delete this.shown;
};

2
app/js/services.js

@ -637,7 +637,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -637,7 +637,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
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,
width: 72,
height: 72,

14
app/partials/mobile/chat_modal.html

@ -49,12 +49,14 @@ @@ -49,12 +49,14 @@
<div class="mobile_user_modal_photo_profile_wrap">
<img
class="mobile_user_modal_image mobile_chat_modal_image"
my-load-thumb
watch="true"
thumb="chatFull.thumb"
/>
<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
class="mobile_user_modal_image mobile_chat_modal_image"
my-load-thumb
watch="true"
thumb="chatFull.thumb"
/>
</a>
<div class="mobile_user_modal_info_wrap clearfix">
<h4 class="mobile_user_modal_header" my-chat-link="chatFull.chat.id"></h4>

Loading…
Cancel
Save