您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add some shortcuts in StartPage's pages.
// ==UserScript== // @name StartPage shortcuts // @namespace https://wiki.gslin.org/wiki/StartPage_shortcuts // @version 0.20190216.0 // @description Add some shortcuts in StartPage's pages. // @author Gea-Suan Lin // @match https://www.startpage.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; document.addEventListener('keyup', function(event) { if ('input' === document.activeElement.tagName.toLowerCase()) { return; } if ('d' === event.key) { let q = document.getElementById('query').value; let q_encoded = encodeURIComponent(q).replace(/%20/g, '+'); let url = 'https://duckduckgo.com/?ia=&q=' + q_encoded; document.location = url; } if ('g' === event.key) { let q = document.getElementById('query').value; let q_encoded = encodeURIComponent(q).replace(/%20/g, '+'); let url = 'https://www.google.com/search?q=' + q_encoded; document.location = url; } }); })();