极简 It之家新闻列表

仅保留新闻列表

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         极简 It之家新闻列表
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  仅保留新闻列表
// @author       You
// @match        *://*.ithome.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    var currentURL = window.location.href;
    var newsList = /list/;

    setTimeout(() => {
        // 如果是新闻列表
        if (newsList.test(currentURL)) {
            // 新闻列表页
            $("html body").html($("#list .fl").html());
            $("html body").css({ "width": "850px", "margin": "0 auto" });
            $("ul.datel li a.t").css("width", "575px");
        } else {
            // 内容页面
            $("html body").html($("#dt.fl").html());

            $("#dt>div:eq(1)").remove();

            $("#dt .fl").css("width", "auto");

            $("#dt .fl>script").remove();

            $("#dt .fl .shareto").remove();

            $("#dt .fl .related_post").remove();

            $("#dt .fl iframe:first").remove();

            $("img").each(function () {
                $(this).prop("src", $(this).data("original"))
            });

        }
    }, 500);
})();