Greasyfork install button on search

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

当前为 2016-09-21 提交的版本,查看 最新版本

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