forked from ge-ku/Ban-Checker-for-Steam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkbans.min.js
1 lines (1 loc) · 1.78 KB
/
checkbans.min.js
1
!function(){function e(e,r){return r>=e.length?"0":e.charAt(e.length-r-1)}function r(e,r){for(var n=e,t=0;r>t;t++)n="0"+n;return n}function n(n,t){for(var a=Math.max(n.length,t.length),o="",s=0,i=0,c=0;a>c;c++){var l=Number(e(n,c)),u=Number(e(t,c)),f=l+u+s;for(s=0;f>=10;)f-=10,s++;0===f?i++:(o=String(f)+r(o,i),i=0)}return s>0&&(o=String(s)+o),o}function t(e){var r="76561197960265728",t=e.attributes.getNamedItem("data-miniprofile").value;return n(r,t)}function a(e){var r=c[e.SteamId];r.forEach(function(r){var n=r.querySelector(".linkFriend_in-game"),t=document.createElement("span");if(t.style.fontWeight="bold",t.style.display="block",n&&(n.innerHTML=n.innerHTML.replace(/<br ?\/?>/," - ")),e.NumberOfVACBans||e.NumberOfGameBans){var a="";e.NumberOfGameBans&&(a+=e.NumberOfGameBans+" OW bans"),e.NumberOfVACBans&&(a+=(""===a?"":", ")+e.NumberOfVACBans+" VAC bans"),a+=" "+e.DaysSinceLastBan+" days ago.",t.style.color="rgb(255, 73, 73)",t.innerHTML=a}else t.style.color="rgb(43, 203, 64)",t.innerHTML="No Bans for this player.";r.querySelector(".friendSmallText").appendChild(t)})}function o(e){if(e.readyState===XMLHttpRequest.DONE&&200===e.status){var r=JSON.parse(e.responseText);r.players.forEach(a)}}function s(e,r){var n=new XMLHttpRequest,t="https://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key="+r+"&steamids=",a=t+e.join(",");n.onreadystatechange=function(){o(n)},n.open("GET",a,!0),n.send()}var i=[].slice.call(document.querySelectorAll("#memberList .member_block, .friendHolder, .friendBlock")),c={};i.forEach(function(e){var r=t(e);c[r]||(c[r]=[]),c[r].push(e)});var l="5DA40A4A4699DEE30C1C9A7BCE84C914";chrome.storage.sync.get("customapikey",function(e){if("undefined"==typeof e.customapikey)var r=l;else var r=e.customapikey;for(var n=Object.keys(c);n.length>0;){var t=n.splice(0,100);s(t,r)}})}();