MCPcopy Create free account
hub / github.com/XIU2/UserScript / addStyle

Function addStyle

Zhihu-Beautification.user.js:186–500  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

184
185 // 添加样式
186 function addStyle() {
187 let style = `/* 屏蔽登录提示(问题页中间的元素) */
188.Question-mainColumnLogin {display: none !important;}
189/* 屏蔽回答页/首页广告 */
190.Pc-card.Card, .Pc-Business-Card-PcTopFeedBanner {display: none !important;}
191/* 屏蔽文章页推荐文章 */
192.Recommendations-Main {display: none !important;}
193/* 解除盐选内容选中复制限制 */
194div[class*="ManuscriptIntro-root-"] {user-select: auto !important;}
195`,
196 style_index = `/* 屏蔽首页广告 */
197.TopstoryItem--advertCard {display: none !important;}
198/* 屏蔽首页活动广告 */
199main.App-main > .Topstory > div:not(.Topstory-container) {display: none !important;}
200html[data-theme="light"] header.AppHeader {background-color: #ffffff !important; -webkit-box-shadow: 0 1px 3px rgba(18,18,18,.1) !important; box-shadow: 0 1px 3px rgba(18,18,18,.1) !important;}
201html[data-theme="light"] header.AppHeader a[aria-label="知乎"] svg {filter: invert(57%) sepia(71%) saturate(949%) hue-rotate(190deg) brightness(86%) contrast(188%) !important;}
202html[data-theme="light"] .AppHeader-TabsLink {color: #8590a6 !important; font-weight: normal !important;}
203html[data-theme="light"] .AppHeader-userInfo Button svg, .SearchBar-searchButton svg {color: inherit !important;}
204html[data-theme="light"] .AppHeader-userInfo button>div {color: #8590a6 !important;}
205html[data-theme="light"] .Input-wrapper.Input-wrapper--grey {background: #f6f6f6 !important;}
206html[data-theme="light"] .SearchBar input {color: #121212 !important;}
207html[data-theme="light"] .SearchBar input::placeholder, html[data-theme="light"] .SearchBar input::-webkit-input-placeholder, html[data-theme="light"] {color: #919baf !important;}
208html[data-theme="light"] .Button--primary.Button--blue {color: #fff !important;background-color: #06f !important;}
209/* 右上角 通知/私信 红点颜色 */
210html[data-theme=light] .AppHeader-notifications:not([aria-label=通知])>div:first-of-type, html[data-theme=light] .AppHeader-messages:not([aria-label=私信])>div:first-of-type {color: #ffffff !important;border: 2px solid #ffffff !important;}
211
212 `,
213 style_widescreenDisplayIndex = `/* 宽屏显示 - 首页 */
214.Topstory-mainColumn, .QuestionWaiting-mainColumn {width: inherit !important;}
215.Topstory-mainColumn~div,[data-za-detail-view-path-module="RightSideBar"] {display: none !important;}
216.Topstory-container {width: ${GM_getValue('menu_widescreenDisplayWidth')}px;}
217@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Topstory-container {width: 97% !important;}}
218`,
219 style_widescreenDisplayQuestion = `/* 宽屏显示 - 问题页 */
220.Question-mainColumn, .ListShortcut, .QuestionWaiting-mainColumn {width: inherit !important;}
221.Question-mainColumn+div,[data-za-detail-view-path-module="RightSideBar"], .Question-sideColumn, .GlobalSideBar {display: none !important;}
222.QuestionWaiting-mainColumn {margin-right: 0 !important;}
223.Question-main {width: ${GM_getValue('menu_widescreenDisplayWidth')}px;}
224@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Question-main {width: auto !important;}}
225@media only screen and (max-width: ${GM_getValue('menu_widescreenDisplayWidth')-100}px) {.Question-main {width: 98.5% !important;}}
226.AuthorInfo {max-width: 100% !important;}
227`,
228 style_widescreenDisplaySearch = `/* 宽屏显示 - 搜索页 */
229.SearchMain, .ContentLayout-mainColumn, .Club-mainColumn, .Post-mainColumn, [data-za-detail-view-path-module=TopicItem]>div:first-child {width: inherit !important;}
230.SearchMain+div, .ContentLayout-sideColumn, .Card.QuestionHeaderTopicMeta, .ClubSideBar, [data-za-detail-view-path-module=TopicItem]>div:not(:first-child) {display: none !important;}
231.Search-container, .ContentLayout, .Club-container, .Post-container, [data-za-detail-view-path-module=TopicItem] {width: ${GM_getValue('menu_widescreenDisplayWidth')}px;}
232@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Search-container, .ContentLayout, .Club-container, .Post-container, [data-za-detail-view-path-module=TopicItem] {width: 97.5% !important;}}
233`,
234 style_widescreenDisplayCollection = `/* 宽屏显示 - 收藏页 */
235.CollectionsDetailPage-mainColumn {width: inherit !important;}
236.CollectionsDetailPage-mainColumn+div {display: none !important;}
237.CollectionsDetailPage {width: ${GM_getValue('menu_widescreenDisplayWidth')}px;}
238@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.CollectionsDetailPage {width: 98.5% !important;}}
239`,
240 style_widescreenDisplayPost = `/* 宽屏显示 - 文章页 */
241.Post-content {min-width: auto !important;}
242.Post-SideActions {left: calc(10vw) !important;}
243.Post-Row-Content-right {display: none !important;}

Callers 1

Calls 3

getThemeFunction · 0.85
setThemeFunction · 0.85
menu_valueFunction · 0.70

Tested by

no test coverage detected