您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Scroll through posts with standard J/K keyboard shortcuts. L to like, O to save, M to play/stop. Why J/K navigation? Because it's also used in Facebook, Twitter, Tumblr, Gmail, etc.
当前为
// ==UserScript== // @name Instagram Keyboard Shortcuts for Power User // @namespace http://tampermonkey.net/ // @version 2.1.0 // @description Scroll through posts with standard J/K keyboard shortcuts. L to like, O to save, M to play/stop. Why J/K navigation? Because it's also used in Facebook, Twitter, Tumblr, Gmail, etc. // @author French Bond // @match https://www.instagram.com/* // @grant none // @require https://code.jquery.com/jquery-3.4.1.min.js // ==/UserScript== /* globals jQuery, $ */ /* jshint esversion: 6 */ let seeAll = true; let currentArticle = null; let searchFocused = false; let scrolling = false; $(function() { 'use strict'; const headerHeight = 62; const scrollSpeed = 200; // Handle search box focus $('[placeholder="Search"]') .focus(() => { searchFocused = true }) .blur(() => { searchFocused = false }); // Handle key press $('body').keydown(function(e) { if (searchFocused || scrolling) return; // A - Toggle see all if (e.keyCode === 65) { seeAll = !seeAll; } // J - Scroll down if (e.keyCode === 74) { if (seeAll && $(currentArticle).find('.coreSpriteRightChevron').length) { $(currentArticle).find('.coreSpriteRightChevron').parent().click(); } else { $('article').each(function(index, article) { const top = $(article).offset().top - headerHeight; if (top > $(window).scrollTop() + 1) { scrolling = true; $("html, body").animate( { scrollTop: top }, { duration: scrollSpeed, done: () => { scrolling = false; } } ); currentArticle = article; return false; } }); } } // K - Scroll up if (e.keyCode === 75) { if (seeAll && $(currentArticle).find('.coreSpriteLeftChevron').length) { $(currentArticle).find('.coreSpriteLeftChevron').parent().click(); } else { let previousArticle = null; $('article').each(function(index, article) { const top = $(article).offset().top - headerHeight; if (top > $(window).scrollTop() - headerHeight - 20) { if (previousArticle) { scrolling = true; $("html, body").animate( { scrollTop: $(previousArticle).offset().top - headerHeight }, { duration: scrollSpeed, done: () => { scrolling = false; } } ); currentArticle = previousArticle; } return false; } previousArticle = article; }); } } // L - Like if (e.keyCode == 76) { $('[aria-label="Like"],[aria-label="Unlike"]', currentArticle).parent().click(); } // O - Save if (e.keyCode == 79) { $('[aria-label="Save"],[aria-label="Remove"]', currentArticle).parent().click(); } // M - Play/stop if (e.keyCode == 77) { $(currentArticle).find('[aria-label="Control"]').click(); } }); });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址