From 45bf484ba46b294f6dd13ace7a28246af2a81704 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Tue, 9 Feb 2016 19:42:01 +0000 Subject: [PATCH] Improved history for copy to clipboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Can’t fix #911 --- app/js/directives.js | 8 ++++--- app/js/lib/i18n.js | 6 ++++- app/less/app.less | 22 ++++++++++++++++--- app/less/desktop.less | 2 +- app/partials/desktop/audio_player.html | 10 +++++---- app/partials/desktop/full_gif.html | 2 +- app/partials/desktop/im.html | 6 ++--- app/partials/desktop/message.html | 9 ++++---- .../desktop/message_attach_document.html | 10 ++++----- app/partials/desktop/message_attach_geo.html | 1 + .../desktop/message_attach_photo.html | 1 + .../desktop/message_attach_venue.html | 1 + .../desktop/message_attach_video.html | 14 ++++++------ .../desktop/message_attach_webpage.html | 4 +++- app/partials/desktop/reply_message.html | 3 +++ app/partials/mobile/chat_modal.html | 2 -- 16 files changed, 66 insertions(+), 35 deletions(-) diff --git a/app/js/directives.js b/app/js/directives.js index f49deb65..4881887a 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -45,7 +45,7 @@ angular.module('myApp.directives', ['myApp.filters']) .directive('myMessage', function($filter, _) { var dateFilter = $filter('myDate'), - dateSplitHtml = '
', + dateSplitHtml = '

--- 
 ---
', unreadSplitHtml = '
' + _('unread_messages_split') + '
', selectedClass = 'im_message_selected', focusClass = 'im_message_focus', @@ -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']) } }) - .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']) var imgElement = $('').addClass(attrs.imgClass); var wasAdded = false; + imgElement.attr('alt', '['+ ($scope.document.stickerEmojiRaw || '') + ' ' + _('conversation_media_sticker') +']'); + if (attrs.open && $scope.document.stickerSetInput) { element .addClass('clickable') diff --git a/app/js/lib/i18n.js b/app/js/lib/i18n.js index 8fa346b5..03db0d12 100644 --- a/app/js/lib/i18n.js +++ b/app/js/lib/i18n.js @@ -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); - format.html(msgstr); + if (format.hasClass('nocopy')) { + format.attr('data-content', msgstr); + } else { + format.html(msgstr); + } }); } } diff --git a/app/less/app.less b/app/less/app.less index d6df681c..a4fdfcc7 100644 --- a/app/less/app.less +++ b/app/less/app.less @@ -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 { overflow: hidden; } -.im_message_meta, +// .im_message_meta, .im_message_body { .user-select(text); } diff --git a/app/less/desktop.less b/app/less/desktop.less index 08b6f42e..1f70db60 100644 --- a/app/less/desktop.less +++ b/app/less/desktop.less @@ -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; } } diff --git a/app/partials/desktop/audio_player.html b/app/partials/desktop/audio_player.html index c804f561..1c9369b0 100644 --- a/app/partials/desktop/audio_player.html +++ b/app/partials/desktop/audio_player.html @@ -7,6 +7,7 @@ + [ @@ -15,19 +16,20 @@ + ]
-
- - +
+ +
- +
diff --git a/app/partials/desktop/full_gif.html b/app/partials/desktop/full_gif.html index ae2f3024..d563bd5d 100644 --- a/app/partials/desktop/full_gif.html +++ b/app/partials/desktop/full_gif.html @@ -10,7 +10,7 @@
-
GIF
+
[GIF]
diff --git a/app/partials/desktop/im.html b/app/partials/desktop/im.html index 0b3b36cf..812ab803 100644 --- a/app/partials/desktop/im.html +++ b/app/partials/desktop/im.html @@ -171,7 +171,7 @@
-
+
@@ -196,7 +196,7 @@
-
+
@@ -207,7 +207,7 @@
- +
diff --git a/app/partials/desktop/message.html b/app/partials/desktop/message.html index fa92172e..9fc96997 100644 --- a/app/partials/desktop/message.html +++ b/app/partials/desktop/message.html @@ -33,25 +33,26 @@ -
+
- +
- + [] :
+
- +  [ diff --git a/app/partials/desktop/message_attach_document.html b/app/partials/desktop/message_attach_document.html index c2415c82..e5c160ed 100644 --- a/app/partials/desktop/message_attach_document.html +++ b/app/partials/desktop/message_attach_document.html @@ -25,17 +25,17 @@
- + []
- - - + + +
- +
diff --git a/app/partials/desktop/message_attach_geo.html b/app/partials/desktop/message_attach_geo.html index f9fb74e5..b894feec 100644 --- a/app/partials/desktop/message_attach_geo.html +++ b/app/partials/desktop/message_attach_geo.html @@ -5,5 +5,6 @@ my-geo-point-map="media.geo" width="300" height="150" + alt="[{{::'conversation_media_location' | i18n}} {{::media.mapUrl}}]" /> \ No newline at end of file diff --git a/app/partials/desktop/message_attach_photo.html b/app/partials/desktop/message_attach_photo.html index 908bbe91..60dcf94b 100644 --- a/app/partials/desktop/message_attach_photo.html +++ b/app/partials/desktop/message_attach_photo.html @@ -3,6 +3,7 @@ class="im_message_photo_thumb" my-load-thumb thumb="media.photo.thumb" + alt="[{{::'conversation_media_photo' | i18n}}]" />
\ No newline at end of file diff --git a/app/partials/desktop/message_attach_venue.html b/app/partials/desktop/message_attach_venue.html index a0657a32..3f87569c 100644 --- a/app/partials/desktop/message_attach_venue.html +++ b/app/partials/desktop/message_attach_venue.html @@ -7,6 +7,7 @@ my-geo-point-map="venue.geo" width="100" height="100" + alt="[{{::'conversation_media_location' | i18n}} {{::venue.mapUrl}}]" /> diff --git a/app/partials/desktop/message_attach_video.html b/app/partials/desktop/message_attach_video.html index 2b34ca0d..2b9aef45 100644 --- a/app/partials/desktop/message_attach_video.html +++ b/app/partials/desktop/message_attach_video.html @@ -1,6 +1,6 @@
- +
- + [ ]
-
+
- +
diff --git a/app/partials/desktop/message_attach_webpage.html b/app/partials/desktop/message_attach_webpage.html index eec02431..2ac2b4ed 100644 --- a/app/partials/desktop/message_attach_webpage.html +++ b/app/partials/desktop/message_attach_webpage.html @@ -9,6 +9,7 @@ class="im_message_photo_thumb" my-load-thumb thumb="webpage.photo.thumb" + alt="[{{::'conversation_media_photo' | i18n}}]" />
@@ -19,12 +20,13 @@
- + [{{::'conversation_media_video' | i18n}}]
diff --git a/app/partials/desktop/reply_message.html b/app/partials/desktop/reply_message.html index 67768dd3..5f19ca4c 100644 --- a/app/partials/desktop/reply_message.html +++ b/app/partials/desktop/reply_message.html @@ -12,9 +12,12 @@ />
+
+ + diff --git a/app/partials/mobile/chat_modal.html b/app/partials/mobile/chat_modal.html index 131bfe66..30127ca2 100644 --- a/app/partials/mobile/chat_modal.html +++ b/app/partials/mobile/chat_modal.html @@ -112,8 +112,6 @@
-
-