Fix google ulr redirects

Prevent redirect from google search results to the redirector site google.com/url

  1. // ==UserScript==
  2. // @name Fix google ulr redirects
  3. // @version 0.1
  4. // @description Prevent redirect from google search results to the redirector site google.com/url
  5. // @author CoilBlimp
  6. // @grant none
  7. // @include http://*.google.com/search*
  8. // @include https://*.google.com/search*
  9. // @include https://*.google.*/search*
  10. // @namespace https://greasyfork.org/users/392376
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. let alist = document.getElementsByTagName("a");
  15.  
  16. let amountOfChangedUrls = 0;
  17.  
  18. let changedUrlDiv = document.createElement("div");
  19. changedUrlDiv.id = "changedUrlDiv";
  20. changedUrlDiv.style.cssText = "background: #333333; z-index: 1000000; color: white; position: fixed; top: 13em; right: 1%; border: solid 2px #aaa !important; border-radius: 5px; padding: 5px;"
  21. changedUrlDiv.innerHTML = "parsing urls...";
  22. document.body.appendChild(changedUrlDiv);
  23.  
  24. for(let i = alist.length-1; i >=0; i--){
  25. if(alist[i].hasAttribute("onmousedown")){
  26. alist[i].removeAttribute("onmousedown")
  27. amountOfChangedUrls++;
  28. }
  29. }
  30. console.log("Changed " + amountOfChangedUrls + " urls ")
  31. changedUrlDiv.innerHTML = "Changed " + amountOfChangedUrls + " urls";
  32.  
  33. })();