templates/*: cleaned up indents + folder restructure
Some checks are pending
/ render (push) Waiting to run
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
55
base/js/mastodon.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
function escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
|
||||
document.getElementById("load-comment").addEventListener("click", function() {
|
||||
document.getElementById("load-comment").innerHTML = "Loading...";
|
||||
fetch('https://<TMPL_VAR mastodon_host>/api/v1/statuses/<TMPL_VAR mastodon_post>/context')
|
||||
.then(function(response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function(data) {
|
||||
if(data['descendants'] &&
|
||||
Array.isArray(data['descendants']) &&
|
||||
data['descendants'].length > 0) {
|
||||
document.getElementById('mastodon-comments-list').innerHTML = "";
|
||||
data['descendants'].forEach(function(reply) {
|
||||
reply.account.display_name = escapeHtml(reply.account.display_name);
|
||||
reply.account.emojis.forEach(emoji => {
|
||||
reply.account.display_name = reply.account.display_name.replace(`:${emoji.shortcode}:`,
|
||||
`<img src="${escapeHtml(emoji.static_url)}" alt="Emoji ${emoji.shortcode}" height="20" width="20" />`);
|
||||
});
|
||||
mastodonComment =
|
||||
`<div class="mastodon-comment comment">
|
||||
<div class="avatar">
|
||||
<img src="${escapeHtml(reply.account.avatar_static)}" height=60 width=60 alt="">
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="author">
|
||||
<a href="${reply.account.url}" rel="nofollow">
|
||||
<span>${reply.account.display_name}</span>
|
||||
<span class="disabled">${escapeHtml(reply.account.acct)}</span>
|
||||
</a>
|
||||
<a class="post" href="${reply.uri}" rel="nofollow">
|
||||
<time datetime="${reply.created_at}" pubdate="pubdate">
|
||||
${reply.created_at.replace(/(T\d+:\d+):\d+(\.\d+)?(.*)/, "$1$3")}
|
||||
</time>
|
||||
</a>
|
||||
</div>
|
||||
<div class="mastodon-comment-content">${reply.content}</div>
|
||||
</div>
|
||||
</div>`;
|
||||
document.getElementById('mastodon-comments-list').appendChild(DOMPurify.sanitize(mastodonComment, {'RETURN_DOM_FRAGMENT': true}));
|
||||
});
|
||||
}
|
||||
else {
|
||||
document.getElementById('mastodon-comments-list').innerHTML = "<p>Not comments found</p>";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 293 B After Width: | Height: | Size: 293 B |
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 74 B After Width: | Height: | Size: 74 B |
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-08-10 21:36-0400\n"
|
||||
"POT-Creation-Date: 2024-09-11 14:32-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-09-10 22:25-0400\n"
|
||||
"POT-Creation-Date: 2024-09-11 14:32-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-08-11 00:05-0400\n"
|
||||
"POT-Creation-Date: 2024-09-11 14:32-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-09-10 22:25-0400\n"
|
||||
"POT-Creation-Date: 2024-09-11 14:32-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
|
@ -54,7 +54,7 @@ templatedir: ./templates
|
|||
#templatedir: /usr/share/ikiwiki/templates
|
||||
# base wiki source location
|
||||
#underlaydir: /usr/share/ikiwiki/basewiki
|
||||
underlaydir: ./basewiki
|
||||
underlaydir: ./base
|
||||
# display verbose messages?
|
||||
verbose: 1
|
||||
# log to syslog?
|
||||
|
|
|
@ -1,249 +1,176 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<TMPL_IF NAME="META"><TMPL_VAR META></TMPL_IF>
|
||||
<TMPL_IF DYNAMIC>
|
||||
<TMPL_IF FORCEBASEURL><base href="<TMPL_VAR FORCEBASEURL>" /><TMPL_ELSE>
|
||||
<TMPL_IF BASEURL><base href="<TMPL_VAR BASEURL>" /></TMPL_IF>
|
||||
</TMPL_IF>
|
||||
</TMPL_IF>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<TMPL_IF NAME="META"><TMPL_VAR META></TMPL_IF>
|
||||
<TMPL_IF DYNAMIC>
|
||||
<TMPL_IF FORCEBASEURL><base href="<TMPL_VAR FORCEBASEURL>" /><TMPL_ELSE>
|
||||
<TMPL_IF BASEURL><base href="<TMPL_VAR BASEURL>" /></TMPL_IF>
|
||||
</TMPL_IF>
|
||||
</TMPL_IF>
|
||||
|
||||
<title><TMPL_VAR TITLE> - <TMPL_VAR WIKINAME></title>
|
||||
<title><TMPL_VAR TITLE> - <TMPL_VAR WIKINAME></title>
|
||||
|
||||
<!-- cargo-culted from https://realfavicongenerator.net/ -->
|
||||
<!-- for the record: it is absolutely ridiculous that new browsers
|
||||
*and* operating systems each want their own little precious
|
||||
snowflake just for a frigging icon -->
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="<TMPL_VAR BASEURL>apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="<TMPL_VAR BASEURL>favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="<TMPL_VAR BASEURL>favicon-16x16.png">
|
||||
<link rel="manifest" href="<TMPL_VAR BASEURL>site.webmanifest">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<!-- cargo-culted from https://realfavicongenerator.net/ -->
|
||||
<!-- for the record: it is absolutely ridiculous that new browsers
|
||||
*and* operating systems each want their own little precious
|
||||
snowflake just for a frigging icon -->
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="<TMPL_VAR BASEURL>apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="<TMPL_VAR BASEURL>favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="<TMPL_VAR BASEURL>favicon-16x16.png">
|
||||
<link rel="manifest" href="<TMPL_VAR BASEURL>site.webmanifest">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<!-- ikiwiki CSS -->
|
||||
<link href="<TMPL_VAR BASEURL>style.css" rel="stylesheet" />
|
||||
<!-- ikiwiki CSS -->
|
||||
<link href="<TMPL_VAR BASEURL>css/style.css" rel="stylesheet" />
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!-- those checksums can be verified with: shasum -b -a 384 $file | xxd -r -p | base64 -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
||||
<!-- Bootstrap core CSS -->
|
||||
<!-- those checksums can be verified with: shasum -b -a 384 $file | xxd -r -p | base64 -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
||||
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="<TMPL_VAR BASEURL>bootstrap.local.css" rel="stylesheet" />
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="<TMPL_VAR BASEURL>css/bootstrap.local.css" rel="stylesheet" />
|
||||
|
||||
<!-- Custom styles for derivatives -->
|
||||
<TMPL_IF LOCAL_CSS>
|
||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL><TMPL_VAR LOCAL_CSS>" type="text/css" />
|
||||
<TMPL_ELSE>
|
||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.css" type="text/css" />
|
||||
</TMPL_IF>
|
||||
<!-- Custom styles for derivatives -->
|
||||
<TMPL_IF LOCAL_CSS>
|
||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL><TMPL_VAR LOCAL_CSS>" type="text/css" />
|
||||
<TMPL_ELSE>
|
||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL>css/local.css" type="text/css" />
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_UNLESS DYNAMIC>
|
||||
<TMPL_IF EDITURL>
|
||||
<link rel="alternate" type="application/x-wiki" title="Edit this page" href="<TMPL_VAR EDITURL>" />
|
||||
</TMPL_IF>
|
||||
<TMPL_IF FEEDLINKS><TMPL_VAR FEEDLINKS></TMPL_IF>
|
||||
<TMPL_IF RELVCS><TMPL_VAR RELVCS></TMPL_IF>
|
||||
<TMPL_IF META><TMPL_VAR META></TMPL_IF>
|
||||
<TMPL_LOOP TRAILLOOP>
|
||||
<TMPL_IF PREVPAGE>
|
||||
<link rel="prev" href="<TMPL_VAR PREVURL>" title="<TMPL_VAR PREVTITLE>" />
|
||||
</TMPL_IF>
|
||||
<link rel="up" href="<TMPL_VAR TRAILURL>" title="<TMPL_VAR TRAILTITLE>" />
|
||||
<TMPL_IF NEXTPAGE>
|
||||
<link rel="next" href="<TMPL_VAR NEXTURL>" title="<TMPL_VAR NEXTTITLE>" />
|
||||
</TMPL_IF>
|
||||
</TMPL_LOOP>
|
||||
</TMPL_UNLESS>
|
||||
</head>
|
||||
<body>
|
||||
<TMPL_UNLESS DYNAMIC>
|
||||
<TMPL_IF EDITURL>
|
||||
<link rel="alternate" type="application/x-wiki" title="Edit this page" href="<TMPL_VAR EDITURL>" />
|
||||
</TMPL_IF>
|
||||
<TMPL_IF FEEDLINKS><TMPL_VAR FEEDLINKS></TMPL_IF>
|
||||
<TMPL_IF RELVCS><TMPL_VAR RELVCS></TMPL_IF>
|
||||
<TMPL_IF META><TMPL_VAR META></TMPL_IF>
|
||||
<TMPL_LOOP TRAILLOOP>
|
||||
<TMPL_IF PREVPAGE>
|
||||
<link rel="prev" href="<TMPL_VAR PREVURL>" title="<TMPL_VAR PREVTITLE>" />
|
||||
</TMPL_IF>
|
||||
<link rel="up" href="<TMPL_VAR TRAILURL>" title="<TMPL_VAR TRAILTITLE>" />
|
||||
<TMPL_IF NEXTPAGE>
|
||||
<link rel="next" href="<TMPL_VAR NEXTURL>" title="<TMPL_VAR NEXTTITLE>" />
|
||||
</TMPL_IF>
|
||||
</TMPL_LOOP>
|
||||
</TMPL_UNLESS>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light border">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand me-auto" href="<TMPL_VAR BASEURL>">
|
||||
<img alt="<TMPL_VAR WIKINAME>" src="<TMPL_VAR BASEURL>favicon.png" width="48" height="48" />
|
||||
</a>
|
||||
<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light border">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand me-auto" href="<TMPL_VAR BASEURL>">
|
||||
<img alt="<TMPL_VAR WIKINAME>" src="<TMPL_VAR BASEURL>favicon.png" width="48" height="48" />
|
||||
</a>
|
||||
|
||||
<TMPL_IF OTHERLANGUAGES>
|
||||
<div class="dropdown ps-2 pe-2">
|
||||
<button class="btn language-switcher dropdown" type="button" id="language-menu-top" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<div class="collapse navbar-collapse float-end ms-1" id="navbar">
|
||||
<TMPL_VAR LANG_NAME>
|
||||
</div>
|
||||
<img src="<TMPL_VAR BASEURL>wikiicons/languages.png">
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start" aria-labelledby="language-menu-top">
|
||||
<TMPL_LOOP OTHERLANGUAGES>
|
||||
<li>
|
||||
<a href="<TMPL_VAR URL>"><TMPL_VAR LANGUAGE></a>
|
||||
</li>
|
||||
</TMPL_LOOP>
|
||||
</ul>
|
||||
</div>
|
||||
</TMPL_IF>
|
||||
<TMPL_IF OTHERLANGUAGES>
|
||||
<div class="dropdown ps-2 pe-2">
|
||||
<button class="btn language-switcher dropdown" type="button" id="language-menu-top" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<div class="collapse navbar-collapse float-end ms-1" id="navbar">
|
||||
<TMPL_VAR LANG_NAME>
|
||||
</div>
|
||||
<img src="<TMPL_VAR BASEURL>wikiicons/languages.png">
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start" aria-labelledby="language-menu-top">
|
||||
<TMPL_LOOP OTHERLANGUAGES>
|
||||
<li><a href="<TMPL_VAR URL>"><TMPL_VAR LANGUAGE></a></li>
|
||||
</TMPL_LOOP>
|
||||
</ul>
|
||||
</div>
|
||||
</TMPL_IF>
|
||||
|
||||
<button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<TMPL_IF SIDEBAR><TMPL_VAR SIDEBAR></TMPL_IF>
|
||||
<ul class="navbar-nav nav-link align-items-center ms-auto">
|
||||
<TMPL_LOOP BOOTMENU>
|
||||
<TMPL_IF FIRSTNAV>
|
||||
<li <TMPL_IF ACTIVE>class="active"</TMPL_IF>><a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a></li>
|
||||
</TMPL_IF>
|
||||
</TMPL_LOOP>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container" id="content">
|
||||
<TMPL_VAR CONTENT>
|
||||
<TMPL_IF ENCLOSURE>
|
||||
<section id="enclosure">
|
||||
<a href="<TMPL_VAR ENCLOSURE>">Download</a>
|
||||
</section>
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_IF TRAILS><TMPL_VAR TRAILS></TMPL_IF>
|
||||
|
||||
<TMPL_UNLESS DYNAMIC>
|
||||
<!-- legacy Ikiwiki comments.pm section -->
|
||||
<TMPL_IF COMMENTS>
|
||||
<section id="comments">
|
||||
<TMPL_VAR COMMENTS>
|
||||
<TMPL_IF ADDCOMMENTURL>
|
||||
<div class="addcomment">
|
||||
<a href="<TMPL_VAR ADDCOMMENTURL>">Add a comment</a>
|
||||
</div>
|
||||
<TMPL_ELSE>
|
||||
<TMPL_UNLESS mastodon_host>
|
||||
<div class="addcomment">Comments on this page are closed.</div>
|
||||
</TMPL_UNLESS>
|
||||
</TMPL_IF>
|
||||
</section>
|
||||
</TMPL_IF>
|
||||
|
||||
<!-- Mastodon comments -->
|
||||
<TMPL_IF mastodon_host>
|
||||
<div class="mastodon-comments comments">
|
||||
<p>You can use your Mastodon account to reply to this <a class="link" href="https://<TMPL_VAR mastodon_host>/@<TMPL_VAR mastodon_username>/<TMPL_VAR mastodon_post>">post</a>.</p>
|
||||
<p id="mastodon-comments-list"><button id="load-comment">Load comments</button></p>
|
||||
<noscript><p>You need JavaScript to view the comments.</p></noscript>
|
||||
<script src="<TMPL_VAR BASEURL>js/purify.min.js"></script>
|
||||
<script src="<TMPL_VAR BASEURL>js/mastodon.js">
|
||||
</script>
|
||||
</div>
|
||||
</TMPL_IF>
|
||||
|
||||
<div class="pagedate text-muted">
|
||||
<span class="created">Created <TMPL_VAR CTIME>.</span>
|
||||
<span class="edited">
|
||||
<TMPL_IF HISTORYURL>
|
||||
<a href="<TMPL_VAR HISTORYURL>">Edited <TMPL_VAR MTIME>.</a>
|
||||
<TMPL_ELSE>
|
||||
Edited <TMPL_VAR MTIME>.
|
||||
</TMPL_IF>
|
||||
</span>
|
||||
</div>
|
||||
</TMPL_UNLESS>
|
||||
</div> <!-- /container -->
|
||||
|
||||
<footer class="footer pb-3 pt-3" role="contentinfo">
|
||||
<div class="container">
|
||||
<TMPL_IF FOOTER><TMPL_VAR FOOTER></TMPL_IF>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
|
||||
<TMPL_IF SIDEBAR>
|
||||
<TMPL_VAR SIDEBAR>
|
||||
</TMPL_IF>
|
||||
<ul class="nav navbar-nav">
|
||||
<TMPL_LOOP BOOTMENU>
|
||||
<TMPL_IF FIRSTNAV>
|
||||
<li <TMPL_IF ACTIVE>class="active"</TMPL_IF>><a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a></li>
|
||||
</TMPL_IF>
|
||||
</TMPL_LOOP>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container" id="content">
|
||||
|
||||
<TMPL_VAR CONTENT>
|
||||
|
||||
<TMPL_IF ENCLOSURE>
|
||||
<section id="enclosure">
|
||||
<a href="<TMPL_VAR ENCLOSURE>">Download</a>
|
||||
</section>
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_IF TRAILS>
|
||||
<TMPL_VAR TRAILS>
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_UNLESS DYNAMIC>
|
||||
<!-- legacy Ikiwiki comments.pm section -->
|
||||
<TMPL_IF COMMENTS>
|
||||
<section id="comments">
|
||||
<TMPL_VAR COMMENTS>
|
||||
<TMPL_IF ADDCOMMENTURL>
|
||||
<div class="addcomment">
|
||||
<a href="<TMPL_VAR ADDCOMMENTURL>">Add a comment</a>
|
||||
</div>
|
||||
<TMPL_ELSE>
|
||||
<TMPL_UNLESS mastodon_host>
|
||||
<div class="addcomment">Comments on this page are closed.</div>
|
||||
</TMPL_UNLESS>
|
||||
</TMPL_IF>
|
||||
</section>
|
||||
</TMPL_IF>
|
||||
|
||||
<!-- Mastodon comments -->
|
||||
<TMPL_IF mastodon_host>
|
||||
<div class="mastodon-comments comments">
|
||||
<p>You can use your Mastodon account to reply to this <a class="link" href="https://<TMPL_VAR mastodon_host>/@<TMPL_VAR mastodon_username>/<TMPL_VAR mastodon_post>">post</a>.</p>
|
||||
<p id="mastodon-comments-list"><button id="load-comment">Load comments</button></p>
|
||||
<noscript><p>You need JavaScript to view the comments.</p></noscript>
|
||||
<script src="/assets/js/purify.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
|
||||
document.getElementById("load-comment").addEventListener("click", function() {
|
||||
document.getElementById("load-comment").innerHTML = "Loading...";
|
||||
fetch('https://<TMPL_VAR mastodon_host>/api/v1/statuses/<TMPL_VAR mastodon_post>/context')
|
||||
.then(function(response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function(data) {
|
||||
if(data['descendants'] &&
|
||||
Array.isArray(data['descendants']) &&
|
||||
data['descendants'].length > 0) {
|
||||
document.getElementById('mastodon-comments-list').innerHTML = "";
|
||||
data['descendants'].forEach(function(reply) {
|
||||
reply.account.display_name = escapeHtml(reply.account.display_name);
|
||||
reply.account.emojis.forEach(emoji => {
|
||||
reply.account.display_name = reply.account.display_name.replace(`:${emoji.shortcode}:`,
|
||||
`<img src="${escapeHtml(emoji.static_url)}" alt="Emoji ${emoji.shortcode}" height="20" width="20" />`);
|
||||
});
|
||||
mastodonComment =
|
||||
`<div class="mastodon-comment comment">
|
||||
<div class="avatar">
|
||||
<img src="${escapeHtml(reply.account.avatar_static)}" height=60 width=60 alt="">
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="author">
|
||||
<a href="${reply.account.url}" rel="nofollow">
|
||||
<span>${reply.account.display_name}</span>
|
||||
<span class="disabled">${escapeHtml(reply.account.acct)}</span>
|
||||
</a>
|
||||
<a class="post" href="${reply.uri}" rel="nofollow">
|
||||
<time datetime="${reply.created_at}" pubdate="pubdate">
|
||||
${reply.created_at.replace(/(T\d+:\d+):\d+(\.\d+)?(.*)/, "$1$3")}
|
||||
</time>
|
||||
</a>
|
||||
</div>
|
||||
<div class="mastodon-comment-content">${reply.content}</div>
|
||||
</div>
|
||||
</div>`;
|
||||
document.getElementById('mastodon-comments-list').appendChild(DOMPurify.sanitize(mastodonComment, {'RETURN_DOM_FRAGMENT': true}));
|
||||
});
|
||||
} else {
|
||||
document.getElementById('mastodon-comments-list').innerHTML = "<p>Not comments found</p>";
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</TMPL_IF>
|
||||
|
||||
<div class="pagedate text-muted">
|
||||
<span class="created">Created <TMPL_VAR CTIME>.</span>
|
||||
<span class="edited">
|
||||
<TMPL_IF HISTORYURL>
|
||||
<a href="<TMPL_VAR HISTORYURL>">Edited <TMPL_VAR MTIME>.</a>
|
||||
<TMPL_ELSE>
|
||||
Edited <TMPL_VAR MTIME>.
|
||||
</TMPL_IF>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</TMPL_UNLESS>
|
||||
</div> <!-- /container -->
|
||||
|
||||
<footer class="footer pb-3 pt-3" role="contentinfo">
|
||||
<div class="container">
|
||||
|
||||
<TMPL_IF FOOTER>
|
||||
<TMPL_VAR FOOTER>
|
||||
</TMPL_IF>
|
||||
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- TODO: Find other ways to setup analytics
|
||||
<script data-goatcounter="https://analytics.anarc.at/count" async src="//analytics.anarc.at/count.js"></script>
|
||||
<noscript>
|
||||
<img src="https://analytics.anarc.at/count?p=<TMPL_VAR PAGE>&t=<TMPL_VAR TITLE ESCAPE=URL>" alt="tracking pixel to count visitors when Javascript is disabled" />
|
||||
</noscript>
|
||||
<script data-goatcounter="https://analytics.anarc.at/count" async src="//analytics.anarc.at/count.js"></script>
|
||||
<noscript>
|
||||
<img src="https://analytics.anarc.at/count?p=<TMPL_VAR PAGE>&t=<TMPL_VAR TITLE ESCAPE=URL>" alt="tracking pixel to count visitors when Javascript is disabled" />
|
||||
</noscript>
|
||||
-->
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
<TMPL_LOOP TRAILLOOP>
|
||||
<TMPL_IF __FIRST__>
|
||||
<nav class="navbar">
|
||||
<ul class="nav navbar-nav pager">
|
||||
</TMPL_IF>
|
||||
<TMPL_IF PREVPAGE>
|
||||
<li class="previous">
|
||||
<a href="<TMPL_VAR PREVURL>">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
<TMPL_VAR PREVTITLE></a>
|
||||
</li>
|
||||
</TMPL_IF>
|
||||
<li class="up">
|
||||
<a href="<TMPL_VAR TRAILURL>">
|
||||
<span class="glyphicon glyphicon-menu-up"></span>
|
||||
<TMPL_VAR TRAILTITLE></a>
|
||||
</li>
|
||||
<TMPL_IF NEXTPAGE>
|
||||
<li class="next">
|
||||
<a href="<TMPL_VAR NEXTURL>"><TMPL_VAR NEXTTITLE>
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</TMPL_IF>
|
||||
<TMPL_IF __LAST__>
|
||||
</ul>
|
||||
</nav>
|
||||
</TMPL_IF>
|
||||
<TMPL_IF __FIRST__>
|
||||
<nav class="navbar">
|
||||
<ul class="nav navbar-nav pager">
|
||||
</TMPL_IF>
|
||||
<TMPL_IF PREVPAGE>
|
||||
<li class="previous">
|
||||
<a href="<TMPL_VAR PREVURL>">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
<TMPL_VAR PREVTITLE></a>
|
||||
</li>
|
||||
</TMPL_IF>
|
||||
<li class="up">
|
||||
<a href="<TMPL_VAR TRAILURL>">
|
||||
<span class="glyphicon glyphicon-menu-up"></span>
|
||||
<TMPL_VAR TRAILTITLE></a>
|
||||
</li>
|
||||
<TMPL_IF NEXTPAGE>
|
||||
<li class="next">
|
||||
<a href="<TMPL_VAR NEXTURL>"><TMPL_VAR NEXTTITLE>
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</TMPL_IF>
|
||||
<TMPL_IF __LAST__>
|
||||
</ul>
|
||||
</nav>
|
||||
</TMPL_IF>
|
||||
</TMPL_LOOP>
|
||||
|
|