File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// ==UserScript==
22// @name 知乎增强
3- // @version 1.3.5
3+ // @version 1.3.6
44// @author X.I.U
55// @description 移除登录弹窗、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、置顶显示时间、显示问题时间、区分问题文章、默认高清原图、默认站外直链
66// @match *://www.zhihu.com/*
@@ -204,11 +204,13 @@ function addTypeTips() {
204204 if ( patt_zhuanlan . test ( postList [ num ] . href ) ) { // 如果是文章
205205 postList [ num ] . innerHTML = `<small class="zhihu_e_tips" style="color: #ffffff;font-weight: normal;font-size: 12px;padding: 0 3px;border-radius: 2px;background-color: #2196F3;display: inline-block;height: 18px;">文章</small> ` + postList [ num ] . innerHTML
206206 } else if ( patt_question . test ( postList [ num ] . href ) ) { // 如果是问题
207+ if ( ! postList [ num ] . getAttribute ( 'data-tooltip' ) ) { // 排除用户名后面的蓝标、黄标等链接
207208 if ( patt_question_answer . test ( postList [ num ] . href ) ) { // 如果是指向回答的问题(而非指向纯问题的链接)
208209 postList [ num ] . innerHTML = `<small class="zhihu_e_tips" style="color: #ffffff;font-weight: normal;font-size: 12px;padding: 0 3px;border-radius: 2px;background-color: #f68b83;display: inline-block;height: 18px;">问题</small> ` + postList [ num ] . innerHTML
209210 } else {
210211 postList [ num ] . innerHTML = `<small class="zhihu_e_tips" style="color: #ffffff;font-weight: normal;font-size: 12px;padding: 0 3px;border-radius: 2px;background-color: #ff5a4e;display: inline-block;height: 18px;">问题</small> ` + postList [ num ] . innerHTML
211212 }
213+ }
212214 } else if ( patt_video . test ( postList [ num ] . href ) ) { // 如果是视频
213215 postList [ num ] . innerHTML = `<small class="zhihu_e_tips" style="color: #ffffff;font-weight: normal;font-size: 12px;padding: 0 3px;border-radius: 2px;background-color: #00BCD4;display: inline-block;height: 18px;">视频</small> ` + postList [ num ] . innerHTML
214216 }
You can’t perform that action at this time.
0 commit comments