diff --git a/AutoInsertData.php b/AutoInsertData.php new file mode 100644 index 0000000..6bf4de3 --- /dev/null +++ b/AutoInsertData.php @@ -0,0 +1,195 @@ + + + + + +loadHTML($string); + $finder = new DomXPath($dom); + + $content = $finder->query("//*[contains(concat(' ', normalize-space(@data-component-name), ' '), ' ProductPage ')]")[0]->textContent; + $content = json_decode($content); + $c = $content->product; + + + $currency = "{ + \"usd\": \"$\", + \"eur\": \"€\", + \"crc\": \"₡\", + \"gbp\": \"£\", + \"ils\": \"₪\", + \"inr\": \"₹\", + \"jpy\": \"¥\", + \"krw\": \"₩\", + \"ngn\": \"₦\", + \"php\": \"₱\", + \"pln\": \"zł\", + \"pyg\": \"₲\", + \"thb\": \"฿\", + \"uah\": \"₴\", + \"vnd\": \"₫\", + \"aud\": \"A\$\", + \"cad\": \"CAD\$\" + }"; + + $currency = json_decode($currency); + $currencyOutput = $c->currency_code; + + if ($c->thumbnail_url == null) { + $thumbnailURL = $c->covers[0]->url; + } else $thumbnailURL = $c->thumbnail_url; + + $rating = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' rating-average ')]")[0]->textContent; + + if ($rating == null || $rating == "" || $rating == " ") $rating = "None"; + + $conn = new mysqli($servername, $username, $password, $dbname); + + if ($conn->connect_error) { + $failed = true; + } + + $c->name = str_replace("'","\'",str_replace("`","\`",str_replace('"','\"',$c->name))); + $c->seller->name = str_replace("'","\'",str_replace("`","\`",str_replace('"','\"',$c->seller->name))); + $species = str_replace("'","\'",str_replace("`","\`",str_replace('"','\"',$species))); + + + $sql2 = "SELECT * FROM `content` WHERE + name LIKE \"%" . $c->name . "%\" AND + url_link LIKE \"%" . $url . "%\" AND + url_image LIKE \"%" . $thumbnailURL . "%\" AND + creator LIKE \"%" . $c->seller->name . "%\";"; + + $result2 = $conn->query($sql2); + + if ($result2->num_rows > 0) { + $isExisting = true; + } else { + $isExisting = false; + } + + $sql = "INSERT INTO content ( + `name`, + `price`, + `currency`, + `url_link`, + `url_image`, + `creator`, + `rating`, + `species`, + `nsfw`, + `section` + ) + VALUES ( + '" . $c->name . "', + '" . $c->price_cents . "', + '" . $currency->$currencyOutput . "', + '" . $url . "', + '" . $thumbnailURL . "', + '" . $c->seller->name . "', + '" . $rating . "', + '" . $species . "', + '" . $nsfw . "', + " . $section . " + )"; + if ($isExisting == false) { + if ($conn->query($sql) === TRUE) { + echo "Successful !"; + } else { + $errormsg = "Error: " . $sql . "
" . $conn->error . "
"; + $failed = true; + } + } else { + echo "Already Exists!"; + } + + + $conn->close(); + } + + +?> + +
+
+
+
+
+
+ + +
+
+
+name . "',
+ '" . ($c->price_cents / 100) . "',
+ '" . $currency->$currencyOutput . "',
+ '" . $url . "',
+ '" . $thumbnailURL . "',
+ '" . $c->seller->name . "',
+ '" . $rating . "',
+ '" . $species . "',
+ '" . $nsfw . "'"; + +?> \ No newline at end of file diff --git a/GatherAllLinks.php b/GatherAllLinks.php new file mode 100644 index 0000000..153e3c9 --- /dev/null +++ b/GatherAllLinks.php @@ -0,0 +1,27 @@ +loadHTML($string); +$finder = new DomXPath($dom); + +$content = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' stretched-link ')]"); + +foreach($content as $node) { + $tmp = $node->attributes[0]->value; + if (str_contains($tmp, '?')) { + $tmp = substr($tmp, 0, strpos($tmp, "?")); + } + + print_r($tmp); + echo "
"; +} + +?> \ No newline at end of file diff --git a/Insert From Array.php b/Insert From Array.php new file mode 100644 index 0000000..7d24016 --- /dev/null +++ b/Insert From Array.php @@ -0,0 +1,181 @@ + + + +loadHTML($string); + $finder = new DomXPath($dom); + + $content = $finder->query("//*[contains(concat(' ', normalize-space(@data-component-name), ' '), ' ProductPage ')]")[0]->textContent; + $content = json_decode($content); + $c = $content->product; + + + $currency = "{ + \"usd\": \"$\", + \"eur\": \"€\", + \"crc\": \"₡\", + \"gbp\": \"£\", + \"ils\": \"₪\", + \"inr\": \"₹\", + \"jpy\": \"¥\", + \"krw\": \"₩\", + \"ngn\": \"₦\", + \"php\": \"₱\", + \"pln\": \"zł\", + \"pyg\": \"₲\", + \"thb\": \"฿\", + \"uah\": \"₴\", + \"vnd\": \"₫\", + \"aud\": \"A\$\", + \"cad\": \"CAD\$\" + }"; + + $currency = json_decode($currency); + $currencyOutput = $c->currency_code; + + if ($c->thumbnail_url == null) { + $thumbnailURL = $c->covers[0]->url; + } else $thumbnailURL = $c->thumbnail_url; + + $rating = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' rating-average ')]")[0]->textContent; + + if ($rating == null || $rating == "" || $rating == " ") $rating = "None"; + + $conn = new mysqli($servername, $username, $password, $dbname); + + if ($conn->connect_error) { + $failed = true; + } + + $c->name = str_replace("'","\'",str_replace("`","\`",str_replace('"','\"',$c->name))); + $c->seller->name = str_replace("'","\'",str_replace("`","\`",str_replace('"','\"',$c->seller->name))); + $species = str_replace("'","\'",str_replace("`","\`",str_replace('"','\"',$species))); + + + $sql2 = "SELECT * FROM `content` WHERE + name LIKE \"%" . $c->name . "%\" AND + url_link LIKE \"%" . $url . "%\" AND + url_image LIKE \"%" . $thumbnailURL . "%\" AND + creator LIKE \"%" . $c->seller->name . "%\";"; + + $result2 = $conn->query($sql2); + + if ($result2->num_rows > 0) { + $isExisting = true; + } else { + $isExisting = false; + } + + $sql = "INSERT INTO content ( + `name`, + `price`, + `currency`, + `url_link`, + `url_image`, + `creator`, + `rating`, + `species`, + `nsfw`, + `section` + ) + VALUES ( + '" . $c->name . "', + '" . $c->price_cents . "', + '" . $currency->$currencyOutput . "', + '" . $url . "', + '" . $thumbnailURL . "', + '" . $c->seller->name . "', + '" . $rating . "', + '" . $species . "', + '" . $nsfw . "', + " . $section . " + )"; + + + if ($isExisting == false) { + if ($conn->query($sql) === TRUE) { + echo "Successful! URL: " . $url; + } else { + echo "Error: " . $sql . " -|- " . $conn->error; + } + } else { + echo "Already Exists! URL: " . $url; + } + $conn->close(); +} + +?> \ No newline at end of file diff --git a/addFav.php b/addFav.php new file mode 100644 index 0000000..128fa24 --- /dev/null +++ b/addFav.php @@ -0,0 +1,41 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +session_start(); + +$itemId = (int)$_POST["id"]; + +$uuid = $_SESSION["uuid"]; + +$sql = "SELECT * FROM wishlist_uuid WHERE uuid=\"" . $uuid . "\""; +$result = $conn->query($sql); +$row = $result->fetch_assoc(); + +if ($row["array"] != "") { + $currentArray = json_decode($row["array"]); +} else { + $currentArray = array(); +} + +if (!in_array($itemId, $currentArray)) { + $currentArray[] = $itemId; +} + +print_r(json_encode($currentArray)); + +$sql_Update = "UPDATE `wishlist_uuid` SET `last_use`='" . date("Y-m-d H:i:s") . "',`array`='" . json_encode($currentArray) . "' WHERE uuid='" . $uuid . "'"; +$result_Update = $conn->query($sql_Update); + + +?> \ No newline at end of file diff --git a/assets/1705483987315.png b/assets/1705483987315.png new file mode 100644 index 0000000..edcecac Binary files /dev/null and b/assets/1705483987315.png differ diff --git a/assets/banner.png b/assets/banner.png new file mode 100644 index 0000000..14434a5 Binary files /dev/null and b/assets/banner.png differ diff --git a/assets/fonts/LEVIBRUSH.TTF b/assets/fonts/LEVIBRUSH.TTF new file mode 100644 index 0000000..d4bae1e Binary files /dev/null and b/assets/fonts/LEVIBRUSH.TTF differ diff --git a/assets/fonts/Rubik-VariableFont_wght.ttf b/assets/fonts/Rubik-VariableFont_wght.ttf new file mode 100644 index 0000000..bbab349 Binary files /dev/null and b/assets/fonts/Rubik-VariableFont_wght.ttf differ diff --git a/assets/fonts/avali-scratch.ttf b/assets/fonts/avali-scratch.ttf new file mode 100644 index 0000000..124926c Binary files /dev/null and b/assets/fonts/avali-scratch.ttf differ diff --git a/assets/images/Eqp9vTsVgAE-uA8.webp b/assets/images/Eqp9vTsVgAE-uA8.webp new file mode 100644 index 0000000..54e1659 Binary files /dev/null and b/assets/images/Eqp9vTsVgAE-uA8.webp differ diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..767547e Binary files /dev/null and b/assets/logo.png differ diff --git a/assets/logo_old.ico b/assets/logo_old.ico new file mode 100644 index 0000000..bf34b9f Binary files /dev/null and b/assets/logo_old.ico differ diff --git a/assets/scripts/account.js b/assets/scripts/account.js new file mode 100644 index 0000000..50db174 --- /dev/null +++ b/assets/scripts/account.js @@ -0,0 +1,110 @@ +function addFav(id) { + return new Promise(function (resolve) { + const xmlhttp = new XMLHttpRequest(); + xmlhttp.onload = function () { + } + xmlhttp.open("POST", "/addFav.php"); + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.send('id=' + id); + }); +} + +function remFav(id) { + return new Promise(function (resolve) { + const xmlhttp = new XMLHttpRequest(); + xmlhttp.onload = function () { + } + xmlhttp.open("POST", "/remFav.php"); + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.send('id=' + id); + }); +} + +function getFav() { + return new Promise(function (resolve) { + const xmlhttp = new XMLHttpRequest(); + xmlhttp.onload = function () { + document.getElementById("wishlist").innerHTML = this.responseText; + console.log(this.responseText); + } + xmlhttp.open("POST", "/getFav.php"); + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.send(); + }); +} + +function refreshLiked() { + document.querySelectorAll('.likebutton').forEach(element => { + var exists = false; + + try { + wishlistArray.forEach(function(item) { + + if (element.attributes[1].value == String(item["id"])) { + exists = true; + } + }); + } catch (err) { + err.message; + } + + if (exists) { + element.innerHTML = "favorite"; + } else { + element.innerHTML = "favorite_border"; + } + + return new Promise(function (resolve) { + const xmlhttp = new XMLHttpRequest(); + xmlhttp.onload = async function () { + document.getElementById("wishlistScript").innerHTML = "var wishlistArray = " + this.responseText; + wishlistArray = JSON.parse(this.responseText); + } + xmlhttp.open("POST", "/getFavArray.php"); + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.send(); + }); + + }); +} + +getFav(); + + +async function accOpen() { + if (!login) { + document.getElementById("wishlist").innerHTML = "

Please Login into your Wishlist to see your Wishlist

"; + } + + currentpos = document.body.scrollTop; + document.getElementById("footer").classList.add("addHeight"); + await sleep(100); + try { document.getElementById("filter").style = "top: " + document.body.scrollTop + "px;"; } catch(err) {} + await sleep(400); + document.getElementById("body").classList.add("disableScrollbar"); + try { document.getElementById("filter").classList.add("filterDisplay"); } catch(err) {} + + try { document.getElementById("filterdiv").style = "display: none !important;"; } catch(err) {} + try { document.getElementById("accdiv").style = "display: grid !important;"; } catch(err) {} + + document.getElementById("filterbutton").href = "#foclose"; + filterisopened = true; +} + +async function accClose() { + await sleep(200); + + document.getElementById("body").classList.remove("disableScrollbar"); + try { document.getElementById("filter").classList.remove("filterDisplay"); } catch(err) {} + + await sleep(400); + await sleep(200); + document.getElementById("footer").classList.remove("addHeight"); + + document.getElementById("filterbutton").href = "#fo"; + + try { document.getElementById("filterdiv").style = "display: none !important;"; } catch(err) {} + try { document.getElementById("accdiv").style = "display: grid !important;"; } catch(err) {} + + filterisopened = false; +} \ No newline at end of file diff --git a/assets/scripts/avali.js b/assets/scripts/avali.js new file mode 100644 index 0000000..005e5c8 --- /dev/null +++ b/assets/scripts/avali.js @@ -0,0 +1,25 @@ +function AvaliMode() { + if(!document.getElementById('id1')) { + var link = document.createElement('link'); + link.id = 'id1'; + link.rel = 'stylesheet'; + link.href = '/assets/style/avali.css'; + document.head.appendChild(link); + AvaliSet("true"); + } else { + document.getElementById("id1").remove(); + AvaliSet("false"); + } +} + +function AvaliSet(VarIDD) { + return new Promise(function (resolve) { + const xmlhttp = new XMLHttpRequest(); + xmlhttp.onload = function () { + resolve(xmlhttp.response) + } + xmlhttp.open("POST", "/setavali.php"); + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.send('avali=' + VarIDD); + }); +} \ No newline at end of file diff --git a/assets/scripts/default-functions.js b/assets/scripts/default-functions.js new file mode 100644 index 0000000..2ac9900 --- /dev/null +++ b/assets/scripts/default-functions.js @@ -0,0 +1,63 @@ +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +async function changeNavAttach() { + if (window.pageYOffset >= sticky) { + navbar.classList.add("sticky"); + navbar.classList.add("ontop"); + } else { + navbar.classList.remove("sticky"); + navbar.classList.remove("ontop"); + } +} + +async function topForBottomBarProductPreview() { + if (window.windowWidth < 1001) { + document.getElementById("purchaseSection").style.top = (825 + document.getElementById("productPage").scrollTop) + "px"; + } else { + document.getElementById("purchaseSection").style.top = null; + } +} + +document.getElementById("productPage").onscroll = function () { + topForBottomBarProductPreview(); +}; + +window.onscroll = function () { + changeNavAttach(); +}; + +function disableScroll() { + window.addEventListener('DOMMouseScroll', preventDefault, false); // older FF + window.addEventListener(wheelEvent, preventDefault, wheelOpt); // modern desktop + window.addEventListener('touchmove', preventDefault, wheelOpt); // mobile + window.addEventListener('keydown', preventDefaultForScrollKeys, false); +} + +function enableScroll() { + window.removeEventListener('DOMMouseScroll', preventDefault, false); + window.removeEventListener(wheelEvent, preventDefault, wheelOpt); + window.removeEventListener('touchmove', preventDefault, wheelOpt); + window.removeEventListener('keydown', preventDefaultForScrollKeys, false); +} + +function preventDefault(e) { + e.preventDefault(); +} + +function preventDefaultForScrollKeys(e) { + if (keys[e.keyCode]) { + preventDefault(e); + return false; + } +} + +function menu() { + var x = document.getElementById("navbar"); + if (x.className.includes("responsive")) { + x.className = x.className.replace(" responsive", ""); + } else { + x.className += " responsive"; + } +} \ No newline at end of file diff --git a/assets/scripts/event-listener.js b/assets/scripts/event-listener.js new file mode 100644 index 0000000..a65fe56 --- /dev/null +++ b/assets/scripts/event-listener.js @@ -0,0 +1,108 @@ +window.addEventListener('resize', function() { + if (window.innerWidth > 800) { + document.getElementById("styleshed").innerHTML = ".likeButton {top: " + (document.getElementsByClassName("imgItem")[0].clientHeight - 18) + "px !important}"; + } else { + document.getElementById("styleshed").innerHTML = ".likeButton {top: " + (document.getElementsByClassName("imgItem")[0].clientHeight - 58) + "px !important}"; + } +}); + +function getClickedElement() { + document.addEventListener('click', async function(event) { + var clickedElement = event.target; + if (clickedElement.classList[0] == "deletebutton") { + var itemid = clickedElement.attributes[2].value + remFav(itemid); + await sleep(200); + getFav(); + await sleep(3000); + refreshLiked(); + } + }); +} + +getClickedElement(); + +window.addEventListener('locationchange', function () { + console.log('location changed!'); +}); + + if (window.location.hash == "#fo") { + try { filterOpen(); } catch(err) { console.log(err.message); } + } else if (window.location.hash == "#foclose") { + try { filterClose(); } catch(err) { console.log(err.message); } + try { accClose(); } catch(err) { console.log(err.message); } + window.location = window.location.replace("#foclose", ""); + } else if (window.location.hash == "#acc") { + try { accOpen(); } catch(err) { console.log(err.message); } + } else if (window.location.hash.includes("#p")) { + try { clearModal(); } catch(err) { console.log(err.message); } + try { openModal(); } catch(err) { console.log(err.message); } + + let vartmp = window.location.hash.replace("#p", ""); + + try { setProduct(vartmp); } catch(err) { console.log(err.message); } + try { openProduct(); } catch(err) { console.log(err.message); } + } else if (window.location.hash.includes("#insert")) { + try { openModalInsert(); } catch(err) { console.log(err.message); } + } else { + try { closeModal(); } catch(err) { console.log(err.message); } + try { closeModalInsert(); } catch(err) { console.log(err.message); } + try { clearModal(); } catch(err) { console.log(err.message); } + + try { filterClose(); } catch(err) { console.log(err.message); } + try { accClose(); } catch(err) { console.log(err.message); } + } + +window.addEventListener('hashchange', async function () { + if (window.location.hash == "#fo") { + try { filterOpen(); } catch(err) { console.log(err.message); } + } else if (window.location.hash == "#acc") { + try { accOpen(); } catch(err) { console.log(err.message); } + } else if (window.location.hash.includes("#p")) { + try { clearModal(); } catch(err) { console.log(err.message); } + try { openModal(); } catch(err) { console.log(err.message); } + + let vartmp = window.location.hash.replace("#p", ""); + + try { setProduct(vartmp); } catch(err) { console.log(err.message); } + try { openProduct(); } catch(err) { console.log(err.message); } + } else if (window.location.hash.includes("#insert")) { + try { openModalInsert(); } catch(err) { console.log(err.message); } + } else { + try { closeModal(); } catch(err) { console.log(err.message); } + try { closeModalInsert(); } catch(err) { console.log(err.message); } + await sleep(200); + try { clearModal(); } catch(err) { console.log(err.message); } + + try { filterClose(); } catch(err) { console.log(err.message); } + try { accClose(); } catch(err) { console.log(err.message); } + } +}); + +document.body.addEventListener('keypress', function(e) { + if (e.key == "Escape" && filterisopened == true) { + location.href='/'; + } +}); + + +try { + window.addEventListener("test", null, Object.defineProperty({}, 'passive', { + get: function () { + supportsPassive = true; + } + })); +} catch (e) { } + +function addListener() { + try { + var elements = document.getElementsByClassName('nsfw-filter'); + for (var element in elements) { + elements[element].addEventListener('click', function (e) { + e.target.remove(); + }) + } + } catch (e) {} +} + +addListener(); \ No newline at end of file diff --git a/assets/scripts/filter.js b/assets/scripts/filter.js new file mode 100644 index 0000000..22ee3df --- /dev/null +++ b/assets/scripts/filter.js @@ -0,0 +1,33 @@ + +async function filterOpen() { + currentpos = document.body.scrollTop; + document.getElementById("footer").classList.add("addHeight"); + await sleep(100); + document.getElementById("filter").style = "top: " + document.body.scrollTop + "px;"; + await sleep(400); + document.getElementById("body").classList.add("disableScrollbar"); + + document.getElementById("filterdiv").style = "display: grid !important;"; + document.getElementById("accdiv").style = "display: none !important;"; + + document.getElementById("filter").classList.add("filterDisplay"); + + document.getElementById("filterbutton").href = "#foclose"; + filterisopened = true; +} + +async function filterClose() { + document.getElementById("body").classList.remove("disableScrollbar"); + document.getElementById("filter").classList.remove("filterDisplay"); + + await sleep(400); + await sleep(200); + document.getElementById("footer").classList.remove("addHeight"); + + document.getElementById("filterbutton").href = "#fo"; + + document.getElementById("filterdiv").style = "display: grid !important;"; + document.getElementById("accdiv").style = "display: none !important;"; + + filterisopened = false; +} \ No newline at end of file diff --git a/assets/scripts/modal.js b/assets/scripts/modal.js new file mode 100644 index 0000000..d402930 --- /dev/null +++ b/assets/scripts/modal.js @@ -0,0 +1,69 @@ +async function openModalInsert() { + document.getElementById("insertData").classList.add("visibilityVisible"); + await sleep(100); + document.getElementById("insertData").classList.add("backgroundYES"); + document.getElementById("body").classList.add("disableScrollbar"); + await sleep(200); + try {document.getElementById("insertWindow").classList.add("visibilityVisible");} catch (e) {} +} + +async function closeModalInsert() { + try {document.getElementById("insertWindow").classList.remove("visibilityVisible");} catch (e) {} + await sleep(200); + try {document.getElementById("insertData").classList.remove("visibilityVisible");} catch (e) {} + try {document.getElementById("insertData").classList.remove("backgroundYES");} catch (e) {} + try {document.getElementById("insertData").style = "";} catch (e) {} + document.getElementById("body").classList.remove("disableScrollbar"); +} + +async function openModal() { + document.getElementById("previewProduct").classList.add("visibilityVisible"); + await sleep(100); + document.getElementById("previewProduct").classList.add("backgroundYES"); + document.getElementById("body").classList.add("disableScrollbar"); + +} + +async function openProduct() { + document.getElementById("previewProduct").style = "top:" + (document.body.scrollTop) + "px;"; + await sleep(400); + document.getElementById("productPage").classList.add("visibilityVisible"); + await sleep(200); + try { + document.getElementsByClassName("slide")[0].style.display = "block"; + } catch (e) {} +} + +async function closeModal() { + document.getElementById("productPage").classList.remove("visibilityVisible"); + await sleep(200); + document.getElementById("previewProduct").classList.remove("visibilityVisible"); + document.getElementById("previewProduct").classList.remove("backgroundYES"); + document.getElementById("previewProduct").style = ""; + document.getElementById("body").classList.remove("disableScrollbar"); + + document.getElementById("productLoading").style = "display: flex;"; +} + +function clearModal() { + document.getElementById("productImageContainer").innerHTML = ""; + document.getElementById("productDescription").innerHTML = ""; + document.getElementById("containsSection").innerHTML = ""; + document.getElementById("gotoproduct").style = ""; + document.getElementById("purchasePrice").innerHTML = ""; + document.getElementById("creatorImg").src = ""; + document.getElementById("creatorName").innerHTML = ""; + document.getElementById("ratingSection").style = ""; + + document.getElementById("productImageContainer").style = ""; + document.getElementById("productImageContainerButtons").style = ""; + document.getElementById("productMetaData").style = ""; + + data = ""; +} + +function backback() { + var tmp = window.scrollY; + window.location = "#"; + window.scrollTo(0, tmp); +} diff --git a/assets/scripts/preview.js b/assets/scripts/preview.js new file mode 100644 index 0000000..6b40bba --- /dev/null +++ b/assets/scripts/preview.js @@ -0,0 +1,138 @@ +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 += "