GameFAQs - Private Board invite link on message list

GameFAQs - Private Board invite link on message list descr

Verze ze dne 12. 05. 2015. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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.3
// @grant       none
// ==/UserScript==

var board = "848"; //Enter the board number you are admin of here
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

//Do not edit below this line unless you know what you're doing.
if (!left) {
	var msg_stats_arr = document.getElementsByClassName('msg_stats');
} else {
	var msg_stats_arr = document.getElementsByClassName('msg_stats_left');
}
var user_key = document.forms[1].key.value;
for (var i=0; i<msg_stats_arr.length;i++) {
	var username_arr = msg_stats_arr[i].getElementsByClassName('name')[0].childNodes[0];
	var username = username_arr.textContent;
	
	var form = document.createElement('form');
  form.setAttribute("action","http://www.gamefaqs.com/boardaction/"+board+"-?admin=1");
	form.setAttribute("method","post");
	form.setAttribute("style","display:none;");
	form.setAttribute("name","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['gm_invite_"+i+"'].submit();");
	inviteLink.textContent = "invite";
	
	if (!left) {
		msg_stats_arr[i].appendChild(document.createTextNode(" | "));
		msg_stats_arr[i].appendChild(inviteLink);

	} else {
		var leftSpan = document.createElement('span');
		leftSpan.setAttribute("class","author_data");
		msg_stats_arr[i].appendChild(leftSpan);
		leftSpan.appendChild(inviteLink);
	}
		inviteLink.appendChild(form);
		form.appendChild(inputName);
		form.appendChild(inputKey);
		form.appendChild(action);
	}