From 7bdba384c9cb214cae4af042fdd07dd8c30ea81d Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Tue, 6 Oct 2015 15:07:37 +0300 Subject: [PATCH] Added changeling --- app/js/lib/ng_utils.js | 28 +++++++++++------- app/less/app.less | 36 +++++++++++++++-------- app/partials/desktop/changelog_modal.html | 12 ++++++++ app/partials/mobile/changelog_modal.html | 16 +++++++++- 4 files changed, 68 insertions(+), 24 deletions(-) diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js index c43ce9cf..80f13d4b 100644 --- a/app/js/lib/ng_utils.js +++ b/app/js/lib/ng_utils.js @@ -1146,7 +1146,7 @@ angular.module('izhukov.utils', []) var soundcloudRegExp = /^https?:\/\/(?:soundcloud\.com|snd\.sc)\/([a-zA-Z0-9%\-\_]+)\/([a-zA-Z0-9%\-\_]+)/i; var spotifyRegExp = /(https?:\/\/(open\.spotify\.com|play\.spotify\.com|spoti\.fi)\/(.+)|spotify:(.+))/i; - var markdownRegExp = /(^|\n)```(.{0,16})\n([\s\S]+?)\n```(\n|$)|(^|\s)`([^\n]+?)`/; + var markdownRegExp = /(^|\s)```([\s\S]+?)```|(^|\s)`([^\n]+?)`/; var siteHashtags = { Telegram: '#/im?q=%23{1}', @@ -1319,26 +1319,32 @@ angular.module('izhukov.utils', []) var raw = text; var match; var newText = []; + var rawOffset = 0; + var matchIndex; while (match = raw.match(markdownRegExp)) { + matchIndex = rawOffset + match.index; newText.push(raw.substr(0, match.index)); - if (match[3]) { // pre - newText.push(match[1] + match[3] + match[4]); + if (match[2]) { // pre + newText.push(match[1] + match[2]); entities.push({ _: 'messageEntityPre', - language: match[2] || '', - offset: match.index + match[1].length, - length: match[3].length - }) + language: '', + offset: matchIndex + match[1].length, + length: match[2].length + }); + rawOffset -= 6; } else { // code - newText.push(match[5] + match[6]); + newText.push(match[3] + match[4]); entities.push({ _: 'messageEntityCode', - offset: match.index + match[5].length, - length: match[6].length - }) + offset: matchIndex + match[3].length, + length: match[4].length + }); + rawOffset -= 2; } raw = raw.substr(match.index + match[0].length); + rawOffset += match.index + match[0].length; } newText.push(raw); return newText.join(''); diff --git a/app/less/app.less b/app/less/app.less index 4d5f8299..488b1387 100644 --- a/app/less/app.less +++ b/app/less/app.less @@ -38,6 +38,14 @@ h1, h2, h3, h4, h5 { .user-select(text); } +pre { + margin-bottom: 0; + max-height: 300px; + overflow: auto; + padding: 3px; + border: 1px solid #dedede; +} + a { cursor: pointer; @@ -2049,12 +2057,6 @@ a.im_message_fwd_photo { word-wrap: break-word; line-height: 150%; } -.im_message_text pre { - margin-bottom: 0; - max-height: 300px; - overflow: auto; - padding: 4px; -} .im_message_photo_caption, .im_message_video_caption { clear: both; @@ -3984,12 +3986,12 @@ a.countries_modal_search_clear { box-shadow: none; overflow: visible; } - .im_dialogs_col_wrap, - .im_bottom_panel_wrap, - .tg_head_logo_wrap, - .tg_head_msgs_edit_btn, - .tg_head_peer_return_btn, - .tg_head_peer_dropdown { + body .im_dialogs_col_wrap, + body .im_bottom_panel_wrap, + body .tg_head_logo_wrap, + body .tg_head_msgs_edit_btn, + body .tg_head_peer_return_btn, + body .tg_head_peer_dropdown { display: none; } body .im_history_wrap { @@ -4001,6 +4003,16 @@ a.countries_modal_search_clear { body .nano > .nano-content { position: static; } + body .tg_head_peer_info { + text-align: center; + } + body .im_history_col_wrap, + body .tg_head_main_wrap { + width: auto; + max-width: 700px; + float: none; + margin: 0 auto; + } } diff --git a/app/partials/desktop/changelog_modal.html b/app/partials/desktop/changelog_modal.html index 29431446..37cecf87 100644 --- a/app/partials/desktop/changelog_modal.html +++ b/app/partials/desktop/changelog_modal.html @@ -31,6 +31,18 @@
+
+
0.4.8
+
+
    +
  • Introducing Channels – a great new way to broadcast your messages to unlimited audiences.
  • +
  • Check out the Telegram Blog for more info
  • +
  • Improved performance in Safari on OS X El Capitan.
  • +
  • Added formatting for fixed-width code, surround text with `single backticks` for inline text and ```triple backticks``` for blocks of pre-formatted text.
  • +
+
+
+
0.4.7
diff --git a/app/partials/mobile/changelog_modal.html b/app/partials/mobile/changelog_modal.html index 63633b77..b893d41c 100644 --- a/app/partials/mobile/changelog_modal.html +++ b/app/partials/mobile/changelog_modal.html @@ -19,9 +19,23 @@ + +