Skip to content

Commit 8207763

Browse files
committed
fix fullview buttons
1 parent 9235277 commit 8207763

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/wwwroot/js/genpage/gentab/currentimagehandler.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,13 @@ class ImageFullViewHelper {
244244
this.currentBatchId = batchId;
245245
this.updateCounter();
246246
let wasAlreadyOpen = this.isOpen();
247-
let isVideo = isVideoExt(src);
248-
let isAudio = isAudioExt(src);
247+
let mediaType = getMediaType(src);
249248
let encodedSrc = escapeHtmlForUrl(src);
250249
let imgHtml = `<img class="imageview_popup_modal_img" id="imageview_popup_modal_img" style="cursor:grab;max-width:100%;object-fit:contain;" src="${encodedSrc}" onload="imageFullView.onImgLoad()">`;
251-
if (isVideo) {
250+
if (mediaType == 'video') {
252251
imgHtml = `<div class="video-container imageview_popup_modal_img" id="imageview_popup_modal_img"><video class="imageview_popup_modal_img" style="cursor:grab;max-width:100%;object-fit:contain;" autoplay loop muted onload="imageFullView.onImgLoad()"><source src="${encodedSrc}" type="${isVideo}"></video></div>`;
253252
}
254-
else if (isAudio) {
253+
else if (mediaType == 'audio') {
255254
imgHtml = `<div class="audio-container imageview_popup_modal_img" id="imageview_popup_modal_img" style="cursor:grab;max-width:100%;"><audio class="imageview_popup_modal_img" preload="metadata" src="${encodedSrc}" onloadedmetadata="imageFullView.onImgLoad()"></audio></div>`;
256255
}
257256
this.content.innerHTML = `
@@ -267,6 +266,9 @@ class ImageFullViewHelper {
267266
</div>`;
268267
let subDiv = this.content.querySelector('.image_fullview_extra_buttons');
269268
for (let added of buttonsForImage(getImageFullSrc(src), src, metadata)) {
269+
if (added.multi_only || (added.media_types && !added.media_types.includes(mediaType))) {
270+
continue;
271+
}
270272
if (added.href) {
271273
if (added.is_download) {
272274
subDiv.appendChild(createDiv(null, 'inline-block', `<a class="text_button basic-button translate" href="${added.href}" title="${added.title}" download>${added.label}</a>`));
@@ -287,13 +289,13 @@ class ImageFullViewHelper {
287289
this.toggleMetadataVisibility(true);
288290
}
289291
this.modalJq.modal('show');
290-
if (isVideo) {
292+
if (mediaType == 'video') {
291293
new VideoControls(this.getImg());
292294
}
293-
else if (isAudio) {
295+
else if (mediaType == 'audio') {
294296
new AudioControls(this.getImg());
295297
}
296-
if (isVideo || isAudio) {
298+
if (mediaType == 'video' || mediaType == 'audio') {
297299
let curImgElem = currentImageHelper.getCurrentImage();
298300
if (curImgElem) {
299301
if (curImgElem.tagName == 'VIDEO' || curImgElem.tagName == 'AUDIO') {

0 commit comments

Comments
 (0)