Make entries in blocklist hyperlinkable. Add hyperlinks to RSS.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
0f3ffb4d99
commit
68373bca00
|
@ -51,6 +51,9 @@ void write_html(ostream &out, const vector<entry_type> &entries)
|
|||
<title>FediBlock – Blocklist</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<style>
|
||||
.small { font-size: small; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Blocklist</h1>
|
||||
|
@ -59,8 +62,10 @@ void write_html(ostream &out, const vector<entry_type> &entries)
|
|||
for (const auto &entry : entries)
|
||||
{
|
||||
out << "\n";
|
||||
out << " <details>\n";
|
||||
out << " <details id=\"" << entry.instance << "\">\n";
|
||||
out << " <summary>" << entry.instance << "</summary>\n";
|
||||
out << R"( <a href="#)" << entry.instance
|
||||
<< R"(" class="small">Hyperlink to this entry</a>)" << '\n';
|
||||
out << " <p>" << cgi::text2html(entry.description) << "</p>\n";
|
||||
out << " <p><strong>Tags:</strong> ";
|
||||
for (const auto &tag : entry.tags)
|
||||
|
@ -94,6 +99,24 @@ void write_html(ostream &out, const vector<entry_type> &entries)
|
|||
<a href="https://schlomp.space/FediBlock">Sourcecode</a> licensed under the
|
||||
<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL-3.0-only</a>.
|
||||
</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Open details when called with ID.
|
||||
function open_details()
|
||||
{
|
||||
const hash = decodeURI(location.hash.substring(1));
|
||||
if(hash)
|
||||
{
|
||||
const details = document.getElementById(hash);
|
||||
if(details && details.tagName.toLowerCase() === 'details')
|
||||
{
|
||||
details.open = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
window.addEventListener('hashchange', open_details);
|
||||
open_details();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
)";
|
||||
|
|
|
@ -149,6 +149,7 @@ void write_rss(ostream &out, const vector<entry_type> &entries,
|
|||
"FediBlock: " + entry.report_time + " " + entry.instance);
|
||||
write_line(out, 6, "pubDate",
|
||||
time::to_string(entry.report_time, rss_time_format));
|
||||
write_line(out, 6, "link", baseurl + '#' += entry.instance);
|
||||
|
||||
string item_description{"<p>" + cgi::text2html(entry.description)
|
||||
+ "</p>"};
|
||||
|
|
Reference in New Issue
Block a user