aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-22 19:11:03 +0000
committerMario <mario@mariovavti.com>2020-10-22 19:11:03 +0000
commit78f655f877d2d2b7afd6d606edabc5b0df638738 (patch)
tree8436fb821e8258801971b5e0f0210c6b4932da4a
parent75a73be60c97597f93a67a4ecd412daed06cd744 (diff)
downloadvolse-hubzilla-78f655f877d2d2b7afd6d606edabc5b0df638738.tar.gz
volse-hubzilla-78f655f877d2d2b7afd6d606edabc5b0df638738.tar.bz2
volse-hubzilla-78f655f877d2d2b7afd6d606edabc5b0df638738.zip
more lazy, less eager
-rw-r--r--include/bbcode.php12
-rwxr-xr-xview/tpl/contact_template.tpl2
-rwxr-xr-xview/tpl/micropro_img.tpl2
-rwxr-xr-xview/tpl/photo_top.tpl2
4 files changed, 9 insertions, 9 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index d79429719..c5d58e80d 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -218,7 +218,7 @@ function bb_replace_images($body, $images) {
// We're depending on the property of 'foreach' (specified on the PHP website) that
// it loops over the array starting from the first element and going sequentially
// to the last element
- $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img src="' . $image .'" alt="' . t('Image/photo') . '" loading="eager" />', $newbody);
+ $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img src="' . $image .'" alt="' . t('Image/photo') . '" loading="lazy" />', $newbody);
$cnt++;
}
// logger('replace_images: ' . $newbody);
@@ -881,7 +881,7 @@ function bb_imgoptions($match) {
// now assemble the resulting img tag from these components
- $output = '<img ' . (($match[1] === 'z') ? 'class="zrl" loading="eager"' : '') . ' ';
+ $output = '<img ' . (($match[1] === 'z') ? 'class="zrl" loading="lazy"' : '') . ' ';
if ($width) {
$style .= 'width: 100%; max-width: ' . $width . 'px; ';
@@ -1483,19 +1483,19 @@ function bbcode($Text, $options = []) {
// Images
// [img]pathtoimage[/img]
if (strpos($Text,'[/img]') !== false) {
- $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" loading="eager" />', $Text);
+ $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" loading="lazy" />', $Text);
}
// [img=pathtoimage]image description[/img]
if (strpos($Text,'[/img]') !== false) {
- $Text = preg_replace("/\[img=http(.*?)\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="http$1" alt="$2" title="$2" loading="eager" />', $Text);
+ $Text = preg_replace("/\[img=http(.*?)\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="http$1" alt="$2" title="$2" loading="lazy" />', $Text);
}
// [zmg]pathtoimage[/zmg]
if (strpos($Text,'[/zmg]') !== false) {
- $Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" loading="eager" />', $Text);
+ $Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" loading="lazy" />', $Text);
}
// [zmg=pathtoimage]image description[/zmg]
if (strpos($Text,'[/zmg]') !== false) {
- $Text = preg_replace("/\[zmg=http(.*?)\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="http$1" alt="$2" title="$2" loading="eager" />', $Text);
+ $Text = preg_replace("/\[zmg=http(.*?)\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="http$1" alt="$2" title="$2" loading="lazy" />', $Text);
}
$Text = preg_replace_callback("/\[([zi])mg([ \=])(.*?)\](.*?)\[\/[zi]mg\]/ism",'bb_imgoptions',$Text);
diff --git a/view/tpl/contact_template.tpl b/view/tpl/contact_template.tpl
index 73fa5adde..7c8c02ea2 100755
--- a/view/tpl/contact_template.tpl
+++ b/view/tpl/contact_template.tpl
@@ -1,6 +1,6 @@
<div class="contact-entry-wrapper" id="contact-entry-wrapper-{{$contact.id}}" >
<div class="contact-entry-photo-wrapper" >
- <a href="{{$contact.link}}" title="{{$contact.img_hover}}" ><img class="contact-block-img" src="{{$contact.thumb}}" alt="{{$contact.name}}" /></a>
+ <a href="{{$contact.link}}" title="{{$contact.img_hover}}" ><img class="contact-block-img" src="{{$contact.thumb}}" alt="{{$contact.name}}" loading="lazy" /></a>
{{if $contact.perminfo}}{{include "connstatus.tpl" perminfo=$contact.perminfo}}{{/if}}
</div>
<div class="contact-entry-photo-end" ></div>
diff --git a/view/tpl/micropro_img.tpl b/view/tpl/micropro_img.tpl
index 98f33d119..5bfca615f 100755
--- a/view/tpl/micropro_img.tpl
+++ b/view/tpl/micropro_img.tpl
@@ -1 +1 @@
-<div class="contact-block-div{{if $class}} {{$class}}{{/if}}"><a class="contact-block-link{{if $class}} {{$class}}{{/if}}{{if $click}} fakelink{{/if}}" href="{{if $click}}#{{else}}{{$url}}{{/if}}" {{if $click}}onclick="{{$click}}"{{/if}}><img class="contact-block-img{{if $class}} {{$class}}{{/if}}" src="{{$photo}}" title="{{$title}}" alt="" />{{if $perminfo}}{{include "connstatus.tpl"}}{{/if}}</a></div>
+<div class="contact-block-div{{if $class}} {{$class}}{{/if}}"><a class="contact-block-link{{if $class}} {{$class}}{{/if}}{{if $click}} fakelink{{/if}}" href="{{if $click}}#{{else}}{{$url}}{{/if}}" {{if $click}}onclick="{{$click}}"{{/if}}><img class="contact-block-img{{if $class}} {{$class}}{{/if}}" src="{{$photo}}" title="{{$title}}" alt="" loading="lazy" />{{if $perminfo}}{{include "connstatus.tpl"}}{{/if}}</a></div>
diff --git a/view/tpl/photo_top.tpl b/view/tpl/photo_top.tpl
index a86aa7f80..16862a8d6 100755
--- a/view/tpl/photo_top.tpl
+++ b/view/tpl/photo_top.tpl
@@ -1,4 +1,4 @@
<a href="{{$photo.link}}" id="photo-top-photo-link-{{$photo.id}}" title="{{$photo.title}}">
- <img src="{{$photo.src}}" alt="{{if $photo.album.name}}{{$photo.album.name}}{{elseif $photo.desc}}{{$photo.desc}}{{elseif $photo.alt}}{{$photo.alt}}{{else}}{{$photo.unknown}}{{/if}}" title="{{$photo.title}}" id="photo-top-photo-{{$photo.id}}" />
+ <img src="{{$photo.src}}" alt="{{if $photo.album.name}}{{$photo.album.name}}{{elseif $photo.desc}}{{$photo.desc}}{{elseif $photo.alt}}{{$photo.alt}}{{else}}{{$photo.unknown}}{{/if}}" title="{{$photo.title}}" id="photo-top-photo-{{$photo.id}}" loading="lazy" />
</a>