Dev_Multi_Open

Open all selected deviations at once!

当前为 2015-06-15 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Dev_Multi_Open
  3. // @description Open all selected deviations at once!
  4. // @namespace dev_multi_open_but
  5. // @match *://*.deviantart.com/notifications/*
  6. // @version 1.30
  7. // @contributor Dediggefedde
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11.  
  12. function Multi_Open_injecter() {
  13.  
  14. // var $=unsafeWindow.jQuery,holder,query,offset,fPage,pPage,lPage;
  15. var akturls = [];
  16. var container;
  17. var selected = $();
  18.  
  19. setInterval(start, 500);
  20. setInterval(pruf, 500);
  21. function start() {
  22. if($("div.mcbox").length==0)return;
  23. container = $(".f.td-sr").filter(function () {
  24. if ($(this).find(".dev_multiopen_but").length == 0)
  25. return true;
  26. });
  27. // console.log(container.length);
  28. if (container.length > 0) {
  29. container.css("width", "auto").append("<a href='' class='gmbutton disabledbutton dev_multiopen_but' onclick='return false;'>Open 0</a>");
  30. container.find(".dev_multiopen_but").click(function () {
  31. selected.each(function () {
  32. open($(this).attr("href"));
  33. $(".mcbox-sel a[href='']:not(.u,.journal)").parents(".mcbox-sel").removeClass("mcbox-sel");
  34. });
  35. });
  36. }
  37.  
  38. }
  39. function pruf() {
  40. if ($(".mcbox:not([multi_open])").length > 0) {
  41. $(".mcbox:not([multi_open])").click(pruf);
  42. $(".mcbox:not([multi_open])").attr("multi_open", "true");
  43. }
  44.  
  45. var altsel = selected.length;
  46. selected = $(".mcbox-sel a:not([href=''],.journal)").filter(function () {
  47. if (akturls.indexOf($(this).attr("href")) != -1)
  48. return false;
  49. if ($(this).parents(".mczone").find(".mczone-title:contains('Activity')").length == 1) {
  50. if (!$(this).hasClass("u"))
  51. return false;
  52. } else {
  53. if ($(this).attr("href").search(/deviantart\.com.*\d+\/?$/i) == -1)
  54. return false;
  55. }
  56. akturls.push($(this).attr("href"));
  57. return true;
  58. });
  59. akturls = [];
  60. if (selected.length == altsel)
  61. return true;
  62. if (selected.length > 0) {
  63. $(".dev_multiopen_but").removeClass("disabledbutton");
  64. } else {
  65. $(".dev_multiopen_but").addClass("disabledbutton");
  66. }
  67. $(".dev_multiopen_but").html("Open " + selected.length);
  68. }
  69. }
  70.  
  71. var el=document.createElement("script");
  72. el.innerHTML="("+Multi_Open_injecter.toString()+")()";
  73. document.body.appendChild(el);
  74. document.body.removeChild(el);
  75. // Multi_Open_injecter();