Greasy Fork is available in English.

StartPage shortcuts

Add some shortcuts in StartPage's pages.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==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;
        }
    });
})();