function plusDivs(n) {
showDivs(slideIndex += n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("slide");
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
if (document.getElementById("previewProduct").classList.value.includes("visibilityVisible")) {
x[slideIndex-1].style.display = "block";
}
}
function getGumroadData(VarIDD) {
return new Promise(function (resolve) {
const xmlhttp = new XMLHttpRequest();
xmlhttp.onload = function () {
resolve(xmlhttp.response)
}
xmlhttp.open("POST", "/getGumroadData.php");
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send('id=' + VarIDD);
});
}
async function setProduct(varID) {
try {
var remoteCode = await getGumroadData(varID);
data = JSON.parse(remoteCode);
data.product.covers.forEach(element => {
if (element.type == "image") {
document.getElementById("productImageContainer").innerHTML += "
";
} else if (element.type == "video") {
document.getElementById("productImageContainer").innerHTML += "