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 ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
|
@ -54,7 +54,7 @@ templatedir: ./templates
|
||||||
#templatedir: /usr/share/ikiwiki/templates
|
#templatedir: /usr/share/ikiwiki/templates
|
||||||
# base wiki source location
|
# base wiki source location
|
||||||
#underlaydir: /usr/share/ikiwiki/basewiki
|
#underlaydir: /usr/share/ikiwiki/basewiki
|
||||||
underlaydir: ./basewiki
|
underlaydir: ./base
|
||||||
# display verbose messages?
|
# display verbose messages?
|
||||||
verbose: 1
|
verbose: 1
|
||||||
# log to syslog?
|
# log to syslog?
|
||||||
|
|
|
@ -26,20 +26,20 @@
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
|
||||||
<!-- ikiwiki CSS -->
|
<!-- ikiwiki CSS -->
|
||||||
<link href="<TMPL_VAR BASEURL>style.css" rel="stylesheet" />
|
<link href="<TMPL_VAR BASEURL>css/style.css" rel="stylesheet" />
|
||||||
|
|
||||||
<!-- Bootstrap core CSS -->
|
<!-- Bootstrap core CSS -->
|
||||||
<!-- those checksums can be verified with: shasum -b -a 384 $file | xxd -r -p | base64 -->
|
<!-- 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">
|
<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 -->
|
<!-- Custom styles for this template -->
|
||||||
<link href="<TMPL_VAR BASEURL>bootstrap.local.css" rel="stylesheet" />
|
<link href="<TMPL_VAR BASEURL>css/bootstrap.local.css" rel="stylesheet" />
|
||||||
|
|
||||||
<!-- Custom styles for derivatives -->
|
<!-- Custom styles for derivatives -->
|
||||||
<TMPL_IF LOCAL_CSS>
|
<TMPL_IF LOCAL_CSS>
|
||||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL><TMPL_VAR LOCAL_CSS>" type="text/css" />
|
<link rel="stylesheet" href="<TMPL_VAR BASEURL><TMPL_VAR LOCAL_CSS>" type="text/css" />
|
||||||
<TMPL_ELSE>
|
<TMPL_ELSE>
|
||||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.css" type="text/css" />
|
<link rel="stylesheet" href="<TMPL_VAR BASEURL>css/local.css" type="text/css" />
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
|
|
||||||
<TMPL_UNLESS DYNAMIC>
|
<TMPL_UNLESS DYNAMIC>
|
||||||
|
@ -78,9 +78,7 @@
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start" aria-labelledby="language-menu-top">
|
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start" aria-labelledby="language-menu-top">
|
||||||
<TMPL_LOOP OTHERLANGUAGES>
|
<TMPL_LOOP OTHERLANGUAGES>
|
||||||
<li>
|
<li><a href="<TMPL_VAR URL>"><TMPL_VAR LANGUAGE></a></li>
|
||||||
<a href="<TMPL_VAR URL>"><TMPL_VAR LANGUAGE></a>
|
|
||||||
</li>
|
|
||||||
</TMPL_LOOP>
|
</TMPL_LOOP>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -90,41 +88,28 @@
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="navbar" class="collapse navbar-collapse">
|
<div id="navbar" class="collapse navbar-collapse">
|
||||||
|
<TMPL_IF SIDEBAR><TMPL_VAR SIDEBAR></TMPL_IF>
|
||||||
<TMPL_IF SIDEBAR>
|
<ul class="navbar-nav nav-link align-items-center ms-auto">
|
||||||
<TMPL_VAR SIDEBAR>
|
|
||||||
</TMPL_IF>
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<TMPL_LOOP BOOTMENU>
|
<TMPL_LOOP BOOTMENU>
|
||||||
<TMPL_IF FIRSTNAV>
|
<TMPL_IF FIRSTNAV>
|
||||||
<li <TMPL_IF ACTIVE>class="active"</TMPL_IF>><a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a></li>
|
<li <TMPL_IF ACTIVE>class="active"</TMPL_IF>><a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a></li>
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
</TMPL_LOOP>
|
</TMPL_LOOP>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container" id="content">
|
<div class="container" id="content">
|
||||||
|
|
||||||
<TMPL_VAR CONTENT>
|
<TMPL_VAR CONTENT>
|
||||||
|
|
||||||
<TMPL_IF ENCLOSURE>
|
<TMPL_IF ENCLOSURE>
|
||||||
<section id="enclosure">
|
<section id="enclosure">
|
||||||
<a href="<TMPL_VAR ENCLOSURE>">Download</a>
|
<a href="<TMPL_VAR ENCLOSURE>">Download</a>
|
||||||
</section>
|
</section>
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
|
|
||||||
<TMPL_IF TRAILS>
|
<TMPL_IF TRAILS><TMPL_VAR TRAILS></TMPL_IF>
|
||||||
<TMPL_VAR TRAILS>
|
|
||||||
</TMPL_IF>
|
|
||||||
|
|
||||||
<TMPL_UNLESS DYNAMIC>
|
<TMPL_UNLESS DYNAMIC>
|
||||||
<!-- legacy Ikiwiki comments.pm section -->
|
<!-- legacy Ikiwiki comments.pm section -->
|
||||||
|
@ -144,68 +129,15 @@
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
|
|
||||||
<!-- Mastodon comments -->
|
<!-- Mastodon comments -->
|
||||||
<TMPL_IF mastodon_host>
|
<TMPL_IF mastodon_host>
|
||||||
<div class="mastodon-comments comments">
|
<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>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>
|
<p id="mastodon-comments-list"><button id="load-comment">Load comments</button></p>
|
||||||
<noscript><p>You need JavaScript to view the comments.</p></noscript>
|
<noscript><p>You need JavaScript to view the comments.</p></noscript>
|
||||||
<script src="/assets/js/purify.min.js"></script>
|
<script src="<TMPL_VAR BASEURL>js/purify.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script src="<TMPL_VAR BASEURL>js/mastodon.js">
|
||||||
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>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
|
|
||||||
<div class="pagedate text-muted">
|
<div class="pagedate text-muted">
|
||||||
|
@ -218,17 +150,12 @@
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</TMPL_UNLESS>
|
</TMPL_UNLESS>
|
||||||
</div> <!-- /container -->
|
</div> <!-- /container -->
|
||||||
|
|
||||||
<footer class="footer pb-3 pt-3" role="contentinfo">
|
<footer class="footer pb-3 pt-3" role="contentinfo">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
<TMPL_IF FOOTER><TMPL_VAR FOOTER></TMPL_IF>
|
||||||
<TMPL_IF FOOTER>
|
|
||||||
<TMPL_VAR FOOTER>
|
|
||||||
</TMPL_IF>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|