Greasyfork install button on search

Adds install buttons to all the search result pages, nice for mass installing

  1. // ==UserScript==
  2. // @name Greasyfork install button on search
  3. // @namespace Danielv123
  4. // @version 1.2
  5. // @description Adds install buttons to all the search result pages, nice for mass installing
  6. // @author You
  7. // @match https://greatest.deepsurf.us/*
  8. // @match https://sleazyfork.org/*
  9. // @requires jQuery
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. // vanilla greasyfork
  14. if(document.querySelector("#user-script-list")){
  15. for(i = 1; document.querySelector("#user-script-list").childNodes.length > i; i++) {
  16. (function(i){
  17. if(document.querySelector("#user-script-list > li:nth-child(" + i + ")>article>h2>a")) {
  18. console.log(document.querySelector("#user-script-list > li:nth-child(" + i + ")>article>h2>a"));
  19. $("<div>").load(document.querySelector("#user-script-list > li:nth-child(" + i + ")>article>h2>a").href+" #install-area", function() {
  20. $("#user-script-list > li:nth-child(" + i + ")").append($(this).html());
  21. console.log(i);
  22. });
  23. }
  24. })(i);
  25. }
  26. }
  27. if(document.querySelector("#browse-script-list")){
  28. for(i = 1; document.querySelector("#browse-script-list").childNodes.length > i; i++) {
  29. (function(i){
  30. if(document.querySelector("#browse-script-list > li:nth-child(" + i + ")>article>h2>a")) {
  31. console.log(document.querySelector("#browse-script-list > li:nth-child(" + i + ")>article>h2>a"));
  32. $("<div>").load(document.querySelector("#browse-script-list > li:nth-child(" + i + ")>article>h2>a").href+" #install-area", function() {
  33. $("#browse-script-list > li:nth-child(" + i + ")").append($(this).html());
  34. console.log(i);
  35. });
  36. }
  37. })(i);
  38. }
  39. }
  40.  
  41. // compat with [TS] Citrus GFork
  42. setTimeout(function(){
  43. if(document.querySelector("#script-table")){
  44. for(i = 0; document.querySelector("#script-table > tbody").childNodes.length > i; i++) {
  45. (function(i){
  46. if(document.querySelector("#script-table tr:nth-child("+i+") > td:nth-child(2) > div.thetitle > a")) {
  47. console.log(document.querySelector("#script-table tr:nth-child("+i+") > td:nth-child(2) > div.thetitle > a"));
  48. $("<div>").load(document.querySelector("#script-table tr:nth-child("+i+") > td:nth-child(2) > div.thetitle > a").href+" #install-area", function() {
  49. $("#script-table tr:nth-child(" + i + ") div:nth-child(2)").append($(this).html());
  50. console.log(i);
  51. });
  52. }
  53. })(i);
  54. }
  55. }
  56. }, 1000);