diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 32ab3a23d..2591e1fba 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -34,7 +34,7 @@ const download_url_us = [ ['https://gh.h233.eu.org/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [@X.I.U/XIU2] 提供'], //['https://gh.api.99988866.xyz/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [github.com/hunshcn/gh-proxy] 提供'], // 官方演示站用的人太多了 - ['https://rapidgit.jjda.de5.net/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [热心网友] 提供'], + //['https://rapidgit.jjda.de5.net/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [热心网友] 提供'],//挂了,522超时 ['https://gh.ddlc.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [@mtr-static-official] 提供'], ['https://gh-proxy.org/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [gh-proxy.com] 提供'], //['https://hk.gh-proxy.org/https://github.com', '其他', '[中国香港] - 该公益加速源由 [gh-proxy.com] 提供'], @@ -46,7 +46,7 @@ ['https://gh.jasonzeng.dev/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [gh.jasonzeng.dev] 提供'], ['https://gh.monlor.com/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [gh.monlor.com] 提供'], //['https://fastgit.cc/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [fastgit.cc] 提供'], // 挂了 - ['https://github.tbedu.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [github.tbedu.top] 提供'], + //['https://github.tbedu.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [github.tbedu.top] 提供'],//挂了 DNS_PROBE_FINISHED_NXDOMAIN ['https://github.geekery.cn/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [github.geekery.cn] 提供'], ['https://github.ednovas.xyz/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [github.ednovas.xyz] 提供'], ['https://ghfile.geekertao.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [ghfile.geekertao.top] 提供'], @@ -99,7 +99,7 @@ //['https://jsd.proxy.aks.moe/gh', '香港 2', '[中国 香港] - 该公益加速源由 [cdn.akass.cn] 提供'], // 证书错误 ['https://wget.la/https://raw.githubusercontent.com', '香港 1', '[中国香港、中国台湾、日本、美国等](CDN 不固定) - 该公益加速源由 [ucdn.me] 提供 - 缓存:无(或很短)'], ['https://hk.gh-proxy.org/https://raw.githubusercontent.com', '香港 2', '[中国香港] - 该公益加速源由 [gh-proxy.com] 提供 - 缓存:有(官方注明 2 小时)'], - ['https://hub.glowp.xyz/https://raw.githubusercontent.com', '香港 3', '[中国香港] - 该公益加速源由 [hub.glowp.xyz] 提供 - 缓存:有'], + //['https://hub.glowp.xyz/https://raw.githubusercontent.com', '香港 3', '[中国香港] - 该公益加速源由 [hub.glowp.xyz] 提供 - 缓存:有'], //域名到期失效 //['https://gitproxy.click/https://raw.githubusercontent.com', '香港', '[中国 香港] - 该公益加速源由 [gitproxy.click] 提供'], // 输出错误 //['https://cdn.moran233.xyz/https://raw.githubusercontent.com', '香港', '[中国 香港] - 该公益加速源由 [cdn.moran233.xyz] 提供'], // 404 //['https://gitdl.cn/https://raw.githubusercontent.com', '香港 3', '[中国香港] - 该公益加速源由 [gitdl] 提供 - 缓存:有'], // 输出文件错误 @@ -505,4 +505,4 @@ window.dispatchEvent(new Event('urlchange')) }); } -})(); \ No newline at end of file +})(); diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index 584671e36..ef314e2d1 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎美化 -// @version 1.5.20 +// @version 1.5.23 // @author X.I.U // @description 宽屏显示、暗黑模式(4种)、暗黑模式跟随浏览器、屏蔽首页活动广告、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏 // @match *://www.zhihu.com/* @@ -13,6 +13,7 @@ // @grant GM_getValue // @grant GM_setValue // @grant GM_notification +// @grant window.onurlchange // @sandbox JavaScript // @license GPL-3.0 License // @run-at document-start @@ -27,9 +28,9 @@ ['menu_widescreenDisplay', '宽屏显示', '勾选 = 该页面开启宽屏显示(刷新后查看效果)', ''], ['menu_widescreenDisplayIndex', '首页', '宽屏显示', true], ['menu_widescreenDisplayQuestion', '问题页', '宽屏显示', true], - ['menu_widescreenDisplaySearch', '搜索页、话题页、圈子', '宽屏显示', true], + ['menu_widescreenDisplaySearch', '搜索页、话题页', '宽屏显示', true], ['menu_widescreenDisplayCollection', '收藏页', '宽屏显示', true], - ['menu_widescreenDisplayPost', '文章页', '宽屏显示', false], + ['menu_widescreenDisplayPost', '文章页(暂不可用)', '宽屏显示', false], ['menu_widescreenDisplayPeople', '用户主页', '用户主页', false], ['menu_widescreenDisplayWidth', '宽屏宽度', '宽屏宽度 (默认 1000)', '1000'], ['menu_darkMode', '暗黑模式', '暗黑模式', true], @@ -43,7 +44,11 @@ if (GM_getValue(menu_ALL[i][0]) == null){GM_setValue(menu_ALL[i][0], menu_ALL[i][3])}; } registerMenuCommand(); + if (window.onurlchange === undefined) {addUrlChangeEvent();} // Tampermonkey v4.11 版本添加的 onurlchange 事件 grant,可以监控 pjax 等网页的 URL 变化 addStyle(); + window.addEventListener('urlchange', function(){ // 网页 URL 动态变化后再次执行(针对在任何页面搜索时) + if (menu_value('menu_widescreenDisplaySearch') && (location.pathname === '/search' || location.pathname.indexOf('/club/') > -1 || location.pathname.indexOf('/topic/') > -1)) {addStyle()}; + }) // 向下翻时自动隐藏顶栏 if (menu_value('menu_hideTitle')) setTimeout(hideTitle, 2000); @@ -217,19 +222,19 @@ html[data-theme=light] .AppHeader-notifications:not([aria-label=通知])>div:fir @media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Topstory-container {width: 97% !important;}} `, style_widescreenDisplayQuestion = `/* 宽屏显示 - 问题页 */ -.Question-mainColumn, .ListShortcut, .QuestionWaiting-mainColumn {width: inherit !important;} +.QuestionWaiting-mainColumn {width: inherit !important;} .Question-mainColumn+div,[data-za-detail-view-path-module="RightSideBar"], .Question-sideColumn, .GlobalSideBar {display: none !important;} .QuestionWaiting-mainColumn {margin-right: 0 !important;} -.Question-main {width: ${GM_getValue('menu_widescreenDisplayWidth')}px;} -@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Question-main {width: auto !important;}} -@media only screen and (max-width: ${GM_getValue('menu_widescreenDisplayWidth')-100}px) {.Question-main {width: 98.5% !important;}} +.Question-mainColumn, .ListShortcut {width: ${GM_getValue('menu_widescreenDisplayWidth')}px; margin: auto!important;} +@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Question-mainColumn, .ListShortcut {width: auto !important;}} +@media only screen and (max-width: ${GM_getValue('menu_widescreenDisplayWidth')-100}px) {.Question-mainColumn, .ListShortcut {width: 98.5% !important;}} .AuthorInfo {max-width: 100% !important;} `, style_widescreenDisplaySearch = `/* 宽屏显示 - 搜索页 */ -.SearchMain, .ContentLayout-mainColumn, .Club-mainColumn, .Post-mainColumn, [data-za-detail-view-path-module=TopicItem]>div:first-child {width: inherit !important;} -.SearchMain+div, .ContentLayout-sideColumn, .Card.QuestionHeaderTopicMeta, .ClubSideBar, [data-za-detail-view-path-module=TopicItem]>div:not(:first-child) {display: none !important;} -.Search-container, .ContentLayout, .Club-container, .Post-container, [data-za-detail-view-path-module=TopicItem] {width: ${GM_getValue('menu_widescreenDisplayWidth')}px;} -@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Search-container, .ContentLayout, .Club-container, .Post-container, [data-za-detail-view-path-module=TopicItem] {width: 97.5% !important;}} +.SearchMain, .App-main>[data-za-detail-view-path-module=TopicItem]>div:first-child {width: inherit !important;} +.SearchMain+div, .App-main>[data-za-detail-view-path-module=TopicItem]>div:not(:first-child) {display: none !important;} +.Search-container, .App-main>[data-za-detail-view-path-module=TopicItem] {width: ${GM_getValue('menu_widescreenDisplayWidth')}px;} +@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Search-container, .App-main>[data-za-detail-view-path-module=TopicItem] {width: 97.5% !important;}} `, style_widescreenDisplayCollection = `/* 宽屏显示 - 收藏页 */ .CollectionsDetailPage-mainColumn {width: inherit !important;} @@ -523,7 +528,7 @@ html {filter: brightness(65%) sepia(30%) !important; background-image: url();} // 获取知乎 Cookie 中的主题类型 function getTheme() { - let name = 'theme=', + let name = 'themeApp=', ca = document.cookie.split(';'); for (let i=0; i function pushState(){ + var ret = f.apply(this, arguments); + window.dispatchEvent(new Event('pushstate')); + window.dispatchEvent(new Event('urlchange')); + return ret; + })(history.pushState); + + history.replaceState = ( f => function replaceState(){ + var ret = f.apply(this, arguments); + window.dispatchEvent(new Event('replacestate')); + window.dispatchEvent(new Event('urlchange')); + return ret; + })(history.replaceState); + + window.addEventListener('popstate',()=>{ + window.dispatchEvent(new Event('urlchange')) + }); + } })(); \ No newline at end of file diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 222676ddb..4fc7b4455 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -3,7 +3,7 @@ // @name:zh-CN 知乎增强 // @name:zh-TW 知乎增強 // @name:ru Улучшение Zhihu -// @version 2.3.29 +// @version 2.3.30 // @author X.I.U // @description A more personalized Zhihu experience~ // @description:zh-CN 移除登录弹窗、屏蔽指定类别(视频、盐选、文章、想法、关注[赞同/关注了XX]等)、屏蔽低赞/低评、屏蔽用户、屏蔽关键词、默认收起回答、快捷收起回答/评论(左键两侧)、快捷回到顶部(右键两侧)、区分问题文章、移除高亮链接、净化搜索热门、净化标题消息、展开问题描述、显示问题作者、默认高清原图(无水印)、置顶显示时间、完整问题时间、直达问题按钮、默认站外直链... @@ -295,119 +295,122 @@ function collapsedAnswer() { function collapsedNowAnswer(selectors) { backToTop(selectors) // 快捷回到顶部 if (!menu_value('menu_collapsedNowAnswer')) return - document.querySelector(selectors).onclick = function(event){ - if (event.target == this) { - // 下面这段主要是 [收起回答],顺便 [收起评论](如果展开了的话) - let rightButton = document.querySelector('.ContentItem-actions.Sticky.RichContent-actions.is-fixed.is-bottom') - if (rightButton) { // 悬浮在底部的 [收起回答](此时正在浏览回答内容 [中间区域]) - // 固定的 [收起评论](先看看是否展开评论) - let commentCollapseButton = rightButton.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') - //console.log('111') - if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); - // 再去收起回答 - rightButton = rightButton.querySelector('.ContentItem-rightButton[data-zop-retract-question]') - //console.log('222') - if (rightButton) rightButton.click(); - - } else { // 固定在回答底部的 [收起回答](此时正在浏览回答内容 [尾部区域]) - - // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) - //if (getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container'))) {getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container')).click();console.log('asfaf')} - - let answerCollapseButton_ = false; - for (let el of document.querySelectorAll('.ContentItem-rightButton[data-zop-retract-question]')) { // 遍历所有回答底部的 [收起] 按钮 - if (isElementInViewport(el)) { // 判断该 [收起] 按钮是否在可视区域内 - // 固定的 [收起评论](先看看是否展开评论,即存在 [收起评论] 按钮) - let commentCollapseButton = el.parentNode.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') - // 如果展开了评论,就收起评论 - //console.log('333') - //if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); - if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) { - commentCollapseButton.click(); - if (!isElementInViewport(commentCollapseButton)) scrollTo(0,el.offsetTop+50) - } - //console.log('444') - el.click() // 再去收起回答 - answerCollapseButton_ = true; // 如果找到并点击收起了,就没必要执行下面的代码了(可视区域中没有 [收起回答] 时) - break - } - } - // 针对完全看不到 [收起回答] 按钮时(如 [头部区域],以及部分明明很长却不显示悬浮横条的回答) - if (!answerCollapseButton_) { - for (let el of document.querySelectorAll('.List-item, .Card.AnswerCard, .Card.TopstoryItem')) { // 遍历所有回答主体元素 - if (isElementInViewport_(el)) { // 判断该回答是否在可视区域内 + let element = document.querySelector(selectors) + if (element) { + element.onclick = function(event){ + if (event.target == this) { + // 下面这段主要是 [收起回答],顺便 [收起评论](如果展开了的话) + let rightButton = document.querySelector('.ContentItem-actions.Sticky.RichContent-actions.is-fixed.is-bottom') + if (rightButton) { // 悬浮在底部的 [收起回答](此时正在浏览回答内容 [中间区域]) + // 固定的 [收起评论](先看看是否展开评论) + let commentCollapseButton = rightButton.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') + //console.log('111') + if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); + // 再去收起回答 + rightButton = rightButton.querySelector('.ContentItem-rightButton[data-zop-retract-question]') + //console.log('222') + if (rightButton) rightButton.click(); + + } else { // 固定在回答底部的 [收起回答](此时正在浏览回答内容 [尾部区域]) + + // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) + //if (getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container'))) {getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container')).click();console.log('asfaf')} + + let answerCollapseButton_ = false; + for (let el of document.querySelectorAll('.ContentItem-rightButton[data-zop-retract-question]')) { // 遍历所有回答底部的 [收起] 按钮 + if (isElementInViewport(el)) { // 判断该 [收起] 按钮是否在可视区域内 // 固定的 [收起评论](先看看是否展开评论,即存在 [收起评论] 按钮) - let commentCollapseButton = el.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') + let commentCollapseButton = el.parentNode.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') // 如果展开了评论,就收起评论 - //console.log('555',commentCollapseButton) + //console.log('333') + //if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) { commentCollapseButton.click(); if (!isElementInViewport(commentCollapseButton)) scrollTo(0,el.offsetTop+50) } - let answerCollapseButton__ = el.querySelector('.ContentItem-rightButton[data-zop-retract-question]'); - //console.log('666') - if (answerCollapseButton__) answerCollapseButton__.click() // 再去收起回答 + //console.log('444') + el.click() // 再去收起回答 + answerCollapseButton_ = true; // 如果找到并点击收起了,就没必要执行下面的代码了(可视区域中没有 [收起回答] 时) break } } - } - } - - // 下面这段只针对 [收起评论](如果展开了的话) - let commentCollapseButton_ = false, commentCollapseButton__ = false; - // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) - let commentCollapseButton = getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container')) - if (commentCollapseButton) { - //console.log('777', commentCollapseButton) - commentCollapseButton.click(); - } else { // 固定的 [收起评论](此时正在浏览评论内容 [头部区域]) - let commentCollapseButton_1 = document.querySelectorAll('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type, .ContentItem-action > button.Button.Button--plain.Button--withIcon.Button--withLabel:first-of-type') - if (commentCollapseButton_1.length > 0) { - for (let el of commentCollapseButton_1) { - if (el.textContent.indexOf('收起评论') > -1) { - if (isElementInViewport(el)) { - //console.log('888') - el.click() - commentCollapseButton_ = true // 如果找到并点击了,就没必要执行下面的代码了(可视区域中没有 [收起评论] 时) + // 针对完全看不到 [收起回答] 按钮时(如 [头部区域],以及部分明明很长却不显示悬浮横条的回答) + if (!answerCollapseButton_) { + for (let el of document.querySelectorAll('.List-item, .Card.AnswerCard, .Card.TopstoryItem')) { // 遍历所有回答主体元素 + if (isElementInViewport_(el)) { // 判断该回答是否在可视区域内 + // 固定的 [收起评论](先看看是否展开评论,即存在 [收起评论] 按钮) + let commentCollapseButton = el.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') + // 如果展开了评论,就收起评论 + //console.log('555',commentCollapseButton) + if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) { + commentCollapseButton.click(); + if (!isElementInViewport(commentCollapseButton)) scrollTo(0,el.offsetTop+50) + } + let answerCollapseButton__ = el.querySelector('.ContentItem-rightButton[data-zop-retract-question]'); + //console.log('666') + if (answerCollapseButton__) answerCollapseButton__.click() // 再去收起回答 break } } } } - if (commentCollapseButton_ == false) { // 可视区域中没有 [收起评论] 时(此时正在浏览评论内容 [头部区域] + [尾部区域](不上不下的,既看不到固定的 [收起评论] 又看不到悬浮的 [收起评论])),需要判断可视区域中是否存在评论元素 - let commentCollapseButton_1 = document.querySelectorAll('.Comments-container') + + // 下面这段只针对 [收起评论](如果展开了的话) + let commentCollapseButton_ = false, commentCollapseButton__ = false; + // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) + let commentCollapseButton = getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container')) + if (commentCollapseButton) { + //console.log('777', commentCollapseButton) + commentCollapseButton.click(); + } else { // 固定的 [收起评论](此时正在浏览评论内容 [头部区域]) + let commentCollapseButton_1 = document.querySelectorAll('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type, .ContentItem-action > button.Button.Button--plain.Button--withIcon.Button--withLabel:first-of-type') if (commentCollapseButton_1.length > 0) { for (let el of commentCollapseButton_1) { - if (isElementInViewport(el)) { - let parentElement = findParentElement(el, 'List-item') || findParentElement(el, 'Card '), - commentCollapseButton = parentElement.querySelector('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') - if (commentCollapseButton.textContent.indexOf('收起评论') > -1) { - //console.log('999') - commentCollapseButton.click() - if (!isElementInViewport(commentCollapseButton)) {console.log(parentElement,parentElement.offsetTop,parentElement.offsetHeight);scrollTo(0,parentElement.offsetTop+parentElement.offsetHeight-50)} - commentCollapseButton__ = true // 如果找到并点击了,就没必要执行下面的代码了(可视区域中没有 评论元素 时) + if (el.textContent.indexOf('收起评论') > -1) { + if (isElementInViewport(el)) { + //console.log('888') + el.click() + commentCollapseButton_ = true // 如果找到并点击了,就没必要执行下面的代码了(可视区域中没有 [收起评论] 时) break } } } } - if (commentCollapseButton__ == false) { // 如果上面的都没找到,那么就尝试寻找评论末尾的 [评论回复框] - let commentCollapseButton_2 = document.querySelectorAll('.Editable-content') - if (commentCollapseButton_2.length > 0) { - for (let el of commentCollapseButton_2) { + if (commentCollapseButton_ == false) { // 可视区域中没有 [收起评论] 时(此时正在浏览评论内容 [头部区域] + [尾部区域](不上不下的,既看不到固定的 [收起评论] 又看不到悬浮的 [收起评论])),需要判断可视区域中是否存在评论元素 + let commentCollapseButton_1 = document.querySelectorAll('.Comments-container') + if (commentCollapseButton_1.length > 0) { + for (let el of commentCollapseButton_1) { if (isElementInViewport(el)) { let parentElement = findParentElement(el, 'List-item') || findParentElement(el, 'Card '), - commentCollapseButton = parentElement.querySelector('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') - //console.log(commentCollapseButton) + commentCollapseButton = parentElement.querySelector('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') if (commentCollapseButton.textContent.indexOf('收起评论') > -1) { - //console.log('101010') + //console.log('999') commentCollapseButton.click() if (!isElementInViewport(commentCollapseButton)) {console.log(parentElement,parentElement.offsetTop,parentElement.offsetHeight);scrollTo(0,parentElement.offsetTop+parentElement.offsetHeight-50)} + commentCollapseButton__ = true // 如果找到并点击了,就没必要执行下面的代码了(可视区域中没有 评论元素 时) break } } } } + if (commentCollapseButton__ == false) { // 如果上面的都没找到,那么就尝试寻找评论末尾的 [评论回复框] + let commentCollapseButton_2 = document.querySelectorAll('.Editable-content') + if (commentCollapseButton_2.length > 0) { + for (let el of commentCollapseButton_2) { + if (isElementInViewport(el)) { + let parentElement = findParentElement(el, 'List-item') || findParentElement(el, 'Card '), + commentCollapseButton = parentElement.querySelector('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') + //console.log(commentCollapseButton) + if (commentCollapseButton.textContent.indexOf('收起评论') > -1) { + //console.log('101010') + commentCollapseButton.click() + if (!isElementInViewport(commentCollapseButton)) {console.log(parentElement,parentElement.offsetTop,parentElement.offsetHeight);scrollTo(0,parentElement.offsetTop+parentElement.offsetHeight-50)} + break + } + } + } + } + } } } } @@ -419,10 +422,13 @@ function collapsedNowAnswer(selectors) { // 回到顶部(监听点击事件,鼠标右键点击网页两侧空白处) function backToTop(selectors) { if (!menu_value('menu_backToTop')) return - document.querySelector(selectors).oncontextmenu = function(event){ - if (event.target == this) { - event.preventDefault(); - window.scrollTo(0,0) + let element = document.querySelector(selectors) + if (element) { + element.oncontextmenu = function(event){ + if (event.target == this) { + event.preventDefault(); + window.scrollTo(0,0) + } } } } @@ -1682,7 +1688,7 @@ function switchHomeRecommend() { if (location.pathname.indexOf('question') > -1 && location.href.indexOf('/log') == -1) { // 回答页 // if (location.pathname.indexOf('waiting') == -1) { collapsedNowAnswer('.QuestionPage'); // 收起当前回答 + 快捷返回顶部 - collapsedNowAnswer('.Question-main'); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer('.QuestionPage>#AnswerFormPortalContainer+div>div:first-child'); //收起当前回答 + 快捷返回顶部 questionRichTextMore(); // 展开问题描述 if (location.pathname.indexOf('answer') == -1) { // 问题页而不是回答页 blockLowCount('question'); // 屏蔽低赞/低评回答/文章 diff --git a/other/Autopage/rules.json b/other/Autopage/rules.json index 188ee117f..62a1fe04f 100644 --- a/other/Autopage/rules.json +++ b/other/Autopage/rules.json @@ -7235,6 +7235,24 @@ "replaceE": ".wp-pagenavi" } }, + "JComic": { + "host": "jcomic.net", + "url": "/^\\/page\\//", + "pager": { + "nextL": "//div[@class='container']//a/button[text()='下一章']/..", + "pageE": ".container>.container+.row.col-lg-12.col-md-12.col-xs-12>img", + "replaceE": ".container>.row.col-lg-12.col-md-12.col-xs-12:first-child" + } + }, + "JComic - cat": { + "host": "jcomic.net", + "url": "/^\\/cat\\//", + "pager": { + "nextL": ".pagination>.active+li>a", + "pageE": "body>.container>div>.row.col-lg-4.col-md-6.col-xs-12", + "replaceE": ".pagination" + } + }, "色漫天堂": { "host": "smtt6.com", "url": "/^\\/man-hua-yue-du\\//", @@ -7627,7 +7645,7 @@ } }, "凸凹吧 tuao.cc": { - "host": ["www.tuao.cc","www.nnao.cc"], + "host": ["www.tuao.cc","www.nnao.cc","www.24ao.cc"], "url": "if(fun.indexOF(/^\\/Articles\\/Content\\//)){let d=document.querySelector('#imgData');if(d&&d.value){let a=d.value.split('|');if(a.length>4){const container=document.getElementById('pageContainer');let i=4;const timer=setInterval(()=>{if(i>=a.length){clearInterval(timer);return};const img=document.createElement('img');img.src=atob(a[i]);container.appendChild(img);i++},1000)};return true};}", "style": "#pagination,body>div:last-of-type,ins", "hiddenPN": true