知乎网站手机浏览器增强

用手机浏览器看知乎网站有很多限制。可以在手机浏览器设置UserAgent为PC,模拟电脑端访问,然后此脚本可以让知乎电脑版的网页自适应手机屏幕宽度。

目前為 2023-08-11 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name 知乎网站手机浏览器增强
  3. // @namespace https://kenjinghuizhao.github.io/S3-02-Dev/KenBrowser/KenBrowser_homepage.html
  4. // @version v3.0.0812
  5. // @description 用手机浏览器看知乎网站有很多限制。可以在手机浏览器设置UserAgent为PC,模拟电脑端访问,然后此脚本可以让知乎电脑版的网页自适应手机屏幕宽度。
  6. // @author ken.jinghui.zhao
  7. // @match https://*.zhihu.com
  8. // @icon
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. var display_width = document.documentElement.clientWidth-10;
  17. var total_width = display_width+300;
  18. var padding = Math.round(display_width/120);
  19. var nod = document.createElement('style');
  20. var str=
  21. 'div.Topstory-container, \n'+ //知乎主页主框
  22. 'div.Topstory-mainColumn, \n'+ //知乎主页左边文章列表框
  23. 'div.Topstory-mainColumn img._1sezuny, \n'+ //知乎主页文章列表图片
  24. 'div.Topstory-mainColumn video, \n'+ //知乎主页文章列表视频
  25. 'div.QuestionHeader-main, \n'+ //知乎答案顶栏
  26. 'div.Question-mainColumn, \n'+ //知乎答案左边文章内容
  27. 'div.css-78p1r9, header.Post-Header, div.Post-RichTextContainer,\n'+ //知乎专栏文章
  28. 'div.Post-Sub.Post-NormalSub>div, \n'+ //知乎专栏评论区
  29. 'div.css-1cqr2ue, \n'+ //知乎答案评论回复
  30. 'div.Search-container, div.SearchMain \n'+ //知乎搜索结果列表
  31. '{width:' +display_width+ 'px !important;} \n'+
  32.  
  33. 'div.Topstory-container, \n'+ //知乎主页主框
  34. 'div.Card.TopstoryItem.TopstoryItem-isRecommend, \n'+ //知乎主页文章列表卡片
  35. 'div.Pc-feedAd-container, div.Pc-feedAd-card-content-detail, \n'+ //知乎主页广告卡片
  36. 'div.QuestionHeader-main, \n'+ //知乎答案顶栏
  37. 'div.Question-main, \n'+ //知乎答案包括右边栏
  38. 'div.QuestionAnswer-content, \n'+ //知乎答案页主答案
  39. 'div.List-item, \n'+ //知乎答案页后续答案
  40. 'div.css-78p1r9, header.Post-Header, div.Post-RichTextContainer, \n'+ //知乎专栏
  41. 'div.Search-container, div.List-item, ContentItem-actions \n'+ //知乎搜索结果列表
  42. '{padding-left:' +padding+ 'px !important; \n'+
  43. ' padding-right:' +padding+ 'px !important; \n'+
  44. ' margin-left:2px !important; \n'+
  45. ' margin-right:0px !important;} \n'+
  46.  
  47. 'div.Pc-feedAd-card-content \n'+ //知乎主页广告外框
  48. '{flex-direction:column;} \n'+
  49. 'div.Question-main \n'+ //知乎答案包括右边栏
  50. '{width:' +total_width+ 'px;} \n'+
  51. 'div.Post-content \n'+ //知乎专栏?
  52. '{min-width:' +display_width+ 'px;} \n'+
  53. 'div.RichContent-inner \n'+ //知乎搜索结果
  54. '{overflow:hidden !important;} \n'+
  55. 'Button.css-1x9te0t \n'+ //知乎回答评论回复关闭按钮
  56. '{background:teal; right:8px; padding:0px} \n'
  57. ;
  58. nod.innerHTML=str;
  59. document.getElementsByTagName('head')[0].appendChild(nod);
  60. void(0);
  61.  
  62. })();

QingJ © 2025

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