osu! Alternative Add Friend Button

osu! Alternative Add Friend Button. ts8zs' request

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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()');
});