mirror of https://github.com/zulip/zulip.git
ui_init: Extract embedded video preview mouse handler.
This commit extracts the logic used to ensure that the play icon is correctly positioned over the video preview for embedded videos, with the intention that we can use this to fix a regression in the play icon positioning for youtube video previews.
This commit is contained in:
parent
d006b6cc3d
commit
58184fc2a9
|
@ -317,16 +317,7 @@ export function initialize_kitchen_sink_stuff() {
|
||||||
$row.removeClass("sender_name_hovered");
|
$row.removeClass("sender_name_hovered");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#main_div").on("mouseenter", ".youtube-video a", function () {
|
function handle_video_preview_mouseenter($elem) {
|
||||||
$(this).addClass("fa fa-play");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#main_div").on("mouseleave", ".youtube-video a", function () {
|
|
||||||
$(this).removeClass("fa fa-play");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#main_div").on("mouseenter", ".embed-video a", function () {
|
|
||||||
const $elem = $(this);
|
|
||||||
// Set image height and css vars for play button position, if not done already
|
// Set image height and css vars for play button position, if not done already
|
||||||
const setPosition = !$elem.data("entered-before");
|
const setPosition = !$elem.data("entered-before");
|
||||||
if (setPosition) {
|
if (setPosition) {
|
||||||
|
@ -341,6 +332,18 @@ export function initialize_kitchen_sink_stuff() {
|
||||||
$elem.data("entered-before", true);
|
$elem.data("entered-before", true);
|
||||||
}
|
}
|
||||||
$elem.addClass("fa fa-play");
|
$elem.addClass("fa fa-play");
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#main_div").on("mouseenter", ".youtube-video a", function () {
|
||||||
|
$(this).addClass("fa fa-play");
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#main_div").on("mouseleave", ".youtube-video a", function () {
|
||||||
|
$(this).removeClass("fa fa-play");
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#main_div").on("mouseenter", ".embed-video a", function () {
|
||||||
|
handle_video_preview_mouseenter($(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#main_div").on("mouseleave", ".embed-video a", function () {
|
$("#main_div").on("mouseleave", ".embed-video a", function () {
|
||||||
|
|
Loading…
Reference in New Issue