您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Allows for the use of the left and right keyboard keys to navigate backpack.tf classifieds and premium search pages.
当前为
// ==UserScript== // @name Backpack.tf Keyboard Navigator // @version 1.04 // @description Allows for the use of the left and right keyboard keys to navigate backpack.tf classifieds and premium search pages. // @author Matt-RJ // @include /https?://(www\.)?backpack\.tf/.+/ // @namespace https://greasyfork.org/users/313414 // ==/UserScript== let openingNewPage = false; let isFirstPage; let isLastPage; window.onkeydown = (e) => { const prevButton = document.getElementsByClassName('fa fa-angle-left')[0]; const nextButton = document.getElementsByClassName('fa fa-angle-right')[0]; try { isFirstPage = prevButton.parentElement.parentElement.className == "disabled"; isLastPage = nextButton.parentElement.parentElement.className == "disabled"; } catch(error) { return; } if (!openingNewPage) { if (e.keyCode === 37) { // Left arrow press if (prevButton && !isFirstPage) { console.log("Opening previous page..."); prevButton.click(); openingNewPage = true; } } else if (e.keyCode === 39) { // Right arrow press if (nextButton && !isLastPage) { console.log("Opening next page..."); nextButton.click(); openingNewPage = true; } } } };