IT之家纯净版

去除无用内容,保留文章及评论主体信息

  1. // ==UserScript==
  2. // @name IT之家纯净版
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.3
  5. // @description 去除无用内容,保留文章及评论主体信息
  6. // @author black lee
  7. // @match *://*.ithome.com/*
  8. // @grant none
  9.  
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. checkJquery();
  15. SetPage();
  16. })();
  17.  
  18.  
  19. function checkJquery() {
  20. if (!typeof jQuery) {
  21. var jqueryScript = document.createElement("script");
  22. jqueryScript.type = "text/javascript";
  23. jqueryScript.src = "https://code.jquery.com/jquery-3.3.1.min.js";
  24. document.head.append(jqueryScript);
  25. }
  26. }
  27.  
  28. function SetPage(){
  29. //$(".con-block .lf,.focus_area").remove();
  30. var style = document.createElement('style');
  31. var strCss = "#top5,#tt50,.current_nav,.sidebar,#side_func,.shareto,.related_post,.dajia,.pre1{ display:none; } ";
  32. strCss += ".content,.post_comment{width:100%;} .add_comm{width:calc(100% - 2px);} .add_comm textarea{width:calc(100% - 30px);} ";
  33. strCss += ".content .newsgrade{height:75px; margin: 60px auto;position: relative; }.newsgrade0{margin-left:150px;} #formCenter{margin-top:20px;}";
  34. strCss += ".vitem iframe{max-height:100%!important;max-width:100%!important}";
  35. strCss += "";
  36. strCss += "";
  37. strCss += "";
  38. strCss += "";
  39. strCss += "";
  40. strCss += "";
  41. strCss += "";
  42. style.innerHTML = strCss;
  43. window.document.head.appendChild(style);
  44. $("img.lazy").parent().css({"text-align":"center"});
  45. $(".vitem iframe").attr("style","max-width:100%;max-height:100%;width:100%;height:100%");
  46. //$("#top5,#tt50,.current_nav,.sidebar,#side_func,.shareto,.related_post,.dajia").remove();
  47. //$(".content,.post_comment").css({"width":"100%"});
  48. //$(".add_comm").css({"width":"calc(100% - 2px)"});
  49. //$(".add_comm textarea").css({"width":"calc(100% - 30px)"});
  50. if(location.href.indexOf("dyn.ithome.com/comment")!=-1){
  51. var style = document.createElement('style');
  52. style.innerHTML = "#ulhotlist li,#ulcommentlist li{ width:100%; }";
  53. window.document.head.appendChild(style);
  54. }
  55. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址