parent
238ad73442
commit
8a31e8775e
1 changed files with 49 additions and 1 deletions
|
|
@ -28,9 +28,57 @@ layout: base.njk
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
<p>Comments are disabled. If you want to leave a public comment on this post, email me and ask me to add it here!</p>
|
|
||||||
|
|
||||||
|
<p>Comments? Write me an email! Be sure to let me know if you want it posted publically.</p>
|
||||||
|
<noscript>
|
||||||
|
<a href="mailto:nupanick@gmail.com">Click Here To Email Nycki</a>
|
||||||
|
</noscript>
|
||||||
|
<div hidden class="comment-form">
|
||||||
|
<textarea></textarea>
|
||||||
|
<p><a href="" id="send">Send it!</a> Link opens in your default email application.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.comment-form textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 10lh;
|
||||||
|
margin: 1ch;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const commentForm = document.querySelector('.comment-form');
|
||||||
|
commentForm.hidden = false;
|
||||||
|
const comment = document.querySelector('.comment-form textarea');
|
||||||
|
const send = document.querySelector('.comment-form #send');
|
||||||
|
const name = 'nupanick';
|
||||||
|
const domain = 'gmail.com';
|
||||||
|
const subject = `RE: ${document.title}`;
|
||||||
|
|
||||||
|
function updateEmailLink() {
|
||||||
|
let value = comment.value;
|
||||||
|
// escape things in the comment that look like part of a query string.
|
||||||
|
value = value.replace('%', '%25');
|
||||||
|
value = value.replace('&', '%26');
|
||||||
|
send.href = `mailto:${name}@${domain}?subject=${subject}&body=${value}`;
|
||||||
|
}
|
||||||
|
updateEmailLink();
|
||||||
|
|
||||||
|
// update the link whenever it changes, so desktop users can preview on hover.
|
||||||
|
// you can remove this line if you don't need link previews.
|
||||||
|
comment.addEventListener('change', updateEmailLink);
|
||||||
|
|
||||||
|
// update the link again right before sending.
|
||||||
|
send.addEventListener('click', (ev) => {
|
||||||
|
updateEmailLink();
|
||||||
|
window.open(send.href);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#
|
||||||
{%- if process.env.NODE_ENV == 'localhost' %}
|
{%- if process.env.NODE_ENV == 'localhost' %}
|
||||||
<script defer src="https://xnil.io/comentario/comentario.js"></script>
|
<script defer src="https://xnil.io/comentario/comentario.js"></script>
|
||||||
<comentario-comments theme="dark"></comentario-comments>
|
<comentario-comments theme="dark"></comentario-comments>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
#}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue