diff options
author | James <james@hale.com.au> | 2018-12-15 11:32:50 +1100 |
---|---|---|
committer | James <james@hale.com.au> | 2018-12-15 11:32:50 +1100 |
commit | d97257a5a93707fbbdc150226c9fbee8feb8aedb (patch) | |
tree | e49f64cb63a1150968a37d1eb692a0987dfeb612 /src/js/plugins/previewThumbnails.js | |
parent | 279f0519053143c43f84d1b0e3511593d26533ae (diff) | |
download | plyr-d97257a5a93707fbbdc150226c9fbee8feb8aedb.tar.lz plyr-d97257a5a93707fbbdc150226c9fbee8feb8aedb.tar.xz plyr-d97257a5a93707fbbdc150226c9fbee8feb8aedb.zip |
Preview seek: Edge+IE11 fixes
- Fixed bug: Edge seek errors: Replaced array spread with Array.from()
- Fixed IE11 bug: seek time was offset to the left. Required an extra container div to facilitate this
Diffstat (limited to 'src/js/plugins/previewThumbnails.js')
-rw-r--r-- | src/js/plugins/previewThumbnails.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/js/plugins/previewThumbnails.js b/src/js/plugins/previewThumbnails.js index 71fdf0c7..7ae077e6 100644 --- a/src/js/plugins/previewThumbnails.js +++ b/src/js/plugins/previewThumbnails.js @@ -244,27 +244,37 @@ class PreviewThumbnails { const previewThumbnailContainer = createElement( 'div', { - class: this.player.config.classNames.previewThumbnailContainer, + class: this.player.config.classNames.previewThumbnails.thumbnailContainer, }, ); this.player.elements.progress.appendChild(previewThumbnailContainer); this.player.elements.display.previewThumbnailContainer = previewThumbnailContainer; + // Create HTML element, parent+span: time text (e.g., 01:32:00) + const timeTextContainer = createElement( + 'div', + { + class: this.player.config.classNames.previewThumbnails.timeTextContainer + }, + ); + + this.player.elements.display.previewThumbnailContainer.appendChild(timeTextContainer); + const timeText = createElement( 'span', {}, '00:00', ); - this.player.elements.display.previewThumbnailContainer.appendChild(timeText); + timeTextContainer.appendChild(timeText); this.player.elements.display.previewThumbnailTimeText = timeText; // Create HTML element: plyr__preview-scrubbing-container const previewScrubbingContainer = createElement( 'div', { - class: this.player.config.classNames.previewScrubbingContainer, + class: this.player.config.classNames.previewThumbnails.scrubbingContainer, }, ); @@ -350,9 +360,10 @@ class PreviewThumbnails { .then(this.getHigherQuality(qualityIndex, previewImage, frame, thumbFilename)); } + // Remove all preview images that aren't the designated current image removeOldImages(currentImage) { - // Get a list of all images, and reverse it - so that we can start from the end and delete all except for the most recent - const allImages = [...this.currentContainer.children]; + // Get a list of all images, convert it from a DOM list to an array + const allImages = Array.from(this.currentContainer.children); for (let image of allImages) { if (image.tagName === 'IMG') { |