Dev_Multi_Open

Open all selected deviations at once!

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

  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.29
  7. // @contributor Dediggefedde
  8. // @grant none
  9. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
  10. // ==/UserScript==
  11.  
  12.  
  13. function injecter(){
  14.  
  15. // var $=unsafeWindow.jQuery,holder,query,offset,fPage,pPage,lPage;
  16. var akturls=[];
  17. var container;
  18. var selected=$();
  19. akturls=[];
  20.  
  21. setInterval(start,500);
  22. setInterval(pruf,500);
  23. function start(){
  24. container=$(".f.td-sr").filter(function(){if($(this).find(".dev_multiopen_but").length==0)return true;});
  25. // console.log(container.length);
  26. if(container.length>0){
  27. container.css("width","auto").append("<a href='' class='gmbutton disabledbutton dev_multiopen_but' onclick='return false;'>Open 0</a>");
  28. container.find(".dev_multiopen_but").click(function(){
  29. selected.each(function(){
  30. open($(this).attr("href"));
  31. $(".mcbox-sel a[href='']:not(.u,.journal)").parents(".mcbox-sel").removeClass("mcbox-sel");
  32. });
  33. });
  34. }
  35. }
  36. function pruf(){
  37. if($(".mcbox:not([multi_open])").length>0){
  38. $(".mcbox:not([multi_open])").click(pruf);
  39. $(".mcbox:not([multi_open])").attr("multi_open","true");
  40. }
  41. var altsel=selected.length;
  42. selected = $(".mcbox-sel a:not([href=''],.journal)").filter(function(){
  43. if(akturls.indexOf($(this).attr("href"))!=-1)return false;
  44. if($(this).parents(".mczone").find(".mczone-title:contains('Activity')").length==1){
  45. if(!$(this).hasClass("u"))return false;
  46. }else{
  47. if($(this).attr("href").search(/deviantart\.com.*\d+\/?$/i)==-1)return false;
  48. }
  49. akturls.push($(this).attr("href"));
  50. return true;
  51. });
  52. akturls=[];
  53. if(selected.length==altsel)return true;
  54. if(selected.length>0){$(".dev_multiopen_but").removeClass("disabledbutton");}else{$(".dev_multiopen_but").addClass("disabledbutton");}
  55. $(".dev_multiopen_but").html("Open " + selected.length);
  56. }
  57. }
  58. injecter();