async function vote(i, amount) {
  if(!user.loggedIn) {
    alert("Please login first!");
    return;
  }
  const id = js[i].key.id;
  await fetch("/upvote-data?id=" + id + "&vote=" + amount);
  getAndRefreshComments();

  var upvotes = js[i].propertyMap.upvotes;
  var countText = upvotes;
  if(upvotes > 0) {
    countText = "+" + upvotes;
  } else if (upvotes == 0) {
    countText = "";
  }
  document.getElementsByClassName("up-counter")[i - (pg-1)*numElemsPerPage].innerText = countText;
}
/* Increments or decrements the upvote count of a comment */
Increments or decrements the upvote count of a comment
Increments or decrements the upvote count of a comment
async function vote(i, amount) {
  if(!user.loggedIn) {
    alert("Please login first!");
    return;
  }
  const id = js[i].key.id;
  await fetch("/upvote-data?id=" + id + "&vote=" + amount);
  getAndRefreshComments();
  var upvotes = js[i].propertyMap.upvotes;
  var countText = upvotes;
  if(upvotes > 0) {
    countText = "+" + upvotes;
  } else if (upvotes == 0) {
    countText = "";
  }
  document.getElementsByClassName("up-counter")[i - (pg-1)*numElemsPerPage].innerText = countText;
}
async function vote ( i , amount ) { if ( ! user . loggedIn ) { alert ( "Please login first!" ) ; return ; } const id = js [ i ] . key . id ; await fetch ( "/upvote-data?id=" + id + "&vote=" + amount ) ; getAndRefreshComments ( ) ; var upvotes = js [ i ] . propertyMap . upvotes ; var countText = upvotes ; if ( upvotes > 0 ) { countText = "+" + upvotes ; } else if ( upvotes == 0 ) { countText = "" ; } document . getElementsByClassName ( "up-counter" ) [ i - ( pg - 1 ) * numElemsPerPage ] . innerText = countText ; }
Increments or decrements the upvote count of a comment
Increments or decrements the upvote count of a comment