function commentConfig() {
  var newSort = document.getElementById("sort-dir").value;
  var newSortBy = document.getElementById("sort-by").value;
  var newElemsPerPage = parseInt(document.getElementById("pg-limit").value);
  var newTotal = parseInt(document.getElementById("limit").value);
  var findAuthor =  document.getElementById("find-author").value.trim();
  var needGet = false;
  var needRefresh = false;

  // filter is not case-sensitive or space-sensitive
  if(findAuthor != null && findAuthor.length > 0) {
    findAuthor = findAuthor.replace(/\s/,'');
  } else {
    findAuthor = "";
  }
  if(newSort.localeCompare(sortDir) != 0 
        || newTotal > js.length 
        || findAuthor.localeCompare(showingAuthor) != 0
        || newSortBy.localeCompare(sortBy) != 0
  ) {
    needGet = true;
  } else if (newTotal < totalElems || numElemsPerPage != newElemsPerPage) {
    needRefresh = true;
  }

  sortDir = newSort;
  sortBy = newSortBy;
  totalElems = newTotal;
  numElemsPerPage = newElemsPerPage;
  showingAuthor = findAuthor;

  document.cookie = "sortDir=" + newSort;
  document.cookie = "totalElems=" + newTotal;
  document.cookie = "numElemsPerPage=" + numElemsPerPage;
  document.cookie = "sortBy=" + sortBy;

  if(needGet) {
    getAndRefreshComments();
  } else if (needRefresh) {
    refreshComments();
  }
}
/* Updates the comment display based on user input and saves settings to cookies. */
Updates the comment display based on user input and saves settings to cookies.
Updates the comment display based on user input and saves settings to cookies .
function commentConfig() {
  var newSort = document.getElementById("sort-dir").value;
  var newSortBy = document.getElementById("sort-by").value;
  var newElemsPerPage = parseInt(document.getElementById("pg-limit").value);
  var newTotal = parseInt(document.getElementById("limit").value);
  var findAuthor =  document.getElementById("find-author").value.trim();
  var needGet = false;
  var needRefresh = false;
  if(findAuthor != null && findAuthor.length > 0) {
    findAuthor = findAuthor.replace(/\s/,'');
  } else {
    findAuthor = "";
  }
  if(newSort.localeCompare(sortDir) != 0 
        || newTotal > js.length 
        || findAuthor.localeCompare(showingAuthor) != 0
        || newSortBy.localeCompare(sortBy) != 0
  ) {
    needGet = true;
  } else if (newTotal < totalElems || numElemsPerPage != newElemsPerPage) {
    needRefresh = true;
  }
  sortDir = newSort;
  sortBy = newSortBy;
  totalElems = newTotal;
  numElemsPerPage = newElemsPerPage;
  showingAuthor = findAuthor;
  document.cookie = "sortDir=" + newSort;
  document.cookie = "totalElems=" + newTotal;
  document.cookie = "numElemsPerPage=" + numElemsPerPage;
  document.cookie = "sortBy=" + sortBy;
  if(needGet) {
    getAndRefreshComments();
  } else if (needRefresh) {
    refreshComments();
  }
}
function commentConfig ( ) { var newSort = document . getElementById ( "sort-dir" ) . value ; var newSortBy = document . getElementById ( "sort-by" ) . value ; var newElemsPerPage = parseInt ( document . getElementById ( "pg-limit" ) . value ) ; var newTotal = parseInt ( document . getElementById ( "limit" ) . value ) ; var findAuthor = document . getElementById ( "find-author" ) . value . trim ( ) ; var needGet = false ; var needRefresh = false ; if ( findAuthor != null && findAuthor . length > 0 ) { findAuthor = findAuthor . replace ( / \s / , '' ) ; } else { findAuthor = "" ; } if ( newSort . localeCompare ( sortDir ) != 0 || newTotal > js . length || findAuthor . localeCompare ( showingAuthor ) != 0 || newSortBy . localeCompare ( sortBy ) != 0 ) { needGet = true ; } else if ( newTotal < totalElems || numElemsPerPage != newElemsPerPage ) { needRefresh = true ; } sortDir = newSort ; sortBy = newSortBy ; totalElems = newTotal ; numElemsPerPage = newElemsPerPage ; showingAuthor = findAuthor ; document . cookie = "sortDir=" + newSort ; document . cookie = "totalElems=" + newTotal ; document . cookie = "numElemsPerPage=" + numElemsPerPage ; document . cookie = "sortBy=" + sortBy ; if ( needGet ) { getAndRefreshComments ( ) ; } else if ( needRefresh ) { refreshComments ( ) ; } }
Updates the comment display based on user input and saves settings to cookies.
Updates the comment display based on user input and saves settings to cookies .
// filter is not case-sensitive or space-sensitive