Backup Commit
This commit is contained in:
@@ -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 = "<icon>favorite</icon>";
|
||||
} else {
|
||||
element.innerHTML = "<icon>favorite_border</icon>";
|
||||
}
|
||||
|
||||
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 = "<p>Please Login into your Wishlist to see your Wishlist</p>";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user