diff --git a/Telegram/Resources/iv_html/page.js b/Telegram/Resources/iv_html/page.js index c0a9c7896..c38bd1119 100644 --- a/Telegram/Resources/iv_html/page.js +++ b/Telegram/Resources/iv_html/page.js @@ -185,6 +185,11 @@ var IV = { button.appendChild(ripple); }, stopRipples: function (button) { + const id = button.id ? button.id : button; + if (IV.frozenRipple === id) { + return; + } + button = document.getElementById(id); const ripples = button.getElementsByClassName('ripple'); for (var i = 0; i < ripples.length; ++i) { const ripple = ripples[i]; @@ -193,6 +198,15 @@ var IV = { } } }, + clearFrozenRipple: function () { + if (IV.frozenRipple) { + const button = document.getElementById(IV.frozenRipple); + IV.frozenRipple = null; + if (button) { + IV.stopRipples(button); + } + } + }, init: function () { IV.hash = window.location.hash.substr(1); @@ -203,7 +217,10 @@ var IV = { IV.addRipple(e.currentTarget, e.clientX, e.clientY); }); button.addEventListener('mouseup', function (e) { - IV.stopRipples(e.currentTarget); + const id = e.currentTarget.id; + setTimeout(function () { + IV.stopRipples(id); + }, 0); }); button.addEventListener('mouseleave', function (e) { IV.stopRipples(e.currentTarget); @@ -226,6 +243,10 @@ var IV = { scrollTo: function (y) { document.getElementById('bottom_up').classList.add('hidden'); window.scrollTo({ top: y || 0, behavior: 'smooth' }); + }, + menu: function (button) { + IV.frozenRipple = button.id; + IV.notify({ event: 'menu', hash: IV.hash }); } }; diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 2805ebaf6..436160e9d 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -4866,6 +4866,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_contact_add" = "Add"; "lng_contact_send_message" = "message"; +"lng_iv_open_in_browser" = "Open in Browser"; +"lng_iv_share" = "Share"; + // Wnd specific "lng_wnd_choose_program_menu" = "Choose Default Program..."; diff --git a/Telegram/SourceFiles/iv/iv.style b/Telegram/SourceFiles/iv/iv.style index 832916791..efd083f44 100644 --- a/Telegram/SourceFiles/iv/iv.style +++ b/Telegram/SourceFiles/iv/iv.style @@ -98,3 +98,4 @@ ivTitle: WindowTitle(defaultWindowTitle) { }; } ivTitleExpandedHeight: 76px; +ivMenuPosition: point(-8px, 36px); diff --git a/Telegram/SourceFiles/iv/iv_controller.cpp b/Telegram/SourceFiles/iv/iv_controller.cpp index c5aca31f5..8dae7db07 100644 --- a/Telegram/SourceFiles/iv/iv_controller.cpp +++ b/Telegram/SourceFiles/iv/iv_controller.cpp @@ -13,12 +13,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "ui/platform/ui_platform_window_title.h" #include "ui/widgets/rp_window.h" +#include "ui/widgets/popup_menu.h" +#include "ui/basic_click_handlers.h" #include "ui/painter.h" #include "webview/webview_data_stream_memory.h" #include "webview/webview_embed.h" #include "webview/webview_interface.h" #include "styles/palette.h" #include "styles/style_iv.h" +#include "styles/style_menu_icons.h" #include "styles/style_widgets.h" #include "styles/style_window.h" @@ -168,7 +171,7 @@ namespace { -