Delete Friend Link *OLD*

Adds a "delete friend" link on their profiles

  1. // ==UserScript==
  2. // @name Delete Friend Link *OLD*
  3. // @namespace ventero.de
  4. // @description Adds a "delete friend" link on their profiles
  5. // @include http://www.kongregate.com/accounts/*
  6. // @author Ventero
  7. // @version 1.0
  8. // @date 03/21/2010
  9. // @License Public domain
  10. // ==/UserScript==
  11.  
  12. // Written by Ventero (http://www.kongregate.com/accounts/Ventero) 06/22/10
  13. // Licensed under MIT/X11 license
  14. // Copyright (c) 2010 Ventero
  15. // Full text of license here:
  16. // http://www.opensource.org/licenses/mit-license.php
  17.  
  18. if(document.getElementById('add_as_friend')){
  19. var k = document.getElementById('add_as_friend').firstChild;
  20.  
  21. if (k.innerHTML.match(/is a friend/)){
  22. var z = document.getElementById('relationship_links'),
  23. l = document.createElement('li'),
  24. a = document.createElement('a');
  25. a.setAttribute('onclick', "if (confirm('Really remove this friend?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'delete'); f.appendChild(m);f.submit(); };return false;");
  26. a.setAttribute('href', k.href+"/"+location.pathname.split("/")[2]);
  27. a.innerHTML = 'delete friend';
  28. l.appendChild(a)
  29. z.appendChild(l);
  30. }
  31. }