180 changes: 180 additions & 0 deletions _scss/comments.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
div#comments {
margin-top: 10px;

h3#comment-count, h2 {
padding: 8px;
}

img.avatar {
border-radius: 4px;
float: left;
width: 48px;
height: 48px;
}

#comments-list {
list-style-type: none;

li {
padding: 8px;
clear: both;
min-height: 48px;
font-size: 15px;
line-height: 21px;
margin-top: 8px;

blockquote {
margin-left: 60px;

cite {
font-style: normal;
font-size: 12px;

span.author {
font-weight: 700;
font-size: 13px;
}

a.muted {
color: #656c7a;
font-size: 12px;
}
}

div.comment-body {
line-height: 21px;
font-size: 15px;
}
}

&.byauthor {
border-radius: 4px;
background-color: #fcf9eb;
}
}

.bullet {
padding: 0;
color: #c2c6cc;
line-height: 1.4;
}
} // #comments-list

form#commentform {
padding: 8px;

input {
transition: all .2s linear;
padding: 5px 9px;
margin: 10px 0 0 0;
font-size: 13px;
border-radius: 4px;
height: 32px;
}

input:focus, div.textarea:focus, button#commentbutton:active, button#commentbutton:focus {
outline:none;
box-shadow: 0 0 8px rgba(230, 210, 180, 1);
border-color: #aaa;
}

div.textarea, div.status {
border-radius: 4px;
height: auto;
line-height: 1.4;
font-size: 14px;
font-family: "Helvetica Neue",arial,sans-serif;
padding: 6px 10px 8px;
}

div.textarea {
width: 100%;
transition: all .15s ease-in-out;
overflow: auto;
word-wrap: break-word;
color: #2a2e2e;
cursor: text;
display: block;
padding: 6px 10px 8px;
min-height: 100px;
}

div.status:not(:empty) {
margin-bottom: 10px;
border: solid 1px #eaa;
background-color: #ecc;
}

div.status:empty {
display: none;
}

[contenteditable=PLAINTEXT-ONLY]:empty:not(:focus):before {
color: #687a86;
line-height: 30px;
font-size: 18px;
content: attr(aria-label);
display: block; /* For Firefox */
}

div#commenttext {
margin-left: 60px;
}

div#comment-box {
min-height: 48px;
}

div#comment-author {
margin-left: 60px;
}

button#commentbutton, input, div.textarea {
border: 1px solid #caced3;
}

button#commentbutton {
margin: 10px 0 0 0;
padding: 5px 9px;
height: 44px;
color: #505050;
border-radius: 4px;
-webkit-appearance: none;
apperance: none;
background-color: 1px solid #dbdfe4;
background-image: linear-gradient(-180deg, #eceff5 0%, #dbdfe4 90%);

&:hover {
border: 1px solid #b0b0c0;
background-color: 1px solid #dbdfe4;
background-image: linear-gradient(-180deg, #eceff5 0%, #dbdfe4 90%);
}

&:active {
border: 1px solid #a8acc2;
background-color: 1px #cbcfd4;
background-image: none;
}

&.confirm-button {
background-color: 1px solid #ffffee;
background-image: linear-gradient(-180deg, #ffffee 0%, #eeeedd 90%)
}
}

#remember-me {
display: inline-block;
padding: 10px 6px;

input {
margin: auto;
padding: auto;
height: auto;
}
}
} // form#commentForm

#comment-count, cite, #remember-me {
font-family: "Helvetica Neue",arial,sans-serif;
}
}
13 changes: 13 additions & 0 deletions _scss/screen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -601,3 +601,16 @@ dd {
}

div.suggest-edit-message {padding: 4px 8px 20px 8px;}

.info-circle:after {
content: "\f05a";
display: inline-block;
font: 1.3em FontAwesome;
color: #777;
}

input + .info-circle:after {
position: relative;
left: -20px;
margin-right: -15px;
}
1 change: 1 addition & 0 deletions css/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
@import "screen";
@import "code";
@import "carbon";
@import "comments";
Binary file added images/comments/unknown-avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
110 changes: 110 additions & 0 deletions js/comment-box.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
Haack.ready(function() {

let form = Haack.get('commentform')

if (form) {
var emailRegex = /[^@\s]+@[^@\s]+\.[^@\s]+$/
var avatarPreview = Haack.get('avatarPreview')
avatarPreview.onerror = (e) => { tryLoad(e.target, 1) }

function changeAvatar() {
let image = avatarPreview
image.possible = buildPossibleAvatars(Haack.get('identity').value)
image.currentIndex = 0
tryLoad(image)
}

function tryLoad(image, increment) {
if (increment) {
image.currentIndex += increment
}

if (image.currentIndex < image.possible.length) {
image.src = image.possible[image.currentIndex]
}
else {
image.onerror = null
image.src = image.dataset.fallbacksrc;
}
}

function buildPossibleAvatars(identity) {
let possibleAvatars = []

if (identity.match(emailRegex)) {
possibleAvatars.push('https://secure.gravatar.com/avatar/' + md5(identity) + '?s=80&d=identicon&r=pg')
} else {
possibleAvatars.push('https://github.com/' + identity + '.png')
possibleAvatars.push('https://avatars.io/twitter/' + identity + '/medium')
}

return possibleAvatars
}

Haack.get('comment-div').oninput = (e) => {
Haack.get('message').value = e.target.innerText
}

Haack.get('identity').onchange = () => {
changeAvatar()
}

function storeUser(name, identity) {
window.localStorage.name = name;
window.localStorage.identity = identity;
}

function retrieveUser(nameInput, identityInput, rememberCheckbox) {
var rememberMe = false
if (window.localStorage.name) {
nameInput.value = window.localStorage.name;
rememberMe = true
}
if (window.localStorage.identity) {
identityInput.value = window.localStorage.identity;
rememberMe = true
}
if (rememberMe) {
rememberCheckbox.checked = true
}
}

Haack.get('commentbutton').onclick = (e) => {
let status = Haack.get('commentstatus')
status.innerText = ''

let missing = Array.from(form.querySelectorAll('[data-required]')).filter(el => el.value === '').map(el => el.name)
if (missing.length > 0) {
status.innerText = 'Some required fields are missing - (' + missing.join(', ') + ')'
return
}
let button = e.target
if (button.innerText != 'Confirm comment') {
button.innerText = 'Confirm comment'
button.title = 'Click the button again to confirm the comment'
button.classList.add('confirm-button')
return
}
let name = Haack.get('name')
let identity = Haack.get('identity')

if (Haack.get('remember').checked) {
storeUser(name.value, identity.value)
}
else {
storeUser('', '')
}
Haack.get('avatarInput').value = avatarPreview.src

button.disabled = true
button.innerText = 'Posting...'
identity.value = ""
form.action = form.dataset.action
form.submit()
}

// Load values from Local Storage.
retrieveUser(Haack.get('name'), Haack.get('identity'), Haack.get('remember'))
changeAvatar() // initial load of avatar
}
})
2 changes: 2 additions & 0 deletions js/md5.min.js
28 changes: 14 additions & 14 deletions js/slash.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
(function($) {
// Append caption after pictures
$('.entry-content img').each(function(i) {
var alt = this.alt;
var parent = $(this).parent();
Haack.ready(function() {
var images = document.querySelectorAll('.post-content img')
images.forEach(function(img) {
var alt = img.alt
var parent = img.parentElement

if (alt != '') {
var element = $(this);
if (parent.is('a')) {
if (alt && alt != '') {
var element = img
if (parent.tagName == 'A') {
element = parent;
}
element.after('<span class="caption">'+alt+'</span>');
}
element.insertAdjacentHTML('afterend', '<span class="caption">' + alt + '</span>');

if (!parent.is('a')) {
$(this).wrap('<a href="'+this.src+'" title="'+alt+'" />');
/* if (!parent.is('a')) {
$(this).wrap('<a href="'+this.src+'" title="'+alt+'" />');
}*/
}
});
})(jQuery);
})
})
32 changes: 32 additions & 0 deletions js/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var Haack = (function() {
// NodeList foreach Polyfill
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this)
}
}
}

// Haack namespace object.
return {
ready: function(init) {
if (document.readyState === "complete" || (document.readyState !== "loading" && !document.documentElement.doScroll)) {
window.setTimeout(init)
}
else {
var completed = function() {
document.removeEventListener("DOMContentLoaded", completed)
window.removeEventListener("load", completed)
init()
}
document.addEventListener("DOMContentLoaded", completed)
window.addEventListener("load", completed)
}
},
get: function(elementId) {
return document.getElementById(elementId)
}
};
})();
9 changes: 3 additions & 6 deletions privacy/index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: page
title: "Privacy Policy"
date: 2004-09-01 -0800
comments: false
disqus_identifier: 1095
categories: []
sharing: false
---
Expand Down Expand Up @@ -31,19 +30,17 @@ share in the first place.
## What Information Do You Collect?

This site doesn't itself collect data. It's a static site hosted on GitHub Pages.
However, I do use Google Analytics so it's worth looking at [Google Analytic's privacy policy](http://www.google.com/analytics/learn/privacy.html).
I also use Disqus for comments, so take a look at the [Disqus's privacy policy](http://help.disqus.com/customer/portal/articles/466259-privacy-policy).

However, I do use Google Analytics so it's worth looking at [Google Analytic's privacy policy](http://www.google.com/analytics/learn/privacy.html).

## What About Cookies?

See the previous answer about Disqus and Google Analytics.
See the previous answer about Google Analytics.

## So Who Do You Share This Information With?

Absolutely nobody, other than occasionally posting aggregate stats about my blog on occasion.

## Even If I Offered You 10 Million Dollars?

Let's talk off-line in private.... er... I mean NO! Absolutely Not.
Haacked.com doesn't gather any information worth selling.

13 changes: 13 additions & 0 deletions thanks/index.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
layout: page
title: "Thank you!"
description: "Thank you for your comment"
date: 2018-06-11 -0800
comments: false
categories: [personal]
sharing: false
---

I appreciate all the feedback.

__Please note!__ It may take a while to display as I moderate comments. Thanks for understanding!