您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
This script adds keyboard navigation to divisare.com
// ==UserScript== // @name Keyboard Navigation // @namespace Violentmonkey Scripts // @match https://divisare.com/* // @author tjia.work // @grant none // @version 1.1 // @license MIT // @description This script adds keyboard navigation to divisare.com // ==/UserScript== (function() { 'use strict'; // Select all images in #gallery const query = "#gallery .image, .projects .project"; const images = Array.from(document.querySelectorAll(query)); if (images.length === 0) return; // Exit if no images found const options = { behavior: "instant", // smooth | instant | auto block: "start", // start | center | end | nearest inline: "start", // start | center | end | nearest }; let index = 0; // Track current image index // Set up Intersection Observer const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { index = images.indexOf(entry.target); } }); }, { threshold: 0.5 }); images.forEach(img => observer.observe(img)); // Keyboard navigation document.addEventListener("keydown", (e) => { switch (e.key.toLowerCase()){ case "arrowright": case "d": case "j": index = Math.min(index + 1, images.length - 1); break; case "arrowleft": case "a": case "k": index = Math.max(index - 1, 0); break; default: return; break; } console.log(`Going to ${index+1} of ${images.length}…`) images[index].scrollIntoView(options); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址