Fuck ZhiHu Mobile Style

日他娘的逼乎手机网页版 样式ver; 针对电脑版进行修改,适配手机屏幕;

目前为 2022-10-30 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Fuck ZhiHu Mobile Style
  3. // @namespace https://github.com/ipcjs
  4. // @version 2.2.0
  5. // @description 日他娘的逼乎手机网页版 样式ver; 针对电脑版进行修改,适配手机屏幕;
  6. // @author ipcjs
  7. // @compatible chrome
  8. // @compatible firefox
  9. // @include https://www.zhihu.com/*
  10. // @include https://zhuanlan.zhihu.com/*
  11. // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
  12. // @grant GM_addStyle
  13. // @grant GM.addStyle
  14. // @run-at document-start
  15. // ==/UserScript==
  16.  
  17. // @template-content
  18.  
  19. var css = "@charset \"UTF-8\";\n/* Header */\n.AppHeader {\n min-width: inherit; }\n .AppHeader .ZhihuLogoLink,\n .AppHeader .SearchBar {\n display: none; }\n .AppHeader .AppHeader-inner {\n width: 100%;\n min-width: inherit; }\n .AppHeader .AppHeader-Tabs {\n margin-left: 0px;\n margin-right: 4px; }\n .AppHeader-Tab {\n padding: 0 4px !important; }\n .AppHeader-messages, .AppHeader-notifications {\n margin-right: 16px; }\n .AppHeader-userInfo {\n margin-left: 0px !important;\n margin-right: 32px; }\n .AppHeader-navItem {\n padding: 0 5px; }\n .AppHeader-nav {\n margin-left: 16px;\n margin-right: 16px; }\n\n/* 往下滚动后显示的顶栏 */\n.TopstoryPageHeader {\n min-width: inherit !important;\n width: 100% !important; }\n .TopstoryPageHeader > div {\n flex: none; }\n .TopstoryPageHeader > .TopstoryPageHeader-main {\n flex: 0 0 64px; }\n .TopstoryPageHeader > .TopstoryPageHeader-aside {\n margin: 0 30px 0 12px;\n flex: auto; }\n .TopstoryPageHeader-main .TopstoryPageHeader-tabs {\n display: none; }\n\n.Topstory .css-11h6utu {\n width: 100%; }\n\n/* 通用列表 */\n.Topstory-container,\n.Search-container,\n.Question-main,\n.Profile-main {\n display: block;\n width: 100%;\n padding: 0px; }\n\n.Topstory-mainColumn,\n.SearchMain,\n.Question-mainColumn,\n.Profile-mainColumn {\n width: 100%; }\n\n.Question-sideColumn,\n.Profile-sideColumn {\n width: 100%; }\n\n/* 回答页面的Header */\n.QuestionHeader .QuestionHeader-content {\n width: 100%;\n display: block;\n padding: 0px; }\n\n.QuestionHeader .QuestionHeader-main {\n width: 100%; }\n\n.QuestionHeader .QuestionHeader-side {\n width: 100%; }\n\n.QuestionHeader .NumberBoard {\n margin: auto; }\n\n.QuestionHeader {\n min-width: inherit; }\n\n.PageHeader .QuestionHeader-content {\n width: 100%; }\n\n.PageHeader .QuestionHeader-main {\n width: 100%;\n padding: 0px; }\n\n.PageHeader .QuestionHeader-side {\n display: none; }\n\n.AuthorInfo {\n overflow-x: hidden; }\n\n/* 个人主页 */\n.ProfileHeader {\n width: 100%;\n padding: 0px; }\n .ProfileHeader-buttons {\n position: static; }\n .ProfileHeader-contentHead {\n padding-right: 0px; }\n\n.SearchTabs-inner {\n width: 100%; }\n\n.SearchTabs-inner,\n.ProfileMain-tabs {\n overflow: scroll; }\n .SearchTabs-inner::-webkit-scrollbar,\n .ProfileMain-tabs::-webkit-scrollbar {\n display: none; }\n\n/* 列表Item上的按钮 */\n.ContentItem-action {\n margin-left: 8px; }\n\n/*\n// 测试按钮的选择器\n.ContentItem-actions button.Button--withLabel,\nbutton.ContentItem-action {\n color: red;\n}\n*/\n/* 专栏页面 */\n.Post-content {\n min-width: unset; }\n\n.Post-Main {\n padding: 0px 16px; }\n\n.Post-NormalSub > div,\n.Post-NormalMain > .Post-Header,\n.Post-NormalMain > div {\n width: 100%; }\n\n/* 专栏主页的Header */\n.ColumnPageHeader-content {\n width: calc(100% - 32px);\n padding: 0px 16px; }\n\n.ColumnPageHeader-profile {\n display: none; }\n\n.ColumnPageHeader-WriteButton {\n font-size: 0px; }\n\n/* 弹窗 */\nbutton.Button.css-1x9te0t,\n.Modal-closeButton {\n position: static;\n margin-left: auto;\n margin-right: auto; }\n\ndiv.css-1bkecgh,\n.Modal {\n width: 100%; }\n\n/* 追踪水印, https://twitter.com/undef_i/status/1566315374765031424 */\n#root > div > div[class^=\"css-\"] {\n display: none; }\n";
  20.  
  21. function main ({ log }) {
  22. removeThankButton(document);
  23. new MutationObserver((mutations, observer) => {
  24. // log(mutations)
  25. for (let m of mutations) {
  26. for (let node of m.addedNodes) {
  27. if (node.nodeType === Node.ELEMENT_NODE) {
  28. removeThankButton(node);
  29. }
  30. }
  31. }
  32. }).observe(document.documentElement, {
  33. childList: true,
  34. subtree: true
  35. });
  36. function removeThankButton(node) {
  37. let count = 0;
  38. node.querySelectorAll('button.ContentItem-action, .ContentItem-actions button.Button--withLabel')
  39. .forEach(btn => {
  40. let $text = btn.childNodes[1];
  41. let group;
  42. if ($text && $text.nodeType === Node.TEXT_NODE) {
  43. let text = $text.textContent;
  44. console.log(text);
  45. count++;
  46. if (text === '感谢' || text === '取消感谢') {
  47. btn.style.display = 'none';
  48. } else if (text === ' 举报' || text === '分享' || text === '收藏' || text === '喜欢') {
  49. $text.textContent = '';
  50. } else if ((group = text.match(/(\d+) 条评论/))) {
  51. $text.textContent = `${group[1]}`;
  52. } else {
  53. count--;
  54. }
  55. }
  56. });
  57. if (count > 0) {
  58. log(`modify: ${count}`);
  59. }
  60. }
  61. }
  62.  
  63. log = GM_info.script.name.endsWith('.dev') ? console.debug.bind(console) : () => { };
  64.  
  65. GM.addStyle(css);
  66. main({ log });
  67.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址