osu! Alternative Add Friend Button

osu! Alternative Add Friend Button. ts8zs' request

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           osu! Alternative Add Friend Button
// @description    osu! Alternative Add Friend Button. ts8zs' request
// @author         JebwizOscar
// @icon           http://osu.ppy.sh/favicon.ico
// @include        http://osu.ppy.sh/u/*
// @include        https://osu.ppy.sh/u/*
// @grant          GM_setValue
// @grant          GM_getValue
// @version        1.0.0.3
// @namespace https://greasyfork.org/users/3079
// ==/UserScript==
function AddFriend(){
	$.post('//osu.ppy.sh/forum/ucp.php?i=zebra&mode=friends',
		{localUserCheck:localUserCheck,add:$('.profile-username').text().replace(/\n/g,''),submit:'Submit'},
		function(data){
			j = data;
			sid = j.match(/name="sid" value="([0-9a-f]*)"/)[1];
			add = j.match(/name="add" value="(.*?)"/)[1];
			uid = j.match(/name="user_id" value="([0-9]*)"/)[1];
			cky = j.match(/friends&&confirm_key=(.*?)"/)[1];
			$.post('//osu.ppy.sh/forum/ucp.php?i=zebra&mode=friends&&confirm_key='+cky,{
					confirm:'Yes',
					localUserCheck:localUserCheck,
					sid:sid,
					mode:'friends',
					sess:sid,
					add:add,
					user_id:uid,
					submit:1
				},function(data){
					location.reload();
				}
			);
		}
	);
}
script = document.createElement("script"), 
script.innerHTML = AddFriend;
document.body.appendChild(script);

$( document ).ready( function(){
	$($('a>i.icon-plus-sign').parent()).attr('href','#').attr('onclick','AddFriend()');
});