Skip to content

Commit

Permalink
Update scripts.js
Browse files Browse the repository at this point in the history
  • Loading branch information
RitwikSrivastava authored Oct 14, 2024
1 parent 0bebb6d commit 1c82613
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,22 +226,25 @@ function decorateExternalImages(ele, deliveryMarker) {
const queryParams = appendQueryParams(new URL(srcset, extImageSrc), searchParams);
if (srcset.includes('/is/image/')) {
child.setAttribute('srcset', queryParams.replaceAll('%24', '$'));
child.setAttribute('loading', 'eager');

} else {
child.setAttribute('srcset', queryParams);
}
child.setAttribute('loading', 'eager');
}
} else if (child.tagName === 'IMG') {
const src = child.getAttribute('src');
if (src) {
const queryParams = appendQueryParams(new URL(src, extImageSrc), searchParams);
if (src.includes('/is/image/')) {
child.setAttribute('src', queryParams.replaceAll('%24', '$'));
child.setAttribute('loading', 'eager');

} else {
child.setAttribute('src', queryParams);
}
child.setAttribute('loading', 'eager');
}

}
});
extImage.parentNode.replaceChild(extPicture, extImage);
Expand Down

0 comments on commit 1c82613

Please sign in to comment.