From 7c0ac79d8b159eb62b127386b2db55f3987f37d1 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Tue, 17 Aug 2021 11:55:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E5=AE=BD=E5=B1=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=20-=20=E9=A6=96=E9=A1=B5]=E3=80=81[=E5=AE=BD?= =?UTF-8?q?=E5=B1=8F=E6=98=BE=E7=A4=BA=20-=20=E9=97=AE=E9=A2=98=E9=A1=B5]?= =?UTF-8?q?=E3=80=81[=E5=AE=BD=E5=B1=8F=E6=98=BE=E7=A4=BA=20-=20=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E9=A1=B5]=E3=80=81[=E5=AE=BD=E5=B1=8F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=20-=20=E6=94=B6=E8=97=8F=E9=A1=B5]=20=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E8=8F=9C=E5=8D=95=E5=BC=80=E5=85=B3;=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E6=9A=97=E9=BB=91=E6=A8=A1=E5=BC=8F=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Beautification.user.js | 57 +++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index d266fba..af9958b 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎美化 -// @version 1.3.0 +// @version 1.3.1 // @author X.I.U // @description 宽屏显示、暗黑模式(4种)、暗黑模式跟随浏览器、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏、文章编辑页面与实际文章宽度一致、屏蔽登录提示 // @match *://www.zhihu.com/* @@ -24,6 +24,10 @@ 'use strict'; var menu_ALL = [ ['menu_widescreenDisplay', '宽屏显示', '宽屏显示', true], + ['menu_widescreenDisplayIndex', '宽屏显示 - 首页', '宽屏显示 - 首页', true], + ['menu_widescreenDisplayQuestion', '宽屏显示 - 问题页', '宽屏显示 - 问题页', true], + ['menu_widescreenDisplaySearch', '宽屏显示 - 搜索页', '宽屏显示 - 搜索页', true], + ['menu_widescreenDisplayCollection', '宽屏显示 - 收藏页', '宽屏显示 - 收藏页', true], ['menu_darkMode', '暗黑模式', '暗黑模式', true], ['menu_darkModeType', '暗黑模式切换(1~4)', '暗黑模式切换', 1], ['menu_darkModeAuto', '暗黑模式跟随浏览器', '暗黑模式跟随浏览器', false], @@ -52,6 +56,10 @@ GM_setValue('menu_darkModeType', menu_ALL[i][3]); } menu_ID[i] = GM_registerMenuCommand(`${menu_num(menu_ALL[i][3])} ${menu_ALL[i][1]}`, function(){menu_toggle(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`)}); + } else if (menu_ALL[i][0] === 'menu_widescreenDisplayIndex' || menu_ALL[i][0] === 'menu_widescreenDisplayQuestion' || menu_ALL[i][0] === 'menu_widescreenDisplaySearch' || menu_ALL[i][0] === 'menu_widescreenDisplayCollection') { + if (menu_value('menu_widescreenDisplay')) { + menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); + } } else { menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } @@ -122,7 +130,7 @@ // 添加样式 function addStyle() { - let style = `/* 屏蔽登录提示 */ + let style = `/* 屏蔽登录提示(问题页中间的元素) */ .Question-mainColumnLogin {display: none !important;} /* 屏蔽首页广告 */ .TopstoryItem--advertCard {display: none !important;} @@ -131,19 +139,23 @@ /* 屏蔽文章页推荐文章 */ .Recommendations-Main {display: none !important;} `, - style_1 = `/* 宽屏显示 */ -.GlobalSideBar, .Question-sideColumn, .ContentLayout-sideColumn, .SearchSideBar, .Card.QuestionHeaderTopicMeta, .ClubSideBar { - display: none !important; -} -.Topstory-mainColumn, .Question-mainColumn, .ContentLayout-mainColumn,.SearchMain, .QuestionWaiting-mainColumn, .Club-mainColumn, .Post-mainColumn { - width: 1000px !important; -} -.QuestionWaiting-mainColumn { - margin-right: 0 !important; -} -.ImageMessage-ImageView { - z-index: 999 !important; -}`, + style_widescreenDisplayIndex = `/* 宽屏显示 - 首页 */ +.Topstory-mainColumn {width: 1000px !important;} +.GlobalSideBar {display: none !important;} +`, + style_widescreenDisplayQuestion = `/* 宽屏显示 - 问题页 */ +.Question-mainColumn, .ListShortcut {width: 1000px !important;} +.Question-sideColumn {display: none !important;} +.QuestionWaiting-mainColumn {margin-right: 0 !important;} +`, + style_widescreenDisplaySearch = `/* 宽屏显示 - 搜索页 */ +.SearchMain, .ContentLayout-mainColumn, .QuestionWaiting-mainColumn, .Club-mainColumn, .Post-mainColumn {width: 1000px !important;} +.SearchSideBar, .ContentLayout-sideColumn, .Card.QuestionHeaderTopicMeta, .ClubSideBar {display: none !important;} +`, + style_widescreenDisplayCollection = `/* 宽屏显示 - 收藏页 */ +.CollectionsDetailPage-mainColumn {width: 1000px !important;} +.CollectionDetailPageSideBar {display: none !important;} +`, style_2 = `/* 隐藏在各列表中查看文章时开头显示的大图,不影响文章、专栏页面 */ .RichContent img.ArticleItem-image {display: none !important;} `, @@ -175,8 +187,8 @@ html[data-theme=dark] .Highlight em {color: #c33c39 !important;} /* 背景颜色 - 网页 */ html[data-theme=dark] body, html[data-theme=dark] .Select-option:focus {background: #22272E !important;} /* 背景颜色 - 问题 */ -html[data-theme=dark] .AppHeader, html[data-theme=dark] .QuestionHeader, html[data-theme=dark] .QuestionHeader-footer, html[data-theme=dark] .EmoticonsFooter-item--selected, html[data-theme=dark] .Card, html[data-theme=dark] .ContentItem-actions, html[data-theme=dark] .MoreAnswers .List-headerText, html[data-theme=dark] .CommentsV2-withPagination, html[data-theme=dark] .Topbar, html[data-theme=dark] .CommentsV2-footer, html[data-theme=dark] .CommentEditorV2-inputWrap--active, html[data-theme=dark] .InputLike, html[data-theme=dark] .Popover-content, html[data-theme=dark] .Notifications-footer, html[data-theme=dark] .Messages-footer, html[data-theme=dark] .Modal-inner, html[data-theme=dark] .Emoticons, html[data-theme=dark] .EmoticonsFooter, html[data-theme=dark] .SearchTabs, html[data-theme=dark] .Popover-arrow:after, html[data-theme=dark] .CommentEditorV2-inputWrap, html[data-theme=dark] .ProfileHeader-wrapper, html[data-theme=dark] .UserCover, html[data-theme=dark] .AnswerForm-footer, html[data-theme=dark] .Editable-toolbar, html[data-theme=dark] .AnswerForm-fullscreenContent .Editable-toolbar, html[data-theme=dark] .KfeCollection-PcCollegeCard-wrapper, html[data-theme=dark] .KfeCollection-PcCollegeCard-root, html[data-theme=dark] .HotItem, html[data-theme=dark] .HotList, html[data-theme=dark] .HotListNavEditPad, html[data-theme=dark] .QuestionWaiting-typesTopper, html[data-theme=dark] .QuestionWaiting-types, html[data-theme=dark] .PostItem, html[data-theme=dark] .ClubSideBar section, html[data-theme=dark] .SearchSubTabs, html[data-theme=dark] .Club-SearchPosts-Content, html[data-theme=dark] .Club-content, html[data-theme=dark] .ClubJoinOrCheckinButton, html[data-theme=dark] .ClubEdit, html[data-theme=dark] .CornerButton, html[data-theme=dark] .Notifications-Section-header, html[data-theme=dark] .NotificationList, .NotificationList-Item.NotificationList-Item:after, .NotificationList-DateSplit.NotificationList-DateSplit:after, html[data-theme=dark] .Chat, .ChatUserListItem:after, .ChatListGroup-SectionTitle--bottomBorder:after, html[data-theme=dark] .ActionMenu, .ChatSideBar-Search--active, html[data-theme=dark] .ChatSideBar-Search-ResultListWrap, html[data-theme=dark] .QuestionMainDivider-inner, html[data-theme=dark] .Topic-bar, html[data-theme=dark] .AnnotationTag, html[data-theme=dark] .HoverCard, html[data-theme=dark] .HoverCard-loading, html[data-theme=dark] .ExploreSpecialCard, html[data-theme=dark] .ExploreHomePage-ContentSection-moreButton a, html[data-theme=dark] .ExploreRoundtableCard, html[data-theme=dark] .ExploreCollectionCard, html[data-theme=dark] .ExploreColumnCard, html[data-theme=dark] .RichText .lazy[data-lazy-status], html[data-theme=dark] #TopstoryContent > div:first-child, html[data-theme=dark] .Topstory-newUserFollowCountPanel {background: #2D333B !important;} -html[data-theme=dark] .CommentListV2-header-divider, html[data-theme=dark] .CommentsV2-openComment-divider, html[data-theme=dark] .AnswerForm-fullscreenScroller, html[data-theme=dark] .HotListNav-item, html[data-theme=dark] .AutoInviteItem-wrapper--desktop, html[data-theme=dark] .ExploreSpecialCard-contentTag, html[data-theme=dark] .ExploreCollectionCard-contentTypeTag, html[data-theme=dark] .Reward-TipjarDialog-tagLine {background-color: #222933 !important;} +html[data-theme=dark] .AppHeader, html[data-theme=dark] .QuestionHeader, html[data-theme=dark] .QuestionHeader-footer, html[data-theme=dark] .EmoticonsFooter-item--selected, html[data-theme=dark] .Card, html[data-theme=dark] .ContentItem-actions, html[data-theme=dark] .MoreAnswers .List-headerText, html[data-theme=dark] .CommentsV2-withPagination, html[data-theme=dark] .Topbar, html[data-theme=dark] .CommentsV2-footer, html[data-theme=dark] .CommentEditorV2-inputWrap--active, html[data-theme=dark] .InputLike, html[data-theme=dark] .Popover-content, html[data-theme=dark] .Notifications-footer, html[data-theme=dark] .Messages-footer, html[data-theme=dark] .Modal-inner, html[data-theme=dark] .Emoticons, html[data-theme=dark] .EmoticonsFooter, html[data-theme=dark] .SearchTabs, html[data-theme=dark] .Popover-arrow:after, html[data-theme=dark] .CommentEditorV2-inputWrap, html[data-theme=dark] .ProfileHeader-wrapper, html[data-theme=dark] .UserCover, html[data-theme=dark] .AnswerForm-footer, html[data-theme=dark] .Editable-toolbar, html[data-theme=dark] .AnswerForm-fullscreenContent .Editable-toolbar, html[data-theme=dark] .KfeCollection-PcCollegeCard-wrapper, html[data-theme=dark] .KfeCollection-PcCollegeCard-root, html[data-theme=dark] .HotItem, html[data-theme=dark] .HotList, html[data-theme=dark] .HotListNavEditPad, html[data-theme=dark] .QuestionWaiting-typesTopper, html[data-theme=dark] .QuestionWaiting-types, html[data-theme=dark] .PostItem, html[data-theme=dark] .ClubSideBar section, html[data-theme=dark] .SearchSubTabs, html[data-theme=dark] .Club-SearchPosts-Content, html[data-theme=dark] .Club-content, html[data-theme=dark] .ClubJoinOrCheckinButton, html[data-theme=dark] .ClubEdit, html[data-theme=dark] .CornerButton, html[data-theme=dark] .Notifications-Section-header, html[data-theme=dark] .NotificationList, .NotificationList-Item.NotificationList-Item:after, .NotificationList-DateSplit.NotificationList-DateSplit:after, html[data-theme=dark] .Chat, .ChatUserListItem:after, .ChatListGroup-SectionTitle--bottomBorder:after, html[data-theme=dark] .ActionMenu, .ChatSideBar-Search--active, html[data-theme=dark] .ChatSideBar-Search-ResultListWrap, html[data-theme=dark] .QuestionMainDivider-inner, html[data-theme=dark] .Topic-bar, html[data-theme=dark] .AnnotationTag, html[data-theme=dark] .HoverCard, html[data-theme=dark] .HoverCard-loading, html[data-theme=dark] .ExploreSpecialCard, html[data-theme=dark] .ExploreHomePage-ContentSection-moreButton a, html[data-theme=dark] .ExploreRoundtableCard, html[data-theme=dark] .ExploreCollectionCard, html[data-theme=dark] .ExploreColumnCard, html[data-theme=dark] .RichText .lazy[data-lazy-status], html[data-theme=dark] #TopstoryContent > div:first-child, html[data-theme=dark] .Topstory-newUserFollowCountPanel, html[data-theme=dark] .AnswerForm-fullscreenContent .RichText {background: #2D333B !important;} +html[data-theme=dark] .CommentListV2-header-divider, html[data-theme=dark] .CommentsV2-openComment-divider, html[data-theme=dark] .AnswerForm-fullscreenScroller, html[data-theme=dark] .HotListNav-item, html[data-theme=dark] .AutoInviteItem-wrapper--desktop, html[data-theme=dark] .ExploreSpecialCard-contentTag, html[data-theme=dark] .ExploreCollectionCard-contentTypeTag, html[data-theme=dark] .Reward-TipjarDialog-tagLine, html[data-theme=dark] .AnswerForm-footer.useNewEditorSetting > div, html[data-theme=dark] .AnswerForm-fullscreenContent > div:first-child, html[data-theme=dark] .Editable-toolbar button:hover, html[data-theme=dark] .AuthorInfo.AnswerAdd-info + div {background-color: #222933 !important;} html[data-theme=dark] .CornerButton:hover {background: #3f4752 !important;} /* 右下角按钮 */ /* 背景颜色 - 引用 */ @@ -225,8 +237,8 @@ html[data-theme=dark] img {opacity: 0.8 !important;} html[data-theme=dark] .GifPlayer img, html[data-theme=dark] .ImageView-img {opacity: 1 !important;} /* 边框 */ -html[data-theme=dark] .Topbar, html[data-theme=dark] .CommentsV2-footer, html[data-theme=dark] .Topstory-mainColumnCard .Card:not(.Topstory-tabCard), html[data-theme=dark] .NestComment:not(:last-child):after, html[data-theme=dark] .NestComment--rootComment:after, html[data-theme=dark] .NestComment .NestComment--child:after, html[data-theme=dark] .NestComment .NestComment--child:after, html[data-theme=dark] .CommentsV2-replyNum, html[data-theme=dark] .CommentItemV2:not(:first-child):after, html[data-theme=dark] .Tabs, html[data-theme=dark] .Popover-arrow:after {border-bottom: 1px solid #282d35 !important;} -html[data-theme=dark] .CommentEditorV2-inputWrap--active, html[data-theme=dark] .CommentEditorV2-inputWrap, html[data-theme=dark] .PostItem {border: none !important;} +html[data-theme=dark] .Topbar, html[data-theme=dark] .CommentsV2-footer, html[data-theme=dark] .Topstory-mainColumnCard .Card:not(.Topstory-tabCard), html[data-theme=dark] .NestComment:not(:last-child):after, html[data-theme=dark] .NestComment--rootComment:after, html[data-theme=dark] .NestComment .NestComment--child:after, html[data-theme=dark] .NestComment .NestComment--child:after, html[data-theme=dark] .CommentsV2-replyNum, html[data-theme=dark] .CommentItemV2:not(:first-child):after, html[data-theme=dark] .Tabs, html[data-theme=dark] .Popover-arrow:after, html[data-theme=dark] .SelfCollectionItem-innerContainer, html[data-theme=dark] .CollectionDetailPageItem-innerContainer {border-bottom: 1px solid #282d35 !important;} +html[data-theme=dark] .CommentEditorV2-inputWrap--active, html[data-theme=dark] .CommentEditorV2-inputWrap, html[data-theme=dark] .PostItem, html[data-theme=dark] .AnswerForm .Editable-toolbar, html[data-theme=dark] .Editable-toolbar span {border: none !important;} html[data-theme=dark] .InputLike {border: 1px solid #424b56 !important;} html[data-theme=dark] .Popover .InputLike {border: 1px solid #2d333b !important;} html[data-theme=dark] .HotLanding-contentItem:not(:last-child) {border-bottom: 1px solid #424b56 !important;} @@ -355,7 +367,12 @@ html {filter: brightness(75%) sepia(30%) !important; background-image: url();} } // 宽屏显示 - if (menu_value('menu_widescreenDisplay')) style += style_1; + if (menu_value('menu_widescreenDisplay')){ + if (menu_value('menu_widescreenDisplayIndex')) style += style_widescreenDisplayIndex; + if (menu_value('menu_widescreenDisplayQuestion') && location.pathname.indexOf('/question/') > -1) style += style_widescreenDisplayQuestion; + if (menu_value('menu_widescreenDisplaySearch') && (location.pathname === '/search' || location.pathname.indexOf('/club/') > -1 || location.pathname.indexOf('/topic/') > -1)) style += style_widescreenDisplaySearch; + if (menu_value('menu_widescreenDisplayCollection') && location.pathname.indexOf('/collection/') > -1) style += style_widescreenDisplayCollection; + } // 调整图片最大高度 if (menu_value('menu_picHeight')) style += style_5; // 隐藏文章开头大图