Understalker's Custom Add to Group (Echo)

Adds people to groups

  1. // ==UserScript==
  2. // @name Understalker's Custom Add to Group (Echo)
  3. // @namespace Snorlax
  4. // @description Adds people to groups
  5. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
  6. // @include *hackforums.net/member.php?action=profile&uid=*
  7. // @version 1.2
  8. // ==/UserScript==
  9.  
  10. var uid = $(location).attr('href').replace(/[^0-9]/g, '')
  11. var name = $("span[class*='group']").text();
  12.  
  13. if($("img[src*='echo2']").length >= 1) {
  14. $("span[class*='group']").after(' - <button class="remove button">Remove</button>');
  15. } else {
  16. $("span[class*='group']").after(' - <button class="add button">Add</button>');
  17. }
  18.  
  19. $(".add").click(function(){
  20. $.post("http://www.hackforums.net/managegroup.php",
  21. {
  22. "my_post_key": my_post_key,
  23. "action": "do_add",
  24. "gid": "21",
  25. "username": name
  26. },
  27. function(data,status){
  28. console.log("Data: " + data + "\nStatus: " + status);
  29. location.reload();
  30. });
  31. });
  32.  
  33. $(".remove").click(function(){
  34. $.post("http://www.hackforums.net/managegroup.php",
  35. {
  36. "my_post_key": my_post_key,
  37. "action": "do_manageusers",
  38. "gid": "21",
  39. "removeuser[0]": uid
  40. },
  41. function(data,status){
  42. console.log("Data: " + data + "\nStatus: " + status);
  43. location.reload();
  44. });
  45. });