您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
长按 Shif键切换网页
// ==UserScript== // @name SHIFT切换选项卡自动跳转指定网页(摸鱼模板) // @namespace http://www. // @version 0.1.1 // @license MIT // @description 长按 Shif键切换网页 // @author Your name // @match *://*/* // @grant none // ==/UserScript== var longpress = false; var presstimer = null; var pageurl = window.location.href; document.addEventListener('keydown', function(e) { if (e.keyCode == 16) { // 判断是否按下 Shift 键 longpress = true; if (!presstimer){// && e.keyCode == 65) { // 判断是否按下 A 键 presstimer = setTimeout(function(){ var tabs = []; var selectedTabIndex = -1; // alert('') window.location.href="https://github.com/search?q=owner%3Akant2002++_SuppressWinFormsTrimError&type=code" // https://github.com/search?q=owner%3Akant2002++_SuppressWinFormsTrimError&type=code /* windows.getCurrent({populate: true}, function(window){ window.tabs.forEach(function(tab, index){ if (tab.url !== '' && tab.url !== 'chrome://newtab/' && tab.url !== 'about:newtab' && tab.url.indexOf(pageurl) < 0) { tabs.push(tab); if (tab.active) selectedTabIndex = index; } }); if (tabs.length >= 1) { var nextTabIndex = (selectedTabIndex+1) % tabs.length; window.location.replace(tabs[nextTabIndex].url); } });*/ presstimer = null; }, 1500); } } }); document.addEventListener('keyup', function(e) { if (e.keyCode == 16 ){//&& e.keyCode == 65) { // 判断是否同时松开 Shift+A 键 if (presstimer !== null) { clearTimeout(presstimer); presstimer = null; } longpress = false; } });