Greasyfork install button on search

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

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

  1. // ==UserScript==
  2. // @name Greasyfork install button on search
  3. // @namespace Danielv123
  4. // @version 1.0
  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. if(document.querySelector("#user-script-list")){
  12. for(i = 1; document.querySelector("#user-script-list").childNodes.length > i; i++) {
  13. (function(i){
  14. if(document.querySelector("#user-script-list > li:nth-child(" + i + ")>article>h2>a")) {
  15. console.log(document.querySelector("#user-script-list > li:nth-child(" + i + ")>article>h2>a"));
  16. $("<div>").load(document.querySelector("#user-script-list > li:nth-child(" + i + ")>article>h2>a").href+" #install-area", function() {
  17. $("#user-script-list > li:nth-child(" + i + ")").append($(this).html());
  18. console.log(i);
  19. });
  20. }
  21. })(i);
  22. }
  23. }
  24. if(document.querySelector("#browse-script-list")){
  25. for(i = 1; document.querySelector("#browse-script-list").childNodes.length > i; i++) {
  26. (function(i){
  27. if(document.querySelector("#browse-script-list > li:nth-child(" + i + ")>article>h2>a")) {
  28. console.log(document.querySelector("#browse-script-list > li:nth-child(" + i + ")>article>h2>a"));
  29. $("<div>").load(document.querySelector("#browse-script-list > li:nth-child(" + i + ")>article>h2>a").href+" #install-area", function() {
  30. $("#browse-script-list > li:nth-child(" + i + ")").append($(this).html());
  31. console.log(i);
  32. });
  33. }
  34. })(i);
  35. }
  36. }