minor bugfix to expanding images with loading bars enabled

even though the image is a blob, when we set the src={blob}, it doesnt load immediately
thus, the offsetWidth is 0 and when expanding, the filename width is wrong (only on the first time expanding, since subsequent times, the blob has "loaded" already and now has an offsetWidth -- it is almost instant).
this adds and onload to wait for the image to "load", and thus has the correct width even on the first time when expanding
indiachan-spamvector
Thomas Lynch 2 years ago
parent 0b01673e06
commit 2386e20f49
  1. 10
      gulp/res/js/expand.js

@ -122,11 +122,13 @@ window.addEventListener('DOMContentLoaded', (event) => {
pfs.removeAttribute('data-loading');
pfs.removeAttribute('style');
const blob = this.response;
source.onload = function() {
thumbElement.style.opacity = '';
thumbElement.style.cursor = '';
fileAnchor.appendChild(expandedElement);
toggle(thumbElement, expandedElement, fileName, pfs);
}
source.src = window.URL.createObjectURL(blob);
thumbElement.style.opacity = '';
thumbElement.style.cursor = '';
fileAnchor.appendChild(expandedElement);
toggle(thumbElement, expandedElement, fileName, pfs);
}
request.onload = loaded;
request.responseType = 'blob';

Loading…
Cancel
Save