Set loading="lazy" to ML images if width and height are known
This commit is contained in:
parent
8852792674
commit
a96fe8040a
@ -1,3 +1,5 @@
|
||||
* New images added via the ML will set loading="lazy", improving
|
||||
site performance for visitors (only if height and width known)
|
||||
* Remove multitude of wysiwyg toolbars
|
||||
* PHP 8 compatibility for serendipity core
|
||||
* Fix: Using the ML filters in the selection popup after uploading
|
||||
|
@ -331,7 +331,13 @@
|
||||
if (floating == "") {
|
||||
floating = "center";
|
||||
}
|
||||
img = "<!-- s9ymdb:" + imgID + " --><img class=\"serendipity_image_"+ floating +"\" width=\"" + imgWidth + "\" height=\"" + imgHeight + '" src="' + img + "\" " + (title != '' ? 'title="' + title + '"' : '') + " alt=\"" + alt + "\">";
|
||||
|
||||
var lazyload = '';
|
||||
if (imgWidth && imgHeight) {
|
||||
lazyload = 'loading="lazy"';
|
||||
}
|
||||
|
||||
img = "<!-- s9ymdb:" + imgID + " --><img class=\"serendipity_image_"+ floating +"\" width=\"" + imgWidth + "\" height=\"" + imgHeight + '" src="' + img + "\" " + (title != '' ? 'title="' + title + '"' : '') + " " + lazyload + " alt=\"" + alt + "\">";
|
||||
|
||||
if ($(':input[name="serendipity[isLink]"]:checked').val() == "yes") {
|
||||
// wrap the img in a link to the image. TODO: The label in the media_chooser.tpl explains it wrong
|
||||
|
Loading…
x
Reference in New Issue
Block a user