shumin-zhihu

自用,适配Safari

  1. // ==UserScript==
  2. // @name shumin-zhihu
  3. // @namespace https://stay.app/
  4. // @version 0.1.1
  5. // @description 自用,适配Safari
  6. // @author qianjunlang
  7. // @match *zhihu.com/*
  8. // @grant none
  9. // @icon https://static.zhihu.com/heifetz/favicon.ico
  10. // @compatible edge
  11. // @compatible chrome
  12. // @compatible safari
  13. // ==/UserScript==
  14. (function () {
  15. 'use strict';
  16. // Your code here...
  17. setTimeout(function(){
  18. if(document.title.indexOf('(')==0)
  19. document.title = document.title.slice(document.title.indexOf(')')+1)
  20. },1000);
  21.  
  22.  
  23. let style = `font-weight: bold;font-size: 13px;padding: 1px 4px 0;border-radius: 2px;display: inline-block;vertical-align: top;margin: ${(location.pathname === '/search') ? '2' : '4'}px 4px 0 0;`
  24. document.body.appendChild(document.createElement('style')).textContent = `/* 区分问题文章 */
  25. .AnswerItem .ContentItem-title a:not(.zhihu_e_toQuestion)::before {content:'问题';color: #f68b83;background-color: #f68b8333;${style}}
  26. .TopstoryQuestionAskItem .ContentItem-title a:not(.zhihu_e_toQuestion)::before {content:'问题';color: #ff5a4e;background-color: #ff5a4e33;${style}}
  27. .ZVideoItem .ContentItem-title a::before, .ZvideoItem .ContentItem-title a::before {content:'视频';color: #00BCD4;background-color: #00BCD433;${style}}
  28. .ArticleItem .ContentItem-title a::before {content:'文章';color: #2196F3;background-color: #2196F333;${style}}
  29. `;
  30.  
  31. })();

QingJ © 2025

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