Archived
4
2

Compare commits

...

10 Commits

Author SHA1 Message Date
Roan Horning
860ce671f8 Merge pull request 'Moved thumbnail image tag to Block with conditional lazy load.' (#95) from I90_Lazy_load_host_avatars into main
Reviewed-on: #95
2023-03-16 16:13:48 +00:00
Roan Horning
51d6188542 Merge branch 'main' into I90_Lazy_load_host_avatars 2023-03-14 03:20:35 +00:00
c9278c0dd6
Remove unused PROCESS directive 2023-03-13 23:16:37 -04:00
aabeca44f5
Refactor templates to use show_avatar MACRO 2023-03-13 23:15:46 -04:00
3a8b6db348
Add show_avatar MACRO 2023-03-13 23:14:35 -04:00
7a6ace156f
Refactor template to use get_avatar MACRO 2023-03-13 23:13:25 -04:00
dee924e6a8
Rename MACRO host_thumb to get_avatar
Update to use lazy_load MACRO and minimize number of
arguments needed.
2023-03-13 23:10:36 -04:00
5b4421071f
Add MACRO lazy_load
Macro which allows programatically setting the HTML5 img
loading attribute.
2023-03-13 23:03:15 -04:00
Gordon Stanton
ce4aefe828 Renamed macro get_avatar to get_avatar_src as per suggestion.
Moved host_thumb macro into shared avatar template file.
Made condition of lazy loading a parameter.
2023-03-12 18:48:51 +11:00
Gordon Stanton
ebcd906300 Moved thumbnail image tag to Block with conditional lazy load. 2023-03-11 01:57:51 +11:00
8 changed files with 21 additions and 20 deletions

View File

@ -1,5 +1,4 @@
<!--% PROCESS 'shared-episode-summary.tpl.html' %--> <!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% PROCESS 'shared-utils.tpl.html' %--> <!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS 'shared-listen-now.tpl.html' %--> <!--% PROCESS 'shared-listen-now.tpl.html' %-->
<!--% PROCESS "queries-episode-${constants.database}.tpl.html" %--> <!--% PROCESS "queries-episode-${constants.database}.tpl.html" %-->

View File

@ -55,8 +55,7 @@
<!--% this_host = hosts.$id %--> <!--% this_host = hosts.$id %-->
<h2 class="title">Correspondent</h2> <h2 class="title">Correspondent</h2>
<h2><!--% this_host.host %--></h2> <h2><!--% this_host.host %--></h2>
<p><img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(this_host.hostid) %-->" <p><!--% get_avatar(this_host.hostid, this_host.host) %--><br>
height="80" alt="Host Image" /><br>
<label>Host ID</label>: <!--% this_host.hostid %--><br><br> <label>Host ID</label>: <!--% this_host.hostid %--><br><br>
<label>email:</label> <u><!--% this_host.email %--></u><br> <label>email:</label> <u><!--% this_host.email %--></u><br>
<label>episodes:</label> <strong><!--% hpr_show_count + twat_show_count %--></strong> <label>episodes:</label> <strong><!--% hpr_show_count + twat_show_count %--></strong>

View File

@ -1,9 +1,10 @@
<!--% PROCESS 'shared-utils.tpl.html' %--> <!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<article> <article>
<h2 class="title">Correspondents</h2> <h2 class="title">Correspondents</h2>
<p>For more information on how to become a Correspondent see our <a href="<!--% absolute_path(baseurl) %-->contribute.html">contribute</a></center> page. To add a logo here, either email one to admin at hpr or setup your email on <a href="https://en.gravatar.com/">Gravatar</a>. To protect your browsing privacy we gather the images every hour and serve them directly from HPR.<p /> <p>For more information on how to become a Correspondent see our <a href="<!--% absolute_path(baseurl) %-->contribute.html">contribute</a></center> page. To add a logo here, either email one to admin at hpr or setup your email on <a href="https://en.gravatar.com/">Gravatar</a>. To protect your browsing privacy we gather the images every hour and serve them directly from HPR.<p />
<!--% USE DBI(constants.driver, constants.user, constants.password) %--> <!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% PROCESS 'shared-avatar.tpl.html' %--> <!--% host_cnt = 0 %-->
<table class="hosts"> <table class="hosts">
<th >Avatar</th> <th >Avatar</th>
<th >Name &amp; Host ID</th> <th >Name &amp; Host ID</th>
@ -17,14 +18,14 @@
on h.hostid = e.hostid ' on h.hostid = e.hostid '
) %--> ) %-->
<tr height="80"> <tr height="80">
<td><img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(host.hostid) %-->" height="80" width="80" alt="avatar" /></td> <td><!--% get_avatar(host.hostid, host.host, host_cnt > 8) %--></td>
<td><strong><!--% host.host %--></strong><br> <td><strong><!--% host.host %--></strong><br>
Host ID: <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(host.hostid) %-->.html"><!--% host.hostid %--></a></td> Host ID: <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(host.hostid) %-->.html"><!--% host.hostid %--></a></td>
<td><!--% host.license %--></td> <td><!--% host.license %--></td>
<td><!--% host.date %--></td> <td><!--% host.date %--></td>
</tr> </tr><!--% host_cnt = host_cnt + 1 %-->
<!--% END %--> <!--% END %-->
</table> </table>
<p><a href="<!--% absolute_path(baseurl) %-->contribute.html">Become a Correspondent</a></p> <p><a href="<!--% absolute_path(baseurl) %-->contribute.html">Become a Correspondent</a></p>

View File

@ -16,8 +16,7 @@
<h3><!--% episode.summary %--></h3> <h3><!--% episode.summary %--></h3>
<p class="meta"><!--% episode_navigation %--> <p class="meta"><!--% episode_navigation %-->
</p> </p>
<p><!--% IF get_avatar(episode.hostid) != 'hpr_logo.png' %--> <p><!--% show_avatar(episode.hostid, episode.host) %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(episode.hostid) %-->" height="80" width="80" alt="" /></a><br><!--% END %-->
Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(episode.hostid) %-->.html"><!--% episode.host %--></a> on <span><!--% episode.date %--></span> is flagged as <span><!--% display_explicit(episode.explicit) %--></span> and is released under a <span><!--% episode.license %--> license</span>. <br> Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(episode.hostid) %-->.html"><!--% episode.host %--></a> on <span><!--% episode.date %--></span> is flagged as <span><!--% display_explicit(episode.explicit) %--></span> and is released under a <span><!--% episode.license %--> license</span>. <br>
<!--% display_tags(episode.tags) %--> <br> <!--% display_tags(episode.tags) %--> <br>
<!--% display_listen_in(episode.id) %--> | <!--% display_listen_in(episode.id) %--> |

View File

@ -1,5 +1,4 @@
<!--% PROCESS 'shared-avatar.tpl.html' %--> <!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% PROCESS 'host-thumbnail.tpl.html' %-->
<!--% PROCESS 'shared-utils.tpl.html' %--> <!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS 'shared-listen-now.tpl.html' %--> <!--% PROCESS 'shared-listen-now.tpl.html' %-->
<!--% PROCESS 'shared-show-transcript.tpl.html' %--> <!--% PROCESS 'shared-show-transcript.tpl.html' %-->
@ -44,11 +43,8 @@
<header> <header>
<h1><a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(latest_episodes.id) %-->/index.html">hpr<!--% latest_episodes.id %--> :: <!--% latest_episodes.title %--></a></h1> <h1><a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(latest_episodes.id) %-->/index.html">hpr<!--% latest_episodes.id %--> :: <!--% latest_episodes.title %--></a></h1>
<h3><!--% latest_episodes.summary%--></h3> <h3><!--% latest_episodes.summary%--></h3>
<p class="meta"$><!--% IF get_avatar(latest_episodes.hostid) != 'hpr_logo.png' %--> <p class="meta"$><!--% show_avatar(latest_episodes.hostid, latest_episodes.host, host_cnt) %-->
<a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(latest_episodes.hostid) %-->.html"> Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(latest_episodes.hostid) %-->.html"><!--% latest_episodes.host %--></a> on <!--% latest_episodes.date %--> is flagged as <!--% display_explicit(latest_episodes.explicit) %--> and released under a <!--% latest_episodes.license %--> license. <br>
<!--% host_thumb(get_avatar(latest_episodes.hostid), latest_episodes.host, host_cnt) %-->
</a><!--% END %-->
<br>Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(latest_episodes.hostid) %-->.html"><!--% latest_episodes.host %--></a> on <!--% latest_episodes.date %--> is flagged as <!--% display_explicit(latest_episodes.explicit) %--> and released under a <!--% latest_episodes.license %--> license. <br>
<!--% display_tags(latest_episodes.tags) %--><br> <!--% display_tags(latest_episodes.tags) %--><br>
<small><!--% display_listen_in(latest_episodes.id) %--> <!--% show_series(latest_episodes.series, latest_episodes.seriesid) %--> | <small><!--% display_listen_in(latest_episodes.id) %--> <!--% show_series(latest_episodes.series, latest_episodes.seriesid) %--> |
<!--% display_comments_tally(latest_episodes.id, latest_episodes.eps_tally) %--></small> <!--% display_comments_tally(latest_episodes.id, latest_episodes.eps_tally) %--></small>

View File

@ -52,8 +52,7 @@
<h3><!--% episode.summary %--></h3> <h3><!--% episode.summary %--></h3>
<p class="meta"><!--% episode_navigation %--> <p class="meta"><!--% episode_navigation %-->
</p> </p>
<p><!--% IF get_avatar(episode.hostid) != 'hpr_logo.png' %--> <p><!--% show_avatar(episode.hostid, episode.host) %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(episode.hostid) %-->" height="80" width="80" alt="" /></a><br><!--% END %-->
Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(episode.hostid) %-->.html"><!--% episode.host %--></a> on <span><!--% episode.date %--></span> is flagged as <span><!--% display_explicit(episode.explicit) %--></span> and is released under a <span><!--% episode.license %--> license</span>. <br> Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(episode.hostid) %-->.html"><!--% episode.host %--></a> on <span><!--% episode.date %--></span> is flagged as <span><!--% display_explicit(episode.explicit) %--></span> and is released under a <span><!--% episode.license %--> license</span>. <br>
<!--% display_tags(episode.tags) %--> <br> <!--% display_tags(episode.tags) %--> <br>
<!--% display_listen_in(episode.id, "twat") %--> <!--% display_listen_in(episode.id, "twat") %-->

View File

@ -1,3 +0,0 @@
<!--% MACRO host_thumb(avatar, host_name, host_cnt) BLOCK %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% avatar %-->" height="80" width="80" alt="Thumbnail of <!--% host_name | html %-->" <!--% IF host_cnt %-->loading="lazy"<!--% END %--> />
<!--% END %-->

View File

@ -1,5 +1,16 @@
<!--% MACRO get_avatar(host_id) BLOCK %--> <!--% MACRO lazy_load(is_lazy) BLOCK %-->
<!--% IF is_lazy %-->loading="lazy"<!--% END %-->
<!--% END %-->
<!--% MACRO get_avatar_src(host_id) BLOCK %-->
<!--% TRY %--> <!--% TRY %-->
<!--% USE File ("./public_html/images/hosts/${host_id}.png") %-->hosts/<!--% File.name %--> <!--% USE File ("./public_html/images/hosts/${host_id}.png") %-->hosts/<!--% File.name %-->
<!--% CATCH File %-->hpr_logo.png<!--% END %--> <!--% CATCH File %-->hpr_logo.png<!--% END %-->
<!--% END %--> <!--% END %-->
<!--% MACRO get_avatar(host_id, host_name, is_lazy_loaded) BLOCK %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar_src(host_id) %-->" height="80" width="80" alt="Thumbnail of <!--% host_name | html %-->" <!--% lazy_load(is_lazy_loaded) %--> />
<!--% END %-->
<!--% MACRO show_avatar(host_id, host_name, is_lazy_loaded) BLOCK %-->
<!--% IF get_avatar_src(host_id) != 'hpr_logo.png' %-->
<a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(host_id) %-->.html"><!--% get_avatar(host_id, host_name, is_lazy_loaded) %--></a><br>
<!--% END %-->
<!--% END %-->