Facepunch Logout Button

The only true and aesthetically pleasing log out button for FP

  1. /*
  2.  
  3. Original Fix Copyright (c) 2010-2014, don't steal or i rephoat yu
  4. Released under the GPL license
  5. http://www.gnu.org/copyleft/gpl.html
  6.  
  7. */
  8. // ==UserScript==
  9. // @name Facepunch Logout Button
  10. // @namespace http://www.facepunch.com/*
  11. // @description The only true and aesthetically pleasing log out button for FP
  12. // @include http://facepunch.com/*
  13. // @include http://www.facepunch.com/*
  14. // @include http://*.facepunch.com/*
  15. // @include http://www.facepunch.com/login.php?do=logout
  16. // @include https://facepunch.com/*
  17. // @include https://www.facepunch.com/*
  18. // @include https://*.facepunch.com/*
  19. // @include https://www.facepunch.com/login.php?do=logout
  20.  
  21. // @version 0.0.1.20180309222324
  22. // ==/UserScript==
  23.  
  24. //logout
  25. if (document.URL.match(/.*facepunch\.com\/login\.php\?do=logout/))
  26. document.location = document.getElementsByClassName("blockrow restore")[0].getElementsByTagName("a")[0].href;
  27.  
  28. var allNav, thread, indicator, ogout;
  29. allNav = document.getElementsByClassName('navbarlink');
  30. nav = allNav[allNav.length - 1];
  31. logoutText = '<a href="http://www.facepunch.com/login.php?do=logout"><img src="http://www.facepunch.com/fp/navbar/register.png" alt="Log Out"> Log Out</a>';
  32. logout = document.createElement("div");
  33. var logout = document.createElement("a");
  34. logout.setAttribute("class","navbarlink floatright");
  35. logout.innerHTML = logoutText;
  36. nav.parentNode.insertBefore(logout, nav.nextSibling);