diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/MediaPartialsPanel.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/MediaPartialsPanel.java index 418984683f6..1a59c437794 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/MediaPartialsPanel.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/MediaPartialsPanel.java @@ -143,7 +143,7 @@ public void editMediaPartialDivision(Map.Entry me * @return True if enabled */ public boolean isEnabled() { - return !addMediaPartialDivisions().isEmpty(); + return !getMediaPartialChildDivisionsOfSelection().isEmpty(); } /** @@ -151,7 +151,7 @@ public boolean isEnabled() { * * @return The divisions as selected items list */ - public List addMediaPartialDivisions() { + public List getMediaPartialChildDivisionsOfSelection() { List mediaPartialDivisions = new ArrayList<>(); Pair lastSelection = dataEditor.getGalleryPanel().getLastSelection(); if (Objects.nonNull(lastSelection) && MediaUtil.isAudioOrVideo( diff --git a/Kitodo/src/main/webapp/WEB-INF/resources/js/modules/media_detail_media_formatted_time.js b/Kitodo/src/main/webapp/WEB-INF/resources/js/modules/media_detail_media_formatted_time.js index 0b3afaefd2f..ff49c85f692 100644 --- a/Kitodo/src/main/webapp/WEB-INF/resources/js/modules/media_detail_media_formatted_time.js +++ b/Kitodo/src/main/webapp/WEB-INF/resources/js/modules/media_detail_media_formatted_time.js @@ -13,24 +13,30 @@ let initMediaFormattedTime = function () { let mediaElement = document.querySelector('#imagePreviewForm\\:mediaDetailMediaContainer video, #imagePreviewForm\\:mediaDetailMediaContainer audio'); - let formattedTime = document.createElement('div'); - formattedTime.setAttribute("id", "mediaFormattedTime"); - mediaElement.after(formattedTime); + if( mediaElement ) { + if(mediaElement.tagName == 'VIDEO') { + mediaElement.style.maxWidth = '700px'; + } - formattedTime.innerHTML = metadataEditor.gallery.mediaPartial.convertSecondsToFormattedTime(mediaElement.currentTime); - mediaElement.addEventListener("timeupdate", function () { - formattedTime.innerHTML = metadataEditor.gallery.mediaPartial.convertSecondsToFormattedTime(mediaElement.currentTime); - }); + let formattedTime = document.createElement('div'); + formattedTime.setAttribute("id", "mediaFormattedTime"); + mediaElement.after(formattedTime); - const jumpButtons = document.getElementsByClassName("media-formatted-time-jump-button"); - Array.from(jumpButtons).forEach(function (jumpButton) { - jumpButton.addEventListener('click', function () { - mediaElement.pause(); - let jumpMilliseconds = parseInt(this.getAttribute("data-media-formatted-time-jump-milliseconds")); - mediaElement.currentTime = ((mediaElement.currentTime * 1000) + jumpMilliseconds) / 1000; + formattedTime.innerHTML = metadataEditor.gallery.mediaPartial.convertSecondsToFormattedTime(mediaElement.currentTime); + mediaElement.addEventListener("timeupdate", function () { formattedTime.innerHTML = metadataEditor.gallery.mediaPartial.convertSecondsToFormattedTime(mediaElement.currentTime); }); - }); + + const jumpButtons = document.getElementsByClassName("media-formatted-time-jump-button"); + Array.from(jumpButtons).forEach(function (jumpButton) { + jumpButton.addEventListener('click', function () { + mediaElement.pause(); + let jumpMilliseconds = parseInt(this.getAttribute("data-media-formatted-time-jump-milliseconds")); + mediaElement.currentTime = ((mediaElement.currentTime * 1000) + jumpMilliseconds) / 1000; + formattedTime.innerHTML = metadataEditor.gallery.mediaPartial.convertSecondsToFormattedTime(mediaElement.currentTime); + }); + }); + } }; initMediaFormattedTime(); diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addMediaPartial.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addMediaPartial.xhtml index 693c2bf8ae1..9fdc94ebe94 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addMediaPartial.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addMediaPartial.xhtml @@ -39,10 +39,10 @@ + styleClass="#{(DataEditorForm.galleryPanel.mediaPartialsPanel.mediaPartialChildDivisionsOfSelection.size() gt 1)?'':'hidden'}"> - + diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/partials/media-detail-media-partial-list.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/partials/media-detail-media-partial-list.xhtml index 15f84e0a0ce..62ad4d216ba 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/partials/media-detail-media-partial-list.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/partials/media-detail-media-partial-list.xhtml @@ -54,12 +54,12 @@ type="button" onclick="metadataEditor.gallery.mediaPartial.togglePlay(this, '#{mediaPartialDivision.value.begin}', '#{mediaPartialDivision.value.extent}')"/> @@ -71,7 +71,7 @@