From b771b71805097607a01be9e52015df46d0039d78 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Fri, 2 Apr 2021 11:36:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E8=BD=AC=E5=9B=BE=E7=89=87=E3=80=81=E5=BF=AB=E9=80=9F=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=EF=BC=88=E5=B7=A6=E9=94=AE=E5=8F=8C=E5=87=BB=E4=B8=A4?= =?UTF-8?q?=E4=BE=A7=E7=A9=BA=E7=99=BD=E5=A4=84=EF=BC=89]=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- V2ex-Enhanced.user.js | 48 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/V2ex-Enhanced.user.js b/V2ex-Enhanced.user.js index e857205..95f4f5e 100644 --- a/V2ex-Enhanced.user.js +++ b/V2ex-Enhanced.user.js @@ -1,8 +1,8 @@ // ==UserScript== // @name V2EX 增强 -// @version 1.0.6 +// @version 1.0.7 // @author X.I.U -// @description 自动签到、自动无缝翻页、回到顶部(右键点击两侧空白处)、标签页伪装为 Github(摸鱼) +// @description 自动签到、链接转图片、自动无缝翻页、回到顶部(右键点击两侧空白处)、快速回复(左键双击两侧空白处)、标签页伪装为 Github(摸鱼) // @match *://v2ex.com/* // @match *://*.v2ex.com/* // @icon https://www.v2ex.com/static/favicon.ico @@ -21,9 +21,11 @@ (function() { var menu_ALL = [ ['menu_autoClockIn', '自动签到', '自动签到', true], + ['menu_linksToImgs', '链接转图片', '链接转图片', true], ['menu_pageLoading', '自动无缝翻页', '自动无缝翻页', true], ['menu_pageLoading_reply', '帖子内自动翻页', '帖子内自动翻页', false], ['menu_backToTop', '回到顶部(右键点击两侧空白处)', '回到顶部', true], + ['menu_quickReply', '快速回复(左键双击两侧空白处)', '快速回复', true], ['menu_fish', '标签页伪装为 Github(摸鱼)', '标签页伪装为 Github', false] ], menu_ID = []; for (let i=0;i .content").oncontextmenu = function(event){ if (event.target==this) { @@ -231,6 +235,42 @@ } + // 链接转图片,修改自:https://greasyfork.org/scripts/14182 + function linksToImgs() { + let links = document.links; + Array.from(links).forEach(function (_this) { + if (/^https.*\.(?:jpg|jpeg|jpe|bmp|png|gif)/i.test(_this.href) && !(/`; + } + }); + } + + + // 快速回复(双击左右两侧空白处) + function quickReply() { + document.getElementById("Wrapper").ondblclick = document.querySelector("#Wrapper > .content").ondblclick = function(event){ + if (event.target==this) { + if (document.querySelector('.box.reply-box-sticky')) { + document.getElementById('undock-button').click(); + }else{ + let _top = document.body.scrollTop + document.documentElement.scrollTop; + document.getElementById('reply_content').focus(); + window.scrollTo(0,_top);console.log(_top); + } + } + } + //document.querySelector('div.topic_buttons').insertAdjacentHTML('beforeend', '快速回复'); + /*document.getElementById('reply_233').onclick = function () { + if (document.querySelector('.box.reply-box-sticky')) { + document.getElementById('undock-button').click(); + }else{ + let _top = document.body.scrollTop + document.documentElement.scrollTop; + document.getElementById('reply_content').focus(); + window.scrollTo(0,_top);console.log(_top); + } + }*/ + } + // 自动无缝翻页 function pageLoading() { if (curSite.SiteTypeID > 0){