function submitComment() {
  var text = escapeHtml($('#comment-text').value);
  var comments = $('#comments').innerHTML;
  var comment = '      <div class="comment">\n        <textarea readonly>\n' + text + '\n        </textarea>\n      </div>\n';
  $('#comments').innerHTML = comment + comments;
  $('#comment-text').value = '';

  var href = window.location.href;
  var sha = href.substring(href.lastIndexOf('/') + 1);
  var httpRequest = new XMLHttpRequest();
  httpRequest.open('POST', 'https://gitshame.xyz/post');
  httpRequest.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
  httpRequest.send(JSON.stringify({
    sha: sha,
    post: text
  }));
}

function escapeHtml(str) {
  var div = document.createElement('div');
  div.appendChild(document.createTextNode(str));
  return div.innerHTML;
};

function unescapeHtml(escapedStr) {
  var div = document.createElement('div');
  div.innerHTML = escapedStr;
  var child = div.childNodes[0];
  return child ? child.nodeValue : '';
};

function openModal() {
  var el = document.getElementById("modal");
  el.style.visibility = "visible";
}

function closeModal() {
  var el = document.getElementById("modal");
  el.style.visibility = "hidden";
}

function closeModalEvent(event) {
  if (event.target.id == "modal") {
    closeModal();
  }
}

function shame() {
  var link = document.getElementById("link").value;
  var httpRequest = new XMLHttpRequest();
  httpRequest.open('POST', 'https://gitshame.xyz/pygmentize');
  httpRequest.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
  httpRequest.send(JSON.stringify({
    github_link: link
  }));
  closeModal();
}

function githubLogin(state) {
  var url = 'https://github.com/login/oauth/authorize'
  url += '?' + 'client_id=' + '6de9e53b515a73893674' + '&state=' + state + '&redirect=' + 'https://gitshame.xyz/login'

  window.location = url
}

@@ -66,18 +66,18 @@
 xt').val
-ue
+()
 );%0A  var
@@ -103,25 +103,22 @@
 ments').
-innerHTML
+html()
 ;%0A  var 
@@ -255,28 +255,21 @@
 ments').
-innerHTML = 
+html(
 comment 
@@ -278,16 +278,17 @@
 comments
+)
 ;%0A  $('#
@@ -309,15 +309,12 @@
 .val
-ue = 
+(
 ''
+)
 ;%0A%0A 

fix up submitComment