lightbox: Remove redundant parameter `options` from lightbox.open().

The `options` parameter is not being passed in any call
of `lightbox.open()` and it uses the same option i.e.
`lightbox_canvas` everytime which is now computed inside
`display_image()` directly.
This commit is contained in:
Hashir Sarwar 2020-04-02 14:37:21 +00:00 committed by Tim Abbott
parent 74ec668e65
commit 34d24bfdac
1 changed files with 6 additions and 11 deletions

View File

@ -28,13 +28,15 @@ function render_lightbox_list_images(preview_source) {
}
}
function display_image(payload, options) {
function display_image(payload) {
render_lightbox_list_images(payload.preview);
$(".player-container").hide();
$(".image-actions, .image-description, .download, .lightbox-canvas-trigger").show();
if (options.lightbox_canvas === true) {
const lightbox_canvas = $(".lightbox-canvas-trigger").hasClass("enabled");
if (lightbox_canvas === true) {
const canvas = document.createElement("canvas");
canvas.setAttribute("data-src", payload.source);
@ -85,14 +87,7 @@ function display_video(payload) {
// the image param is optional, but required on the first preview of an image.
// this will likely be passed in every time but just ignored if the result is already
// stored in the `asset_map`.
exports.open = function ($image, options) {
if (!options) {
options = {
// default to showing standard images.
lightbox_canvas: $(".lightbox-canvas-trigger").hasClass("enabled"),
};
}
exports.open = function ($image) {
// if the asset_map already contains the metadata required to display the
// asset, just recall that metadata.
let $preview_src = $image.attr("src");
@ -120,7 +115,7 @@ exports.open = function ($image, options) {
if (payload.type.match("-video")) {
display_video(payload);
} else if (payload.type === "image") {
display_image(payload, options);
display_image(payload);
}
if (is_open) {