您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds powerful keyboard shortcuts that should be built-in for power-users.
当前为
// ==UserScript== // @name Power User Instagram Keyboard Shortcuts // @namespace http://tampermonkey.net/ // @version 1.2.0 // @description Adds powerful keyboard shortcuts that should be built-in for power-users. // @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; } // K - Scroll down if (e.keyCode === 75) { 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; } }); } } // I - Scroll up if (e.keyCode === 73) { 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 - Scroll right if (e.keyCode === 76) { $(currentArticle).find('.coreSpriteRightChevron').parent().click(); } // J - Scroll left if (e.keyCode === 74) { $(currentArticle).find('.coreSpriteLeftChevron').parent().click(); } // U - Like if (e.keyCode == 85) { const actionsDiv = $(currentArticle).children()[2]; const buttons = $(actionsDiv).find('button'); $(buttons[0]).click(); } // O - Save if (e.keyCode == 79) { const actionsDiv = $(currentArticle).children()[2]; const buttons = $(actionsDiv).find('button'); $(buttons[3]).click(); } // M - Play/stop if (e.keyCode == 77) { $(currentArticle).find('[aria-label="Control"]').click(); } }); });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址