Duckduckgo.com具有键盘导航功能,可让您按向左和向右箭头从网络结果到图像结果,新闻和地图。一切都很好,但当我使用wacom平板电脑浏览时除外。如果我使用数位板滚动,而无意间向左或向右滚动,它将发送左右箭头按键,这意味着搜索结果在所有模式之间交换。它使DDG在平板电脑上无法使用。
我编写了一个tampermonkey脚本来禁用击键事件,但是虽然它禁用了搜索框文本输入中的向左和向右箭头,但并不能防止可怕的左右导航。
// ==UserScript==
// @name disable left-right arrows in DDG
// @namespace http://tampermonkey.net/
// @version 0.1
// @description the left and right scrolling in DDG is annoying when you're using a tablet
// @author stib
// @match https://duckduckgo.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.onkeydown=function(keydn){
if ((keydn.key === "ArrowRight") || (keydn.key === "ArrowLeft")) {
keydn.cancelBubble = true;
keydn.preventDefault();
return false;
}
}
})();