document.getElementById('awardModal').addEventListener('show.bs.modal', function (event) { document.getElementById("awardTarget").action = event.relatedTarget.dataset.url; }); // TODO: Refactor this ugly shit who wrote this lmao function vote(type, id, dir) { const upvotes = document.getElementsByClassName(type + '-' + id + '-up'); const downvotes = document.getElementsByClassName(type + '-' + id + '-down'); const scoretexts = document.getElementsByClassName(type + '-score-' + id); for (let i=0; i= 200 && xhr.status < 300 && data && data["message"]) { document.getElementById('toast-post-success-text2').innerText = data["message"]; bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success2')).show(); document.getElementById('giveaward').disabled=false; let owned = document.getElementById(`${kind}-owned`) let ownednum = Number(owned.textContent); owned.textContent = ownednum + 1 } else { document.getElementById('toast-post-error-text').innerText = "Error, please try again later." if (data && data["error"]) document.getElementById('toast-post-error-text2').innerText = data["error"]; bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error2')).show(); } }; xhr.send(form); }