mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
Add overlay lightbox for displaying inline image previews.
This adds an event listener (by way of delegation) to the .message_inline_image elements that pops up the overlay and hides it when the overlay exit is clicked. Fixes #654.
This commit is contained in:
committed by
Tim Abbott
parent
2ea7d2341e
commit
87afe61860
@@ -281,6 +281,29 @@ exports.small_avatar_url = function (message) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.lightbox_photo = function (image, user) {
|
||||
// image should be an Image Object in JavaScript.
|
||||
var url = $(image).attr("src"),
|
||||
title = $(image).parent().attr("title");
|
||||
|
||||
$("#overlay .image-preview")
|
||||
.css("background-image", "url(" + url + ")");
|
||||
|
||||
$("#overlay").addClass("show");
|
||||
|
||||
$(".right-sidebar, .column-middle-inner, .left-sidebar").addClass("visual-blur");
|
||||
|
||||
$(".title").text(title || "N/A");
|
||||
$(".user").text(user);
|
||||
|
||||
$(".image-actions .open, .image-actions .download").attr("href", url);
|
||||
};
|
||||
|
||||
exports.exit_lightbox_photo = function (image) {
|
||||
$("#overlay").removeClass("show");
|
||||
$(".right-sidebar, .column-middle-inner, .left-sidebar").removeClass("visual-blur");
|
||||
};
|
||||
|
||||
var loading_more_messages_indicator_showing = false;
|
||||
exports.show_loading_more_messages_indicator = function () {
|
||||
if (! loading_more_messages_indicator_showing) {
|
||||
|
||||
Reference in New Issue
Block a user