UD Profile Expander

(Urban Dead) Shows users' profile information in-game

  1. // ==UserScript==
  2. // @match http://urbandead.com/map.cgi*
  3. // @match http://www.urbandead.com/map.cgi*
  4. // @include http://*urbandead.com/map.cgi*
  5. // @exclude http://*urbandead.com/map.cgi?log*
  6. // @name UD Profile Expander
  7. // @namespace http://userscripts.org/users/72447
  8. // @description (Urban Dead) Shows users' profile information in-game
  9. // @version 0.0.1.20200401144736
  10. // ==/UserScript==
  11.  
  12. var trackSkills = [
  13. 'Free Running',
  14. 'Body Building',
  15. 'Lab Experience',
  16. 'Ransack',
  17. 'Scent Trail',
  18. 'Brain Rot'
  19. ];
  20.  
  21. /******************************************************************************/
  22. function addJQ()
  23. {
  24. var script = document.createElement("script");
  25. script.type = "text/javascript";
  26. script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
  27. script.addEventListener('load', function()
  28. {
  29. var script = document.createElement("script");
  30. script.type = "text/javascript";
  31. script.textContent = "(" + main + ")(jQuery);";
  32. document.body.appendChild(script);
  33. },
  34. false);
  35. document.body.appendChild(script);
  36. }
  37.  
  38. function main($)
  39. {
  40. $('#UDProfileSniff').remove();
  41. gt = $('div.gt')[1];
  42. var glob_rgx = /<a[^>]+?href="profile\.cgi\?id=\d+"[^>]*?>(?!<b>).+?<\/a>/ig;
  43. var rgx = /<a[^>]+?href="profile\.cgi\?id=(\d+)"[^>]*?>(?!<b>)(.+?)<\/a>/i;
  44. var matches = gt.innerHTML.match(glob_rgx);
  45. var profilesTbl = '<table style="clear:both;"><tr><td id="udptbl"></td></tr></table>';
  46. gt.innerHTML = gt.innerHTML.replace(/Also here.*?\.<br><br>/, '');
  47. gt.innerHTML += profilesTbl;
  48.  
  49. for(a = 0; a < matches.length; a++)
  50. {
  51. var submatches = rgx.exec(matches[a]);
  52. var udp = $('#udptbl')[0];
  53. udp.innerHTML += '<div style="float:left;margin:8px;padding:8px;">'
  54. + matches[a] + '<br /><span style="font-size:8pt" id="udptbl_'
  55. + submatches[1] + '"></span></div>';
  56. $.ajax({
  57. async: true,
  58. url: 'http://'
  59. + (window.location.hostname.match(/^w/i) ? 'www.' : '')
  60. + 'urbandead.com/profile.cgi?id=' + submatches[1],
  61. dataType: 'html',
  62. success: function(txt, stat)
  63. {
  64. var vals = txt.match(/<td[^>]+?class="slam">.+?<\/td>/ig);
  65. var id = /href="contacts\.cgi\?add=(\d+)"/i.exec(txt)[1];
  66. var pd = new Array();
  67. for(b = 0; b < vals.length; b++)
  68. pd[b] = /<td[^>]+?class="slam">(.+?)<\/td>/i
  69. .exec(vals[b])[1];
  70. var skills = /<td rowspan=10 class="slam">(?:.|\n)*?<\/td>/im
  71. .exec(txt)[0];
  72. var span = $('#udptbl_' + id)[0];
  73. span.innerHTML += '<b>' + pd[3] + '</b><br />';
  74. span.innerHTML += 'Level: ' + pd[1] + ', XP: ' + pd[2]
  75. + '<br />';
  76. for(b = 0; b < trackSkills.length; b++)
  77. if(skills.indexOf('>' + trackSkills[b] + '<') >= 0)
  78. span.innerHTML += trackSkills[b] + '<br />';
  79. }
  80. });
  81. }
  82. }
  83.  
  84. document.body.innerHTML = document.body.innerHTML.replace(
  85. /(<div class="gt">)You are (?!<)/,
  86. '$1<a style="cursor:pointer;font-size:8pt;" id="UDProfileSniff">Expand Profiles<br /></a>You are '
  87. );
  88.  
  89. var sniff = document.getElementById('UDProfileSniff');
  90.  
  91. if (sniff !== null)
  92. sniff.addEventListener('click', addJQ, false);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址