// keeps track of how many events have been displayed let count = 1; $(document).ready(function () { /* Expand alias tab if they have any */ $('#profile_aliases_btn').click(function (e) { const aliases = $('#profile_aliases').text().trim(); if (aliases && aliases.length !== 0) { $('#profile_aliases').slideToggle(150); } }); /* load the initial 40 events */ $.each(clientInfo.Meta, function (index, meta) { if (meta.key.includes("Event")) { loadMeta(meta); if (count % 40 === 0) { count++; return false; } count++ } }); /* load additional events on scroll */ $(window).scroll(function () { if ($(window).scrollTop() === $(document).height() - $(window).height() || $(document).height() === $(window).height()) { while (count % 40 !== 0 && count < clientInfo.Meta.length) { loadMeta(clientInfo.Meta[count - 1]); count++; } count++; } }); /* load meta thats not an event */ $.each(clientInfo.Meta, function (index, meta) { if (!meta.key.includes("Event")) { let metaString = `
`; $("#profile_meta").append(metaString); } }); }); function penaltyToName(penaltyName) { switch (penaltyName) { case "Flag": return "Flagged" case "Warning": return "Warned"; case "Report": return "Reported"; case "Ban": return "Banned"; case "Kick": return "Kicked"; case "TempBan": return "Temp Banned"; case "Unban": return "Unbanned"; } } function loadMeta(meta) { let eventString = ''; // it's a penalty if (meta.class.includes("Penalty")) { if (meta.value.punisherId !== clientInfo.clientId) { eventString = `