Greasy Fork

Greasy Fork is available in English.

IT之家纯净版

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

目前为 2019-09-03 提交的版本,查看 最新版本

// ==UserScript==
// @name         IT之家纯净版
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  去除无用内容,保留文章及评论主体信息
// @author       black lee
// @match        *://*.ithome.com/*
// @grant        none

// ==/UserScript==

(function() {
    'use strict';
  
    checkJquery();
  
    SetPage();
})();


function checkJquery() {
    if (!typeof jQuery) {
        var jqueryScript = document.createElement("script");
        jqueryScript.type = "text/javascript";
        jqueryScript.src = "https://code.jquery.com/jquery-3.3.1.min.js";
        document.head.append(jqueryScript);
    }
}

function SetPage(){
  //$(".con-block .lf,.focus_area").remove();
  
    var style = document.createElement('style');
    style.innerHTML = "#top5,#tt50,.current_nav,.sidebar,#side_func,.shareto,.related_post,.dajia{ display:none; } .content,.post_comment{width:100%;} .add_comm{width:calc(100% - 2px);} .add_comm textarea{width:calc(100% - 30px);}";
    window.document.head.appendChild(style);
  
  
  //$("#top5,#tt50,.current_nav,.sidebar,#side_func,.shareto,.related_post,.dajia").remove();
  //$(".content,.post_comment").css({"width":"100%"});
  
  //$(".add_comm").css({"width":"calc(100% - 2px)"});
  //$(".add_comm textarea").css({"width":"calc(100% - 30px)"});
  
  if(location.href.indexOf("dyn.ithome.com/comment")!=-1){
    var style = document.createElement('style');
    style.innerHTML = "#ulhotlist li,#ulcommentlist li{ width:100%; }";
    window.document.head.appendChild(style);
  }
}