Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
- <title>Last player joined</title>
- <script type="text/javascript">
- //<![CDATA[
- function GetLastPlayer()
- {
- var xhr = new XMLHttpRequest();
- xhr.open('GET','GModLastPlayer.php?mode=player',false);
- xhr.send(null);
- document.getElementById('steamName').innerHTML = 'Loading...';
- document.getElementById('steamName').removeAttribute('href');
- document.getElementById('steamRating').innerHTML = '';
- document.getElementById('steamPlaytime').innerHTML = '';
- document.getElementById('steamAvatar').src = 'http://media.steampowered.com/steamcommunity/public/images/avatars/fe/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb.jpg';
- if (xhr.status==200)
- {
- var elem = xhr.responseXML.getElementsByTagName('profile')[0];
- document.getElementById('steamName').innerHTML = elem.getElementsByTagName('steamID')[0].firstChild.nodeValue;
- document.getElementById('steamName').setAttribute('href','http://steamcommunity.com/profiles/'+elem.getElementsByTagName('steamID64')[0].firstChild.nodeValue);
- var avatar = document.getElementById('steamAvatar');
- avatar.src = elem.getElementsByTagName('avatarIcon')[0].firstChild.nodeValue;
- switch (elem.getElementsByTagName('onlineState')[0].firstChild.nodeValue)
- {
- case 'online':
- avatar.style.borderColor = '#09c';
- break;
- case 'in-game':
- avatar.style.borderColor = '#0c0';
- break;
- default:
- avatar.style.borderColor = '#999';
- break;
- }
- if (elem.getElementsByTagName('privacyState')[0].firstChild.nodeValue == 'public')
- {
- document.getElementById('steamRating').innerHTML = elem.getElementsByTagName('steamRating')[0].firstChild.nodeValue;
- var xhr2 = new XMLHttpRequest();
- xhr2.open('GET','GModLastPlayer.php?mode=games',false);
- xhr2.send(null);
- if (xhr2.status==200)
- {
- var games = xhr2.responseXML.getElementsByTagName('gamesList')[0].getElementsByTagName('games')[0].getElementsByTagName('game');
- document.getElementById('steamPlaytime').innerHTML = 'Couldn\'t get playtime (pirated?)';
- for (var i=0;i<games.length;i++)
- {
- if (games[i].getElementsByTagName('appID')[0].firstChild.nodeValue == '4000')
- {
- document.getElementById('steamPlaytime').innerHTML = games[i].getElementsByTagName('hoursOnRecord')[0].firstChild.nodeValue + ' hours';
- break;
- }
- }
- }
- }
- }
- }
- //]]>
- </script>
- </head>
- <body>
- <table>
- <tr><td rowspan="2"><img src="http://media.steampowered.com/steamcommunity/public/images/avatars/fe/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb.jpg" alt="Avatar" id="steamAvatar" style="border:4px solid #999" /></td>
- <td style="font-weight:bold;width:100%">Last player joined:</td></tr>
- <tr><td><a id="steamName">Press Load/reload</a></td></tr>
- <tr><td colspan="2"><b>Steam Rating:</b> <span id="steamRating"></span><br /><b>GMod Playtime:</b> <span id="steamPlaytime"></span><br /><a href="javascript:GetLastPlayer()">Load/reload</a></td></tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment