[HWM]Unfriend

Fast remove from friend list

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name           [HWM]Unfriend
// @namespace      [HWM]Unfriend by Alex_2oo8
// @description    Fast remove from friend list
// @author         Alex_2oo8
// @version        0.1
// @include        http://www.heroeswm.ru/pl_info.php*
// @include        http://qrator.heroeswm.ru/pl_info.php*
// @include        http://178.248.235.15/pl_info.php*
// ==/UserScript==

	var showArmyObj;

	var obj_arr = document.getElementsByTagName('object');
	for (var i = 0; i < obj_arr.length; i++) if (obj_arr[i].getElementsByTagName('param')[0].name == 'movie' && obj_arr[i].getElementsByTagName('param')[0].value.indexOf('showarmy.swf') != -1) showArmyObj = obj_arr[i];
        
	var td = showArmyObj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].getElementsByTagName('table')[0].getElementsByTagName('tbody')[0].getElementsByTagName('tr')[0].getElementsByTagName('td')[0];
	
	if (td.getElementsByTagName('a').length == 0 || td.getElementsByTagName('a')[0].href.indexOf('friends.php?action=add') == -1) {
        var ifr = document.createElement('iframe');
        ifr.name = 'HWM_UNFRIEND_OLOLO_IFRAME';
        ifr.id = 'HWM_UNFRIEND_OLOLO_IFRAME';
        ifr.style.display = 'none';
        document.body.appendChild(ifr);
        
        document.getElementById('HWM_UNFRIEND_OLOLO_IFRAME').onload = function() { location.href = location.href; };
        
        var txt = document.createTextNode('(');
        td.insertBefore(txt, td.childNodes[1]);
        
        var a = document.createElement('a');
        a.href = '/friends.php?del=' + /\?id\=.*/.exec(location.href)[0].substr(4);
        a.innerHTML = '-';
        a.target = 'HWM_UNFRIEND_OLOLO_IFRAME';
        a.className = 'pi';
        td.insertBefore(a, td.childNodes[2]);
        
        var txt = document.createTextNode(') ');
        td.insertBefore(txt, td.childNodes[3]);
    }