function copyToClipboard(elementId) {

	/* Get the text field */
	var copyText = document.getElementById(elementId);

	/* Select the text field */
	copyText = copyText.textContent;

	/* Copy the text inside the text field */
	navigator.clipboard.writeText(copyText);

	var tooltip = document.getElementById("tooltip");
	tooltip.innerHTML = "Copied";

}

function resetCopy() {

  var tooltip = document.getElementById("tooltip");
  tooltip.innerHTML = "Copy to clipboard";

}

// Event Listeners
// tooltipped has tooltip and clipboard classes

//const clipboard = querySelector('.tooltiptext');
const minecraft = document.getElementById('minecraft-clip');
minecraft.addEventListener('click', function (event) { copyToClipboard('minecraft-server'); });

var tooltipped = document.getElementsByClassName('tooltipped');
for (var i = 0; i < tooltipped.length; i++) {
	//tooltipped[i].addEventListener('click', function (event) { copyToClipboard(); });
	tooltipped[i].addEventListener('mouseout', function (event) { resetCopy(); });
}

