GameFAQs - Private Board invite link on message list

GameFAQs - Private Board invite link on message list descr

目前为 2016-08-09 提交的版本。查看 最新版本

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