
function openTab(evt, tabName, authorID) {
  // Declare all variables
  var i, tabcontent, tablinks;

  // Get all elements with class="tabcontent" and hide them
  tabcontent = document.querySelectorAll("#"+authorID+" .tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }

  // Get all elements with class="tablinks" and remove the class "active"
  tablinks = document.querySelectorAll("#"+authorID+" .tablink");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }

  // Show the current tab, and add an "active" class to the button that opened the tab
  document.getElementById(tabName).style.display = "block";
  evt.currentTarget.className += " active";
}
window.onload = function () {
  var tablinks = document.querySelectorAll('.tablink');
   for (i = 0; i < tablinks.length; i++) {
     tablinks[i].addEventListener('click', function() {
        var author = this.closest(".author-box");
        openTab(event, this.dataset.tab, author.id);
     });
  }

}

//https://www.w3schools.com/howto/howto_js_tabs.asp