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.7
  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.  
  20. //Do not edit below this line unless you know what you're doing.
  21. var msg_stats_arr = document.getElementsByClassName('msg_infobox');
  22. var user_key = document.forms[1].key.value;
  23. for (var i = 0; i < msg_stats_arr.length; i++) {
  24. if (msg_stats_arr[i].getElementsByClassName('msg_deleted').length == 0) {
  25. var username_arr = msg_stats_arr[i].getElementsByClassName('name')[0].childNodes[0];
  26. var username = username_arr.textContent;
  27.  
  28. for (var j = 0; j < boardNumbers.length; j++) {
  29. var form = document.createElement('form');
  30. form.setAttribute("action", "http://www.gamefaqs.com/boardaction/" + boardNumbers[j] + "-?admin=1");
  31. form.setAttribute("method", "post");
  32. form.setAttribute("style", "display:none;");
  33. form.setAttribute("name", j + "gm_invite_" + i);
  34.  
  35. var inputName = document.createElement('input');
  36. inputName.setAttribute("type", "hidden");
  37. inputName.setAttribute("name", "target_text");
  38. inputName.setAttribute("value", username);
  39.  
  40. var inputKey = document.createElement('input');
  41. inputKey.setAttribute("type", "hidden");
  42. inputKey.setAttribute("name", "key");
  43. inputKey.setAttribute("value", user_key);
  44.  
  45. var action = document.createElement('input');
  46. action.setAttribute("type", "hidden");
  47. action.setAttribute("name", "action");
  48. action.setAttribute("value", "addmember");
  49.  
  50. var inviteLink = document.createElement('a');
  51. inviteLink.setAttribute("href", "#");
  52. inviteLink.setAttribute("onclick", "document.forms['" + j + "gm_invite_" + i + "'].submit();");
  53. inviteLink.textContent = inviteTexts[j];
  54.  
  55. var newLi = document.createElement('li');
  56. var user_subnav = document.getElementsByClassName('msg_detail_menu')[i].getElementsByClassName('user_subnav');
  57.  
  58.  
  59. user_subnav[i].appendChild(newLi);
  60. newLi.appendChild(inviteLink);
  61. inviteLink.appendChild(form);
  62. form.appendChild(inputName);
  63. form.appendChild(inputKey);
  64. form.appendChild(action);
  65. }
  66. }
  67. }
  68.