Skip to content

Commit 2470933

Browse files
committed
Add link to plant question hachyderm post
1 parent 055e67b commit 2470933

File tree

70 files changed

+105
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+105
-0
lines changed

404.html

100644100755
File mode changed.

about-orig/index.html

100644100755
File mode changed.

about/index.html

100644100755
File mode changed.

assets/css/stylesheet.b609c58d5c11bb90b1a54e04005d74ad1ddf22165eb79f5533967e57df9c3b50.css

100644100755
File mode changed.

contact/index.html

100644100755
File mode changed.

jfc/index.html

100644100755
File mode changed.

page/3/index.html

100644100755
File mode changed.

page/4/index.html

100644100755
File mode changed.

post/2020-elections/index.html

100644100755
File mode changed.

post/2021-runoff-election/index.html

100644100755
File mode changed.

post/2023-03-boot-orange-pi-5-from-nvme/index.html

100644100755
File mode changed.

post/2023-08-homelab-upgrade/index.html

100644100755
File mode changed.

post/2023-10-16-samba-and-moosefs/index.html

100644100755
File mode changed.

post/add-plex-to-hass/index.html

100644100755
File mode changed.

post/add-smarts-to-ikea-vindriktning-air-sensors/index.html

100644100755
File mode changed.

post/aquarium/plant-question/index.html

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,111 @@ <h3 id="stem-three">Stem three<a hidden class="anchor" aria-hidden="true" href="
262262
</div>
263263
<div>
264264

265+
<div class="article-content">
266+
<h2>Comments</h2>
267+
<p>You can use your Mastodon account to reply to this<a class="button" href="https://hachyderm.io/@unixorn/112899281969429083">post</a></p>
268+
<p><button class="button" id="replyButton" href="https://hachyderm.io/@unixorn/112899281969429083">Reply</button></p>
269+
<dialog id="toot-reply" class="mastodon" data-component="dialog">
270+
<h3>Reply to unixorn's post</h3>
271+
<p>
272+
With an account on the Fediverse or Mastodon, you can respond to this post.
273+
Since Mastodon is decentralized, you can use your existing account hosted by another Mastodon server or compatible platform if you don't have an account on this one.
274+
</p>
275+
<p>Copy and paste this URL into the search field of your favourite Fediverse app or the web interface of your Mastodon server.</p>
276+
<div class="copypaste">
277+
<input type="text" readonly="" value="https://hachyderm.io/@unixorn/112899281969429083">
278+
<button class="button" id="copyButton">Copy</button>
279+
<button class="button" id="cancelButton">Close</button>
280+
</div>
281+
</dialog>
282+
<p id="mastodon-comments-list"><button id="load-comment" class="button">Load comments</button></p>
283+
<noscript><p>You need JavaScript to view the comments.</p></noscript>
284+
<script src="https://unixorn.github.io/assets/js/purify.min.js"></script>
285+
<script type="text/javascript">
286+
const dialog = document.querySelector('dialog');
287+
288+
document.getElementById('replyButton').addEventListener('click', () => {
289+
dialog.showModal();
290+
});
291+
292+
document.getElementById('copyButton').addEventListener('click', () => {
293+
navigator.clipboard.writeText('https://hachyderm.io/@unixorn/112899281969429083');
294+
});
295+
296+
document.getElementById('cancelButton').addEventListener('click', () => {
297+
dialog.close();
298+
});
299+
300+
dialog.addEventListener('keydown', e => {
301+
if (e.key === 'Escape') dialog.close();
302+
});
303+
304+
const dateOptions = {
305+
year: "numeric",
306+
month: "numeric",
307+
day: "numeric",
308+
hour: "numeric",
309+
minute: "numeric",
310+
};
311+
312+
function escapeHtml(unsafe) {
313+
return unsafe
314+
.replace(/&/g, "&amp;")
315+
.replace(/</g, "&lt;")
316+
.replace(/>/g, "&gt;")
317+
.replace(/"/g, "&quot;")
318+
.replace(/'/g, "&#039;");
319+
}
320+
321+
document.getElementById("load-comment").addEventListener("click", function() {
322+
document.getElementById("load-comment").innerHTML = "Loading";
323+
fetch('https://hachyderm.io/api/v1/statuses/112899281969429083/context')
324+
.then(function(response) {
325+
return response.json();
326+
})
327+
.then(function(data) {
328+
if(data['descendants'] &&
329+
Array.isArray(data['descendants']) &&
330+
data['descendants'].length > 0) {
331+
document.getElementById('mastodon-comments-list').innerHTML = "";
332+
data['descendants'].forEach(function(reply) {
333+
reply.account.display_name = escapeHtml(reply.account.display_name);
334+
reply.account.reply_class = reply.in_reply_to_id == "112899281969429083" ? "reply-original" : "reply-child";
335+
reply.account.emojis.forEach(emoji => {
336+
reply.account.display_name = reply.account.display_name.replace(`:${emoji.shortcode}:`,
337+
`<img src="${escapeHtml(emoji.static_url)}" alt="Emoji ${emoji.shortcode}" height="20" width="20" />`);
338+
});
339+
mastodonComment =
340+
`<div class="mastodon-wrapper">
341+
<div class="comment-level ${reply.account.reply_class}"><svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" fill="none" transform="rotate(180)"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path stroke="#535358" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.608 12.526l7.04-6.454C13.931 4.896 16 5.806 16 7.546V11c13 0 11 16 11 16s-4-10-11-10v3.453c0 1.74-2.069 2.65-3.351 1.475l-7.04-6.454a2 2 0 010-2.948z"></path> </g></svg></div>
342+
<div class="mastodon-comment">
343+
<div class="avatar">
344+
<img src="${escapeHtml(reply.account.avatar_static)}" height=60 width=60 alt="">
345+
</div>
346+
<div class="content">
347+
<div class="author">
348+
<a href="${reply.account.url}" rel="nofollow">
349+
<span>${reply.account.display_name}</span>
350+
<span class="disabled">${escapeHtml(reply.account.acct)}</span>
351+
</a>
352+
<a class="date" href="${reply.uri}" rel="nofollow">
353+
${reply.created_at.substr(0, 10)}
354+
</a>
355+
</div>
356+
<div class="mastodon-comment-content">${reply.content}</div>
357+
</div>
358+
</div>
359+
</div>`;
360+
document.getElementById('mastodon-comments-list').appendChild(DOMPurify.sanitize(mastodonComment, {'RETURN_DOM_FRAGMENT': true}));
361+
});
362+
} else {
363+
document.getElementById('mastodon-comments-list').innerHTML = "<p>No comments found</p>";
364+
}
365+
});
366+
});
367+
</script>
368+
</div>
369+
265370
</div>
266371

267372
<footer class="post-footer">

post/arm_cluster_parts_list/index.html

100644100755
File mode changed.

post/autodesk-fusion-signup/index.html

100644100755
File mode changed.

post/backing-up-the-cluster-with-duplicacy/index.html

100644100755
File mode changed.

post/cupsd-setup/index.html

100644100755
File mode changed.

post/fix-congo-backticks/index.html

100644100755
File mode changed.

post/fix-macos-captive-portal-issue/index.html

100644100755
File mode changed.

post/growing-ebs-volumes-in-place/index.html

100644100755
File mode changed.

post/ha-mqtt-discoverable-0.8.0/index.html

100644100755
File mode changed.

post/hail-mary-podcast/index.html

100644100755
File mode changed.

post/hass-using-postgresql-instead-of-sqlite/index.html

100644100755
File mode changed.

post/hass/2023-05-21-install-esphome/index.html

100644100755
File mode changed.

post/hass/2023-07-09-set-up-nginx-proxy-manager/index.html

100644100755
File mode changed.

post/hass/2023-11-weird-ha-scripts-bug/index.html

100644100755
File mode changed.

post/hass/ha-mqtt-discoverable-0.12.0/index.html

100644100755
File mode changed.

post/hass/ha-mqtt-discoverable-0.14.0/index.html

100644100755
File mode changed.

post/home-assistant-notifications-via-twilio/index.html

100644100755
File mode changed.

post/homelab/homelab-nut-upsd/index.html

100644100755
File mode changed.

post/homelab/homelab-setup-prometheus-and-grafana/index.html

100644100755
File mode changed.

post/multi-architecture-images/index.html

100644100755
File mode changed.

post/page/2/index.html

100644100755
File mode changed.

post/page/4/index.html

100644100755
File mode changed.

post/securifi-peanut-gotcha/index.html

100644100755
File mode changed.

post/western-digital-red-smr-fiasco/index.html

100644100755
File mode changed.

tags/2020-election/index.html

100644100755
File mode changed.

tags/3d_printing/index.html

100644100755
File mode changed.

tags/administrivia/page/1/index.html

100644100755
File mode changed.

tags/alerting/index.html

100644100755
File mode changed.

tags/apple/index.html

100644100755
File mode changed.

tags/aquarium/plant/index.html

100644100755
File mode changed.

tags/arm/page/1/index.html

100644100755
File mode changed.

tags/arm64/page/1/index.html

100644100755
File mode changed.

tags/armbian/index.html

100644100755
File mode changed.

tags/autodesk-fusion-360/index.html

100644100755
File mode changed.

tags/autodesk/index.html

100644100755
File mode changed.

tags/b2/index.html

100644100755
File mode changed.

tags/blog/page/1/index.html

100644100755
File mode changed.

tags/cadvisor/page/1/index.html

100644100755
File mode changed.

tags/containerd/index.html

100644100755
File mode changed.

tags/data-breach/index.html

100644100755
File mode changed.

tags/deprecated/page/1/index.html

100644100755
File mode changed.

tags/dfs/index.html

100644100755
File mode changed.

tags/docker-compose/index.html

100644100755
File mode changed.

tags/ebs/page/1/index.html

100644100755
File mode changed.

tags/ec2/page/1/index.html

100644100755
File mode changed.

tags/esp32/index.html

100644100755
File mode changed.

tags/esphome/index.html

100644100755
File mode changed.

tags/freebsd/page/1/index.html

100644100755
File mode changed.

tags/glusterfs/index.html

100644100755
File mode changed.

tags/glusterfs/page/1/index.html

100644100755
File mode changed.

tags/grafana/index.html

100644100755
File mode changed.

tags/ha-mqtt-discoverable/index.html

100644100755
File mode changed.

tags/ha-mqtt-discoverable/page/1/index.html

100644100755
File mode changed.

tags/hass/index.html

100644100755
File mode changed.

tags/home/index.html

100644100755
File mode changed.

0 commit comments

Comments
 (0)