Improve short_header display moving From and Date to right (if configured to do so).

This commit is contained in:
Retro_Guy 2024-11-10 07:21:08 -07:00
parent d72ef00ec8
commit 73b6a50880
3 changed files with 81 additions and 28 deletions

View File

@ -406,6 +406,19 @@
}
/* ***** SHORT HEADERS ***** */
/* short header 'Subject: ' title */
.short_header_subject_title {
margin-top: 0;
margin-bottom: 0;
margin-left: 0.4em;
text-decoration: none;
font-weight: bold;
color: var(--color-highlight);
font-family: Arial, Helvetica, sans-serif;
font-size: 1.1em;
}
/* short header Subject: */
.short_header_subject {
margin-top: 0;
@ -420,11 +433,12 @@
.short_header_from_with_subject {
margin-top: 0;
margin-bottom: 0;
margin-right: 1em;
text-decoration: none;
float: right;
color: var(--color-highlight);
font-style: italic;
font-family: Arial, Helvetica, sans-serif;
font-size: 1.0em;
font-size: 1.2em;
}
.short_header_from_local_poster {
@ -447,16 +461,42 @@
.short_header_date {
margin-top: 0;
margin-bottom: 0;
margin-right: 1em;
text-decoration: none;
color: var(--color-highlight);
font-family: Arial, Helvetica, sans-serif;
font-size: 0.8em;
font-size: 0.9em;
}
/* short header 'Date: ' title (with subject)*/
.short_header_date_title_with_subject {
margin-top: 0;
margin-bottom: 0;
text-decoration: none;
font-weight: bold;
color: var(--color-highlight);
font-family: Arial, Helvetica, sans-serif;
font-size: 1.1em;
}
/* short header Date: */
.short_header_date_with_subject {
margin-top: 0;
margin-bottom: 0;
margin-right: 1em;
text-decoration: none;
float: right;
color: var(--color-text);
font-family: Arial, Helvetica, sans-serif;
font-size: 1.1em;
}
/* short header Newsgroups: */
.short_header_newsgroups {
margin-top: 0;
margin-bottom: 0;
margin-left: 0.4em;
text-decoration: none;
color: var(--color-highlight);
font-family: Arial, Helvetica, sans-serif;

View File

@ -587,15 +587,21 @@ function show_header_short($head, $group, $local_poster = false)
}
if ($local_poster) {
$displayname = '<span class="short_header_from_local_poster">' . $displayname . '</span>';
$displayname = '<span class="short_header_from_local_poster">' . $displayname . '</span>';
}
// Try to use client timezone else default to UTC
$displaydate = get_date_for_client_timezone($head->date);
// Where to show From in short_headers
if (isset($OVERRIDES['short_header_show_from_in_subject']) && $OVERRIDES['short_header_show_from_in_subject'] == true && strlen($head->subject) < $maxsubjectlength) {
if (isset($OVERRIDES['short_header_show_from_in_subject']) && $OVERRIDES['short_header_show_from_in_subject'] == true) {
echo '<span class="short_header_subject_title">';
echo 'Subject: ';
echo '</span>';
echo '<span class="short_header_subject">';
echo htmlspecialchars($head->subject);
echo '</span><span class="short_header_from_with_subject">';
echo '&nbsp;&nbsp;</span>(<span class="short_header_from_with_subject"><b>From: </b></span>' . $displayname . ')<br>';
echo '</span>';
echo '<span class="short_header_from_with_subject"><b>From: </b>' . $displayname . '</span><br>';
} else {
echo '<div class="short_header_subject">';
echo htmlspecialchars($head->subject) . "<br>";
@ -603,10 +609,25 @@ function show_header_short($head, $group, $local_poster = false)
echo '<div class="short_header_from">';
echo "<b>From: </b>" . $displayname;
echo '</div>';
// Try to use client timezone else default to UTC
echo '<span class="short_header_date">';
echo '<b>Date: </b>' . $displaydate;
echo '</span><br>';
}
// Try to use client timezone else default to UTC
$displaydate = get_date_for_client_timezone($head->date);
echo '<span class="short_header_newsgroups">';
echo '<b>Newsgroups: </b>';
$ngroups = preg_replace("/\,|\ /", "\t", $head->newsgroups);
$ngroups = explode("\t", $ngroups);
// echo "&nbsp;";
foreach ($ngroups as $onegroup) {
if (get_section_by_group($onegroup)) {
echo '<a href="' . $file_thread . '?group=' . urlencode($onegroup) . '" title="Visit ' . $onegroup . '"> ' . $onegroup . " </a>";
} else {
echo " " . $onegroup . " ";
}
}
echo '</span>';
// Copy MID to clipboard (requires js)
echo '<script>';
@ -621,23 +642,15 @@ function show_header_short($head, $group, $local_poster = false)
echo '}';
echo '</script> ';
echo '<span class="short_header_date">';
echo '<b>Date: </b>' . $displaydate;
echo '</span>';
echo '<span class="short_header_newsgroups">';
echo '&nbsp;&nbsp;<b>Newsgroups: </b>';
$ngroups = preg_replace("/\,|\ /", "\t", $head->newsgroups);
$ngroups = explode("\t", $ngroups);
// echo "&nbsp;";
foreach ($ngroups as $onegroup) {
if (get_section_by_group($onegroup)) {
echo '<a href="' . $file_thread . '?group=' . urlencode($onegroup) . '" title="Visit ' . $onegroup . '"> ' . $onegroup . " </a>";
} else {
echo " " . $onegroup . " ";
}
if (isset($OVERRIDES['short_header_show_from_in_subject']) && $OVERRIDES['short_header_show_from_in_subject'] == true) {
echo '<span class="short_header_date_with_subject">';
echo '<span class="short_header_date_title_with_subject">';
echo 'Date: ';
echo '</span>';
echo $displaydate;
echo '</span>';
}
echo '</span>';
if (isset($head->followup) && ($article_show["Followup"]) && ($head->followup != "")) {
echo '<div class="short_header_followup-to">';
@ -699,8 +712,8 @@ function show_header_short($head, $group, $local_poster = false)
echo '</div>';
}
echo '</div>';
// echo '</p>';
// echo '</div>';
// echo '</p>';
// echo '</div>';
}
function copy_messageid()

View File

@ -16,7 +16,7 @@ return [
// Display short view of headers (only subject, name, date)
'short_headers' => true,
// Display From to the right of Subject in short_headers
// Display From and Date to the right of Subject in short_headers
// Default is false, will show separately (below)
'short_header_show_from_in_subject' => false,