极简 It之家新闻列表

仅保留新闻列表

目前為 2022-02-20 提交的版本,檢視 最新版本

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

(function () {
    'use strict';

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

    // 如果是新闻列表
    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"))
        });
        
    }
})();