CNET Direct Download Patch

Make the green file download button points directly to the file download instead of the "Thank you" download page.

  1. // ==UserScript==
  2. // @name CNET Direct Download Patch
  3. // @namespace CNETDirectDownloadPatch
  4. // @description Make the green file download button points directly to the file download instead of the "Thank you" download page.
  5. // @author jcunews
  6. // @include *://download.cnet.com/*
  7. // @version 1
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. var ele = document.createElement("SCRIPT");
  13. ele.text = "(" + (function() {
  14. document.querySelectorAll_ = document.querySelectorAll;
  15. document.querySelectorAll = function() {
  16. if (window.fireTrackDownloadClick) {
  17. fireTrackDownloadClick = function(arr, sel, ele){
  18. var atr = ele.attributes["data-dl-url"];
  19. if (atr) {
  20. var lnk = ele.querySelector(".dln-a");
  21. if (lnk) {
  22. lnk.href = atr.value;
  23. }
  24. }
  25. return null;
  26. };
  27. document.querySelectorAll = document.querySelectorAll_;
  28. }
  29. return this.querySelectorAll_.apply(this, arguments);
  30. };
  31. }).toString() + ")()";
  32. document.head.appendChild(ele);