|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 知乎增强 |
3 | | -// @version 1.9.0 |
| 3 | +// @version 1.9.1 |
4 | 4 | // @author X.I.U |
5 | | -// @description 移除登录弹窗、屏蔽首页视频、默认收起回答、快捷收起当前回答/评论(左键两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、移除高亮链接、屏蔽盐选内容、净化标题消息、展开问题描述、置顶显示时间、完整问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 |
| 5 | +// @description 移除登录弹窗、屏蔽首页视频、默认收起回答、快捷收起当前回答/评论(左键两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、移除高亮链接、屏蔽盐选内容、净化标题消息、展开问题描述、显示问题作者、置顶显示时间、完整问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 |
6 | 6 | // @match *://www.zhihu.com/* |
7 | 7 | // @match *://zhuanlan.zhihu.com/* |
8 | 8 | // @icon https://static.zhihu.com/heifetz/favicon.ico |
@@ -1215,6 +1215,18 @@ function addLocationchange() { |
1215 | 1215 | } |
1216 | 1216 |
|
1217 | 1217 |
|
| 1218 | +// 显示问题作者 |
| 1219 | +function question_author() { |
| 1220 | + if (document.querySelector('.BrandQuestionSymbol, .QuestionAuthor')) return |
| 1221 | + let qJson = JSON.parse(document.querySelector('#js-initialData').textContent).initialState.entities.questions[/\d+/.exec(location.pathname)[0]].author, |
| 1222 | + html = `<div class="BrandQuestionSymbol"><a class="BrandQuestionSymbol-brandLink" href="/people/${qJson.urlToken}"><img role="presentation" src="${qJson.avatarUrl}" class="BrandQuestionSymbol-logo" alt=""><span class="BrandQuestionSymbol-name">${qJson.name}</span></a><span>的提问</span><div class="BrandQuestionSymbol-divider"></div></div>`; |
| 1223 | + //html2 = `<div class="QuestionAuthor"><div class="AuthorInfo AuthorInfo--plain" itemprop="author" itemscope="" itemtype="http://schema.org/Person"><div class="AuthorInfo"><span class="UserLink AuthorInfo-avatarWrapper"><div class="Popover"><div id="Popover18-toggle" aria-haspopup="true" aria-expanded="false" aria-owns="Popover18-content"><a class="UserLink-link" data-za-detail-view-element_name="User" target="_blank" href="${qJson.urlToken}"><img class="Avatar AuthorInfo-avatar" width="24" height="24" src="${qJson.avatarUrl}"></a></div></div></span><div class="AuthorInfo-content"><div class="AuthorInfo-head"><span class="UserLink AuthorInfo-name"><div class="Popover"><div id="Popover19-toggle" aria-haspopup="true" aria-expanded="false" aria-owns="Popover19-content"><a class="UserLink-link" data-za-detail-view-element_name="User" target="_blank" href="${qJson.urlToken}">${qJson.name}</a></div></div></span></div></div></div></div></div>` |
| 1224 | + //console.log(qJson) |
| 1225 | + document.querySelector('.QuestionHeader-topics').insertAdjacentHTML('beforebegin', html); |
| 1226 | + //document.querySelector('.QuestionPage h1.QuestionHeader-title').insertAdjacentHTML('afterend', html2); |
| 1227 | +} |
| 1228 | + |
| 1229 | + |
1218 | 1230 | // [完整显示时间 + 置顶显示时间] 功能修改自:https://greasyfork.org/scripts/402808(从 JQuery 改为原生 JavaScript,且精简、优化了代码) |
1219 | 1231 | // 完整显示时间 + 置顶显示时间 |
1220 | 1232 | function topTime_(css, classs) { |
@@ -1360,7 +1372,7 @@ function questionInvitation(){ |
1360 | 1372 | defaultCollapsedAnswer(); // 默认收起回答 |
1361 | 1373 | } |
1362 | 1374 | setInterval(function(){topTime_('.ContentItem.AnswerItem', 'ContentItem-meta')}, 300); // 置顶显示时间 |
1363 | | - setTimeout(question_time, 300); // 问题创建时间 |
| 1375 | + setTimeout(function(){question_time(); question_author()}, 100); //问题创建时间 + 显示问题作者 |
1364 | 1376 | questionInvitation(); // 默认折叠邀请 |
1365 | 1377 |
|
1366 | 1378 | } else if (location.pathname === '/search') { // 搜索结果页 // |
|
0 commit comments