GameFAQs - Private Board invite link on message list

GameFAQs - Private Board invite link on message list descr

As of 09.08.2016. See апошняя версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        GameFAQs - Private Board invite link on message list
// @namespace   http://userscripts.org/scripts/source/181911.user.js
// @description GameFAQs - Private Board invite link on message list descr
// @include     http://www.gamefaqs.com/boards/*
// @version     1.6
// @grant       none
// ==/UserScript==

var boardNumbers = [
    "848",
    "850"]; //Board Numbers

var inviteTexts = [
    "Invite1",
    "Invite2"
]; //Text for invite link


//Do not edit below this line unless you know what you're doing.
var msg_stats_arr = document.getElementsByClassName('msg_infobox');
var user_key = document.forms[1].key.value;
for (var i = 0; i < msg_stats_arr.length; i++) {
    if (msg_stats_arr[i].getElementsByClassName('msg_deleted').length == 0) {
        var username_arr = msg_stats_arr[i].getElementsByClassName('name')[0].childNodes[0];
        var username = username_arr.textContent;

        for (var j = 0; j < boardNumbers.length; j++) {
            var form = document.createElement('form');
            form.setAttribute("action", "http://www.gamefaqs.com/boardaction/" + boardNumbers[j] + "-?admin=1");
            form.setAttribute("method", "post");
            form.setAttribute("style", "display:none;");
            form.setAttribute("name", j + "gm_invite_" + i);

            var inputName = document.createElement('input');
            inputName.setAttribute("type", "hidden");
            inputName.setAttribute("name", "target_text");
            inputName.setAttribute("value", username);

            var inputKey = document.createElement('input');
            inputKey.setAttribute("type", "hidden");
            inputKey.setAttribute("name", "key");
            inputKey.setAttribute("value", user_key);

            var action = document.createElement('input');
            action.setAttribute("type", "hidden");
            action.setAttribute("name", "action");
            action.setAttribute("value", "addmember");

            var inviteLink = document.createElement('a');
            inviteLink.setAttribute("href", "#");
            inviteLink.setAttribute("onclick", "document.forms['" + j + "gm_invite_" + i + "'].submit();");
            inviteLink.textContent = inviteTexts[j];

            var newLi = document.createElement('li');
            var user_subnav = document.getElementsByClassName('user_subnav');


            user_subnav[i].appendChild(newLi);
            newLi.appendChild(inviteLink);
            inviteLink.appendChild(form);
            form.appendChild(inputName);
            form.appendChild(inputKey);
            form.appendChild(action);
        }
    }
}