diff --git a/3dm-Enhanced.user.js b/3dm-Enhanced.user.js index 922d3d5..ba5c63b 100644 --- a/3dm-Enhanced.user.js +++ b/3dm-Enhanced.user.js @@ -40,7 +40,7 @@ menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]); menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } - menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});}); + menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/412890/feedback', {active: true,insert: true,setParent: true});}); } // 菜单开关 diff --git a/52pojie-Beautification.user.js b/52pojie-Beautification.user.js index 82d5838..a95761c 100644 --- a/52pojie-Beautification.user.js +++ b/52pojie-Beautification.user.js @@ -37,7 +37,7 @@ menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]); menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } - menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});}); + menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/412681/feedback', {active: true,insert: true,setParent: true});}); } // 菜单开关 diff --git a/52pojie-Enhanced.user.js b/52pojie-Enhanced.user.js index 040f918..59b56fb 100644 --- a/52pojie-Enhanced.user.js +++ b/52pojie-Enhanced.user.js @@ -39,7 +39,7 @@ menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]); menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } - menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});}); + menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/412680/feedback', {active: true,insert: true,setParent: true});}); } // 菜单开关 diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 1d98114..acb6d87 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -71,7 +71,7 @@ menu_raw_fast = 0 } menu_menu_raw_fast_ID = GM_registerMenuCommand(`🔄 [ ${raw_url[menu_raw_fast][1]} ] 加速源 (☁) - 点击切换`, menu_toggle_raw_fast); - menu_feedBack_ID = GM_registerMenuCommand('💬 反馈 & 建议 [Github]', function () {window.GM_openInTab('https://github.com/XIU2/UserScript', {active: true,insert: true,setParent: true});}); + menu_feedBack_ID = GM_registerMenuCommand('💬 反馈 & 建议 [Github]', function () {window.GM_openInTab('https://github.com/XIU2/UserScript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/412245/feedback', {active: true,insert: true,setParent: true});}); } // 切换加速源 diff --git a/Hostloc-Enhanced.user.js b/Hostloc-Enhanced.user.js index 2451c3c..0963e19 100644 --- a/Hostloc-Enhanced.user.js +++ b/Hostloc-Enhanced.user.js @@ -38,7 +38,7 @@ menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]); menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } - menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});}); + menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/414005/feedback', {active: true,insert: true,setParent: true});}); } // 菜单开关 diff --git a/Lanzou-Enhanced.user.js b/Lanzou-Enhanced.user.js index 7d81572..475eec5 100644 --- a/Lanzou-Enhanced.user.js +++ b/Lanzou-Enhanced.user.js @@ -55,7 +55,7 @@ menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } } - menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});}); + menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/419224/feedback', {active: true,insert: true,setParent: true});}); } // 菜单开关 diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index 93cd9c9..9694b03 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -41,7 +41,7 @@ menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]); menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } - menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});}); + menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/412212/feedback', {active: true,insert: true,setParent: true});}); } // 菜单开关 diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 60f7dff..08d4a66 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -42,7 +42,7 @@ function registerMenuCommand() { menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]); menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } - menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});}); + menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/419081/feedback', {active: true,insert: true,setParent: true});}); } @@ -70,90 +70,88 @@ function menu_value(menuName) { // 一键收起回答 -function collapsedAnswer(){ - if(menu_value('menu_collapsedAnswer')){ - let button_Add = `` - let style_Add = document.createElement('style'); - style_Add.innerHTML = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:45px !important;}'; - document.head.appendChild(style_Add); - document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', button_Add); - document.getElementById('collapsed-button').onclick = function () { - document.querySelectorAll('.ContentItem-rightButton').forEach(function (el) { - if (el.hasAttribute('data-zop-retract-question')) { - el.click() - } - }); - } +function collapsedAnswer() { + if (!menu_value('menu_collapsedAnswer')) return + let button_Add = `` + let style_Add = document.createElement('style'); + style_Add.innerHTML = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:45px !important;}'; + document.head.appendChild(style_Add); + document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', button_Add); + document.getElementById('collapsed-button').onclick = function () { + document.querySelectorAll('.ContentItem-rightButton').forEach(function (el) { + if (el.hasAttribute('data-zop-retract-question')) { + el.click() + } + }); } } // 收起当前回答、评论(监听点击事件,点击网页两侧空白处) -function collapsedNowAnswer(selectors){ - backToTop(selectors) - if (menu_value('menu_collapsedNowAnswer')) { - 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') - if (commentCollapseButton && commentCollapseButton.innerText.indexOf("收起评论") > -1) { - commentCollapseButton.click(); +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') + if (commentCollapseButton && commentCollapseButton.innerText.indexOf("收起评论") > -1) { + commentCollapseButton.click(); + } + // 再去收起回答 + rightButton = rightButton.querySelector('.ContentItem-rightButton') + if (rightButton && rightButton.hasAttribute('data-zop-retract-question')) { + rightButton.click(); + } + } else { // 固定的 [收起回答](此时正在浏览回答内容 [尾部区域]) + for (let el of document.querySelectorAll('.ContentItem-rightButton')) { + if (el.hasAttribute('data-zop-retract-question')) { + if (isElementInViewport(el)) { + // 固定的 [收起评论](先看看是否展开评论) + let commentCollapseButton = el.parentNode.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel') + if (commentCollapseButton && commentCollapseButton.innerText.indexOf("收起评论") > -1) { + commentCollapseButton.click(); + } + el.click() // 再去收起回答 + break + } } - // 再去收起回答 - rightButton = rightButton.querySelector('.ContentItem-rightButton') - if (rightButton && rightButton.hasAttribute('data-zop-retract-question')) { - rightButton.click(); - } - } else { // 固定的 [收起回答](此时正在浏览回答内容 [尾部区域]) - for (let el of document.querySelectorAll('.ContentItem-rightButton')) { - if (el.hasAttribute('data-zop-retract-question')) { + } + } + + var commentCollapseButton_ = false; + // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) + let commentCollapseButton = document.querySelector('.CommentCollapseButton') + if (commentCollapseButton) { + commentCollapseButton.click(); + } else { // 固定的 [收起评论](此时正在浏览评论内容 [头部区域]) + let commentCollapseButton_1 = document.querySelectorAll('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel') + if (commentCollapseButton_1.length > 0) { + for (let el of commentCollapseButton_1) { + if (el.innerText.indexOf("收起评论") > -1) { if (isElementInViewport(el)) { - // 固定的 [收起评论](先看看是否展开评论) - let commentCollapseButton = el.parentNode.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel') - if (commentCollapseButton && commentCollapseButton.innerText.indexOf("收起评论") > -1) { - commentCollapseButton.click(); - } - el.click() // 再去收起回答 + el.click() + commentCollapseButton_ = true // 如果找到并点击了,就没必要执行下面的代码了(可视区域中没有 [收起评论] 时) break } } } } - - var commentCollapseButton_ = false; - // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) - let commentCollapseButton = document.querySelector('.CommentCollapseButton') - if (commentCollapseButton) { - commentCollapseButton.click(); - } else { // 固定的 [收起评论](此时正在浏览评论内容 [头部区域]) - let commentCollapseButton_1 = document.querySelectorAll('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel') + if (commentCollapseButton_ == false) { // 可视区域中没有 [收起评论] 时(此时正在浏览评论内容 [头部区域] + [尾部区域](不上不下的,既看不到固定的 [收起评论] 又看不到悬浮的 [收起评论])),需要判断可视区域中是否存在评论元素 + let commentCollapseButton_1 = document.querySelectorAll('.NestComment') if (commentCollapseButton_1.length > 0) { for (let el of commentCollapseButton_1) { - if (el.innerText.indexOf("收起评论") > -1) { - if (isElementInViewport(el)) { - el.click() - commentCollapseButton_ = true // 如果找到并点击了,就没必要执行下面的代码了(可视区域中没有 [收起评论] 时) + if (isElementInViewport(el)) { + let commentCollapseButton = el.parentNode.parentNode.parentNode.parentNode.parentNode.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel') + if (commentCollapseButton.innerText.indexOf("收起评论") > -1) { + commentCollapseButton.click() break } } } } - if (commentCollapseButton_ == false) { // 可视区域中没有 [收起评论] 时(此时正在浏览评论内容 [头部区域] + [尾部区域](不上不下的,既看不到固定的 [收起评论] 又看不到悬浮的 [收起评论])),需要判断可视区域中是否存在评论元素 - let commentCollapseButton_1 = document.querySelectorAll('.NestComment') - if (commentCollapseButton_1.length > 0) { - for (let el of commentCollapseButton_1) { - if (isElementInViewport(el)) { - let commentCollapseButton = el.parentNode.parentNode.parentNode.parentNode.parentNode.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel') - if (commentCollapseButton.innerText.indexOf("收起评论") > -1) { - commentCollapseButton.click() - break - } - } - } - } - } } } } @@ -162,13 +160,12 @@ function collapsedNowAnswer(selectors){ // 回到顶部(监听点击事件,鼠标右键点击网页两侧空白处) -function backToTop(selectors){ - if(menu_value('menu_backToTop')){ - document.querySelector(selectors).oncontextmenu = function(event){ - if (event.target==this) { - event.preventDefault(); - window.scrollTo(0,0) - } +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) } } } @@ -191,32 +188,31 @@ function isElementInViewport(el) { var postNum; // 区分问题文章 function addTypeTips() { - if(menu_value('menu_typeTips')){ - // URL 匹配正则表达式 - let patt_zhuanlan = /zhuanlan.zhihu.com/, - patt_question = /question\/\d+/, - patt_question_answer = /answer\/\d+/, - patt_video = /\/zvideo\//, - patt_tip = /zhihu_e_tips/ - let postList = document.querySelectorAll('h2.ContentItem-title a'); - postNum = document.querySelectorAll('small.zhihu_e_tips'); - //console.log(`${postList.length} ${postNum.length}`) - if (postList.length > postNum.length){ - for(let num = postNum.length;num文章 ` + postList[num].innerHTML - }else if (patt_question.test(postList[num].href)){ // 如果是问题 - if (patt_question_answer.test(postList[num].href)){ // 如果是指向回答的问题(而非指向纯问题的链接) - postList[num].innerHTML = `问题 ` + postList[num].innerHTML - }else{ - postList[num].innerHTML = `问题 ` + postList[num].innerHTML - } - }else if (patt_video.test(postList[num].href)){ // 如果是视频 - postList[num].innerHTML = `视频 ` + postList[num].innerHTML + if (!menu_value('menu_typeTips')) return + // URL 匹配正则表达式 + let patt_zhuanlan = /zhuanlan.zhihu.com/, + patt_question = /question\/\d+/, + patt_question_answer = /answer\/\d+/, + patt_video = /\/zvideo\//, + patt_tip = /zhihu_e_tips/ + let postList = document.querySelectorAll('h2.ContentItem-title a'); + postNum = document.querySelectorAll('small.zhihu_e_tips'); + //console.log(`${postList.length} ${postNum.length}`) + if (postList.length > postNum.length) { + for (let num = postNum.length;num文章 ` + postList[num].innerHTML + } else if (patt_question.test(postList[num].href)) { // 如果是问题 + if (patt_question_answer.test(postList[num].href)) { // 如果是指向回答的问题(而非指向纯问题的链接) + postList[num].innerHTML = `问题 ` + postList[num].innerHTML + } else { + postList[num].innerHTML = `问题 ` + postList[num].innerHTML } - //postNum += 1; + } else if (patt_video.test(postList[num].href)) { // 如果是视频 + postList[num].innerHTML = `视频 ` + postList[num].innerHTML } + //postNum += 1; } } } @@ -284,7 +280,7 @@ function topTime_index() { // 发布时间置顶 topTime_publishTop(ContentItemTime, _this, 'ContentItem-meta') } - }) + }); } @@ -300,7 +296,7 @@ function topTime_question() { topTime_publishTop(ContentItemTime, _this, 'ContentItem-meta') } - }) + }); // 问题创建时间 if (!(document.querySelector('.QuestionPage .QuestionHeader-side p')) && window.location.href.indexOf("log") == -1) { // 没有执行过 且 非问题日志页 @@ -326,7 +322,7 @@ function topTime_search() { topTime_publishTop(ContentItemTime, _this, 'SearchItem-meta') } - }) + }); } @@ -342,7 +338,7 @@ function topTime_people() { topTime_publishTop(ContentItemTime, _this, 'ContentItem-meta') } - }) + }); } @@ -375,29 +371,27 @@ function topTime_zhuanlan() { // 完整显示时间 function topTime_allTime(ContentItemTime) { - if (menu_value('menu_allTime')) { - if (ContentItemTime.innerText.indexOf("发布于") == -1 && ContentItemTime.innerText.indexOf("编辑于") > -1) { //只有 "编辑于" 时增加具体发布时间 data-tooltip - let data_tooltip = ContentItemTime.querySelector('span').getAttribute('data-tooltip'); - let oldtext = ContentItemTime.querySelector('span').innerText; - ContentItemTime.querySelector('span').innerText = data_tooltip + "," + oldtext; - ContentItemTime.classList.add('full'); - } else if (ContentItemTime.innerText.indexOf("发布于") > -1 && ContentItemTime.innerText.indexOf("编辑于") == -1) { //只有 "发布于" 时替换为具体发布时间 data-tooltip - let data_tooltip = ContentItemTime.querySelector('span').getAttribute('data-tooltip'); - ContentItemTime.querySelector('span').innerText = data_tooltip; - ContentItemTime.classList.add('full'); - } + if (!menu_value('menu_allTime')) return + if (ContentItemTime.innerText.indexOf("发布于") == -1 && ContentItemTime.innerText.indexOf("编辑于") > -1) { //只有 "编辑于" 时增加具体发布时间 data-tooltip + let data_tooltip = ContentItemTime.querySelector('span').getAttribute('data-tooltip'); + let oldtext = ContentItemTime.querySelector('span').innerText; + ContentItemTime.querySelector('span').innerText = data_tooltip + "," + oldtext; + ContentItemTime.classList.add('full'); + } else if (ContentItemTime.innerText.indexOf("发布于") > -1 && ContentItemTime.innerText.indexOf("编辑于") == -1) { //只有 "发布于" 时替换为具体发布时间 data-tooltip + let data_tooltip = ContentItemTime.querySelector('span').getAttribute('data-tooltip'); + ContentItemTime.querySelector('span').innerText = data_tooltip; + ContentItemTime.classList.add('full'); } } // 发布时间置顶 function topTime_publishTop(ContentItemTime, _this, class_) { - if (menu_value('menu_publishTop')) { - if (!ContentItemTime.parentNode.classList.contains(class_)) { - let temp_time = ContentItemTime.cloneNode(true); - //_this.querySelector('.RichContent .ContentItem-time').style.display = 'none'; - _this.querySelector('.' + class_).insertAdjacentElement('beforeEnd', temp_time); - } + if (!menu_value('menu_publishTop')) return + if (!ContentItemTime.parentNode.classList.contains(class_)) { + let temp_time = ContentItemTime.cloneNode(true); + //_this.querySelector('.RichContent .ContentItem-time').style.display = 'none'; + _this.querySelector('.' + class_).insertAdjacentElement('beforeEnd', temp_time); } } @@ -489,14 +483,12 @@ function originalPic(){ pic1.setAttribute('src', pic1.getAttribute('data-original')) } } - }) + }); } -(function() { - addEventListener_DOMNodeInserted(); // 监听 网页插入元素 事件 - - // 默认折叠邀请,修改自:https://greasyfork.org/scripts/402808(从 JQuery 改为原生 JavaScript) +// 默认折叠邀请,修改自:https://greasyfork.org/scripts/402808(从 JQuery 改为原生 JavaScript) +function questionInvitation(){ let timer = setInterval(function(){ let QuestionInvitation = document.querySelector('.QuestionInvitation-content');if (!QuestionInvitation) return clearInterval(timer); @@ -511,51 +503,54 @@ function originalPic(){ QuestionInvitation.style.display = 'none' } } - }) + }); +} +(function() { + addEventListener_DOMNodeInserted(); // 监听 网页插入元素 事件 + questionInvitation(); // 默认折叠邀请 setInterval(originalPic,100); // 默认高清原图 - if(menu_value('menu_directLink')) setInterval(directLink, 100); // 默认站外直链 + if (menu_value('menu_directLink')) setInterval(directLink, 100); // 默认站外直链 - - if(window.location.href.indexOf("question") > -1){ // 回答页 // - if(window.location.href.indexOf("waiting") == -1){ + if (window.location.href.indexOf("question") > -1) { // 回答页 // + if (window.location.href.indexOf("waiting") == -1) { collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer(".QuestionPage"); - collapsedNowAnswer(".Question-main"); + collapsedNowAnswer(".QuestionPage"); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer(".Question-main"); // 收起当前回答 + 快捷返回顶部 } setInterval(topTime_question, 300); // 置顶显示时间 - }else if(window.location.href.indexOf("search") > -1){ // 搜索结果页 // + } else if (window.location.href.indexOf("search") > -1) { // 搜索结果页 // collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer("main div"); - collapsedNowAnswer(".Search-container"); + collapsedNowAnswer("main div"); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer(".Search-container"); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_search, 300); // 置顶显示时间 EventXMLHttpRequest(); // 区分问题文章 - }else if(window.location.href.indexOf("topic") > -1){ // 话题页 // - if(window.location.href.indexOf("hot") > -1 || window.location.href.indexOf("top-answers") > -1){ + } else if (window.location.href.indexOf("topic") > -1) { // 话题页 // + if (window.location.href.indexOf("hot") > -1 || window.location.href.indexOf("top-answers") > -1) { // 仅限 [讨论] [精华] collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer("main.App-main"); - collapsedNowAnswer(".ContentLayout"); + collapsedNowAnswer("main.App-main"); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer(".ContentLayout"); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_people, 300); // 置顶显示时间 EventXMLHttpRequest(); // 区分问题文章 } - }else if(window.location.href.indexOf("zhuanlan") > -1){ // 文章 // - backToTop("article.Post-Main.Post-NormalMain") - backToTop("div.Post-Sub.Post-NormalSub") + } else if (window.location.href.indexOf("zhuanlan") > -1){ // 文章 // + backToTop("article.Post-Main.Post-NormalMain"); // 快捷返回顶部 + backToTop("div.Post-Sub.Post-NormalSub"); // 快捷返回顶部 setInterval(topTime_zhuanlan, 300); // 置顶显示时间 - }else if(window.location.href.indexOf("column") > -1){ // 专栏 // + } else if (window.location.href.indexOf("column") > -1) { // 专栏 // collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer("main div"); + collapsedNowAnswer("main div"); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_zhuanlan, 300); // 置顶显示时间 - }else if(window.location.href.indexOf("people") > -1 || window.location.href.indexOf("org") > -1){ // 用户主页 // + } else if (window.location.href.indexOf("people") > -1 || window.location.href.indexOf("org") > -1) { // 用户主页 // collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer("main div"); - collapsedNowAnswer(".Profile-main"); + collapsedNowAnswer("main div"); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer(".Profile-main"); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_people, 300); // 置顶显示时间 - }else{ // 首页 // + } else { // 首页 // collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer("main div"); - collapsedNowAnswer(".Topstory-container"); + collapsedNowAnswer("main div"); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer(".Topstory-container"); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_index, 300); // 置顶显示时间 EventXMLHttpRequest(); // 区分问题文章 } diff --git a/Zhiyoo-Enhanced.user.js b/Zhiyoo-Enhanced.user.js index 2b37946..db22ec9 100644 --- a/Zhiyoo-Enhanced.user.js +++ b/Zhiyoo-Enhanced.user.js @@ -47,7 +47,7 @@ menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } } - menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});}); + menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/412362/feedback', {active: true,insert: true,setParent: true});}); } // 菜单开关