GameFAQs - Private Board invite link on message list

GameFAQs - Private Board invite link on message list descr

目前为 2015-05-12 提交的版本。查看 最新版本

  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.3
  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_stats');
  16. } else {
  17. var msg_stats_arr = document.getElementsByClassName('msg_stats_left');
  18. }
  19. var user_key = document.forms[1].key.value;
  20. for (var i=0; i<msg_stats_arr.length;i++) {
  21. var username_arr = msg_stats_arr[i].getElementsByClassName('name')[0].childNodes[0];
  22. var username = username_arr.textContent;
  23. var form = document.createElement('form');
  24. form.setAttribute("action","http://www.gamefaqs.com/boardaction/"+board+"-?admin=1");
  25. form.setAttribute("method","post");
  26. form.setAttribute("style","display:none;");
  27. form.setAttribute("name","gm_invite_"+i);
  28. var inputName = document.createElement('input');
  29. inputName.setAttribute("type","hidden");
  30. inputName.setAttribute("name","target_text");
  31. inputName.setAttribute("value",username);
  32. var inputKey = document.createElement('input');
  33. inputKey.setAttribute("type","hidden");
  34. inputKey.setAttribute("name","key");
  35. inputKey.setAttribute("value",user_key);
  36. var action = document.createElement('input');
  37. action.setAttribute("type", "hidden");
  38. action.setAttribute("name", "action");
  39. action.setAttribute("value", "addmember");
  40. var inviteLink = document.createElement('a');
  41. inviteLink.setAttribute("href","#");
  42. inviteLink.setAttribute("onclick","document.forms['gm_invite_"+i+"'].submit();");
  43. inviteLink.textContent = "invite";
  44. if (!left) {
  45. msg_stats_arr[i].appendChild(document.createTextNode(" | "));
  46. msg_stats_arr[i].appendChild(inviteLink);
  47.  
  48. } else {
  49. var leftSpan = document.createElement('span');
  50. leftSpan.setAttribute("class","author_data");
  51. msg_stats_arr[i].appendChild(leftSpan);
  52. leftSpan.appendChild(inviteLink);
  53. }
  54. inviteLink.appendChild(form);
  55. form.appendChild(inputName);
  56. form.appendChild(inputKey);
  57. form.appendChild(action);
  58. }