Browse Source

Improved history for copy to clipboard

Can’t fix #911
master
Igor Zhukov 9 years ago
parent
commit
45bf484ba4
  1. 8
      app/js/directives.js
  2. 4
      app/js/lib/i18n.js
  3. 22
      app/less/app.less
  4. 2
      app/less/desktop.less
  5. 10
      app/partials/desktop/audio_player.html
  6. 2
      app/partials/desktop/full_gif.html
  7. 6
      app/partials/desktop/im.html
  8. 9
      app/partials/desktop/message.html
  9. 10
      app/partials/desktop/message_attach_document.html
  10. 1
      app/partials/desktop/message_attach_geo.html
  11. 1
      app/partials/desktop/message_attach_photo.html
  12. 1
      app/partials/desktop/message_attach_venue.html
  13. 14
      app/partials/desktop/message_attach_video.html
  14. 4
      app/partials/desktop/message_attach_webpage.html
  15. 3
      app/partials/desktop/reply_message.html
  16. 2
      app/partials/mobile/chat_modal.html

8
app/js/directives.js

@ -45,7 +45,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -45,7 +45,7 @@ angular.module('myApp.directives', ['myApp.filters'])
.directive('myMessage', function($filter, _) {
var dateFilter = $filter('myDate'),
dateSplitHtml = '<div class="im_message_date_split im_service_message_wrap"><div class="im_service_message"></div></div>',
dateSplitHtml = '<div class="im_message_date_split im_service_message_wrap"><div class="im_service_message"><span class="copyonly"><br/>---&nbsp;</span><span class="im_message_date_split_text"></span><span class="copyonly">&nbsp;---</span></div></div>',
unreadSplitHtml = '<div class="im_message_unread_split">' + _('unread_messages_split') + '</div>',
selectedClass = 'im_message_selected',
focusClass = 'im_message_focus',
@ -90,7 +90,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -90,7 +90,7 @@ angular.module('myApp.directives', ['myApp.filters'])
needDateSplit.show();
} else {
needDateSplit = $(dateSplitHtml);
$(needDateSplit[0].firstChild).text(dateFilter($scope.historyMessage.date));
$('.im_message_date_split_text', needDateSplit).text(dateFilter($scope.historyMessage.date));
if (unreadAfterSplit) {
needDateSplit.insertBefore(unreadAfterSplit)
} else {
@ -2090,7 +2090,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -2090,7 +2090,7 @@ angular.module('myApp.directives', ['myApp.filters'])
}
})
.directive('myLoadSticker', function(MtpApiFileManager, FileManager, AppStickersManager) {
.directive('myLoadSticker', function(_, MtpApiFileManager, FileManager, AppStickersManager) {
var emptySrc = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
@ -2105,6 +2105,8 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -2105,6 +2105,8 @@ angular.module('myApp.directives', ['myApp.filters'])
var imgElement = $('<img />').addClass(attrs.imgClass);
var wasAdded = false;
imgElement.attr('alt', '['+ ($scope.document.stickerEmojiRaw || '') + ' ' + _('conversation_media_sticker') +']');
if (attrs.open && $scope.document.stickerSetInput) {
element
.addClass('clickable')

4
app/js/lib/i18n.js

@ -115,7 +115,11 @@ angular.module('myApp.i18n', ['izhukov.utils']) @@ -115,7 +115,11 @@ angular.module('myApp.i18n', ['izhukov.utils'])
var format = angular.element(element);
var msgid = format.attr("my-i18n") || format.attr("msgid") || format.attr("my-i18n-format") || format.html().replace(/\s+/g, ' ').trim();
var msgstr = _(msgid, params);
if (format.hasClass('nocopy')) {
format.attr('data-content', msgstr);
} else {
format.html(msgstr);
}
});
}
}

22
app/less/app.less

@ -37,12 +37,28 @@ h1, h2, h3, h4, h5 { @@ -37,12 +37,28 @@ h1, h2, h3, h4, h5 {
.user-select(text);
}
.copyonly {
color: transparent;
display: inline-block;
vertical-align: baseline;
width: 1px;
height: 0px;
background: none 0 no-repeat;
font-size: 0px;
float: left;
text-rendering: auto;
.user-select(none);
}
.nocopy::before {
content: attr(data-content);
}
pre {
margin-bottom: 0;
max-height: 300px;
overflow: auto;
padding: 3px;
border: 1px solid #dedede;
border: 1px solid #eee;
max-height: none;
font-size: inherit;
}
@ -2060,7 +2076,7 @@ div.im_message_body { @@ -2060,7 +2076,7 @@ div.im_message_body {
overflow: hidden;
}
.im_message_meta,
// .im_message_meta,
.im_message_body {
.user-select(text);
}

2
app/less/desktop.less

@ -1832,7 +1832,7 @@ a.im_panel_peer_photo .peer_initials { @@ -1832,7 +1832,7 @@ a.im_panel_peer_photo .peer_initials {
.im_grouped &,
.im_grouped_fwd &,
.im_grouped_fwd_short & {
.im_message_date {
.im_message_meta {
display: none;
}
}

10
app/partials/desktop/audio_player.html

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
<span ng-switch-when="true" class="audio_player_duration" ng-bind="mediaPlayer.player.currentTime | durationRemains : (mediaPlayer.player.duration || audio.duration)"></span>
<span ng-switch-default class="audio_player_duration" ng-bind="mediaPlayer.player.duration || audio.duration | duration"></span>
</div>
<span class="copyonly">[ </span>
<a ng-click="download()" class="audio_player_title" ng-switch="::audio.audioTitle.length > 0 ? 2 : (audio.file_name.length > 0 ? 1 : 0)">
<span ng-switch-when="2">
<strong ng-bind="::audio.audioPerformer"></strong>
@ -15,19 +16,20 @@ @@ -15,19 +16,20 @@
<span ng-switch-when="1" ng-bind="::audio.file_name"></span>
<span ng-switch-default my-i18n="message_attach_audio_message"></span>
</a>
<span class="copyonly">]</span>
<i ng-if="::message.pFlags.media_unread || false" ng-show="message.pFlags.media_unread" class="icon icon-audio-unread"></i>
<div class="audio_player_meta" ng-if="!audio.downloaded || !(mediaPlayer.player.duration || audio.duration)" ng-switch="audio.progress.enabled">
<span ng-switch-when="true" class="audio_player_size" ng-bind="audio.progress | formatSizeProgress"></span>
<span ng-switch-default class="audio_player_size" ng-bind="audio.size | formatSize"></span>
</div>
</div>
<div class="audio_player_actions" ng-if="!audio.progress.enabled &amp;&amp; !audio.downloaded">
<a ng-if="audio._ == 'document'" ng-click="download()" my-i18n="message_attach_document_download"></a>
<a ng-click="togglePlay()" my-i18n="message_attach_audio_play"></a>
<div class="audio_player_actions noselect" ng-if="!audio.progress.enabled &amp;&amp; !audio.downloaded">
<a class="nocopy" ng-if="audio._ == 'document'" ng-click="download()" my-i18n="message_attach_document_download"></a>
<a class="nocopy" ng-click="togglePlay()" my-i18n="message_attach_audio_play"></a>
</div>
<div class="audio_player_progress_wrap" ng-if="audio.progress.enabled || audio.downloaded" ng-switch="audio.progress.enabled">
<div ng-switch-when="true" class="clearfix im_message_cancelable_progress_wrap">
<a class="im_message_media_progress_cancel pull-right" ng-click="audio.progress.cancel()" my-i18n="modal_cancel"></a>
<a class="im_message_media_progress_cancel pull-right nocopy" ng-click="audio.progress.cancel()" my-i18n="modal_cancel"></a>
<div class="im_message_download_progress_wrap">
<div class="progress tg_down_progress">
<div class="progress-bar progress-bar-success" ng-style="{width: audio.progress.percent + '%'}"></div>

2
app/partials/desktop/full_gif.html

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
</i>
<div my-arc-progress="document.progress.percent"></div>
</div>
<div ng-switch-default class="img_gif_label noselect img_gif_meta_contents">GIF</div>
<div ng-switch-default class="img_gif_label noselect img_gif_meta_contents"><span class="copyonly">[</span>GIF<span class="copyonly">]</span></div>
</div>
<div ng-if="document.url" ng-show="document.downloaded &amp;&amp; isActive" ng-switch="document.mime_type == 'video/mp4'">

6
app/partials/desktop/im.html

@ -171,7 +171,7 @@ @@ -171,7 +171,7 @@
</div>
</div>
<div class="im_send_panel_wrap" ng-show="!historyState.actions()">
<div class="im_send_panel_wrap noselect" ng-show="!historyState.actions()">
<div class="im_send_form_wrap1">
@ -196,7 +196,7 @@ @@ -196,7 +196,7 @@
<div class="im_message_reply_wrap" my-forwarded-messages="draftMessage.fwdMessages"></div>
</div>
<div class="im_send_field_wrap" ng-class="historyState.replyKeyboard._ == 'replyKeyboardMarkup' ? 'im_send_field_wrap_2ndbtn' : ''">
<div class="im_send_field_wrap hasselect" ng-class="historyState.replyKeyboard._ == 'replyKeyboardMarkup' ? 'im_send_field_wrap_2ndbtn' : ''">
<a class="composer_emoji_insert_btn"><i class="icon icon-emoji"></i></a>
<div class="composer_progress_icon" my-arc-progress width="22" stroke="2.5"></div>
<a class="composer_command_btn" ng-show="!historyState.replyKeyboard && commands.list.length > 0 && (!draftMessage.text.length || draftMessage.text[0] == '/')" ng-mousedown="toggleSlash($event)" ng-class="draftMessage.text[0] == '/' ? 'active' : ''"><i class="icon icon-slash"></i></a>
@ -207,7 +207,7 @@ @@ -207,7 +207,7 @@
</div>
<div class="im_send_buttons_wrap clearfix">
<button type="submit" class="btn btn-md im_submit" my-i18n="im_submit_message"></button>
<button type="submit" class="btn btn-md im_submit nocopy" my-i18n="im_submit_message"></button>
<div class="im_attach pull-left">
<input type="file" class="im_attach_input" size="28" multiple="multiple" title="{{'im_attach_file_title' | i18n}}" />

9
app/partials/desktop/message.html

@ -33,25 +33,26 @@ @@ -33,25 +33,26 @@
<a class="im_message_from_photo pull-left" my-peer-photolink="::historyMessage.fromID" img-class="im_message_from_photo"></a>
<div class="im_message_meta pull-right text-right">
<div class="im_message_meta pull-right text-right noselect">
<div class="im_message_views_wrap" ng-if="::!historyMessage.fwdFromID && historyMessage.views > 0">
<div class="im_message_views">
<i class="icon-message-views"></i><span class="im_message_views_cnt" my-message-views="historyMessage.mid"></span>
</div>
</div>
<span class="im_message_date clickable" ng-bind="::historyMessage.date | time"></span>
<span class="im_message_date clickable nocopy" data-content="{{::historyMessage.date | time}}"></span>
</div>
<div class="im_message_body" ng-class="::{im_message_body_media: historyMessage._ == 'message' &amp;&amp; historyMessage.media ? true : false}">
<a class="im_message_author" my-peer-link="historyMessage.fromID" short="historyMessage.toID > 0" color="historyMessage.toID < 0" no-watch="true"></a><span ng-if="::historyMessage.viaBotID && !historyMessage.fwdFromID" class="im_message_author_via" my-i18n="message_via_bot"><my-i18n-param name="bot"><a class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true" ng-click="selectInlineBot(historyMessage.viaBotID, $event)"></a></my-i18n-param></span>
<span class="copyonly">[<span ng-bind="::historyMessage.date | time"></span>] </span><a class="im_message_author" my-peer-link="historyMessage.fromID" short="historyMessage.toID > 0" color="historyMessage.toID < 0" no-watch="true"></a><span ng-if="::historyMessage.viaBotID && !historyMessage.fwdFromID" class="im_message_author_via" my-i18n="message_via_bot"><my-i18n-param name="bot"><a class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true" ng-click="selectInlineBot(historyMessage.viaBotID, $event)"></a></my-i18n-param></span><span class="copyonly">:</span>
<a class="im_message_reply_wrap" my-reply-message="historyMessage.reply_to_msg" ng-if="::historyMessage.reply_to_mid"></a>
<div ng-if="::historyMessage.fwdFromID || false" class="im_message_fwd_from">
<span class="copyonly"><span my-i18n="message_forwarded_message"></span>:&nbsp;</span>
<a class="im_message_fwd_photo pull-left" my-peer-photolink="::historyMessage.fwdFromID" img-class="im_message_fwd_photo"></a>
<div class="im_message_fwd_author_wrap">
<a class="im_message_fwd_author" my-peer-link="historyMessage.fwdFromID"></a><span ng-if="::historyMessage.viaBotID" class="im_message_fwd_via" my-i18n="message_via_bot"><my-i18n-param name="bot"><a class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true"></a></my-i18n-param></span><span class="im_message_fwd_date" ng-bind="::historyMessage.fwd_date | dateOrTime"></span>
<a class="im_message_fwd_author" my-peer-link="historyMessage.fwdFromID"></a><span ng-if="::historyMessage.viaBotID" class="im_message_fwd_via" my-i18n="message_via_bot"><my-i18n-param name="bot"><a class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true"></a></my-i18n-param></span><span class="copyonly">&nbsp;[</span><span class="im_message_fwd_date" ng-bind="::historyMessage.fwd_date | dateOrTime"></span><span class="copyonly">]&nbsp;</span>
<span class="im_message_views_inline" ng-if="::historyMessage.views > 0">
<i class="icon-message-views"></i><span class="im_message_views_cnt" my-message-views="historyMessage.mid"></span>
</span>

10
app/partials/desktop/message_attach_document.html

@ -25,17 +25,17 @@ @@ -25,17 +25,17 @@
<div class="im_message_document_info">
<div class="im_message_document_name_wrap">
<a href="" ng-click="docOpen()" class="im_message_document_name" ng-bind="::media.document.file_name"></a>
<span class="copyonly">[</span><a href="" ng-click="docOpen()" class="im_message_document_name" ng-bind="::media.document.file_name"></a><span class="copyonly">]</span>
<span class="im_message_document_size" ng-if="!media.document.progress.enabled" ng-bind="::media.document.size | formatSize"></span>
<span class="im_message_document_size" ng-if="media.document.progress.enabled" ng-bind="media.document.progress | formatSizeProgress"></span>
</div>
<div class="im_message_document_actions" ng-if="!media.document.progress.enabled" ng-switch="media.document.downloaded">
<a ng-switch-when="true" href="" ng-click="docSave()" my-i18n="message_attach_document_save"></a>
<a ng-switch-default href="" ng-click="docSave()" my-i18n="message_attach_document_download"></a>
<a ng-if="::media.document.withPreview" href="" ng-click="docOpen()" my-i18n="message_attach_document_open"></a>
<a class="nocopy" ng-switch-when="true" href="" ng-click="docSave()" my-i18n="message_attach_document_save"></a>
<a class="nocopy" ng-switch-default href="" ng-click="docSave()" my-i18n="message_attach_document_download"></a>
<a class="nocopy" ng-if="::media.document.withPreview" href="" ng-click="docOpen()" my-i18n="message_attach_document_open"></a>
</div>
<div class="clearfix im_message_cancelable_progress_wrap" ng-if="media.document.progress.enabled">
<a class="im_message_media_progress_cancel pull-right" ng-click="media.document.progress.cancel()" my-i18n="modal_cancel"></a>
<a class="im_message_media_progress_cancel pull-right nocopy" ng-click="media.document.progress.cancel()" my-i18n="modal_cancel"></a>
<div class="im_message_download_progress_wrap">
<div class="progress tg_down_progress">
<div class="progress-bar progress-bar-success" ng-style="{width: media.document.progress.percent + '%'}"></div>

1
app/partials/desktop/message_attach_geo.html

@ -5,5 +5,6 @@ @@ -5,5 +5,6 @@
my-geo-point-map="media.geo"
width="300"
height="150"
alt="[{{::'conversation_media_location' | i18n}} {{::media.mapUrl}}]"
/>
</a>

1
app/partials/desktop/message_attach_photo.html

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
class="im_message_photo_thumb"
my-load-thumb
thumb="media.photo.thumb"
alt="[{{::'conversation_media_photo' | i18n}}]"
/>
</a>
<div ng-if="::media.rCaption" class="im_message_photo_caption" ng-bind-html="::media.rCaption"></div>

1
app/partials/desktop/message_attach_venue.html

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
my-geo-point-map="venue.geo"
width="100"
height="100"
alt="[{{::'conversation_media_location' | i18n}} {{::venue.mapUrl}}]"
/>
</a>

14
app/partials/desktop/message_attach_video.html

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<div class="im_message_video im_message_document_thumbed">
<a class="im_message_video_thumb" ng-click="videoOpen()" ng-style="::{width: media.video.thumb.width + 'px'}">
<span class="im_message_video_duration" ng-bind="::media.video.duration | duration"></span>
<span class="im_message_video_duration nocopy" data-content="{{::media.video.duration | duration}}"></span>
<i class="icon icon-videoplay"></i>
<img
class="im_message_video_thumb im_message_video_thumb_blurred"
@ -11,19 +11,19 @@ @@ -11,19 +11,19 @@
<div class="im_message_document_info">
<div class="im_message_document_name_wrap">
<span class="im_message_document_name" my-i18n="message_attach_video_video"></span>
<span class="copyonly">[</span><span class="im_message_document_name" my-i18n="message_attach_video_video"></span><span class="copyonly">&nbsp;<span ng-bind="::media.video.duration | duration"></span>]</span>
<span class="im_message_document_size" ng-if="!media.video.progress.enabled" ng-bind="::media.video.size | formatSize"></span>
<span class="im_message_document_size" ng-if="media.video.progress.enabled" ng-bind="media.video.progress | formatSizeProgress"></span>
</div>
<div class="im_message_document_actions" ng-if="!media.video.progress.enabled">
<div class="im_message_document_actions noselect" ng-if="!media.video.progress.enabled">
<a href="" ng-click="videoSave()" ng-switch="media.video.downloaded">
<span ng-switch-when="true" my-i18n="message_attach_video_save"></span>
<span ng-switch-default my-i18n="message_attach_video_download"></span>
<span class="nocopy" ng-switch-when="true" my-i18n="message_attach_video_save"></span>
<span class="nocopy" ng-switch-default my-i18n="message_attach_video_download"></span>
</a>
<a href="" ng-click="videoOpen()" my-i18n="message_attach_video_play"></a>
<a class="nocopy" href="" ng-click="videoOpen()" my-i18n="message_attach_video_play"></a>
</div>
<div class="clearfix im_message_cancelable_progress_wrap" ng-if="media.video.progress.enabled">
<a class="im_message_media_progress_cancel pull-right" ng-click="media.video.progress.cancel()" my-i18n="modal_cancel"></a>
<a class="im_message_media_progress_cancel pull-right nocopy" ng-click="media.video.progress.cancel()" my-i18n="modal_cancel"></a>
<div class="im_message_download_progress_wrap">
<div class="progress tg_down_progress">
<div class="progress-bar progress-bar-success" ng-style="{width: media.video.progress.percent + '%'}"></div>

4
app/partials/desktop/message_attach_webpage.html

@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
class="im_message_photo_thumb"
my-load-thumb
thumb="webpage.photo.thumb"
alt="[{{::'conversation_media_photo' | i18n}}]"
/>
</a>
</div>
@ -19,12 +20,13 @@ @@ -19,12 +20,13 @@
</div>
<div ng-if="webpage.description.length" class="im_message_webpage_description" ng-bind-html="webpage.rDescription"></div>
<a class="im_message_video_thumb" ng-click="openEmbed($event)" ng-href="{{webpage.url}}" target="_blank" ng-style="::{width: video.thumb.width + 'px'}">
<span ng-if="webpage.duration > 0" class="im_message_video_duration" ng-bind="::webpage.duration | duration"></span>
<span ng-if="webpage.duration > 0" class="im_message_video_duration nocopy" data-content="::webpage.duration | duration"></span>
<i class="icon icon-videoplay"></i>
<img
class="im_message_video_thumb"
my-load-thumb
thumb="webpage.photo.thumb"
alt="[{{::'conversation_media_video' | i18n}}]"
/>
</a>
</div>

3
app/partials/desktop/reply_message.html

@ -12,9 +12,12 @@ @@ -12,9 +12,12 @@
/>
</div>
<div class="im_message_reply_author" ng-switch-default>
<span class="copyonly">&gt;&nbsp;</span>
<span my-peer-link="replyMessage.fromID" peer-watch="true"></span>
</div>
<div class="im_message_reply_body" ng-switch-default>
<span class="copyonly">&gt;&nbsp;</span>
<span class="im_reply_message_media" ng-if="replyMessage.media" ng-switch="replyMessage.media._">
<span ng-switch-when="messageMediaPhoto" my-i18n="conversation_media_photo"></span>
<span ng-switch-when="messageMediaVideo" my-i18n="conversation_media_video"></span>

2
app/partials/mobile/chat_modal.html

@ -112,8 +112,6 @@ @@ -112,8 +112,6 @@
</div>
<div class="chat_modal_members_forbidden" ng-if="chatFull.chat._ == 'chatForbidden' || chatFull.chat.pFlags.left" my-i18n="group_modal_members_unavailable"></div>
</div>
</div>

Loading…
Cancel
Save