SiPlus

GModLastPlayer.htm

Jan 13th, 2012
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  5. <title>Last player joined</title>
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. function GetLastPlayer()
  9. {
  10. var xhr = new XMLHttpRequest();
  11. xhr.open('GET','GModLastPlayer.php?mode=player',false);
  12. xhr.send(null);
  13. document.getElementById('steamName').innerHTML = 'Loading...';
  14. document.getElementById('steamName').removeAttribute('href');
  15. document.getElementById('steamRating').innerHTML = '';
  16. document.getElementById('steamPlaytime').innerHTML = '';
  17. document.getElementById('steamAvatar').src = 'http://media.steampowered.com/steamcommunity/public/images/avatars/fe/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb.jpg';
  18. if (xhr.status==200)
  19. {
  20. var elem = xhr.responseXML.getElementsByTagName('profile')[0];
  21. document.getElementById('steamName').innerHTML = elem.getElementsByTagName('steamID')[0].firstChild.nodeValue;
  22. document.getElementById('steamName').setAttribute('href','http://steamcommunity.com/profiles/'+elem.getElementsByTagName('steamID64')[0].firstChild.nodeValue);
  23. var avatar = document.getElementById('steamAvatar');
  24. avatar.src = elem.getElementsByTagName('avatarIcon')[0].firstChild.nodeValue;
  25. switch (elem.getElementsByTagName('onlineState')[0].firstChild.nodeValue)
  26. {
  27. case 'online':
  28. avatar.style.borderColor = '#09c';
  29. break;
  30. case 'in-game':
  31. avatar.style.borderColor = '#0c0';
  32. break;
  33. default:
  34. avatar.style.borderColor = '#999';
  35. break;
  36. }
  37. if (elem.getElementsByTagName('privacyState')[0].firstChild.nodeValue == 'public')
  38. {
  39. document.getElementById('steamRating').innerHTML = elem.getElementsByTagName('steamRating')[0].firstChild.nodeValue;
  40. var xhr2 = new XMLHttpRequest();
  41. xhr2.open('GET','GModLastPlayer.php?mode=games',false);
  42. xhr2.send(null);
  43. if (xhr2.status==200)
  44. {
  45. var games = xhr2.responseXML.getElementsByTagName('gamesList')[0].getElementsByTagName('games')[0].getElementsByTagName('game');
  46. document.getElementById('steamPlaytime').innerHTML = 'Couldn\'t get playtime (pirated?)';
  47. for (var i=0;i<games.length;i++)
  48. {
  49. if (games[i].getElementsByTagName('appID')[0].firstChild.nodeValue == '4000')
  50. {
  51. document.getElementById('steamPlaytime').innerHTML = games[i].getElementsByTagName('hoursOnRecord')[0].firstChild.nodeValue + ' hours';
  52. break;
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. //]]>
  60. </script>
  61. </head>
  62. <body>
  63. <table>
  64. <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>
  65. <td style="font-weight:bold;width:100%">Last player joined:</td></tr>
  66. <tr><td><a id="steamName">Press Load/reload</a></td></tr>
  67. <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>
  68. </table>
  69. </body>
  70. </html>
Advertisement
Add Comment
Please, Sign In to add comment