优化 [快捷回到顶部] 功能 (最左侧不触发的问题)

This commit is contained in:
xiu2
2022-01-13 11:40:58 +08:00
parent ac05e24f26
commit f6aae0a072
+3 -3
View File
@@ -1,6 +1,6 @@
// ==UserScript==
// @name DuckDuckGo 增强
// @version 1.0.0
// @version 1.0.1
// @author X.I.U
// @description 屏蔽指定域名、修复图标加载、链接不携来源、快捷回到顶部(右键两侧空白处)
// @match https://duckduckgo.com/*
@@ -40,7 +40,7 @@
menu_ID[i] = GM_registerMenuCommand(`${GM_getValue(menu_ALL[i][0])?'✅':'❌'} ${menu_ALL[i][1]}`, function(){menu_switch(GM_getValue(menu_ALL[i][0]), 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});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/436428/feedback', {active: true,insert: true,setParent: true});});
menu_ID[menu_ID.length] = GM_registerMenuCommand('💬 反馈 & 建议', function () {GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true}); GM_openInTab('https://greasyfork.org/zh-CN/scripts/436428/feedback', {active: true,insert: true,setParent: true});});
}
// 菜单开关
@@ -135,7 +135,7 @@
// 快捷回到顶部(右键两侧空白处)
function backToTop() {
if (!GM_getValue('menu_backToTop')) return
document.getElementById('web_content_wrapper').oncontextmenu = document.getElementById('links_wrapper').oncontextmenu = function(e){
document.getElementById('web_content_wrapper').oncontextmenu = document.querySelector('#web_content_wrapper > .cw').oncontextmenu = document.getElementById('links_wrapper').oncontextmenu = function(e){
if (e.target == this) {
e.preventDefault();
window.scrollTo(0,0);