您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
// ==UserScript== // @name Medium Web hotkeys // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://web.imedium.net/* // @grant none // ==/UserScript== (function() { 'use strict'; // Your code here... function isWPressed(keyCode) { return [119, 1094].indexOf(keyCode) !== -1; } function isSPressed(keyCode) { return [115, 1099].indexOf(keyCode) !== -1; } function isBodyFocus() { return document.activeElement === document.body; } function setBodyFocus() { document.activeElement.blur(); } function getList() { return document.getElementsByClassName('chats-list main')[0]; } function getContacts() { return getList().children; } function getNextContact() { var contacts = getContacts(); for (var i = 0; i < contacts.length; i++) { if (contacts[i].className.indexOf('active') !== -1) { if (i < contacts.length - 1) { return contacts[i + 1]; } } } return contacts[0] || null; } function getPreviousContact() { var contacts = getContacts(); var previousContact = contacts[0]; for (var i = 0; i < contacts.length; i++) { if (contacts[i].className.indexOf('active') !== -1) { return previousContact; } previousContact = contacts[i]; } return null; } function click(element) { if (element === null) { return; } element.click(); setTimeout(setBodyFocus, 2); } function onKeyPress(event) { if (!isBodyFocus()) { return; } var keyCode = event.keyCode; if (isWPressed(keyCode)) { return click(getPreviousContact()); } if (isSPressed(keyCode)) { return click(getNextContact()); } } document.addEventListener('keypress', onKeyPress); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址