Slickdeals Clean URL

Removes tracking urls and replaces with original, canonical link

  1. // ==UserScript==
  2. // @name Slickdeals Clean URL
  3. // @author h.zhuang
  4. // @contributor Stephen Schrauger
  5. // @version 2015.05.28
  6. // @description Removes tracking urls and replaces with original, canonical link
  7. // @lastchanges added https support
  8. // @namespace com.schrauger.fork.slickdeals-clean-url
  9. // @homepage https://github.com/schrauger/slickdeals-clean-url
  10. // @include http://slickdeals.net/*
  11. // @include https://slickdeals.net/*
  12. // @include http://www.fatwallet.com/*
  13. // @include https://www.fatwallet.com/*
  14. // ==/UserScript==
  15.  
  16. var thisLink, allLinks,linkArray;
  17. allLinks = document.getElementsByTagName('a');
  18. for (var j = 0; j < allLinks.length; j++) {
  19. thisLink = allLinks[j];
  20. if(thisLink.href.indexOf('http') !=-1)
  21. {
  22. linkArray=thisLink.href.split('http');
  23. thisLink.href=decodeURIComponent('http'+linkArray[linkArray.length-1]);
  24. thisLink.href=thisLink.href.replace(/&amp;/g,'&');
  25. }
  26. }