GameFAQs - Private Board invite link on message list

GameFAQs - Private Board invite link on message list descr

当前为 2016-08-08 提交的版本,查看 最新版本

  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.5
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. var board = "848"; //Enter the board number you are admin of here
  11. var left = false; //Set this to true if you display the poster name to the left of the message, set it to false for above message
  12.  
  13. //Do not edit below this line unless you know what you're doing.
  14. if (!left) {
  15. var msg_stats_arr = document.getElementsByClassName('msg_infobox');
  16. } else {
  17. var msg_stats_arr = document.getElementsByClassName('msg_infobox');
  18. }
  19. var user_key = document.forms[1].key.value;
  20. for (var i=0; i<msg_stats_arr.length;i++) {
  21. if(msg_stats_arr[i].getElementsByClassName('msg_deleted').length==0)
  22. {
  23. var username_arr = msg_stats_arr[i].getElementsByClassName('name')[0].childNodes[0];
  24. var username = username_arr.textContent;
  25. var form = document.createElement('form');
  26. form.setAttribute("action","http://www.gamefaqs.com/boardaction/"+board+"-?admin=1");
  27. form.setAttribute("method","post");
  28. form.setAttribute("style","display:none;");
  29. form.setAttribute("name","gm_invite_"+i);
  30. var inputName = document.createElement('input');
  31. inputName.setAttribute("type","hidden");
  32. inputName.setAttribute("name","target_text");
  33. inputName.setAttribute("value",username);
  34. var inputKey = document.createElement('input');
  35. inputKey.setAttribute("type","hidden");
  36. inputKey.setAttribute("name","key");
  37. inputKey.setAttribute("value",user_key);
  38. var action = document.createElement('input');
  39. action.setAttribute("type", "hidden");
  40. action.setAttribute("name", "action");
  41. action.setAttribute("value", "addmember");
  42. var inviteLink = document.createElement('a');
  43. inviteLink.setAttribute("href","#");
  44. inviteLink.setAttribute("onclick","document.forms['gm_invite_"+i+"'].submit();");
  45. inviteLink.textContent = "invite";
  46. if (!left) {
  47. msg_stats_arr[i].appendChild(document.createTextNode(" | "));
  48. msg_stats_arr[i].appendChild(inviteLink);
  49.  
  50. } else {
  51. var leftSpan = document.createElement('span');
  52. leftSpan.setAttribute("class","author_data");
  53. msg_stats_arr[i].appendChild(leftSpan);
  54. leftSpan.appendChild(inviteLink);
  55. }
  56. inviteLink.appendChild(form);
  57. form.appendChild(inputName);
  58. form.appendChild(inputKey);
  59. form.appendChild(action);
  60. }
  61. }