GT old-style links fix

Change /forums links into regular links

  1. // ==UserScript==
  2. // @name GT old-style links fix
  3. // @namespace http://www.gametoast.com
  4. // @description Change /forums links into regular links
  5. // @include http://www.gametoast.com/*
  6. // @include http://gametoast.com/*
  7. // @grant none
  8. // @version 0.0.1.20140817045428
  9. // ==/UserScript==
  10.  
  11. var links,thisLink;
  12. links = document.evaluate("//a[@href]",
  13. document,
  14. null,
  15. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
  16. null);
  17. for (var i=0;i<links.snapshotLength;i++) {
  18. var thisLink = links.snapshotItem(i);
  19.  
  20. thisLink.href = thisLink.href.replace('http://gametoast.com/forums/',
  21. 'http://gametoast.com/');
  22. thisLink.href = thisLink.href.replace('http://www.gametoast.com/forums/',
  23. 'http://www.gametoast.com/');
  24. }