[HWM]Unfriend

Fast remove from friend list

  1. // ==UserScript==
  2. // @name [HWM]Unfriend
  3. // @namespace [HWM]Unfriend by Alex_2oo8
  4. // @description Fast remove from friend list
  5. // @author Alex_2oo8
  6. // @version 0.1
  7. // @include http://www.heroeswm.ru/pl_info.php*
  8. // @include http://qrator.heroeswm.ru/pl_info.php*
  9. // @include http://178.248.235.15/pl_info.php*
  10. // ==/UserScript==
  11.  
  12. var showArmyObj;
  13.  
  14. var obj_arr = document.getElementsByTagName('object');
  15. 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];
  16. 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];
  17. if (td.getElementsByTagName('a').length == 0 || td.getElementsByTagName('a')[0].href.indexOf('friends.php?action=add') == -1) {
  18. var ifr = document.createElement('iframe');
  19. ifr.name = 'HWM_UNFRIEND_OLOLO_IFRAME';
  20. ifr.id = 'HWM_UNFRIEND_OLOLO_IFRAME';
  21. ifr.style.display = 'none';
  22. document.body.appendChild(ifr);
  23. document.getElementById('HWM_UNFRIEND_OLOLO_IFRAME').onload = function() { location.href = location.href; };
  24. var txt = document.createTextNode('(');
  25. td.insertBefore(txt, td.childNodes[1]);
  26. var a = document.createElement('a');
  27. a.href = '/friends.php?del=' + /\?id\=.*/.exec(location.href)[0].substr(4);
  28. a.innerHTML = '-';
  29. a.target = 'HWM_UNFRIEND_OLOLO_IFRAME';
  30. a.className = 'pi';
  31. td.insertBefore(a, td.childNodes[2]);
  32. var txt = document.createTextNode(') ');
  33. td.insertBefore(txt, td.childNodes[3]);
  34. }