仅保留新闻列表
当前为
// ==UserScript==
// @name 极简 It之家新闻列表
// @namespace http://tampermonkey.net/
// @version 1.1
// @description 仅保留新闻列表
// @author You
// @match *://*.ithome.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
var currentURL = window.location.href;
var newsList = /list/;
// 如果是新闻列表
if (newsList.test(currentURL)) {
// 新闻列表页
$("body").html(`<div style="width:720px;margin:0 auto;">${$("#list").find("div.fl").html()}</div>`)
$("li a[class='t']").each(function () {
if ($(this).prop("href").indexOf("lapin") > -1) {
$(this).parent().remove();
}
})
} else {
// 内容页面
$("#dt").siblings().remove();
$("#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"))
});
}
})();