自动展开

自动展开文档 隐藏部分;长期维护、全平台支持:CSDN、简书、知乎、百家号、百度闻、新资讯、百度经验、百度知道、百度贴吧、百度新浪新闻、腾讯新闻、搜狐新闻、网易新闻、CSDN手机版、简书手机版、知乎手机版、百家号手机版、百度资讯手机版、百度经验手机版、百度知道手机版、百度贴吧手机版、百度新闻手机版、新浪新闻手机版、腾讯新闻手机版、搜狐新闻手机版、网易新闻手机版

As of 19.02.2022. See апошняя версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         自动展开
// @version      1.1.5
// @namespace    https://github.com/AirBashX/AutoUnfold/
// @author       airbash
// @description  自动展开文档	隐藏部分;长期维护、全平台支持:CSDN、简书、知乎、百家号、百度闻、新资讯、百度经验、百度知道、百度贴吧、百度新浪新闻、腾讯新闻、搜狐新闻、网易新闻、CSDN手机版、简书手机版、知乎手机版、百家号手机版、百度资讯手机版、百度经验手机版、百度知道手机版、百度贴吧手机版、百度新闻手机版、新浪新闻手机版、腾讯新闻手机版、搜狐新闻手机版、网易新闻手机版
// @match      	 *://*.jianshu.com/*
// @match        *://blog.csdn.net/*
// @match        *://www.zhihu.com/question/*
// @match        *://jingyan.baidu.com/article*
// @match        *://zhidao.baidu.com/question*
// @match        *://tieba.baidu.com/p*
// @match        *://baijiahao.baidu.com/s*
// @match        *://mbd.baidu.com/newspage/data/*
// @match        *://news.baidu.com/news*
// @match        *://m.baidu.com/sf_baijiahao/*
// @match        *://*.sina.cn/*
// @match        *://3g.163.com/*
// @match        *://m.sohu.com/a/*
// @match        *://xw.qq.com/*
// @run-at       document-body
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAAHECAYAAACnX1ofAAAABmJLR0QA/wD/AP+gvaeTAAAMeklEQVR4nO3cTY4dVxnH4Zd0Rpll4B1kwgpgBQyQsNhCBkwslsEgA0RAQgLyDZJDIrEExCLwCpCCYMSHxAAjYRh0l+Nud92uuvc9db6eR/rPzym7/dORrI4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADjIVe0DTObdiPhXRPyt9kGA3b4XEW9HxJ9rHwR694OIeBERf4mIb1Y+C7DPdyPi3xHxz4j4duWzQNeWGP7vZqII/VhiuPz8iiKc6W4MRRH6cTeGoghnWouhKEL71mIoirDTQzEURWjXQzEURdhoawxFEdqzNYaiCA/YG0NRhHbsjaEowopzYyiKUN+5MRRFuOPSGIoi1HNpDEURbmTFUBTheFkxFEWmlx1DUYTjZMdQFJlWqRiKIpRXKoaiyHRKx1AUoZzSMRRFpnFUDEUR8h0VQ1FkeEfHUBQhz9ExFEWGVSuGogiXqxVDUWQ4tWMoinC+2jEURYbRSgxFEfZrJYaiSPdai6EownatxVAU6VarMRRFeFirMRRFutN6DEUR1rUeQ1GkG73EUBThdb3EUBRpXm8xFEX4Wm8xFEWa1WsMRRH6jaEo0pzeYyiKzKz3GIoizRglhqLIjEaJoShS3WgxFEVmMloMRZFqRo2hKDK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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3fo/tBf+1ozpM9IAAAAASUVORK5CYII=
// @grant        none
// @license      GPL-3.0
// ==/UserScript==
(function () {
	/**
	 * 网站列表
	 * @type {name/url/操作类型}
	 */
	var websites = [
		{
			name: "CSDN",
			url: "blog.csdn.net",
			handles: [
				//自动展开代码块
				{
					type: "click",
					item: ".look-more-preCode",
				},
				//移动版:弹出窗口
				{
					type: "display",
					item: ".weixin-shadowbox",
				},
				//移动版:下载App按钮
				{
					type: "display",
					item: ".feed-Sign-span",
				},
				//移动版:阅读全文
				{
					type: "display",
					item: ".btn_mod",
				},
				{
					type: "height",
					item: ".article_content",
				},
				{
					type: "display",
					item: ".readall_box",
				},
				//移动版:展开评论
				{
					type: "click",
					item: ".btn_comment_readmore",
				},
			],
		},
		{
			name: "简书",
			url: "jianshu.com/p",
			handles: [
				//移动版:弹出窗口
				{
					type: "display",
					item: ".download-app-guidance",
				},
				//移动版:下载App按钮
				{
					type: "display",
					item: ".call-app-btn",
				},
				//移动版:阅读全文
				{
					type: "display",
					item: ".collapse-tips",
				},
				{
					type: "height",
					item: ".collapse-free-content",
				},
				{
					type: "display",
					item: ".copyright",
				},
				// 移动版:允许滑动
				{
					type: "overflow",
					item: "body",
				},
			],
		},
		{
			name: "百度经验",
			url: "jingyan.baidu.com/article",
			handles: [
				{
					type: "display",
					item: ".read-whole-mask",
				},
				{
					type: "height",
					item: ".exp-content-container",
				},
				//移动版:展开内容
				{
					type: "click",
					item: ".more-img-opt",
				},
			],
		},
		{
			name: "百度知道",
			url: "zhidao.baidu.com/question",
			handles: [
				{
					type: "display",
					item: ".wgt-best-mask",
				},
				{
					type: "height",
					item: ".best-text",
				},
				{
					type: "display",
					item: ".wgt-answers-mask",
				},
				{
					type: "height",
					item: ".answer-text",
				},
				{
					type: "click",
					item: "#show-answer-hide",
				},
				{
					type: "click",
					item: ".show-hide-dispute",
				},
				//移动版:展开内容
				{
					type: "display",
					item: ".w-detail-display-btn",
				},
				{
					type: "height",
					item: ".w-detail-container",
				},
				{
					type: "click",
					item: ".show-more-replies",
				},
			],
		},
		{
			name: "百度贴吧",
			url: "tieba.baidu.com/p",
			handles: [
				//自动展开图片
				{
					type: "display",
					item: ".replace_tip",
				},
				{
					type: "height",
					item: ".replace_div",
				},
				//自动展开回复
				{
					type: "click",
					item: ".j_lzl_m",
				},
				//移动版:弹出窗口
				{
					type: "display",
					item: ".tb-backflow-defensive",
				},
				//移动版:允许滑动
				{
					type: "overflow",
					item: "body",
				},
			],
		},
		{
			name: "百家号",
			url: "baijiahao.baidu.com/s",
			handles: [
				//移动版:弹出窗口
				{
					type: "display",
					item: ".layer-wrap",
				},
				{
					type: "overflow",
					item: "body",
				},
				//移动版:阅读全文
				{
					type: "display",
					item: ".oPadding",
				},
				{
					type: "height",
					item: ".mainContent",
				},
				//移动版:悬浮按钮
				{
					type: "display",
					item: ".undefined",
				},
			],
		},
		{
			name: "百度app新闻",
			url: "mbd.baidu.com/newspage/data",
			handles: [
				//类似于百家
				//移动版:弹出窗口
				{
					type: "display",
					item: ".layer-wrap",
				},
				{
					type: "overflow",
					item: "body",
				},
				//移动版:阅读全文
				{
					type: "display",
					item: ".height-fold",
				},
				{
					type: "height",
					item: ".dynamic-item",
				},

				//类似于百度
				//移动版:阅读全文
				{
					type: "display",
					item: ".packupButton",
				},
				{
					type: "height",
					item: ".mainContent",
				},
				//移动版:悬浮按钮
				{
					type: "display",
					item: ".GcwrDCd4cJnZ_u",
				},
			],
		},
		{
			name: "百度资讯",
			url: "m.baidu.com/sf_baijiahao",
			handles: [
				//移动版:下载弹窗
				{
					type: "display",
					item: ".layer-wrap",
				},
				{
					type: "overflow",
					item: "body",
				},
				//移动版:展开全文
				{
					type: "display",
					item: ".oPadding",
				},
				{
					type: "height",
					item: ".mainContent",
				},
				//移动版:悬浮按钮
				{
					type: "display",
					item: ".undefined",
				},
			]
		},
		{
			name: "百度新闻",
			url: "news.baidu.com/news#/detail",
			handles: [
				//移动版:阅读全文
				{
					type: "display",
					item: ".show-more-btn-container",
				},
				{
					type: "display",
					item: ".show-more-end",
				},
				{
					type: "height",
					item: ".detail-content-main",
				},
			],
		},
		{
			name: "新浪新闻",
			url: "sina.cn",
			handles: [
				//移动版:展开
				{
					type: "display",
					item: ".look_more",
				},
				{
					type: "height",
					item: ".s_card",
				},
				//other:悬浮下载按钮
				{
					type: "display",
					item: "#float-btn",
				},
			],
		},
		{
			name: "网易新闻",
			url: "3g.163.com",
			handles: [
				//移动版:展开
				{
					type: "display",
					item: ".show_article",
				},
				{
					type: "height",
					item: "article",
				},
			],
		},
		{
			name: "搜狐新闻",
			url: "m.sohu.com/a",
			handles: [
				//移动版:展开
				{
					type: "click",
					item: ".look-all",
				},
			],
		},
		{
			name: "腾讯新闻",
			url: "xw.qq.com/cmsid",
			handles: [
				//移动版:展开
				{
					type: "display",
					item: ".icon-content-more",
				},
				{
					type: "display",
					item: ".mask",
				},
				{
					type: "height",
					item: ".packed",
				},
			],
		},
		{
			name: "知乎",
			url: "www.zhihu.com/question",
			handles: [
				//PC版+移动版:展开全文
				{
					type: "display",
					item: ".ContentItem-rightButton",
				},
				{
					type: "height",
					item: ".RichContent-inner",
				},
				//移动版:下载弹窗
				{
					type: "display",
					item: ".ModalWrap",
				},
				//移动版:悬浮按钮
				{
					type: "display",
					item: ".OpenInAppButton",
				},
				//移动版:允许滑动
				{
					type: "overflow",
					item: "body",
				},
				//移动版:主页悬浮
				// {
				// 	type: "display",
				// 	item: ".DownloadGuide-inner",
				// }
			],
		}
	];
	var interval = setInterval(() => {
		for (var website of websites) {
			if (location.href.indexOf(website.url) != -1) {
				for (var handle of website.handles) {
					var items = document.querySelectorAll(handle.item);
					if (items.length != 0) {
						if (handle.type == "display") {
							//使用css的display:none;隐藏遮挡部分
							for (var item of items) {
								item.style.display = "none";
							}
						} else if (handle.type == "height") {
							//加长内容部分
							for (var item of items) {
								item.style.height = "unset";
								item.style.maxHeight = "unset";
								item.style.minHeight = "unset";
								//知乎删除遮挡
								item.style.setProperty(
									"-webkit-mask-image",
									"unset",
									"important"
								);
							}
							//防止无法滑动
						} else if (handle.type == "overflow") {
							for (var item of items) {
								item.style.setProperty(
									"overflow",
									"unset",
									"important"
								);
							}
						//模拟点击,后续可能取消
						} else {
							for (var item of items) {
								if (
									item != null &&
									item.getAttribute("opened") != "yes"
								) {
									item.click();
									item.setAttribute("opened", "yes");
								}
							}
						}
					}
				}
			}
		}
	}, 100);
})();