aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-22 18:54:21 +0000
committerMario <mario@mariovavti.com>2020-10-22 18:54:21 +0000
commit75a73be60c97597f93a67a4ecd412daed06cd744 (patch)
treeb53c128740b8f63963a8cd62d65cb4034269de9b
parent690874fc6e2cf399fe0808ba9d52ff67951266fd (diff)
downloadvolse-hubzilla-75a73be60c97597f93a67a4ecd412daed06cd744.tar.gz
volse-hubzilla-75a73be60c97597f93a67a4ecd412daed06cd744.tar.bz2
volse-hubzilla-75a73be60c97597f93a67a4ecd412daed06cd744.zip
lazy/eager loading and minor css fixes
-rw-r--r--include/bbcode.php14
-rw-r--r--view/js/autocomplete.js2
-rwxr-xr-xview/tpl/acl_selector.tpl4
-rwxr-xr-xview/tpl/connection_template.tpl2
-rwxr-xr-xview/tpl/conv_item.tpl2
-rwxr-xr-xview/tpl/conv_list.tpl2
-rwxr-xr-xview/tpl/direntry.tpl2
-rw-r--r--view/tpl/notifications_widget.tpl4
-rwxr-xr-xview/tpl/search_item.tpl2
9 files changed, 17 insertions, 17 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index e5b2a068a..d79429719 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') . '" />', $newbody);
+ $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img src="' . $image .'" alt="' . t('Image/photo') . '" loading="eager" />', $newbody);
$cnt++;
}
// logger('replace_images: ' . $newbody);
@@ -513,7 +513,7 @@ function bb_ShareAttributes($match) {
$headline = '<div id="shared_container_' . $rnd . '" class="shared_container"> <div id="shared_header_' . $rnd . '" class="shared_header">';
if ($avatar != "")
- $headline .= '<a href="' . (($auth) ? zid($profile) : $profile) . '" ><img src="' . $avatar . '" alt="' . $author . '" height="32" width="32" /></a>';
+ $headline .= '<a href="' . (($auth) ? zid($profile) : $profile) . '" ><img src="' . $avatar . '" alt="' . $author . '" height="32" width="32" loading="lazy" /></a>';
if(strpos($link,'/cards/'))
$type = t('card');
@@ -881,7 +881,7 @@ function bb_imgoptions($match) {
// now assemble the resulting img tag from these components
- $output = '<img ' . (($match[1] === 'z') ? 'class="zrl" ' : '') . ' ';
+ $output = '<img ' . (($match[1] === 'z') ? 'class="zrl" loading="eager"' : '') . ' ';
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') . '" />', $Text);
+ $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" loading="eager" />', $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"/>', $Text);
+ $Text = preg_replace("/\[img=http(.*?)\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="http$1" alt="$2" title="$2" loading="eager" />', $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') . '" />', $Text);
+ $Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" loading="eager" />', $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"/>', $Text);
+ $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_callback("/\[([zi])mg([ \=])(.*?)\](.*?)\[\/[zi]mg\]/ism",'bb_imgoptions',$Text);
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 660b5f190..27011b4d4 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -40,7 +40,7 @@ function contact_format(item) {
var desc = ((item.label) ? item.nick + ' ' + item.label : item.nick);
if(typeof desc === 'undefined') desc = '';
if(desc) desc = ' ('+desc+')';
- return "<div class='{0} dropdown-item dropdown-notification clearfix' title='{4}'><img class='menu-img-2' src='{1}'><span class='contactname'>{2}</span><span class='dropdown-sub-text'>{4}</span></div>".format(item.taggable, item.photo, item.name, desc, typeof(item.link) !== 'undefined' ? item.link : desc.replace('(','').replace(')',''));
+ return "<div class='{0} dropdown-item dropdown-notification clearfix' title='{4}'><img class='menu-img-2' src='{1}' loading='lazy'><span class='font-weight-bold contactname'>{2}</span><span class='dropdown-sub-text'>{4}</span></div>".format(item.taggable, item.photo, item.name, desc, typeof(item.link) !== 'undefined' ? item.link : desc.replace('(','').replace(')',''));
}
else
return "<div>" + item.text + "</div>";
diff --git a/view/tpl/acl_selector.tpl b/view/tpl/acl_selector.tpl
index 7447644a9..c58a345e5 100755
--- a/view/tpl/acl_selector.tpl
+++ b/view/tpl/acl_selector.tpl
@@ -41,8 +41,8 @@
<div class="list-group-item acl-list-item" rel="acl-template" style="display:none">
<div class="acl-item-header clearfix">
- <img class="menu-img-3" data-src="{0}">
- <span class="contactname">{1}</span>
+ <img class="menu-img-3" data-src="{0}" loading="lazy" />
+ <span class="font-weight-bold contactname">{1}</span>
<span class="dropdown-sub-text">{6}</span>
</div>
<button class="acl-button-hide btn btn-sm btn-outline-danger"><i class="fa fa-times"></i> {{$hide}}</button>
diff --git a/view/tpl/connection_template.tpl b/view/tpl/connection_template.tpl
index f9b46b41e..86a230c7f 100755
--- a/view/tpl/connection_template.tpl
+++ b/view/tpl/connection_template.tpl
@@ -22,7 +22,7 @@
<div class="section-content-tools-wrapper">
<div class="contact-photo-wrapper" >
<a href="{{$contact.url}}" title="{{$contact.img_hover}}" >
- <img class="directory-photo-img {{if $contact.classes}}{{$contact.classes}}{{/if}}" src="{{$contact.thumb}}" alt="{{$contact.name}}" />
+ <img class="directory-photo-img {{if $contact.classes}}{{$contact.classes}}{{/if}}" src="{{$contact.thumb}}" alt="{{$contact.name}}" loading="lazy" />
</a>
{{include "connstatus.tpl" perminfo=$contact.perminfo}}
</div>
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index f48e88006..d7eaefe7e 100755
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -35,7 +35,7 @@
{{/if}}
<div class="wall-item-info" id="wall-item-info-{{$item.id}}" >
<div class="wall-item-photo-wrapper{{if $item.owner_url}} wwfrom{{/if}} h-card p-author" id="wall-item-photo-wrapper-{{$item.id}}">
- <img src="{{$item.thumb}}" class="fakelink wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" data-toggle="dropdown" />
+ <img src="{{$item.thumb}}" class="fakelink wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" loading="lazy" data-toggle="dropdown" />
{{if $item.thread_author_menu}}
<i class="fa fa-caret-down wall-item-photo-caret cursor-pointer" data-toggle="dropdown"></i>
<div class="dropdown-menu">
diff --git a/view/tpl/conv_list.tpl b/view/tpl/conv_list.tpl
index 21c38829a..113cf2324 100755
--- a/view/tpl/conv_list.tpl
+++ b/view/tpl/conv_list.tpl
@@ -29,7 +29,7 @@
<div class="p-2 clearfix wall-item-head{{if !$item.title && !$item.event && !$item.photo}} rounded-top{{/if}}{{if $item.is_new && !$item.event && !$item.is_comment}} wall-item-head-new{{/if}}">
<div class="wall-item-info" id="wall-item-info-{{$item.id}}" >
<div class="wall-item-photo-wrapper{{if $item.owner_url}} wwfrom{{/if}} h-card p-author" id="wall-item-photo-wrapper-{{$item.id}}">
- <img src="{{$item.thumb}}" class="fakelink wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" data-toggle="dropdown" /></a>
+ <img src="{{$item.thumb}}" class="fakelink wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" data-toggle="dropdown" loading="lazy" /></a>
{{if $item.thread_author_menu}}
<i class="fa fa-caret-down wall-item-photo-caret cursor-pointer" data-toggle="dropdown"></i>
<div class="dropdown-menu">
diff --git a/view/tpl/direntry.tpl b/view/tpl/direntry.tpl
index 175d813c5..015f1102d 100755
--- a/view/tpl/direntry.tpl
+++ b/view/tpl/direntry.tpl
@@ -23,7 +23,7 @@
<div class="contact-photo-wrapper" id="directory-photo-wrapper-{{$entry.hash}}" >
<div class="contact-photo" id="directory-photo-{{$entry.hash}}" >
<a href="{{$entry.profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$entry.hash}}" >
- <img class="directory-photo-img" src="{{$entry.photo}}" alt="{{$entry.alttext}}" title="{{$entry.alttext}}" />
+ <img class="directory-photo-img" src="{{$entry.photo}}" alt="{{$entry.alttext}}" title="{{$entry.alttext}}" loading="lazy"/>
</a>
</div>
</div>
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index 70b847ee5..1a24ca7c4 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -143,7 +143,7 @@
</div>
<div id="nav-notifications-template" rel="template">
<a class="list-group-item text-decoration-none text-darkclearfix notification {6}" href="{0}" title="{13}" data-b64mid="{7}" data-notify_id="{8}" data-thread_top="{9}" data-contact_name="{2}" data-contact_addr="{3}" data-when="{5}">
- <img class="menu-img-3" data-src="{1}">
+ <img class="menu-img-3" data-src="{1}" loading="lazy">
<div class="contactname"><span class="text-dark font-weight-bold">{2}</span> <span class="text-muted">{3}</span></div>
<span class="text-muted">{4}</span><br>
<span class="text-muted notifications-autotime" title="{5}">{5}</span>
@@ -152,7 +152,7 @@
<div id="nav-notifications-forums-template" rel="template">
<a class="list-group-item text-decoration-none clearfix notification notification-forum" href="{0}" title="{4} - {3}" data-b64mid="{7}" data-notify_id="{8}" data-thread_top="{9}" data-contact_name="{2}" data-contact_addr="{3}" data-b64mids='{12}'>
<span class="float-right badge badge-secondary">{10}</span>
- <img class="menu-img-1" data-src="{1}">
+ <img class="menu-img-1" data-src="{1}" loading="lazy">
<span class="">{2}</span>
<i class="fa fa-{11} text-muted"></i>
</a>
diff --git a/view/tpl/search_item.tpl b/view/tpl/search_item.tpl
index 40341a840..3e986ea21 100755
--- a/view/tpl/search_item.tpl
+++ b/view/tpl/search_item.tpl
@@ -23,7 +23,7 @@
<div class="p-2 clearfix wall-item-head{{if !$item.title && !$item.event && !$item.photo}} rounded-top{{/if}}{{if $item.is_new && !$item.event && !$item.is_comment}} wall-item-head-new{{/if}}" >
<div class="wall-item-info" id="wall-item-info-{{$item.id}}" >
<div class="wall-item-photo-wrapper{{if $item.owner_url}} wwfrom{{/if}}" id="wall-item-photo-wrapper-{{$item.id}}">
- <img src="{{$item.thumb}}" class="fakelink wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" data-toggle="dropdown" />
+ <img src="{{$item.thumb}}" class="fakelink wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" data-toggle="dropdown" loading="lazy" />
{{if $item.thread_author_menu}}
<i class="fa fa-caret-down wall-item-photo-caret cursor-pointer" data-toggle="dropdown"></i>
<div class="dropdown-menu">