Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. // ==UserScript==
  2. // @name LeaderboardRank
  3. // @namespace robloxext
  4. // @description Finds your rank on a leaderboard
  5. // @include https://www.roblox.com/games/*
  6. // @include http://www.roblox.com/games/*
  7. // @include https://web.roblox.com/games/*
  8. // @include http://web.roblox.com/games/*
  9. // @version 1
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13.  
  14. var placeID = window.location.pathname.split("/")[2];
  15. var button = 'btn-full-width btn-control-xs rbx-game-server-join';
  16. var domain = "https://www.roblox.com";
  17. var used = 0;
  18. var endit = 0;
  19. if(window.location.toString().indexOf("web.roblox.com") > -1){
  20. domain = "https://web.roblox.com";
  21. }
  22. var pagesize = 50;
  23. // 0 today, 1 week, 2 month, 3 all
  24. var tt = ["Today", "Last week", "Last month", "All time"];
  25. function getRank(username, pos, points, d, cb)
  26. {
  27. if(endit == 1){
  28. return false; }
  29. if(pos >= 1000 && d.c == false){
  30. if(confirm("You're going past rank 1,000, do you want to continue?")){
  31. d.c = true;
  32. } else {
  33. cb(false);
  34. return;
  35. }
  36. }
  37. $.ajax({
  38. 'url' : domain+'/leaderboards/game/json',
  39. 'type' : 'GET',
  40. 'data' : {
  41. targetType: 0,
  42. distributorTargetId: 113491250,
  43. timeFilter: d.t,
  44. startIndex: pos,
  45. currentRank: pos+1,
  46. previousPoints: -1,
  47. max: pagesize,
  48. imgWidth: 48,
  49. imgHeight: 48,
  50. imgFormat:"PNG"
  51. },
  52. 'success' : function(data) {
  53.  
  54. if(data.length == 0){
  55. cb(false);
  56. return;
  57. }
  58.  
  59. var poi = -1;
  60. for(var i in data){
  61. if(data[i].Name.toLowerCase() == username){
  62. d.myrank = data[i].Rank;
  63. d.poi = data[i].Points;
  64. cb(d);
  65. return;
  66. } else {
  67. poi = data[i].Points;
  68. }
  69. }
  70.  
  71. setTimeout(function(){ getRank(username, pos + pagesize, poi, d, cb); }, 100);
  72.  
  73. }
  74. });
  75. }
  76.  
  77. $(".game-stat-footer").after("<h2>PR Clan Management Tool</h2><input placeholder=\"Username\" id=\"lb-pos-in\" /> <button id=\"buttonGetLeaderboard\" class=\""+button+" buttonLB\" style=\"width: 25%;\;background-color: #840000;color: white;font-size:18px\">Find Score</button> <select id=\"timetypes\">"
  78. +"<option value=\"0\">Today</option>"
  79. +"<option value=\"1\">Week</option>"
  80. +"<option value=\"2\">Month</option>"
  81. +"<option value=\"3\">All time</option></select>"
  82. +"<br /><font color=red>Made by iOwn_You FOR PostmanSam</font><hr/><br />");
  83. $(function(){
  84. $(".buttonLB").click(function(){
  85. if(used == 1) {
  86. endit = 1;c
  87. used = 0;
  88. $(".buttonLB").html("Find Score");
  89. return false;
  90. }
  91. used = 1;
  92. endit = 0;
  93. // $(".buttonLB").attr("enabled", "disabled");
  94. $(".buttonLB").html("Cancel Search");
  95. var user = $("#lb-pos-in").val();
  96. var tim = $("#timetypes").val();
  97. getRank(user.toLowerCase(), 0, -1, {myrank: false, c: false, t: tim}, function(data){
  98. $(".buttonLB").removeAttr("disabled");
  99. $(".buttonLB").html("Find Score");
  100. if(data == false){
  101. alert("Failed to fetch score");
  102. used = 0;
  103. } else {
  104. alert("The rank for "+user+" is "+ data.myrank+" for "+tt[tim] +" points: "+Math.floor(data.poi/1000)+"k");
  105. used = 0;
  106. }
  107. });
  108. });
  109. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement