Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Better QG
  3. // @version 2.12
  4. // @description dfsa
  5. // @author nie znam typa
  6. // @match *.margonem.pl/
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. var qgStorage = localStorage;
  11. if (qgStorage.getItem('adiQGacceptGrp') == null) qgStorage.setItem('adiQGacceptGrp', 'false');
  12.  
  13. g.loadQueue.push({
  14. fun: function () {
  15. $('<div id="adiQGcheckbox">Automatyczne przyjmowanie zaproszeń do grupy</div>').appendTo('#cfg_options').click(function () {
  16. if ($('#adiQGcheckbox').attr('style') == 'background-position: 0px -22px') {
  17. $('#adiQGcheckbox').attr('style', 'background-position: 0px 0px');
  18. qgStorage.setItem('adiQGacceptGrp', 'false')
  19. } else {
  20. $('#adiQGcheckbox').attr('style', 'background-position: 0px -22px');
  21. qgStorage.setItem('adiQGacceptGrp', 'true')
  22. }
  23. });
  24. if (qgStorage.getItem('adiQGacceptGrp') == 'true') $('#adiQGcheckbox').attr('style', 'background-position: 0px -22px');
  25. else $('#adiQGcheckbox').attr('style', 'background-position: 0px 0px');
  26. },
  27. data: ''
  28. });
  29.  
  30. ! function (oldAlert) {
  31. mAlert = function (e, a, o, t) {
  32. if (typeof (e) == "string") {
  33. if (-1 != e.search(/Ten gracz należy|Ten gracz aktualnie|Ten gracz nie życzy sobie drużyn|Wysłano zaproszenie teleportacji|Ta postać jest teraz w trakcie/)) {
  34. message(e)
  35. } else if (-1 != e.search(/Czy chcesz dołączyć do drużyny/) && qgStorage.getItem('adiQGacceptGrp') == 'true') {
  36. message(e)
  37. } else oldAlert(e, a, o, t)
  38. } else oldAlert(e, a, o, t)
  39. }
  40. }(mAlert);
  41.  
  42. ! function (oldAjax) {
  43. $.ajax = function (o) {
  44. if (o.url.indexOf("engine") > -1 && qgStorage.getItem("adiQGacceptGrp") == "true") {
  45. var oldsucc = o.success;
  46. o.success = function (res) {
  47. var msh = oldsucc.apply(this, arguments);
  48. if (res.ask !== undefined) {
  49. if (res.ask.q.indexOf("Czy chcesz dołączyć do drużyny") > -1) {
  50. _g("party&a=accept&answer=1");
  51. }
  52. }
  53. return msh;
  54. };
  55. }
  56. return oldAjax.apply(this, arguments);
  57. };
  58. }($.ajax);
  59.  
  60. document.addEventListener("keyup", async function (e) {
  61. if (e.target.tagName != "INPUT" && e.target.tagName != "TEXTAREA" && e.which == 82 && !g.battle) {
  62. if (!g.engineStopped) {
  63. await inviteToParty();
  64. }
  65. };
  66. });
  67.  
  68. async function inviteToParty() {
  69. await fetch(`/engine?t=friends&a=show&ev=${g.ev + 0.01}&browser_token=${g.browser_token}&aid=${g.aid}`).then(body => body.json()).then(jsonFriends => {
  70. g.ev = jsonFriends.ev;
  71. const friends = [];
  72. for (let i = 0; i < jsonFriends.friends.length; i += 10) {
  73. if (jsonFriends.friends[i + 8] !== 'online' || jsonFriends.friends[i + 5] !== map.name) {
  74. continue;
  75. }
  76.  
  77. friends.push(jsonFriends.friends[i]);
  78. }
  79. friends.forEach(friendId => friendInviteParty(friendId));
  80. });
  81.  
  82. await fetch(`/engine?t=clan&a=members&ev=${g.ev + 0.01}&browser_token=${g.browser_token}&aid=${g.aid}`).then(body => body.json()).then(clan => {
  83. g.ev = clan.ev;
  84. const onlineMembers = [];
  85. for (let i = 0; i < clan.members.length; i += 9) {
  86. if (clan.members[i + 8] !== 'online' || clan.members[i + 4] !== map.name) {
  87. continue;
  88. }
  89.  
  90. onlineMembers.push(clan.members[i]);
  91. }
  92. onlineMembers.forEach(memberId => friendInviteParty(memberId));
  93. });
  94. }// ==UserScript==
  95. // @name New Userscript
  96. // @namespace http://tampermonkey.net/
  97. // @version 0.1
  98. // @description try to take over the world!
  99. // @author You
  100. // @match http://*/*
  101. // @grant none
  102. // ==/UserScript==
  103.  
  104. (function() {
  105. 'use strict';
  106.  
  107. // Your code here...
  108. })();// ==UserScript==
  109. // @name New Userscript
  110. // @namespace http://tampermonkey.net/
  111. // @version 0.1
  112. // @description try to take over the world!
  113. // @author You
  114. // @match http://*/*
  115. // @grant none
  116. // ==/UserScript==
  117.  
  118. (function() {
  119. 'use strict';
  120.  
  121. // Your code here...
  122. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement