Add Download Button to TC4Shell.com 7-Zip Plugins Page

Some download links are manually processed AND they need my manual update to keep update with TC4Shell.com AND the last update is done at 2019-11-24.

当前为 2019-11-23 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Add Download Button to TC4Shell.com 7-Zip Plugins Page
  3. // @description Some download links are manually processed AND they need my manual update to keep update with TC4Shell.com AND the last update is done at 2019-11-24.
  4. // @namespace RainSlide
  5. // @author RainSlide
  6. // @match http://www.tc4shell.com/en/7zip/
  7. // @match http://www.tc4shell.com/ru/7zip/
  8. // @match https://www.tc4shell.com/en/7zip/
  9. // @match https://www.tc4shell.com/ru/7zip/
  10. // @note HTTPS is not ready...
  11. // @version 1.0
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. document.head.appendChild( (css => {
  16. const style = document.createElement("style");
  17. style.textContent = css;
  18. return style;
  19. })(`
  20. #content h1 ~ div > h2 {
  21. display: flex;
  22. flex-flow: row nowrap;
  23. justify-content: space-between;
  24. align-items: center;
  25. }
  26.  
  27. .button_7z_plugins_download {
  28. padding: .5em;
  29. box-sizing: content-box;
  30. height: 1em;
  31. line-height: 1;
  32. font-family: inherit;
  33. font-size: smaller;
  34. background: #e84c3d;
  35. }
  36. .button_7z_plugins_download:hover {
  37. background: #ff605f;
  38. }
  39. `.trim()) );
  40.  
  41. document.querySelectorAll('#content h1 ~ div > h2').forEach( h2 => {
  42.  
  43. let filename = h2.textContent.split(" ")[0];
  44. // if ( [ "Asar7z", "Lzip7z" ].some( str => str === filename ) )
  45. // filename = filename.replace(/7z$/, "");
  46. if (filename === "Asar7z") filename = "Asar"; else
  47. if (filename === "Lzip7z") filename = "Lzip";
  48.  
  49. const a = document.createElement("a");
  50. a.href = "/binary/" + filename + ".zip";
  51. a.setAttribute("download", "");
  52. a.className = "button button_7z_plugins_download";
  53. a.textContent = "Download";
  54.  
  55. h2.appendChild(a);
  56.  
  57. } );