Greasy Fork 支持简体中文。

dev_hide_critique

shortens critiques until you click them

  1. // ==UserScript==
  2. // @name dev_hide_critique
  3. // @namespace dev_hide_critique
  4. // @description shortens critiques until you click them
  5. // @include http://*.deviantart.com/*
  6. // @author dediggefedde
  7. // @version 1.7
  8. // ==/UserScript==
  9.  
  10. function injection(){
  11. // var $=unsafeWindow.jQuery,holder,query,offset,fPage,pPage,lPage;
  12. var pdown="data:image/gif;base64,R0lGODlhEAAQAMIHACkwMDI6OjQ9PUFNTFVlY2FycWR2df%2F%2F%2FyH%2BEUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAAcALAAAAAAQABAAAAMteLrc%2FjCyIKqtIAOjyPhg%2BHGdKJKlCaKpyS7eCcXhy9CD3cT6PkqwAnBIXCQAADs%3D";
  13. var pup="data:image/gif;base64,R0lGODlhEAAQAMIHACkwMDI6OjQ9PUFNTFVlY2FycWR2df%2F%2F%2FyH%2BEUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAAcALAAAAAAQABAAAAMoeLrc%2FnABEhkYg9Zz8%2B6Y9oCYN5alaKGoyrGsSsLiDJtGru%2F75v%2B%2FBAA7";
  14. var critique_text=new Array();
  15.  
  16. // $(document).ready(init);
  17.  
  18. // function init(){
  19. if(($("#gmi-ResViewSizer_img").length || $("div[collect_rid]").length) && !$("#artist-comments").length){setTimeout(init,500);return;}
  20. $(".ccomment.grf-stream .critique").css({"height":"1.5em","min-height":"1.5em","overflow":"hidden"});
  21. $(".ccomment.grf-stream .critique_feedback").css("display","none");
  22. $(".ccomment.grf-stream .ratings").css({"height":"38pt","min-height":"38pt","overflow":"hidden","display":"block"});
  23. $(".ccomment.grf-stream .gr").css({"min-height":"5em","height":"5em"});
  24. $(".ccomment.grf-stream .critique").each(function(){
  25. critique_text.push($(this).html());
  26. $(this).html($(this).html().replace(/<.*?>/g,"").substr(0,100)+"[Read more]");
  27. });
  28. $(".ccomment.grf-stream .gr-body").append("<div class='dev_crit_hide'><span>click to see more</span><br><img src="+pdown+" alt='read more!'/></div>");
  29. $(".ccomment.grf-stream .dev_crit_hide").css({"text-align":"center","cursor":"pointer","color":"#196BA7"});
  30. var i=0;
  31. $(".ccomment.grf-stream .dev_crit_hide").each(function(){
  32. $(this).attr("crit_id",i);
  33. i++;
  34. });
  35. $(".ccomment.grf-stream .dev_crit_hide").attr("visible","0")
  36. $(".ccomment.grf-stream .dev_crit_hide").click(blend);
  37. // }
  38. function blend(){
  39. var i = $(this).attr("crit_id");
  40. if($(this).attr("visible")=="0"){
  41. $(this).parent().find(".critique").css({"height":"","min-height":"","overflow":""});
  42. $(this).parent().find(".critique_feedback").css("display","");
  43. $(this).parent().find(".ratings").css({"height":"","min-height":"","display":"","overflow":""});
  44. $(this).parent().find(".gr").css({"min-height":"","height":""});
  45. $(this).attr("visible","1");
  46. this.parentNode.getElementsByClassName("critique")[0].innerHTML=critique_text[i];
  47. $(this).parent().find(".critique").html(critique_text[i]);
  48. $(this).children("img").attr("src",pup);
  49. $(this).children("span").html("click to see less");
  50. }else{
  51. $(this).attr("visible","0");
  52. $(".ccomment.grf-stream .critique").css({"height":"1.5em","min-height":"1.5em","overflow":"hidden"});
  53. $(".ccomment.grf-stream .critique_feedback").css("display","none");
  54. $(".ccomment.grf-stream .ratings").css({"height":"28pt","min-height":"28pt","overflow":"hidden","display":"block"});
  55. $(".ccomment.grf-stream .gr").css({"min-height":"5em","height":"5em"});
  56. critique_text[i]=$(this).parent().find(".critique").html();
  57. $(this).parent().find(".critique").html($(this).parent().find(".critique").html().replace(/<.*?>/g,"").substr(0,100)+"[Read more]");
  58. $(this).children("img").attr("src",pdown);
  59. $(this).children("span").html("click to see more");
  60. }
  61. }
  62. }
  63.  
  64.  
  65. var el = document.createElement("script");
  66. el.innerHTML="("+injection.toString()+")();";
  67. document.body.appendChild(el);