11// ==UserScript==
22// @name 知乎美化
3- // @version 1.5.20
3+ // @version 1.5.21
44// @author X.I.U
55// @description 宽屏显示、暗黑模式(4种)、暗黑模式跟随浏览器、屏蔽首页活动广告、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏
66// @match *://www.zhihu.com/*
@@ -217,12 +217,12 @@ html[data-theme=light] .AppHeader-notifications:not([aria-label=通知])>div:fir
217217@media only screen and (max-width: ${ Number ( GM_getValue ( 'menu_widescreenDisplayWidth' ) ) + 50 } px) {.Topstory-container {width: 97% !important;}}
218218` ,
219219 style_widescreenDisplayQuestion = `/* 宽屏显示 - 问题页 */
220- .Question-mainColumn, . ListShortcut, .QuestionWaiting-mainColumn {width: inherit !important;}
220+ .ListShortcut, .QuestionWaiting-mainColumn {width: inherit !important;}
221221.Question-mainColumn+div,[data-za-detail-view-path-module="RightSideBar"], .Question-sideColumn, .GlobalSideBar {display: none !important;}
222222.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;}}
223+ .Question-mainColumn {width: ${ GM_getValue ( 'menu_widescreenDisplayWidth' ) } px; margin: auto!important ;}
224+ @media only screen and (max-width: ${ Number ( GM_getValue ( 'menu_widescreenDisplayWidth' ) ) + 50 } px) {.Question-mainColumn {width: auto !important;}}
225+ @media only screen and (max-width: ${ GM_getValue ( 'menu_widescreenDisplayWidth' ) - 100 } px) {.Question-mainColumn {width: 98.5% !important;}}
226226.AuthorInfo {max-width: 100% !important;}
227227` ,
228228 style_widescreenDisplaySearch = `/* 宽屏显示 - 搜索页 */
@@ -477,7 +477,7 @@ html {filter: brightness(65%) sepia(30%) !important; background-image: url();}
477477 // 宽屏显示
478478 if ( menu_value ( 'menu_widescreenDisplayIndex' ) ) style += style_widescreenDisplayIndex ;
479479 if ( menu_value ( 'menu_widescreenDisplayQuestion' ) && location . pathname . indexOf ( '/question/' ) > - 1 ) style += style_widescreenDisplayQuestion ;
480- if ( menu_value ( 'menu_widescreenDisplaySearch' ) && ( location . pathname === '/search' || location . pathname . indexOf ( '/club/' ) > - 1 || location . pathname . indexOf ( '/topic/' ) > - 1 ) ) style += style_widescreenDisplaySearch ;
480+ if ( menu_value ( 'menu_widescreenDisplaySearch' ) ) style += style_widescreenDisplaySearch ;
481481 if ( menu_value ( 'menu_widescreenDisplayCollection' ) && location . pathname . indexOf ( '/collection/' ) > - 1 ) style += style_widescreenDisplayCollection ;
482482 if ( menu_value ( 'menu_widescreenDisplayPost' ) && location . hostname . indexOf ( 'zhuanlan' ) > - 1 && ( location . pathname . indexOf ( '/edit' ) === - 1 || location . pathname . indexOf ( '/write' ) === - 1 ) ) style += style_widescreenDisplayPost ;
483483 if ( menu_value ( 'menu_widescreenDisplayPeople' ) && location . pathname . indexOf ( '/people/' ) > - 1 ) style += style_widescreenDisplayPeople ;
@@ -523,7 +523,7 @@ html {filter: brightness(65%) sepia(30%) !important; background-image: url();}
523523
524524 // 获取知乎 Cookie 中的主题类型
525525 function getTheme ( ) {
526- let name = 'theme =' ,
526+ let name = 'themeApp =' ,
527527 ca = document . cookie . split ( ';' ) ;
528528 for ( let i = 0 ; i < ca . length ; i ++ ) {
529529 let c = ca [ i ] . trim ( ) ;
@@ -536,12 +536,12 @@ html {filter: brightness(65%) sepia(30%) !important; background-image: url();}
536536 function setTheme ( theme ) {
537537 switch ( theme ) {
538538 case 'light' :
539- document . cookie = 'theme =; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/' ;
539+ document . cookie = 'themeApp =; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=.zhihu.com ' ;
540540 document . lastChild . setAttribute ( 'data-theme' , 'light' ) ;
541541 location . reload ( ) ; // 刷新网页
542542 break ;
543543 case 'dark' :
544- document . cookie = 'theme =dark; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/' ;
544+ document . cookie = 'themeApp =dark; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/; domain=.zhihu.com ' ;
545545 document . lastChild . setAttribute ( 'data-theme' , 'dark' ) ;
546546 if ( GM_getValue ( 'menu_darkMode' ) ) location . reload ( ) ; // 刷新网页
547547 break ;
0 commit comments