您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
快速了解一个领域用,在谷歌搜索页面 按 Alt+1 ...2,3,4... Alt+5 将会打开一定数量的搜索结果。
当前为
// ==UserScript== // @name 一键打开谷歌搜索前N项搜索结果 // @namespace [email protected] // @version 0.2 // @description 快速了解一个领域用,在谷歌搜索页面 按 Alt+1 ...2,3,4... Alt+5 将会打开一定数量的搜索结果。 // @author snomiao // @match https://www.google.com/search?* // @match http://www.google.com/search?* // @grant none // ==/UserScript== (function() { 'use strict'; var 已打开过的链接 = {} var open = (url) => {if(!已打开过的链接[url]){window.open(url)}; 已打开过的链接[url] = 1}; var copyText = (content) => { const input = document.createElement('textarea'); input.setAttribute('readonly', 'readonly'); input.setAttribute('value', content); input.innerHTML= (content); input.setAttribute('style', 'position: fixed; top:0; left:0;z-index: 9999'); document.body.appendChild(input); input.select(); input.setSelectionRange(0, 9999); console.log('test') if (document.execCommand('copy')) { document.execCommand('copy'); console.log(`长度为${content.length}的内容已复制`); //alert(`长度为${content.length}的内容已复制`); } document.body.removeChild(input); }; window.addEventListener("keydown", (e) => { var 获取没有打开过链接 = 需要的链接条数 => ([...document.querySelectorAll("h3")].filter(h3=>h3.parentElement.href).slice(0, 需要的链接条数).reverse().map(h3 => ({"title": h3.textContent, "href": h3.parentElement.href}))); if(!e.ctrlKey && !e.shiftKey && e.altKey && e.key == '1'){copyText(获取没有打开过链接(2).map(link=> "#" + link.title + '\n' + link.href).join('\n\n')); 获取没有打开过链接(2).map(link=> link.href).map(open) } if(!e.ctrlKey && !e.shiftKey && e.altKey && e.key == '2'){copyText(获取没有打开过链接(4).map(link=> "#" + link.title + '\n' + link.href).join('\n\n')); 获取没有打开过链接(4).map(link=> link.href).map(open) } if(!e.ctrlKey && !e.shiftKey && e.altKey && e.key == '3'){copyText(获取没有打开过链接(8).map(link=> "#" + link.title + '\n' + link.href).join('\n\n')); 获取没有打开过链接(8).map(link=> link.href).map(open) } if(!e.ctrlKey && !e.shiftKey && e.altKey && e.key == '4'){copyText(获取没有打开过链接(16).map(link=> "#" + link.title + '\n' + link.href).join('\n\n')); 获取没有打开过链接(16).map(link=> link.href).map(open) } if(!e.ctrlKey && !e.shiftKey && e.altKey && e.key == '5'){copyText(获取没有打开过链接(32).map(link=> "#" + link.title + '\n' + link.href).join('\n\n')); 获取没有打开过链接(32).map(link=> link.href).map(open) } }) console.log("loading: 谷歌一键打开前N项搜索结果"); })();