GameFAQs - Private Board invite button on message list

GameFAQs - Private Board invite button on message list descr

  1. // ==UserScript==
  2. // @name GameFAQs - Private Board invite button on message list
  3. // @namespace http://userscripts.org/scripts/source/181911.user.js
  4. // @description GameFAQs - Private Board invite button on message list descr
  5. // @include http://www.gamefaqs.com/boards/*
  6. // @version 1.83
  7. // @grant none
  8. // ==/UserScript==
  9. var boardNumbers = [
  10. "848", "850"
  11. ]; //Board Numbers
  12.  
  13. var inviteTexts = [
  14. "Invite to Hardcore", "Invite to 850"
  15. ]; //Text for invite link
  16.  
  17.  
  18. //Do not edit below this line unless you know what you're doing.
  19. var msg_stats_arr = document.getElementsByClassName('msg_infobox');
  20. var user_key = document.forms[1].key.value;
  21. for (var i = 0; i < msg_stats_arr.length; i++) {
  22. if (msg_stats_arr[i].getElementsByClassName('msg_deleted').length == 0) {
  23. var username_arr = msg_stats_arr[i].getElementsByClassName('name')[0].childNodes[0];
  24. var username = username_arr.textContent;
  25.  
  26. for (var j = 0; j < boardNumbers.length; j++) {
  27. var form = document.createElement('form');
  28. form.setAttribute("action", "http://www.gamefaqs.com/boardaction/" + boardNumbers[j] + "-?admin=1");
  29. form.setAttribute("method", "post");
  30. form.setAttribute("style", "display:none;");
  31. form.setAttribute("name", j + "gm_invite_" + i);
  32.  
  33. var inputName = document.createElement('input');
  34. inputName.setAttribute("type", "hidden");
  35. inputName.setAttribute("name", "target_text");
  36. inputName.setAttribute("value", username);
  37.  
  38. var inputKey = document.createElement('input');
  39. inputKey.setAttribute("type", "hidden");
  40. inputKey.setAttribute("name", "key");
  41. inputKey.setAttribute("value", user_key);
  42.  
  43. var action = document.createElement('input');
  44. action.setAttribute("type", "hidden");
  45. action.setAttribute("name", "action");
  46. action.setAttribute("value", "addmember");
  47.  
  48. var inviteLink = document.createElement('input');
  49. inviteLink.setAttribute("type", "button");
  50. inviteLink.setAttribute("onclick", "document.forms['" + j + "gm_invite_" + i + "'].submit();");
  51. if (j == 0) {
  52. inviteLink.setAttribute("style", "margin-left:10px;");
  53. }
  54. inviteLink.setAttribute("value", inviteTexts[j]);
  55.  
  56.  
  57. msg_stats_arr[i].appendChild(inviteLink);
  58. inviteLink.appendChild(form);
  59. form.appendChild(inputName);
  60. form.appendChild(inputKey);
  61. form.appendChild(action);
  62. }
  63. }
  64. }