Greasy Fork

Greasy Fork is available in English.

IT之家纯净版

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         IT之家纯净版
// @namespace    http://tampermonkey.net/
// @version      0.1.3
// @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');
    var strCss = "#top5,#tt50,.current_nav,.sidebar,#side_func,.shareto,.related_post,.dajia,.pre1{ display:none; } ";
    strCss += ".content,.post_comment{width:100%;} .add_comm{width:calc(100% - 2px);} .add_comm textarea{width:calc(100% - 30px);} ";
    strCss += ".content .newsgrade{height:75px; margin: 60px auto;position: relative; }.newsgrade0{margin-left:150px;} #formCenter{margin-top:20px;}";
    strCss += ".vitem iframe{max-height:100%!important;max-width:100%!important}";
    strCss += "";
    strCss += "";
    strCss += "";
    strCss += "";
    strCss += "";
    strCss += "";
    strCss += "";
  
    style.innerHTML = strCss;
    window.document.head.appendChild(style);
    $("img.lazy").parent().css({"text-align":"center"});
    $(".vitem iframe").attr("style","max-width:100%;max-height:100%;width:100%;height:100%");
  
  //$("#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);
  }
}